diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-14 16:34:31 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-14 16:34:31 +0000 |
commit | 2f814d30264d0ebcb5f452d3b0c785b72e240ead (patch) | |
tree | 085c3e50bc38c0eb6a81765f2483ee92c8fc67c8 /base/message_pump_x.cc | |
parent | 33e1c37730f7d404b61f8bed2eb768f9902b1b64 (diff) | |
download | chromium_src-2f814d30264d0ebcb5f452d3b0c785b72e240ead.zip chromium_src-2f814d30264d0ebcb5f452d3b0c785b72e240ead.tar.gz chromium_src-2f814d30264d0ebcb5f452d3b0c785b72e240ead.tar.bz2 |
Refactor MessagePumpX to dispatch events inside of the source Dispatch function.
Also clean up MessagePumpGlib.
BUG=None
TEST=None
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=114168
Review URL: http://codereview.chromium.org/8872055
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114439 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_pump_x.cc')
-rw-r--r-- | base/message_pump_x.cc | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/base/message_pump_x.cc b/base/message_pump_x.cc index 13adb37..5230c7e 100644 --- a/base/message_pump_x.cc +++ b/base/message_pump_x.cc @@ -25,11 +25,9 @@ gboolean XSourceCheck(GSource* source) { gboolean XSourceDispatch(GSource* source, GSourceFunc unused_func, - 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; + gpointer data) { + base::MessagePumpX* pump = static_cast<base::MessagePumpX*>(data); + return pump->DispatchXEvents(); } GSourceFuncs XSourceFuncs = { @@ -128,7 +126,8 @@ 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_can_recurse(x_source_, TRUE); + g_source_set_callback(x_source_, NULL, this, NULL); g_source_attach(x_source_, g_main_context_default()); } @@ -162,24 +161,21 @@ bool MessagePumpX::ProcessXEvent(MessagePumpDispatcher* dispatcher, return should_quit; } -bool MessagePumpX::RunOnce(GMainContext* context, bool block) { +gboolean MessagePumpX::DispatchXEvents() { 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 g_main_context_iteration(context, block); + return TRUE; } bool MessagePumpX::WillProcessXEvent(XEvent* xevent) { |