From 7a7c722782a435f7c01b94f48df7a5f4ff4d599e Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Tue, 22 May 2018 16:33:53 +0200 Subject: 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: DragEnter->DragMove->DragLeave DragEnter->DragLeave but the expected is: DragEnter->DragMove->DragLeave DragEnter->DragMove->DragLeave Task-number: QTBUG-34331 Change-Id: I3cc96c87d1fd5d1342c7f6c9438802ab30076e9e Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbintegration.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/plugins/platforms/xcb/qxcbintegration.cpp') 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 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 -- cgit v1.2.3