Bug 1186967 - ignore double-click on WM without _NET_WM_MOVERESIZE support, r=jhorak
authorMartin Stransky <stransky@redhat.com>
Tue, 17 Oct 2017 09:50:18 +0200
changeset 387374 8a595cffab114331e6161eedaa1079693b90de70
parent 387373 10ec88e1aa4e737f61b8199a34327bd8be4a1a76
child 387375 cb3d7a0ae189bcadbe086caa80f2eb4806b884cd
push id32717
push userarchaeopteryx@coole-files.de
push dateFri, 20 Oct 2017 22:01:38 +0000
treeherdermozilla-central@69998f1363be [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjhorak
bugs1186967
milestone58.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
Bug 1186967 - ignore double-click on WM without _NET_WM_MOVERESIZE support, r=jhorak MozReview-Commit-ID: 2Vs6i5leero
widget/gtk/nsWindow.cpp
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -6439,16 +6439,32 @@ nsWindow::GetDragInfo(WidgetMouseEvent* 
     MOZ_ASSERT(gdk_window,
                "gdk_window_get_toplevel should not return null");
     *aWindow = gdk_window;
 
     if (!aMouseEvent->mWidget) {
         return false;
     }
 
+    if (mIsX11Display) {
+      // Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=789054
+      // To avoid crashes disable double-click on WM without _NET_WM_MOVERESIZE.
+      // See _should_perform_ewmh_drag() at gdkwindow-x11.c
+      GdkScreen* screen = gdk_window_get_screen(gdk_window);
+      GdkAtom atom = gdk_atom_intern("_NET_WM_MOVERESIZE", FALSE);
+      if (!gdk_x11_screen_supports_net_wm_hint(screen, atom)) {
+          static unsigned int lastTimeStamp = 0;
+          if (lastTimeStamp != aMouseEvent->mTime) {
+              lastTimeStamp = aMouseEvent->mTime;
+          } else {
+              return false;
+          }
+      }
+    }
+
     // FIXME: It would be nice to have the widget position at the time
     // of the event, but it's relatively unlikely that the widget has
     // moved since the mousedown.  (On the other hand, it's quite likely
     // that the mouse has moved, which is why we use the mouse position
     // from the event.)
     LayoutDeviceIntPoint offset = aMouseEvent->mWidget->WidgetToScreenOffset();
     *aRootX = aMouseEvent->mRefPoint.x + offset.x;
     *aRootY = aMouseEvent->mRefPoint.y + offset.y;