diff options
author | Błażej Szczygieł <spaz16@wp.pl> | 2015-10-17 17:22:16 +0200 |
---|---|---|
committer | Błażej Szczygieł <spaz16@wp.pl> | 2016-02-06 09:59:11 +0000 |
commit | b9f76db30d261421e4da58f29053181af04ceb4d (patch) | |
tree | 78fdce99f2504be09e11e9256b3afd7ab93569e3 | |
parent | e4fb521b3f3b9e59146b7569b72aee08dbaeb268 (diff) |
xcb: Correct enter/leave event handling when mouse button is pressed
This patch fixes cursor shape when mouse leaves the window and enters
the window again with pressed mouse button - ignore the mouse enter
and leave event when any of mouse buttons is pressed.
Task-number: QTBUG-46576
Change-Id: Id6ce50cd0d66da51a251d4811bc42cd31606de29
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 91c5eadf34..354c29152f 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -2198,11 +2198,14 @@ void QXcbWindow::handleEnterNotifyEvent(int event_x, int event_y, int root_x, in connection()->handleEnterEvent(); #endif - if (ignoreEnterEvent(mode, detail)) + const QPoint global = QPoint(root_x, root_y); + + if (ignoreEnterEvent(mode, detail) + || (connection()->buttons() != Qt::NoButton + && QGuiApplicationPrivate::lastCursorPosition != global)) return; const QPoint local(event_x, event_y); - QPoint global = QPoint(root_x, root_y); QWindowSystemInterface::handleEnterEvent(window(), local, global); } @@ -2211,7 +2214,11 @@ void QXcbWindow::handleLeaveNotifyEvent(int root_x, int root_y, { connection()->setTime(timestamp); - if (ignoreLeaveEvent(mode, detail)) + const QPoint global(root_x, root_y); + + if (ignoreLeaveEvent(mode, detail) + || (connection()->buttons() != Qt::NoButton + && QGuiApplicationPrivate::lastCursorPosition != global)) return; EnterEventChecker checker; |