Raise/Map and Focus a window: BadMatch error
Glynn Clements
glynn at gclements.plus.com
Wed Dec 19 10:36:20 PST 2007
Andrew Troschinetz wrote:
> I also printed out the values of the XEvent that causes the do-while-
> XWindowEvent() loop to exit and the XEvent returned by XPeekIfEvent()
> and they're the same --- So XPeekIfEvent() and XWindowEvent() are
> returning the same event exactly how I want them to, but one fails and
> the other doesn't. So yeah, I'm completely clueless now. Maybe I _DO_
> want to remove the XEvent from the event queue?
It needs to get removed at some point; otherwise, once XPeekIfEvent()
returns true once, it will always return true thereafter, even if the
window is subsequently unmapped.
The issue is whether or not you need to remove it in this particular
section of code. If you have a generic main loop which will remove it
anyhow, you probably shouldn't be removing it yourself (particularly
if you are using a toolkit which wants that event for its own
purposes). But what happens if the window gets unmapped before main
loop gets around to removing that event? Maybe you should remove it
then put it back onto the head of the queue?
Ultimately, there's always the possibility of spurious errors
occurring due to race conditions.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the xorg
mailing list