Bug 1440413 - Use original mouse event position when checking for doubleclick on titlebar; r=stransky
authorJan Horak <jhorak@redhat.com>
Mon, 26 Feb 2018 16:23:34 +0100
changeset 405517 59daaec35ff17562f119b3f06d04c67a0057d8f1
parent 405516 8e612e57fc498c4be3b33f97cc014a9dfa22e7b8
child 405518 808d909f106b517ace7fb301303b1132ed60cbfb
push id33523
push userapavel@mozilla.com
push dateTue, 27 Feb 2018 22:13:55 +0000
treeherdermozilla-central@81ff01f63004 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstransky
bugs1440413
milestone60.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 1440413 - Use original mouse event position when checking for doubleclick on titlebar; r=stransky The DispatchEvent can manipulate with the mRefPoint we're later using to check if the double click happened on the titlebar. We need to save it for later check to avoid unwanted restore/maximize event when mouse event occurs near top border of any widget. Also don't handle doubleclick on titlebar when CSD is not enabled. MozReview-Commit-ID: KjxM1EsT4Lg
widget/gtk/nsWindow.cpp
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -2805,23 +2805,27 @@ nsWindow::OnButtonReleaseEvent(GdkEventB
     WidgetMouseEvent event(true, eMouseUp, this,
                            WidgetMouseEvent::eReal);
     event.button = domButton;
     InitButtonEvent(event, aEvent);
     gdouble pressure = 0;
     gdk_event_get_axis ((GdkEvent*)aEvent, GDK_AXIS_PRESSURE, &pressure);
     event.pressure = pressure ? pressure : mLastMotionPressure;
 
+    // The mRefPoint is manipulated in DispatchInputEvent, we're saving it
+    // to use it for the doubleclick position check.
+    LayoutDeviceIntPoint pos = event.mRefPoint;
+
     nsEventStatus eventStatus = DispatchInputEvent(&event);
 
     bool defaultPrevented = (eventStatus == nsEventStatus_eConsumeNoDefault);
     // Check if mouse position in titlebar and doubleclick happened to
     // trigger restore/maximize.
-    LayoutDeviceIntPoint pos = event.mRefPoint;
     if (!defaultPrevented
+             && mIsCSDEnabled
              && event.button == WidgetMouseEvent::eLeftButton
              && event.mClickCount == 2
              && mDraggableRegion.Contains(pos.x, pos.y)) {
 
         if (mSizeState == nsSizeMode_Maximized) {
             SetSizeMode(nsSizeMode_Normal);
         } else {
             SetSizeMode(nsSizeMode_Maximized);