summaryrefslogtreecommitdiffstats
path: root/base/message_pump_glib.cc
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-31 22:53:37 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-31 22:53:37 +0000
commit148d105e27c7c8c2cda0c81292690b9edafcae1f (patch)
treee278052fc84a6e5399aec5bd0d423162aecb6d16 /base/message_pump_glib.cc
parentdc75d4823b598a9b9b313728a06f6b47d6a73929 (diff)
downloadchromium_src-148d105e27c7c8c2cda0c81292690b9edafcae1f.zip
chromium_src-148d105e27c7c8c2cda0c81292690b9edafcae1f.tar.gz
chromium_src-148d105e27c7c8c2cda0c81292690b9edafcae1f.tar.bz2
This CL adds accelerators to the Linux toolkit views.
The MessageLoop had to be modified to support Dispatchers on Linux. BUG=None TEST=On Windows and Linux, make sure the accelerators still work as expected. On Linux toolkit views, build and run the unit-tests. Review URL: http://codereview.chromium.org/159046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22210 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_pump_glib.cc')
-rw-r--r--base/message_pump_glib.cc17
1 files changed, 13 insertions, 4 deletions
diff --git a/base/message_pump_glib.cc b/base/message_pump_glib.cc
index ac0a080..6f050ba 100644
--- a/base/message_pump_glib.cc
+++ b/base/message_pump_glib.cc
@@ -153,7 +153,8 @@ MessagePumpForUI::~MessagePumpForUI() {
close(wakeup_pipe_write_);
}
-void MessagePumpForUI::Run(Delegate* delegate) {
+void MessagePumpForUI::RunWithDispatcher(Delegate* delegate,
+ Dispatcher* dispatcher) {
#ifndef NDEBUG
// Make sure we only run this on one thread. GTK only has one message pump
// so we can only have one UI loop per process.
@@ -165,6 +166,7 @@ void MessagePumpForUI::Run(Delegate* delegate) {
RunState state;
state.delegate = delegate;
+ state.dispatcher = dispatcher;
state.should_quit = false;
state.run_depth = state_ ? state_->run_depth + 1 : 1;
state.has_work = false;
@@ -309,9 +311,16 @@ void MessagePumpForUI::ScheduleDelayedWork(const Time& delayed_work_time) {
// static
void MessagePumpForUI::EventDispatcher(GdkEvent* event, gpointer data) {
- reinterpret_cast<MessagePumpForUI*>(data)->WillProcessEvent(event);
- gtk_main_do_event(event);
- reinterpret_cast<MessagePumpForUI*>(data)->DidProcessEvent(event);
+ MessagePumpForUI* message_pump = reinterpret_cast<MessagePumpForUI*>(data);
+
+ message_pump->WillProcessEvent(event);
+ if (message_pump->state_->dispatcher) {
+ if (!message_pump->state_->dispatcher->Dispatch(event))
+ message_pump->state_->should_quit = true;
+ } else {
+ gtk_main_do_event(event);
+ }
+ message_pump->DidProcessEvent(event);
}
} // namespace base