--- rxvt-unicode/src/rxvttoolkit.C 2008/01/26 10:24:47 1.93 +++ rxvt-unicode/src/rxvttoolkit.C 2008/01/26 13:13:20 1.98 @@ -550,8 +550,6 @@ XEvent xev; XNextEvent (dpy, &xev); - flush_ev.start (); - #ifdef USE_XIM if (!XFilterEvent (&xev, None)) #endif @@ -560,6 +558,7 @@ && xev.xany.window == root && xev.xproperty.atom == xa[XA_XIM_SERVERS]) im_change_check (); + if (xev.type == MappingNotify) XRefreshKeyboardMapping (&xev.xmapping); @@ -572,13 +571,14 @@ } } } - - XFlush (dpy); } -void rxvt_display::flush_cb (ev::idle &w, int revents) +void rxvt_display::flush_cb (ev::prepare &w, int revents) { - XFlush (dpy); + while (XEventsQueued (dpy, QueuedAfterFlush)) + x_cb (x_ev, EV_READ); + + w.stop (); } void rxvt_display::reg (xevent_watcher *w)