don't keep trying pointer grab when failing due to another application's grab b=500081 r=roc
authorKarl Tomlinson <karlt+@karlt.net>
Thu, 02 Feb 2012 15:11:44 +1300
changeset 86278 31d649d2db254d6ae5752cfcc630ba1f785839e6
parent 86277 34e3dad7a39daaf8109ae458e600459f7ce0256b
child 86279 ca19aff687a18efe997887d52785acda04764008
push id22008
push userbmo@edmorley.co.uk
push dateTue, 07 Feb 2012 10:32:58 +0000
treeherdermozilla-central@2b61af9d18ee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs500081
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
don't keep trying pointer grab when failing due to another application's grab b=500081 r=roc
widget/gtk2/nsWindow.cpp
--- a/widget/gtk2/nsWindow.cpp
+++ b/widget/gtk2/nsWindow.cpp
@@ -4908,19 +4908,25 @@ nsWindow::GrabPointer(void)
                                              GDK_ENTER_NOTIFY_MASK |
                                              GDK_LEAVE_NOTIFY_MASK |
 #ifdef HAVE_GTK_MOTION_HINTS
                                              GDK_POINTER_MOTION_HINT_MASK |
 #endif
                                              GDK_POINTER_MOTION_MASK),
                               (GdkWindow *)NULL, NULL, GDK_CURRENT_TIME);
 
-    if (retval != GDK_GRAB_SUCCESS) {
-        LOG(("GrabPointer: pointer grab failed\n"));
+    if (retval == GDK_GRAB_NOT_VIEWABLE) {
+        LOG(("GrabPointer: window not viewable; will retry\n"));
         mRetryPointerGrab = true;
+    } else if (retval != GDK_GRAB_SUCCESS) {
+        LOG(("GrabPointer: pointer grab failed: %i\n", retval));
+        // A failed grab indicates that another app has grabbed the pointer.
+        // Check for rollup now, because, without the grab, we likely won't
+        // get subsequent button press events.
+        check_for_rollup(0, 0, false, true);
     }
 }
 
 void
 nsWindow::ReleaseGrabs(void)
 {
     LOG(("ReleaseGrabs\n"));