diff options
author | Gatis Paeglis <gatis.paeglis@qt.io> | 2018-05-22 16:33:53 +0200 |
---|---|---|
committer | Gatis Paeglis <gatis.paeglis@qt.io> | 2018-06-25 12:45:47 +0000 |
commit | 7a7c722782a435f7c01b94f48df7a5f4ff4d599e (patch) | |
tree | 63f1261126d502e05f0d396822ba6ebee4e1d323 /src/plugins/platforms/xcb | |
parent | ca3460775cadd055792457eab42bd8783b1df795 (diff) |
dnd: send DragEnter and DragMove on DnD start
This was a regression from Qt4 and also is the documented behavior.
In addition this patch fixes various issues with cursor shape updating
that were discovered along the way and that are necessary for testing
the new changes.
The code in QGuiApplicationPrivate::processDrag() also needed a fixup,
particularly the resetting of QGuiApplicationPrivate::currentDragWindow.
Without this fix we would get DragMove (the one that immediately follows
the DragEnter) only for the first DragEnter event. For example when dnd
starts on mouse press then for mouse click we would get:
<click> DragEnter->DragMove->DragLeave <click> DragEnter->DragLeave
but the expected is:
<click> DragEnter->DragMove->DragLeave <click> DragEnter->DragMove->DragLeave
Task-number: QTBUG-34331
Change-Id: I3cc96c87d1fd5d1342c7f6c9438802ab30076e9e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbdrag.cpp | 3 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbintegration.cpp | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index 999ae16897..20b01225cf 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.cpp +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -201,6 +201,9 @@ void QXcbDrag::startDrag() QBasicDrag::startDrag(); if (connection()->mouseGrabber() == nullptr) shapedPixmapWindow()->setMouseGrabEnabled(true); + + auto nativePixelPos = QHighDpi::toNativePixels(QCursor::pos(), initiatorWindow); + move(nativePixelPos, QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers()); } void QXcbDrag::endDrag() diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index b8a0e85465..49649eb816 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -379,8 +379,17 @@ QPlatformClipboard *QXcbIntegration::clipboard() const #endif #if QT_CONFIG(draganddrop) +#include <private/qsimpledrag_p.h> QPlatformDrag *QXcbIntegration::drag() const { + static const bool useSimpleDrag = qEnvironmentVariableIsSet("QT_XCB_USE_SIMPLE_DRAG"); + if (Q_UNLIKELY(useSimpleDrag)) { // This is useful for testing purposes + static QSimpleDrag *simpleDrag = nullptr; + if (!simpleDrag) + simpleDrag = new QSimpleDrag(); + return simpleDrag; + } + return m_connections.at(0)->drag(); } #endif |