From 430ba47c731b2c3b523600ea88ee428d8d1d3a5f Mon Sep 17 00:00:00 2001 From: pcg Date: Thu, 12 Feb 2004 01:42:03 +0000 Subject: [PATCH] *** empty log message *** --- src/command.C | 2 +- src/rxvtcolor.C | 25 +++++++++++++++++++++---- src/rxvtcolor.h | 4 +++- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/command.C b/src/command.C index a8c900a1..1149fff2 100644 --- a/src/command.C +++ b/src/command.C @@ -755,7 +755,7 @@ rxvt_term::flush () } - XFlush (display->display); + display->flush (); } void diff --git a/src/rxvtcolor.C b/src/rxvtcolor.C index 27f25105..edd381ec 100644 --- a/src/rxvtcolor.C +++ b/src/rxvtcolor.C @@ -104,7 +104,7 @@ rxvt_xim::~rxvt_xim () rxvt_display::rxvt_display (const char *id) : refcounted (id) -, x_watcher (this, &rxvt_display::x_event) +, x_ev (this, &rxvt_display::x_cb) , selection_owner (0) { } @@ -139,18 +139,20 @@ bool rxvt_display::init () #endif int fd = XConnectionNumber (display); - x_watcher.start (fd, EVENT_READ); + x_ev.start (fd, EVENT_READ); fcntl (fd, F_SETFL, FD_CLOEXEC); XSelectInput (display, root, PropertyChangeMask); xa_xim_servers = XInternAtom (display, "XIM_SERVERS", 0); + flush (); + return true; } rxvt_display::~rxvt_display () { - x_watcher.stop (); + x_ev.stop (); XCloseDisplay (display); } @@ -161,7 +163,7 @@ void rxvt_display::im_change_cb () (*i)->call (); } -void rxvt_display::x_event (io_watcher &w, short revents) +void rxvt_display::x_cb (io_watcher &w, short revents) { do { @@ -184,6 +186,21 @@ void rxvt_display::x_event (io_watcher &w, short revents) } } while (XPending (display)); + + flush (); +} + +void rxvt_display::flush () +{ + for (;;) + { + XFlush (display); + + if (!XPending (display)) + break; + + x_cb (x_ev, 0); + } } void rxvt_display::reg (xevent_watcher *w) diff --git a/src/rxvtcolor.h b/src/rxvtcolor.h index 80c3ccad..d811a27a 100644 --- a/src/rxvtcolor.h +++ b/src/rxvtcolor.h @@ -56,7 +56,7 @@ struct rxvt_display : refcounted { io_manager_vec xw; - io_watcher x_watcher; void x_event (io_watcher &w, short revents); + io_watcher x_ev; void x_cb (io_watcher &w, short revents); refcache xims; vector imw; @@ -75,6 +75,8 @@ struct rxvt_display : refcounted { bool init (); ~rxvt_display (); + void flush (); + void reg (xevent_watcher *w); void unreg (xevent_watcher *w); void reg (im_watcher *w); -- 2.34.1