diff options
author | Błażej Szczygieł <spaz16@wp.pl> | 2017-08-27 16:22:08 +0200 |
---|---|---|
committer | Błażej Szczygieł <spaz16@wp.pl> | 2017-11-29 23:05:06 +0000 |
commit | da50a0b38ceb730ad3c30d600adfe4435a498550 (patch) | |
tree | 3fd5840cf34b98ced669d4914c7b8604802601e2 /src/plugins | |
parent | 85eef0e5e05e84b1640a1887fe872e3adbc0ac5b (diff) |
xcb: Set executed drop action when drop is outside the application
Task-number: QTBUG-62815
Change-Id: I13ee1a3a7e9515d827d29ada38bc0d396f4800d7
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbdrag.cpp | 11 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbdrag.h | 4 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index 60d142157f..51d09d8927 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.cpp +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -170,6 +170,9 @@ void QXcbDrag::init() QXcbCursor::queryPointer(connection(), ¤t_virtual_desktop, 0); drag_types.clear(); + + dropped = false; + canceled = false; } QMimeData *QXcbDrag::platformDropData() @@ -225,6 +228,10 @@ void QXcbDrag::startDrag() void QXcbDrag::endDrag() { QBasicDrag::endDrag(); + if (!dropped && !canceled && canDrop()) { + // Set executed drop action when dropping outside application. + setExecutedDropAction(accepted_drop_action); + } initiatorWindow.clear(); } @@ -1026,6 +1033,8 @@ void QXcbDrag::handleDrop(QPlatformWindow *, const xcb_client_message_event_t *e // reset target_time = XCB_CURRENT_TIME; + + dropped = true; } @@ -1124,6 +1133,8 @@ void QXcbDrag::cancel() // remove canceled object currentDrag()->deleteLater(); + + canceled = true; } // find an ancestor with XdndAware on it diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h index 2d152edf76..9e1ee46593 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.h +++ b/src/plugins/platforms/xcb/qxcbdrag.h @@ -136,6 +136,10 @@ private: QRect source_sameanswer; bool waiting_for_status; + // helpers for setting executed drop action outside application + bool dropped; + bool canceled; + // top-level window we sent position to last. xcb_window_t current_target; // window to send events to (always valid if current_target) |