From bb97a20777e74d681e5f1912f5b243f19253600b Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 23 Apr 2010 11:50:24 -0400 Subject: [PATCH] don't use XPutBackEvent and mess up timestamp order in the event queue --- openbox/window.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/openbox/window.c b/openbox/window.c index 19b362ed..c8cb348c 100644 --- a/openbox/window.c +++ b/openbox/window.c @@ -146,6 +146,13 @@ void window_manage_all(void) if (children) XFree(children); } +static Bool check_unmap(Display *d, XEvent *e, XPointer arg) +{ + const Window win = *(Window*)arg; + return ((e->type == DestroyNotify && e->xdestroywindow.window == win) || + (e->type == UnmapNotify && e->xunmap.window == win)); +} + void window_manage(Window win) { XEvent e; @@ -158,10 +165,7 @@ void window_manage(Window win) /* check if it has already been unmapped by the time we started mapping. the grab does a sync so we don't have to here */ - if (XCheckTypedWindowEvent(obt_display, win, DestroyNotify, &e) || - XCheckTypedWindowEvent(obt_display, win, UnmapNotify, &e)) - { - XPutBackEvent(obt_display, &e); + if (XCheckIfEvent(obt_display, &e, check_unmap, (XPointer)&win)) { ob_debug("Trying to manage unmapped window. Aborting that."); no_manage = TRUE; } -- 2.45.2