diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-06-07 13:03:20 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-08-30 12:40:31 +0200 |
commit | f00bbd5eb77d0d4669e0a15a277c3937c49ed813 (patch) | |
tree | 6c2a28758a838cb342ddaf135c5f070f9692c0f5 /src/plugins/platforms/vnc | |
parent | acd7259a03d0168682fedd278ee14ae70a4d87a6 (diff) |
Update QPA mouse event handling in offscreen and VNC plugins
This is needed after a37785ec7638e7485112b87dd7e767881fecc114
deprecated the versions of QWindowSystemInterface::handleMouseEvent()
that were in use here.
Change-Id: Ib704ae2be905436f5a4a80ae6686b5fe3972d34c
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/plugins/platforms/vnc')
-rw-r--r-- | src/plugins/platforms/vnc/qvncclient.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/plugins/platforms/vnc/qvncclient.cpp b/src/plugins/platforms/vnc/qvncclient.cpp index 9dfe873927..3a373a5e4b 100644 --- a/src/plugins/platforms/vnc/qvncclient.cpp +++ b/src/plugins/platforms/vnc/qvncclient.cpp @@ -587,9 +587,18 @@ void QVncClient::frameBufferUpdateRequest() void QVncClient::pointerEvent() { QRfbPointerEvent ev; + static int buttonState = Qt::NoButton; if (ev.read(m_clientSocket)) { - const QPoint pos = m_server->screen()->geometry().topLeft() + QPoint(ev.x, ev.y); - QWindowSystemInterface::handleMouseEvent(0, pos, pos, ev.buttons, QGuiApplication::keyboardModifiers()); + const QPointF pos = m_server->screen()->geometry().topLeft() + QPoint(ev.x, ev.y); + int buttonStateChange = buttonState ^ int(ev.buttons); + QEvent::Type type = QEvent::MouseMove; + if (int(ev.buttons) > buttonState) + type = QEvent::MouseButtonPress; + else if (int(ev.buttons) < buttonState) + type = QEvent::MouseButtonRelease; + QWindowSystemInterface::handleMouseEvent(nullptr, pos, pos, ev.buttons, Qt::MouseButton(buttonStateChange), + type, QGuiApplication::keyboardModifiers()); + buttonState = int(ev.buttons); m_handleMsg = false; } } |