diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2019-10-21 12:02:15 +0200 |
---|---|---|
committer | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2020-01-03 23:47:02 +0100 |
commit | eaf72c8ffdcdc6e9a3e1e3d67bf09db1dabe7af6 (patch) | |
tree | 705871987df521c50de0442273c0cacfd0d24a7e /src/client/qwaylandwindow.cpp | |
parent | 919efcd994b5284bb73e11859ca953e9186b0bae (diff) | |
download | qtwayland-eaf72c8ffdcdc6e9a3e1e3d67bf09db1dabe7af6.tar.gz |
Client: Don't use deprecated handleMouseEvent version
The new version requires the button that caused the event, as well as the event
type. Instead of adding a conversion functions to and from
QWaylandInputDevice::Type to QEvent::Type, just use QEvent::Type directly, as
there is one-to-one mappings for all the event types we need.
Fixes: QTBUG-80044
Change-Id: I0f6e0e8e7f2e026a1d601f86e819affe0570a1b2
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
Diffstat (limited to 'src/client/qwaylandwindow.cpp')
-rw-r--r-- | src/client/qwaylandwindow.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 0a623e9a..8cc26d71 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -869,7 +869,7 @@ QWaylandWindow *QWaylandWindow::transientParent() const void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e) { - if (e.type == QWaylandPointerEvent::Leave) { + if (e.type == QEvent::Leave) { if (mWindowDecoration) { if (mMouseEventsInContentArea) QWindowSystemInterface::handleLeaveEvent(window()); @@ -886,24 +886,26 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan handleMouseEventWithDecoration(inputDevice, e); } else { switch (e.type) { - case QWaylandPointerEvent::Enter: + case QEvent::Enter: QWindowSystemInterface::handleEnterEvent(window(), e.local, e.global); break; - case QWaylandPointerEvent::Press: - case QWaylandPointerEvent::Release: - case QWaylandPointerEvent::Motion: - QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, e.local, e.global, e.buttons, e.modifiers); + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseMove: + QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, e.local, e.global, e.buttons, e.button, e.type, e.modifiers); break; - case QWaylandPointerEvent::Wheel: + case QEvent::Wheel: QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, e.local, e.global, e.pixelDelta, e.angleDelta, e.modifiers, e.phase, e.source, false); break; + default: + Q_UNREACHABLE(); } } #if QT_CONFIG(cursor) - if (e.type == QWaylandPointerEvent::Enter) { + if (e.type == QEvent::Enter) { QRect contentGeometry = windowContentGeometry().marginsRemoved(frameMargins()); if (contentGeometry.contains(e.local.toPoint())) restoreMouseCursor(inputDevice); @@ -947,21 +949,23 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe } switch (e.type) { - case QWaylandPointerEvent::Enter: + case QEvent::Enter: QWindowSystemInterface::handleEnterEvent(window(), localTranslated, globalTranslated); break; - case QWaylandPointerEvent::Press: - case QWaylandPointerEvent::Release: - case QWaylandPointerEvent::Motion: - QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, localTranslated, globalTranslated, e.buttons, e.modifiers); + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseMove: + QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, localTranslated, globalTranslated, e.buttons, e.button, e.type, e.modifiers); break; - case QWaylandPointerEvent::Wheel: { + case QEvent::Wheel: { QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, localTranslated, globalTranslated, e.pixelDelta, e.angleDelta, e.modifiers, e.phase, e.source, false); break; } + default: + Q_UNREACHABLE(); } mMouseEventsInContentArea = true; |