--- rxvt-unicode/src/rxvttoolkit.C 2008/01/26 11:37:51 1.94 +++ rxvt-unicode/src/rxvttoolkit.C 2008/01/26 14:35:28 1.101 @@ -545,38 +545,42 @@ void rxvt_display::x_cb (ev::io &w, int revents) { - while (XEventsQueued (dpy, QueuedAfterReading)) - { - XEvent xev; - XNextEvent (dpy, &xev); - -#ifdef USE_XIM - if (!XFilterEvent (&xev, None)) -#endif - { - if (xev.type == PropertyNotify - && xev.xany.window == root - && xev.xproperty.atom == xa[XA_XIM_SERVERS]) - im_change_check (); - - if (xev.type == MappingNotify) - XRefreshKeyboardMapping (&xev.xmapping); - - for (int i = xw.size (); i--; ) - { - if (!xw[i]) - xw.erase_unordered (i); - else if (xw[i]->window == xev.xany.window) - xw[i]->call (xev); - } - } - } + flush_ev.start (); } void rxvt_display::flush_cb (ev::prepare &w, int revents) { + while (XEventsQueued (dpy, QueuedAfterFlush)) + do + { + XEvent xev; + XNextEvent (dpy, &xev); + +#ifdef USE_XIM + if (!XFilterEvent (&xev, None)) + { + if (xev.type == PropertyNotify + && xev.xany.window == root + && xev.xproperty.atom == xa[XA_XIM_SERVERS]) + im_change_check (); +#endif + if (xev.type == MappingNotify) + XRefreshKeyboardMapping (&xev.xmapping); + + for (int i = xw.size (); i--; ) + { + if (!xw[i]) + xw.erase_unordered (i); + else if (xw[i]->window == xev.xany.window) + xw[i]->call (xev); + } +#ifdef USE_XIM + } +#endif + } + while (XEventsQueued (dpy, QueuedAlready)); + w.stop (); - XFlush (dpy); } void rxvt_display::reg (xevent_watcher *w)