… | |
… | |
543 | } |
543 | } |
544 | #endif |
544 | #endif |
545 | |
545 | |
546 | void rxvt_display::x_cb (ev::io &w, int revents) |
546 | void rxvt_display::x_cb (ev::io &w, int revents) |
547 | { |
547 | { |
|
|
548 | flush_ev.start (); |
|
|
549 | } |
|
|
550 | |
|
|
551 | void rxvt_display::flush_cb (ev::prepare &w, int revents) |
|
|
552 | { |
548 | while (XEventsQueued (dpy, QueuedAfterReading)) |
553 | while (XEventsQueued (dpy, QueuedAfterFlush)) |
|
|
554 | do |
549 | { |
555 | { |
550 | XEvent xev; |
556 | XEvent xev; |
551 | XNextEvent (dpy, &xev); |
557 | XNextEvent (dpy, &xev); |
552 | |
558 | |
553 | #ifdef USE_XIM |
559 | #ifdef USE_XIM |
554 | if (!XFilterEvent (&xev, None)) |
560 | if (!XFilterEvent (&xev, None)) |
555 | #endif |
|
|
556 | { |
561 | { |
557 | if (xev.type == PropertyNotify |
562 | if (xev.type == PropertyNotify |
558 | && xev.xany.window == root |
563 | && xev.xany.window == root |
559 | && xev.xproperty.atom == xa[XA_XIM_SERVERS]) |
564 | && xev.xproperty.atom == xa[XA_XIM_SERVERS]) |
560 | im_change_check (); |
565 | im_change_check (); |
561 | |
566 | #endif |
562 | if (xev.type == MappingNotify) |
567 | if (xev.type == MappingNotify) |
563 | XRefreshKeyboardMapping (&xev.xmapping); |
568 | XRefreshKeyboardMapping (&xev.xmapping); |
564 | |
569 | |
565 | for (int i = xw.size (); i--; ) |
570 | for (int i = xw.size (); i--; ) |
566 | { |
571 | { |
567 | if (!xw[i]) |
572 | if (!xw[i]) |
568 | xw.erase_unordered (i); |
573 | xw.erase_unordered (i); |
569 | else if (xw[i]->window == xev.xany.window) |
574 | else if (xw[i]->window == xev.xany.window) |
570 | xw[i]->call (xev); |
575 | xw[i]->call (xev); |
571 | } |
576 | } |
|
|
577 | #ifdef USE_XIM |
572 | } |
578 | } |
|
|
579 | #endif |
573 | } |
580 | } |
574 | } |
581 | while (XEventsQueued (dpy, QueuedAlready)); |
575 | |
582 | |
576 | void rxvt_display::flush_cb (ev::prepare &w, int revents) |
|
|
577 | { |
|
|
578 | w.stop (); |
583 | w.stop (); |
579 | XFlush (dpy); |
|
|
580 | } |
584 | } |
581 | |
585 | |
582 | void rxvt_display::reg (xevent_watcher *w) |
586 | void rxvt_display::reg (xevent_watcher *w) |
583 | { |
587 | { |
584 | if (!w->active) |
588 | if (!w->active) |