From ab9fe0f8b3127a8cc224322107d2f77fe0a9ef38 Mon Sep 17 00:00:00 2001 From: "oshima@chromium.org" Date: Tue, 13 Dec 2011 19:27:51 +0000 Subject: Revert r114168 "Refactor MessagePumpX to dispatch events inside of the source Dispatch function." This reverts commit bae6675d851184f2be0ac117c1a847289c1c7bd9. TBR=piman@chromium.org BUG=none TEST=none Review URL: http://codereview.chromium.org/8931009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114245 0039d316-1c4b-4281-b951-d872f2087c98 --- base/message_pump_x.cc | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'base/message_pump_x.cc') diff --git a/base/message_pump_x.cc b/base/message_pump_x.cc index 2ef34ef..13adb37 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(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) { -- cgit v1.1