summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbwindow.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 17fafd5ef0..789229c0a7 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -2336,9 +2336,14 @@ void QXcbWindow::handleMotionNotifyEvent(int event_x, int event_y, int root_x, i
QPoint local(event_x, event_y);
QPoint global(root_x, root_y);
- // "mousePressWindow" can be NULL i.e. if a window will be grabbed or umnapped, so set it again here
- if (connection()->buttons() != Qt::NoButton && connection()->mousePressWindow() == Q_NULLPTR)
+ // "mousePressWindow" can be NULL i.e. if a window will be grabbed or unmapped, so set it again here.
+ // Unset "mousePressWindow" when mouse button isn't pressed - in some cases the release event won't arrive.
+ const bool isMouseButtonPressed = (connection()->buttons() != Qt::NoButton);
+ const bool hasMousePressWindow = (connection()->mousePressWindow() != Q_NULLPTR);
+ if (isMouseButtonPressed && !hasMousePressWindow)
connection()->setMousePressWindow(this);
+ else if (hasMousePressWindow && !isMouseButtonPressed)
+ connection()->setMousePressWindow(Q_NULLPTR);
handleMouseEvent(timestamp, local, global, modifiers, source);
}