wasm: handle mouse events even when not over a window

If the mouse button is held and mouse moves from over the window, that
window would never register the button up event, and cause issue like
being able to move a dialog around by simply moving the mouse around.

Change-Id: I1363ac9c9f4113a79bf6863668ba74b90b1cea4a
Fixes: QTBUG-75951
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Lorn Potter 2019-05-30 18:30:17 +10:00
parent 8d2df3002b
commit df9f9fb368

View File

@ -552,9 +552,12 @@ void QWasmEventTranslator::processMouse(int eventType, const EmscriptenMouseEven
Qt::KeyboardModifiers modifiers = translateMouseEventModifier(mouseEvent);
QWindow *window2 = screen()->compositor()->windowAt(globalPoint, 5);
if (window2 == nullptr)
return;
lastWindow = window2;
if (window2 == nullptr) {
window2 = lastWindow;
} else {
lastWindow = window2;
}
QPoint localPoint = window2->mapFromGlobal(globalPoint);
bool interior = window2->geometry().contains(globalPoint);
@ -616,7 +619,7 @@ void QWasmEventTranslator::processMouse(int eventType, const EmscriptenMouseEven
}
if (resizeMode != QWasmWindow::ResizeNone && !(htmlWindow->m_windowState & Qt::WindowFullScreen)) {
QPoint delta = QPoint(mouseEvent->canvasX, mouseEvent->canvasY) - resizePoint;
QPoint delta = QPoint(mouseEvent->targetX, mouseEvent->targetY) - resizePoint;
resizeWindow(draggedWindow, resizeMode, resizeStartRect, delta);
}
}