diff options
Diffstat (limited to 'base/message_pump_x.cc')
-rw-r--r-- | base/message_pump_x.cc | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/base/message_pump_x.cc b/base/message_pump_x.cc index 67e0b6c..b16cf35 100644 --- a/base/message_pump_x.cc +++ b/base/message_pump_x.cc @@ -93,13 +93,6 @@ MessagePumpX::MessagePumpX() : MessagePumpGlib(), InitXSource(); } -MessagePumpX::~MessagePumpX() { - g_source_destroy(x_source_); - g_source_unref(x_source_); - XCloseDisplay(g_xdisplay); - g_xdisplay = NULL; -} - // static Display* MessagePumpX::GetDefaultXDisplay() { if (!g_xdisplay) @@ -118,6 +111,30 @@ void MessagePumpX::SetDefaultDispatcher(MessagePumpDispatcher* dispatcher) { g_default_dispatcher = dispatcher; } +gboolean MessagePumpX::DispatchXEvents() { + Display* display = GetDefaultXDisplay(); + DCHECK(display); + MessagePumpDispatcher* dispatcher = + GetDispatcher() ? GetDispatcher() : g_default_dispatcher; + + // In the general case, we want to handle all pending events before running + // the tasks. This is what happens in the message_pump_glib case. + while (XPending(display)) { + XEvent xev; + XNextEvent(display, &xev); + if (dispatcher && ProcessXEvent(dispatcher, &xev)) + return TRUE; + } + return TRUE; +} + +MessagePumpX::~MessagePumpX() { + g_source_destroy(x_source_); + g_source_unref(x_source_); + XCloseDisplay(g_xdisplay); + g_xdisplay = NULL; +} + void MessagePumpX::InitXSource() { // CHECKs are to help track down crbug.com/113106. CHECK(!x_source_); @@ -160,23 +177,6 @@ bool MessagePumpX::ProcessXEvent(MessagePumpDispatcher* dispatcher, return should_quit; } -gboolean MessagePumpX::DispatchXEvents() { - Display* display = GetDefaultXDisplay(); - DCHECK(display); - MessagePumpDispatcher* dispatcher = - GetDispatcher() ? GetDispatcher() : g_default_dispatcher; - - // In the general case, we want to handle all pending events before running - // the tasks. This is what happens in the message_pump_glib case. - while (XPending(display)) { - XEvent xev; - XNextEvent(display, &xev); - if (dispatcher && ProcessXEvent(dispatcher, &xev)) - return TRUE; - } - return TRUE; -} - bool MessagePumpX::WillProcessXEvent(XEvent* xevent) { if (!observers().might_have_observers()) return false; |