Client: Send release button event on pointer leave
Fixes: QTBUG-97037 Pick-to: 6.6 6.5 6.2 5.15 Change-Id: I151239b276ab5aefe166f5615baf43dab428ce0c Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
parent
8a48175f26
commit
2aa8de5524
@ -716,8 +716,8 @@ public:
|
||||
|
||||
void QWaylandInputDevice::Pointer::pointer_leave(uint32_t time, struct wl_surface *surface)
|
||||
{
|
||||
releaseButtons();
|
||||
invalidateFocus();
|
||||
mButtons = Qt::NoButton;
|
||||
|
||||
mParent->mTime = time;
|
||||
|
||||
@ -832,6 +832,8 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time
|
||||
default: return; // invalid button number (as far as Qt is concerned)
|
||||
}
|
||||
|
||||
mLastButton = qt_button;
|
||||
|
||||
if (state)
|
||||
mButtons |= qt_button;
|
||||
else
|
||||
@ -870,10 +872,13 @@ void QWaylandInputDevice::Pointer::invalidateFocus()
|
||||
|
||||
void QWaylandInputDevice::Pointer::releaseButtons()
|
||||
{
|
||||
if (mButtons == Qt::NoButton)
|
||||
return;
|
||||
|
||||
mButtons = Qt::NoButton;
|
||||
|
||||
if (auto *window = focusWindow()) {
|
||||
ReleaseEvent e(focusWindow(), mParent->mTime, mSurfacePos, mGlobalPos, mButtons, Qt::NoButton, mParent->modifiers());
|
||||
ReleaseEvent e(focusWindow(), mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mLastButton, mParent->modifiers());
|
||||
window->handleMouse(mParent, e);
|
||||
}
|
||||
}
|
||||
|
@ -336,6 +336,7 @@ public:
|
||||
QPointF mSurfacePos;
|
||||
QPointF mGlobalPos;
|
||||
Qt::MouseButtons mButtons = Qt::NoButton;
|
||||
Qt::MouseButton mLastButton = Qt::NoButton;
|
||||
#if QT_CONFIG(cursor)
|
||||
wl_buffer *mCursorBuffer = nullptr;
|
||||
Qt::CursorShape mCursorShape = Qt::BitmapCursor;
|
||||
|
Loading…
x
Reference in New Issue
Block a user