Index: base/message_pump_x.cc |
diff --git a/base/message_pump_x.cc b/base/message_pump_x.cc |
index 2ef34effbde80e8cec2b8f10adc4a771d3b73fed..13adb37837b4e9b529d8212102329ae61b787cbc 100644 |
--- a/base/message_pump_x.cc |
+++ b/base/message_pump_x.cc |
@@ -25,9 +25,11 @@ gboolean XSourceCheck(GSource* source) { |
gboolean XSourceDispatch(GSource* source, |
GSourceFunc unused_func, |
- gpointer data) { |
- base::MessagePumpX* pump = static_cast<base::MessagePumpX*>(data); |
- return pump->DispatchXEvents(); |
+ gpointer unused_data) { |
+ // TODO(sad): When GTK event proecssing is completely removed, the event |
+ // processing and dispatching should be done here (i.e. XNextEvent, |
+ // ProcessXEvent etc.) |
+ return TRUE; |
} |
GSourceFuncs XSourceFuncs = { |
@@ -127,7 +129,6 @@ void MessagePumpX::InitXSource() { |
x_source_ = g_source_new(&XSourceFuncs, sizeof(GSource)); |
g_source_add_poll(x_source_, x_poll); |
g_source_set_can_recurse(x_source_, FALSE); |
- g_source_set_callback(x_source_, NULL, this, NULL); |
g_source_attach(x_source_, g_main_context_default()); |
} |
@@ -161,21 +162,24 @@ bool MessagePumpX::ProcessXEvent(MessagePumpDispatcher* dispatcher, |
return should_quit; |
} |
-gboolean MessagePumpX::DispatchXEvents() { |
+bool MessagePumpX::RunOnce(GMainContext* context, bool block) { |
Display* display = GetDefaultXDisplay(); |
- DCHECK(display); |
MessagePumpDispatcher* dispatcher = |
GetDispatcher() ? GetDispatcher() : g_default_dispatcher; |
+ if (!display) |
+ return g_main_context_iteration(context, block); |
+ |
// 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; |
} |
- return TRUE; |
+ |
+ return g_main_context_iteration(context, block); |
} |
bool MessagePumpX::WillProcessXEvent(XEvent* xevent) { |