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

--HG--
extra : rebase_source : b880e4d89ebe3546b7ef70e3d94926a628f98598
This commit is contained in:
Jan Horak 2018-02-26 16:23:34 +01:00
Родитель 69367dbfc5
Коммит 2fec7aac11
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -2810,13 +2810,17 @@ nsWindow::OnButtonReleaseEvent(GdkEventButton *aEvent)
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)) {