Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!snorkelwacker!bloom-beacon!athena.mit.edu!bjaspan From: bjaspan@athena.mit.edu (Barr3y Jaspan) Newsgroups: comp.windows.x Subject: Ignoring XSendEvents *other* than by checking send_event Message-ID: <1990Jul8.195537.18395@athena.mit.edu> Date: 8 Jul 90 19:55:37 GMT Sender: daemon@athena.mit.edu (Mr Background) Reply-To: bjaspan@athena.mit.edu (Barr3y Jaspan) Organization: Massachusetts Institute of Technology Lines: 85 I wrote a small program that takes a list of window ids and forwards all the events it receives to each window on the list using XSendEvent. I know the program works because if I run two copies, I can send events from one to the other and everything happens correctly. However, I have been unable to get any other program to recognize the resent events. This article is specifically about getting X Toolkit programs to accept the events. I wrote a simple X Toolkit application that creates a single button, and then I ran it under Saber-C tracing _XtwaitForSomething. Sure enough, the program runs until it hits the select() and waits for something to happen. If I move the cursor into the button, select() returns and the program goes merrily on it's way. When I send events to the window with my program, however, *select never returns*. The events are simply not getting sent to the client. I have run the test under twm and uwm (to see if the reason had to do with reparenting). I thought the only was to ignore artifical events was to check the send_event field and ignore the event if it was set, but obivously this is not the case. What am I missing? The source code for my event-duplicating program (which I call xfork) is below. Barr3y Jaspan Student Information Processing Board (SIPB) ---- snip snip ---- #include #include main(argc, argv) int argc; char **argv; { Display *dpy; Window window; Window wins[100]; int num_wins, i; XEvent event; argc -= 1; num_wins = 0; while (argc > 0) { wins[num_wins] = atoi(argv[num_wins+1]); printf("wins[%d] = %d\n", num_wins, wins[num_wins]); num_wins += 1; argc -= 1; } dpy = XOpenDisplay(NULL); window = XCreateSimpleWindow(dpy, RootWindow(dpy, DefaultScreen(dpy)), 0, 0, 100, 100, 2, WhitePixel(dpy, DefaultScreen(dpy)), BlackPixel(dpy, DefaultScreen(dpy))); XSelectInput(dpy, window, 0xffffff); XMapWindow(dpy, window); while (1) { XNextEvent(dpy, &event); if (event.type == Expose) break; } printf("got expose\n"); while (1) { XNextEvent(dpy, &event); printf("got event\n"); printf("forwarding\n"); for (i=0; i < num_wins; i++) printf("%d\n", XSendEvent(dpy, wins[i], False, 0xffffff, &event)); } /* NOTREACHED */ return 0; }