diff options
author | Błażej Szczygieł <spaz16@wp.pl> | 2016-05-05 14:03:56 +0200 |
---|---|---|
committer | Błażej Szczygieł <spaz16@wp.pl> | 2016-05-09 21:46:29 +0000 |
commit | d6cbf9efb7c42b10de5fe293589176019faf0373 (patch) | |
tree | a2bb0645ee6451fab59c0408839a62e2dd603504 /src/plugins/platforms/xcb | |
parent | ab2cf73440e5fbda9e2a3ba15dc1df7895c49679 (diff) |
xcb: Properly unset mousePressWindow()
In some cases the mouse release event won't arrive, i.e. when window is
minimized on button press. Check for mouse buttons state on mouse move
event and properly unset the mousePressWindow to avoid blocking
enter/leave events in this case.
Amends: c511466d747d99ee76465cfe90ce594fa1f27469
Change-Id: I543a75104f528df1bf644bace13f78a6af017455
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 226507f7a0..429ba8df71 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -2351,9 +2351,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); } |