Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3607)

Unified Diff: chrome/browser/ui/gtk/bubble/bubble_gtk.cc

Issue 10961016: [gtk] re-acquire input grab on bubbles when another widget (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/gtk/bubble/bubble_gtk.cc
diff --git a/chrome/browser/ui/gtk/bubble/bubble_gtk.cc b/chrome/browser/ui/gtk/bubble/bubble_gtk.cc
index 4ffee09feb9ff5c5eb682603ba85cbf39077d797..d4cbee68608f8862452ef134b2b06450e31fdf6d 100644
--- a/chrome/browser/ui/gtk/bubble/bubble_gtk.cc
+++ b/chrome/browser/ui/gtk/bubble/bubble_gtk.cc
@@ -179,6 +179,10 @@ void BubbleGtk::Init(GtkWidget* anchor_widget,
G_CALLBACK(OnButtonPressThunk), this);
signals_.Connect(window_, "destroy", G_CALLBACK(OnDestroyThunk), this);
signals_.Connect(window_, "hide", G_CALLBACK(OnHideThunk), this);
+ if (grab_input_) {
+ signals_.Connect(window_, "grab-broken-event",
+ G_CALLBACK(OnGrabBrokenThunk), this);
+ }
// If the toplevel window is being used as the anchor, then the signals below
// are enough to keep us positioned correctly.
@@ -462,11 +466,6 @@ void BubbleGtk::Observe(int type,
}
}
-void BubbleGtk::HandlePointerAndKeyboardUngrabbedByContent() {
- if (grab_input_)
- GrabPointerAndKeyboard();
-}
-
void BubbleGtk::StopGrabbingInput() {
if (!grab_input_)
return;
@@ -650,6 +649,30 @@ void BubbleGtk::OnHide(GtkWidget* widget) {
gtk_widget_destroy(widget);
}
+gboolean BubbleGtk::OnGrabBroken(GtkWidget* widget,
+ GdkEventGrabBroken* grab_broken) {
+ // |grab_input_| may have been changed to false.
+ if (!grab_input_)
+ return false;
+
+ gpointer user_data;
+ gdk_window_get_user_data(grab_broken->grab_window, &user_data);
+
+ if (GTK_IS_WIDGET(user_data)) {
+ signals_.Connect(GTK_WIDGET(user_data), "hide",
+ G_CALLBACK(OnForeshadowWidgetHideThunk), this);
+ }
+
+ return FALSE;
+}
+
+void BubbleGtk::OnForeshadowWidgetHide(GtkWidget* widget) {
+ if (grab_input_)
+ GrabPointerAndKeyboard();
+
+ signals_.DisconnectAll(widget);
+}
+
gboolean BubbleGtk::OnToplevelConfigure(GtkWidget* widget,
GdkEventConfigure* event) {
if (!UpdateArrowLocation(false))
« no previous file with comments | « chrome/browser/ui/gtk/bubble/bubble_gtk.h ('k') | chrome/browser/ui/gtk/website_settings/permission_selector_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698