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>
bb10
Błażej Szczygieł 2017-08-27 16:22:08 +02:00
parent 85eef0e5e0
commit da50a0b38c
2 changed files with 15 additions and 0 deletions

View File

@ -170,6 +170,9 @@ void QXcbDrag::init()
QXcbCursor::queryPointer(connection(), &current_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

View File

@ -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)