Deliver mouse press and release events on X11 also when dragging

We generally assume that for every mouse press we also get a mouse
release eventually. The event filter installed by QBasicDrag broke this
assumption as it didn't take care of filtering mouse press and mouse
release events symmetrically. We cannot immediately pass on the release
event as that would mean a release event is generated from a press
event (via the blocking drag call), which breaks assumptions in other
places.

Change-Id: If7e48c7dc0ef5265bed4f9a9366a7606ec875d93
Task-number: QTBUG-46361
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com>
bb10
Ulf Hermann 2015-09-22 17:22:22 +02:00
parent 73b8cd879c
commit 1765046730
1 changed files with 3 additions and 3 deletions

View File

@ -149,7 +149,7 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
{
QPoint nativePosition = getNativeMousePos(e, o);
move(nativePosition);
return true; // Eat all mouse events
return true; // Eat all mouse move events
}
case QEvent::MouseButtonRelease:
disableEventFilter();
@ -160,8 +160,8 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
cancel();
}
exitDndEventLoop();
return true; // Eat all mouse events
case QEvent::MouseButtonPress:
QCoreApplication::postEvent(o, new QMouseEvent(*static_cast<QMouseEvent *>(e)));
return true; // defer mouse release events until drag event loop has returned
case QEvent::MouseButtonDblClick:
case QEvent::Wheel:
return true;