diff -ur xmove/xmove/print11.c xmove-patched/xmove/print11.c --- xmove/xmove/print11.c 1997-06-30 22:01:43.000000000 +0200 +++ xmove-patched/xmove/print11.c 2003-03-26 23:06:54.000000000 +0100 @@ -2325,7 +2325,7 @@ ISetLong(&buf[4], MapWindowID(client_window, Request)); ISetLong(&buf[8], MapAtom(client_atom, Request)); ISetLong(&buf[12], MapAtom(client_type, Request)); - + atom = FindAtom(client_atom); if (atom && atom->transient_map_func) { map_func = atom->transient_map_func->MapProperty; @@ -6537,6 +6537,8 @@ AdjustSCREEN(&buf[ROUNDUP4((long)(40 + v) + 8 * n)], (long)m); #endif ISetByte(&buf[28], 1); + ISetShort(&buf[6], (40 + ROUNDUP4((long)v) + 8*n + visbytes)/4-2); /* Set size of request */ + SaveBytes(&client->fdd->outBuffer, buf, 40 + ROUNDUP4((long)v) + 8*n); SaveBytes(&client->fdd->outBuffer, screen, visbytes); ignore_bytes = True; Only in xmove-patched/xmove: print11.o Only in xmove-patched/xmove: prtype.o Only in xmove-patched/xmove: put_image.o diff -ur xmove/xmove/server.c xmove-patched/xmove/server.c --- xmove/xmove/server.c 1997-08-03 21:36:45.000000000 +0200 +++ xmove-patched/xmove/server.c 2003-03-27 17:25:17.000000000 +0100 @@ -56,6 +56,7 @@ static int FinishSetUpReply P((Pointer private_data , unsigned char *buf , long n )); int ServerPacket P((Pointer private_data , unsigned char *buf, long n )); static int XmoveCtrlMoveAll P((Pointer private_data, unsigned char *buf, long n)); +static int XmoveCtrlFindClient P((Pointer private_data, unsigned char *buf, long n)); static int XmoveCtrlList P((Pointer private_data, unsigned char *buf, long n)); static int XmoveCtrlQuit P((Pointer private_data, unsigned char *buf, long n)); static int XmoveCtrlSetDefaultServer P((Pointer private_data, unsigned char *buf, long n)); @@ -627,6 +628,90 @@ static int +XmoveCtrlFindClient (Pointer private_data, unsigned char *buf, long n) +{ + Client *my_client = (Client *) private_data; + int num_clients = -1; /* don't include ourselves -- start at -1 */ + unsigned char num_clients_buf[4], out_buf[84]; + int msglen = my_client->fdd->inBuffer.num_Needed; + Window window_id; + Client *global_client; + Server *global_server; + + ignore_bytes = True; + + ForAllInList(&client_list) + { + num_clients++; + } + + + global_server = server; + global_client = client; + + window_id = ILong(&buf[12]); + + ForAllInList(&meta_client_list) { + MetaClient *tmp_meta; + + tmp_meta = (MetaClient *)CurrentContentsOfList(&meta_client_list); + + ForAllInList(&tmp_meta->client_list) + { + Client *tmp_client; + + tmp_client = (Client *)CurrentContentsOfList(&tmp_meta->client_list); + if (tmp_client != my_client) { + int x; + void *pos; + WindowPtr window; + + for(window = hash_getfirst(&pos, tmp_client->window_table); + window; window = hash_getnext(&pos, tmp_client->window_table)){ + Window id; + + /* Ugly hack so we can use MapWindowID */ + client = tmp_client; + server = tmp_client->server; + + id = MapWindowID(window->window_id,Request); + + client = global_client; + server = global_server; + + if(id == window_id){ + ISetLong(num_clients_buf, 1); + SendBuffer(my_client->fdd->fd, num_clients_buf, 4); + + x = sprintf((char *)out_buf, "%-5d %-20.20s %-52.52s\n", + tmp_meta->meta_id, + (tmp_client->window_name ? + tmp_client->window_name : "(no name)"), + (tmp_client->suspended ? "suspended" : + tmp_client->server->server_name)); + SendBuffer(my_client->fdd->fd, out_buf, 80); + my_client->fdd->ByteProcessing = XmoveCtrlRequest; + my_client->fdd->inBuffer.num_Needed = 12; + return(msglen); + + if (x != 80) + printf("ETHAN: XmoveCtrlList sprintf %d\n", x); + } + } + } + + } + } + + ISetLong(num_clients_buf, 0); + SendBuffer(my_client->fdd->fd, num_clients_buf, 4); + + my_client->fdd->ByteProcessing = XmoveCtrlRequest; + my_client->fdd->inBuffer.num_Needed = 12; + return(msglen); +} + +static int XmoveCtrlList (Pointer private_data, unsigned char *buf, long n) { Client *client = (Client *) private_data; @@ -656,6 +741,7 @@ tmp_client = (Client *)CurrentContentsOfList(&tmp_meta->client_list); if (tmp_client != client) { int x; + x = sprintf((char *)out_buf, "%-5d %-20.20s %-52.52s\n", tmp_meta->meta_id, (tmp_client->window_name ? @@ -665,6 +751,7 @@ SendBuffer(client->fdd->fd, out_buf, 80); if (x != 80) printf("ETHAN: XmoveCtrlList sprintf %d\n", x); + } } @@ -775,6 +862,10 @@ client->fdd->ByteProcessing = XmoveCtrlSetDefaultServer; return 0; + case 5: /* 5 == List */ + client->fdd->ByteProcessing = XmoveCtrlFindClient; + return 0; + default: ignore_bytes = True; client->fdd->inBuffer.num_Needed = 12; @@ -902,6 +993,9 @@ DecodeReply(buf, replylength); server->fdd->inBuffer.num_Needed = 32; + + /* Reinitialize this since DecodeReply() could change this */ + replylength = 32 + (ILong(&buf[4]) << 2); return replylength; } else { if (buf[0] == 253) diff -ur xmove/xmovectrl/xmovectrl.c xmove-patched/xmovectrl/xmovectrl.c --- xmove/xmovectrl/xmovectrl.c 2003-03-27 19:40:04.000000000 +0100 +++ xmove-patched/xmovectrl/xmovectrl.c 2003-03-26 23:43:05.000000000 +0100 @@ -81,6 +81,9 @@ else if (strcmp(*cur_argv, "-list") == 0) return (Ctrl_list(--num_args, ++cur_argv)); + else if (strcmp(*cur_argv, "-find") == 0) + return (Ctrl_find(--num_args, ++cur_argv)); + else if (strcmp(*cur_argv, "-move") == 0) return (Ctrl_move(--num_args, ++cur_argv)); @@ -371,6 +374,40 @@ return 0; } +Ctrl_find(num_args, my_argv) +int num_args; +char **my_argv; +{ + unsigned long num_clients; + unsigned char buf[80]; + + if (num_args != 1) { + printf("list option expects one argument\n"); + return -1; + } + + ISetShort(&buf[0], 5); /* command: Find */ + ISetShort(&buf[2], 4); + ISetShort(&buf[4], 0); + ISetShort(&buf[6], 0); + ISetShort(&buf[8], 0); + ISetShort(&buf[10], 0); + + SendBuffer(XmoveFd, (char *)buf, 12); + ISetLong(&buf[0], strtol(my_argv[0],0,0)); + SendBuffer(XmoveFd, (char *)buf, 4); + + ReceiveBuffer(XmoveFd, (char *)&num_clients, sizeof(unsigned long)); + num_clients = ILong((unsigned char *)&num_clients); /* convert endianisms */ + + while (num_clients--) { + ReceiveBuffer(XmoveFd, (char *)buf, 80); + printf("%.80s", buf); + } + + return 0; +} + Ctrl_list(num_args, my_argv) int num_args; char **my_argv;