wasm: fix mouse move and right click
Emscripten has no concept of 'no mouse button', so when there is no button down, it was sending left mouse. Also we were hiding mousepress for only leftmouse downs. Fixes: QTBUG-97431 Pick-to: 6.2 Change-Id: Ibf078705c343944e45551830b7fee94ed5aa7333 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
625cfb6b40
commit
820a6d4117
@ -437,7 +437,7 @@ bool QWasmEventTranslator::processMouse(int eventType, const EmscriptenMouseEven
|
||||
QPoint globalPoint = screen()->geometry().topLeft() + targetPoint;
|
||||
|
||||
QEvent::Type buttonEventType = QEvent::None;
|
||||
Qt::MouseButton button = translateMouseButton(mouseEvent->button);
|
||||
Qt::MouseButton button = Qt::NoButton;
|
||||
Qt::KeyboardModifiers modifiers = translateMouseEventModifier(mouseEvent);
|
||||
|
||||
QWindow *window2 = nullptr;
|
||||
@ -457,19 +457,22 @@ bool QWasmEventTranslator::processMouse(int eventType, const EmscriptenMouseEven
|
||||
switch (eventType) {
|
||||
case EMSCRIPTEN_EVENT_MOUSEDOWN:
|
||||
{
|
||||
button = translateMouseButton(mouseEvent->button);
|
||||
|
||||
if (window2)
|
||||
window2->requestActivate();
|
||||
|
||||
pressedButtons.setFlag(button);
|
||||
|
||||
pressedWindow = window2;
|
||||
buttonEventType = QEvent::MouseButtonPress;
|
||||
|
||||
// button overview:
|
||||
// 0 = primary mouse button, usually left click
|
||||
// 1 = middle mouse button, usually mouse wheel
|
||||
// 2 = right mouse button, usually right click
|
||||
// from: https://w3c.github.io/uievents/#dom-mouseevent-button
|
||||
if (mouseEvent->button == 0) {
|
||||
pressedWindow = window2;
|
||||
buttonEventType = QEvent::MouseButtonPress;
|
||||
if (!(htmlWindow->m_windowState & Qt::WindowFullScreen) && !(htmlWindow->m_windowState & Qt::WindowMaximized)) {
|
||||
if (htmlWindow && window2->flags().testFlag(Qt::WindowTitleHint) && htmlWindow->isPointOnTitle(globalPoint))
|
||||
draggedWindow = window2;
|
||||
@ -487,7 +490,8 @@ bool QWasmEventTranslator::processMouse(int eventType, const EmscriptenMouseEven
|
||||
}
|
||||
case EMSCRIPTEN_EVENT_MOUSEUP:
|
||||
{
|
||||
pressedButtons.setFlag(translateMouseButton(mouseEvent->button), false);
|
||||
button = translateMouseButton(mouseEvent->button);
|
||||
pressedButtons.setFlag(button, false);
|
||||
buttonEventType = QEvent::MouseButtonRelease;
|
||||
QWasmWindow *oldWindow = nullptr;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user