diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-02 20:16:32 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-02 20:16:32 +0000 |
commit | 6ea309f8db3cadf7abcb2a11ea45c91320b6255b (patch) | |
tree | 9f978a49183d7cfa00ea08007363b85068bdee73 /chrome/browser/gtk/gtk_util.cc | |
parent | f0c2a66e82c2aa1f4d756150e525df7623e38c18 (diff) | |
download | chromium_src-6ea309f8db3cadf7abcb2a11ea45c91320b6255b.zip chromium_src-6ea309f8db3cadf7abcb2a11ea45c91320b6255b.tar.gz chromium_src-6ea309f8db3cadf7abcb2a11ea45c91320b6255b.tar.bz2 |
GTK browser actions toolbar fiddling:
- make the toolbar size restore properly when the toolbar is created before the model is loaded
- allow the user to right click menu items in the overflow menu
BUG=40068 (sorta)
TEST=manual
Review URL: http://codereview.chromium.org/1602003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43515 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/gtk_util.cc')
-rw-r--r-- | chrome/browser/gtk/gtk_util.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/chrome/browser/gtk/gtk_util.cc b/chrome/browser/gtk/gtk_util.cc index bb3725c..6157bda 100644 --- a/chrome/browser/gtk/gtk_util.cc +++ b/chrome/browser/gtk/gtk_util.cc @@ -814,4 +814,29 @@ WindowOpenDisposition DispositionForCurrentButtonPressEvent() { return event_utils::DispositionFromEventFlags(state); } +bool GrabAllInput(GtkWidget* widget) { + guint time = gtk_get_current_event_time(); + + if (!GTK_WIDGET_VISIBLE(widget)) + return false; + + if (!gdk_pointer_grab(widget->window, TRUE, + GdkEventMask(GDK_BUTTON_PRESS_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_ENTER_NOTIFY_MASK | + GDK_LEAVE_NOTIFY_MASK | + GDK_POINTER_MOTION_MASK), + NULL, NULL, time) == 0) { + return false; + } + + if (!gdk_keyboard_grab(widget->window, TRUE, time) == 0) { + gdk_display_pointer_ungrab(gdk_drawable_get_display(widget->window), time); + return false; + } + + gtk_grab_add(widget); + return true; +} + } // namespace gtk_util |