summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs/qfiledialog.cpp
diff options
context:
space:
mode:
authorEike Hein <hein@kde.org>2018-01-07 13:02:01 +0900
committerShawn Rutledge <shawn.rutledge@qt.io>2018-02-01 04:56:52 +0000
commit4a7771f206d4b29be549d3827c36a46679d90de6 (patch)
tree21337cb422409102b1b5b35f7f9fc1cd11c7a0a4 /src/widgets/dialogs/qfiledialog.cpp
parent3adfcbf1ed9b63c3ce41d7417658db3836fd3530 (diff)
QSimpleDrag: Fix mouse release coords for delayed event transmission
On platforms such as XCB, the drag cursor pixmap is shown via a window (a QShapedPixmapWindow) under the cursor. The mouse button release event at the end of the drag is received in this QXcbWindow, but intercepted by an event filter that QSimpleDrag installs on the QApplication. It then resends it unmodified(!) after the drag has ended and the drag pixmap window destroyed, causing it to be delivered to the new top-level window. The local coordinates in the unmodified QMouseEvent are local to the drag pixmap window and don't match the window it is delayed-transmitted to. This ends up having fatal, user-visible effects particularly in Qt Quick: QQuickWindow synthesizes a hover event once per frame using the last received mouse coordinates, here: the release posted by QSimpleDrag. This is done to update the hover event state for items under the cursor when the mouse hasn't moved (e.g. QQuickMouseArea:: containsMouse). The bogus event coordinates in the release event then usually end up causing an item near the top-left of the QQuickWindow to assume it is hovered (because drag pixmap windows tend to be small), even when the mouse cursor is actually far away from it at the end of the drag. This shows up e.g. in the Plasma 5 desktop, where dragging an icon on the desktop will cause the icon at the top-left of the screen (if any) to switch to hovered state, as the release coordinates on the drag pixmap window (showing a dragged icon) fall into the geometry of the top-left icon. QSimpleDrag contains a topLevelAt() function to find the top-level window under the global cursor coordinates that is not the drag pixmap window. This is used by the drop event delivery code. This patch uses this function to find the relevant top-level window, then asks it to map the global cusor coordinates to its local coordinate system, then synthesizes a new QMouseEvent with local coordinates computed in this fashion. As a result the window now gets a release event with coordinates that make sense and are correct. Task-number: QTBUG-66103 Change-Id: I04ebe6ccd4a991fdd4b540ff0227973ea8896a9d Reviewed-by: Eike Hein <hein@kde.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/widgets/dialogs/qfiledialog.cpp')
0 files changed, 0 insertions, 0 deletions