diff options
author | Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> | 2015-02-12 13:07:24 +0100 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> | 2015-02-15 11:12:50 +0000 |
commit | ab3113b679922e5232d56a9532c4330b8986e493 (patch) | |
tree | fdd253a1509dbcd1926a6581f9263f7c3034ef81 /src | |
parent | 6342c4a1836f76db43e09a89239d73eda44f414a (diff) |
QGuiApplication: revert b8d0fac5a9 (mouse event handling)
The current attempt to fix the problem described in b8d0fac5a9
has shown to have unforeseen issues. The assert in the
patch has been triggered in user code (see bug report), which, when
looking more closely, shows that the assert cannot be guaranteed
for all cases. E.g if user code (or Qt drag'n'drop code) starts a new
event loop upon receiving the move event, this can deliver new mouse
events before the move returns, which will trigger the assert.
So it seems like the most correct solution is to *post* the second button
event after all (directly trailing the move event), to at least make sure
mouse events are being delivered in the correct order. The crash that caused
the original change will need to be fixed by other means.
Task-number: QTBUG-38597
Change-Id: I47633d1ea310b7c16e937ef0404d9954281452c3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 928d0cddc9..42b80846eb 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1682,14 +1682,12 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo if (e->globalPos != QGuiApplicationPrivate::lastCursorPosition && (stateChange != Qt::NoButton)) { // A mouse event should not change both position and buttons at the same time. Instead we // should first send a move event followed by a button changed event. Since this is not the case - // with the current event, we fake a move-only event that we recurse and process first. This - // will update the global mouse position and cause the second event to be a button only event. - QWindowSystemInterfacePrivate::MouseEvent moveEvent(e->window.data(), - e->timestamp, e->type, e->localPos, e->globalPos, buttons, e->modifiers, e->source); - moveEvent.synthetic = e->synthetic; - processMouseEvent(&moveEvent); - Q_ASSERT(e->globalPos == QGuiApplicationPrivate::lastCursorPosition); - // continue with processing mouse button change event + // with the current event, we split it in two. + QWindowSystemInterfacePrivate::MouseEvent *mouseButtonEvent = new QWindowSystemInterfacePrivate::MouseEvent( + e->window.data(), e->timestamp, e->type, e->localPos, e->globalPos, e->buttons, e->modifiers); + mouseButtonEvent->synthetic = e->synthetic; + QWindowSystemInterfacePrivate::windowSystemEventQueue.prepend(mouseButtonEvent); + stateChange = Qt::NoButton; } QWindow *window = e->window.data(); |