diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-02 18:34:20 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-02 18:34:20 +0000 |
commit | aae59c124ade1f6314cec70a4d5e9bc8df9af67b (patch) | |
tree | 66d3f45fd11542899a28bd8c819d20b737601c29 /views/focus | |
parent | 006febfee42193e999c25c5ce4dcd510f630013b (diff) | |
download | chromium_src-aae59c124ade1f6314cec70a4d5e9bc8df9af67b.zip chromium_src-aae59c124ade1f6314cec70a4d5e9bc8df9af67b.tar.gz chromium_src-aae59c124ade1f6314cec70a4d5e9bc8df9af67b.tar.bz2 |
Process accelerators if grabbed widget is a window.
Update the gtk event filtering logic to process key events for grabbed window (i.e. modal dialog).
BUG=chromium-os:3701
TEST=Verify fix for chromium-os:3701.
Review URL: http://codereview.chromium.org/2455004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48742 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/focus')
-rw-r--r-- | views/focus/accelerator_handler_gtk.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/views/focus/accelerator_handler_gtk.cc b/views/focus/accelerator_handler_gtk.cc index 1218340..e69553f 100644 --- a/views/focus/accelerator_handler_gtk.cc +++ b/views/focus/accelerator_handler_gtk.cc @@ -24,10 +24,23 @@ bool AcceleratorHandler::Dispatch(GdkEvent* event) { only_menu_pressed_ = false; } - // Let Gtk process the event if there is a grabbed widget or it's not - // a keyboard event. - if (gtk_grab_get_current() || - (event->type != GDK_KEY_PRESS && event->type != GDK_KEY_RELEASE)) { + // Skip accelerator handling for non key events. + bool skip = event->type != GDK_KEY_PRESS && event->type != GDK_KEY_RELEASE; + + // Skip if there is a grabbed widget and it is not a window. This is because + // of the following two reasons: + // 1. Widget such as pop up from GtkComboBox is a grabbed widget and use ESC + // as its accelerator key to dismiss itself. We will break Gtk's code if + // we eat this key. See http://crosbug.com/2355 + // 2. Modal dialogs in Gtk are grabbed windows and we want to have our + // accelerator key processing in this case. See http://crogbug.com/3701 + if (!skip) { + GtkWidget* grabbed_widget = gtk_grab_get_current(); + skip = grabbed_widget && !GTK_IS_WINDOW(grabbed_widget); + } + + if (skip) { + // Let Gtk processes the event. gtk_main_do_event(event); return true; } |