I am developing a window manager as a personal project and I hit a curious problem. Part of the operation is mapping and unmapping windows, but UnmapNotify events must also be caught as clients sometimes request this.
The problem: When I explicitly call XUnmapWindow(...) the UnmapNotify event does not arrive immediately, but only after a few other functions are called. It sometimes happens that UnmapNotify comes so late another XMapWindow is called before, which causes all sorts of trouble. I called XSync and XFlush, but this only flushes the output buffer and the events seem to be stuck at the server side. The XPending call claims there is nothing there until more stuff happens. Am I correct the events are stuck in the server queue? Is this intended behaviour of xlib? Is there a possibility to force the server to send out all the signals? Is there a common mistake I might be making? I subscribe for the StructureNotify events. My event loop is a poll call that also polls another socket: while(running){ int ret=poll(fdlist,2,-1); if(ret==-1){ if(errno==EINTR)continue; perror("poll returned -1, error: "); break; } //omitted hangup testing if(fdlist[0].revents&POLLIN){//event has come XEvent ev; while(XPending(dpy)){ if(XNextEvent(dpy,&ev)){ say("xnextevent failed\n"); break; } if(handler[ev.type])handler[ev.type](&ev);//execute handler XSync(dpy,False);//does nothing } } //the other socket ... } Help appreciated! Thanks.
_______________________________________________ xorg@lists.freedesktop.org: X.Org support Archives: http://lists.freedesktop.org/archives/xorg Info: http://lists.freedesktop.org/mailman/listinfo/xorg Your subscription address: arch...@mail-archive.com