diff options
author | Gatis Paeglis <gatis.paeglis@digia.com> | 2012-10-01 12:26:20 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-10-02 13:22:49 +0200 |
commit | caaa94b0419473fb39aeff2005b9830166f1ad1d (patch) | |
tree | 27a97a928761b0eadacb00d3c931a857b86450c8 /src/plugins/platforms/xcb/qxcbdrag.cpp | |
parent | 03fd3a8f34679793b87a5d901202ea2805b89d84 (diff) |
Ensure that QDrag is set correctly at all times.
This patch fixes broken code in handleSelectionRequest(). There are 2 cases
when this function is called:
1) When XdndDrop has arrived (on mouse release)
2) When drop has not occurred yet (while mouse are still pressed down)
Second case was not working due to this bug.
Task-number: QTBUG-27405
Change-Id: I913cfd332128a28861e2fcc027b406eb821d2597
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbdrag.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbdrag.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index ab4489af61..82a3fc8a83 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.cpp +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -1086,7 +1086,7 @@ void QXcbDrag::handleSelectionRequest(const xcb_selection_request_event_t *event notify.property = XCB_NONE; notify.time = event->time; - // which transaction do we use? (note: -2 means use current manager->object) + // which transaction do we use? (note: -2 means use current currentDrag()) int at = -1; // figure out which data the requestor is really interested in @@ -1095,11 +1095,11 @@ void QXcbDrag::handleSelectionRequest(const xcb_selection_request_event_t *event at = -2; } else { // if someone has requested data in response to XdndDrop, find the corresponding transaction. the - // spec says to call XConvertSelection() using the timestamp from the XdndDrop + // spec says to call xcb_convert_selection() using the timestamp from the XdndDrop at = findTransactionByTime(event->time); if (at == -1) { - // no dice, perhaps the client was nice enough to use the same window id in XConvertSelection() - // that we sent the XdndDrop event to. + // no dice, perhaps the client was nice enough to use the same window id in + // xcb_convert_selection() that we sent the XdndDrop event to. at = findTransactionByWindow(event->requestor); } // if (at == -1 && event->time == XCB_CURRENT_TIME) { @@ -1118,9 +1118,11 @@ void QXcbDrag::handleSelectionRequest(const xcb_selection_request_event_t *event QDrag *transactionDrag = 0; if (at >= 0) { restartDropExpiryTimer(); - transactionDrag = transactions.at(at).drag; + } else if (at == -2) { + transactionDrag = currentDrag(); } + if (transactionDrag) { xcb_atom_t atomFormat = event->target; int dataFormat = 0; |