My test program is the basic window app from Xlib Programming manual. I made two changes. One I had it print it's window ID in the window and have it print a line to teh launching X window whanever an event is received. I start it and the win id is in the window and I get several "event received" printed on teh xterm, as you should.
Noe I have a command line app that you enter the target window id into and trys to use XSendEvent to send a ClientMessage to the basic window. Here is my quciky code.
#include "stdio.h" #include <X11/X.h> #include <X11/Xlib.h>
char line[80]; unsigned long winID, mask; XEvent ev; Display *disp; Status status;
int main(int argc, char *argv[]){
disp = XOpenDisplay(NULL); if(!disp){ perror("Unable to open X display"); exit(1); }
do{ printf("Enter a line: "); fgets(line, 80, stdin); if(line[0] != 'q'){ winID = strtol(line, NULL, 16); printf("You entered %d:0x%x\n", winID, winID); ev.xclient.type = ClientMessage; ev.xclient.window = winID; ev.xclient.message_type = 0; ev.xclient.format = 32; ev.xclient.data.l[0] = CurrentTime; mask = 0l; status = XSendEvent(disp, winID, False, mask, &ev); printf("The XSendEvent returned: %d\n", status); } }while(line[0] != 'q'); }
I run basic window and it tells me the window ID is 0x1600001, I then run the send event app an enter 0x1600001 as teh win dow id. The XSendEvent return status is 1. But, no "event received message from teh basic window app.
What am I doing wrong.
Please help, I am pulling what little hair I have left out.
Jeff wd4nmq@xxxxxxxxxxx
_______________________________________________ XFree86 mailing list XFree86@xxxxxxxxxxx http://XFree86.Org/mailman/listinfo/xfree86