path: root/src/plugins/platforms/xcb/qxcbcursor.cpp
diff options
authorGatis Paeglis <>2017-05-15 16:23:49 +0200
committerGatis Paeglis <>2018-05-04 10:44:15 +0000
commit10b3286313c78fa380b5fe676a7c14f3ae84f017 (patch)
treec42b5d2173c2b31775bfaa4185e9c59f55f22f0e /src/plugins/platforms/xcb/qxcbcursor.cpp
parentbd52d9d73be83d5e4d2e16e45fe369dc79ae2117 (diff)
qpa: improve API to support DnDs from other processes
... instead of using a hack of directly accessing QGuiApplication members. The current QPA API was bad for two reasons: 1) It expects platform plugin authors to know about internals of Qt Gui, particularly that QGuiApplication uses QGuiApplication::{mouseButtons,keyboardModifiers} to construct QDragMoveEvent and QDropEvent events. Which results in the second reason why this is bad. 2) Platform plugins should not directly access member variables of QGuiApplication, just to make sure that QDragMoveEvent and QDropEvent events contain correct state. Platform plugins should instead use QWindowSystemInterface to communicate with Qt Gui (which is also the solution here). The solution is to extend QWindowSystemInterface::handle{Drag,Drop} to require mouse/keyboard state. We already do this for some of the other methods, so it is nothing extraordinary. This type of interface is also _required_ to support drag-n-drops from other processes. We can't use QGuiApplication::{mouseButtons,keyboardModifiers} when the drag originates from another process, instead we need to query mouse/keyboard state from the system. This patch fixes drag-n-drops from others processes on XCB platform plugin. Task-number: QTBUG-57168 Change-Id: I3f8b0d2f76e9a32ae157622fef801829d629921d Reviewed-by: Mikhail Svetkin <> Reviewed-by: Tor Arne Vestbø <> Reviewed-by: Friedemann Kleint <>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbcursor.cpp')
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
index 8d151b760b..6795cb8905 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
+++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
@@ -626,6 +626,12 @@ xcb_cursor_t QXcbCursor::createBitmapCursor(QCursor *cursor)
+/*! \internal
+ Note that the logical state of a device (as seen by means of the protocol) may
+ lag the physical state if device event processing is frozen. See QueryPointer
+ in X11 protocol specification.
void QXcbCursor::queryPointer(QXcbConnection *c, QXcbVirtualDesktop **virtualDesktop, QPoint *pos, int *keybMask)
if (pos)