Update QPA mouse event handling in offscreen and VNC plugins
This is needed after a37785ec76
deprecated the versions of QWindowSystemInterface::handleMouseEvent()
that were in use here.
Change-Id: Ib704ae2be905436f5a4a80ae6686b5fe3972d34c
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
parent
acd7259a03
commit
f00bbd5eb7
@ -77,7 +77,8 @@ public:
|
|||||||
if (containing != previous)
|
if (containing != previous)
|
||||||
QWindowSystemInterface::handleEnterLeaveEvent(containing, previous, local, pos);
|
QWindowSystemInterface::handleEnterLeaveEvent(containing, previous, local, pos);
|
||||||
|
|
||||||
QWindowSystemInterface::handleMouseEvent(containing, local, pos, QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers());
|
QWindowSystemInterface::handleMouseEvent(containing, local, pos, QGuiApplication::mouseButtons(), Qt::NoButton,
|
||||||
|
QEvent::MouseMove, QGuiApplication::keyboardModifiers(), Qt::MouseEventSynthesizedByQt);
|
||||||
|
|
||||||
QOffscreenScreen::windowContainingCursor = containing ? containing->handle() : 0;
|
QOffscreenScreen::windowContainingCursor = containing ? containing->handle() : 0;
|
||||||
}
|
}
|
||||||
|
@ -587,9 +587,18 @@ void QVncClient::frameBufferUpdateRequest()
|
|||||||
void QVncClient::pointerEvent()
|
void QVncClient::pointerEvent()
|
||||||
{
|
{
|
||||||
QRfbPointerEvent ev;
|
QRfbPointerEvent ev;
|
||||||
|
static int buttonState = Qt::NoButton;
|
||||||
if (ev.read(m_clientSocket)) {
|
if (ev.read(m_clientSocket)) {
|
||||||
const QPoint pos = m_server->screen()->geometry().topLeft() + QPoint(ev.x, ev.y);
|
const QPointF pos = m_server->screen()->geometry().topLeft() + QPoint(ev.x, ev.y);
|
||||||
QWindowSystemInterface::handleMouseEvent(0, pos, pos, ev.buttons, QGuiApplication::keyboardModifiers());
|
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;
|
m_handleMsg = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user