I have been debating this one for a while but I think we need to drain

all but the last event.  So lets run with this for a while and see what
happens.
This commit is contained in:
Marco Peereboom 2009-10-08 12:22:06 +00:00
parent f0c9f65a11
commit 69c9a026f3

View file

@ -941,6 +941,7 @@ set_win_state(struct ws_win *win, long state)
long data[] = {state, None}; long data[] = {state, None};
XEvent ev; XEvent ev;
XWindowAttributes wa; XWindowAttributes wa;
int putback;
DNPRINTF(SWM_D_EVENT, "set_win_state: window: %lu\n", win->id); DNPRINTF(SWM_D_EVENT, "set_win_state: window: %lu\n", win->id);
@ -957,8 +958,11 @@ set_win_state(struct ws_win *win, long state)
(unsigned char *)data, 2); (unsigned char *)data, 2);
/* wait for completion of XChangeProperty */ /* wait for completion of XChangeProperty */
putback = 0;
while (XCheckIfEvent(display, &ev, set_win_notify_cb, (char *)win)) while (XCheckIfEvent(display, &ev, set_win_notify_cb, (char *)win))
; putback = 1;
if (putback)
XPutBackEvent(display, &ev);
} }
long long
@ -1090,6 +1094,7 @@ unmap_window(struct ws_win *win)
{ {
XEvent ev; XEvent ev;
XWindowAttributes wa; XWindowAttributes wa;
int putback;
if (win == NULL) if (win == NULL)
return; return;
@ -1109,8 +1114,11 @@ unmap_window(struct ws_win *win)
XUnmapWindow(display, win->id); XUnmapWindow(display, win->id);
/* make sure we wait for XUnmapWindow completion */ /* make sure we wait for XUnmapWindow completion */
putback = 0;
while (XCheckIfEvent(display, &ev, unmap_window_cb, (char *)win)) while (XCheckIfEvent(display, &ev, unmap_window_cb, (char *)win))
; putback = 1;
if (putback)
XPutBackEvent(display, &ev);
} }
void void