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>
bb10
Błażej Szczygieł 2015-10-17 17:22:16 +02:00
parent e4fb521b3f
commit b9f76db30d
1 changed files with 10 additions and 3 deletions

View File

@ -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;