[Development] Help with Xcb drag and drop code?

gatis.paeglis at nokia.com gatis.paeglis at nokia.com
Tue Aug 14 15:55:01 CEST 2012


Hi,

Lately i have been hacking around xcb, mostly with a selections/clipboard... After taking a look at the DnD code i found that in QXcbDrag::handleDrop we are trying to read data.l[4] field from XdndDrop client message, which is not defined at all in the specification from http://www.newplanetsoftware.com/xdnd/

[..]

XdndDrop Sent from source to target to complete the drop. data.l[0] contains the XID of the source window. data.l[1] is reserved for future use (flags). data.l[2] contains the time stamp for retrieving the data. (new in version 1)

[..]

In Qt processes data.l[4] is used for holding supportedActions(), but we can not expect that external clients will use that field in the same way.

I didn't test the patch in detail, but at least it generates the same output as in qt4.8. Before applying it to main Qt repository, it should be tested more properly..

--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -765,7 +765,7 @@ void QXcbDrag::handle_xdnd_position(QWindow *w, const xcb_client_message_event_t
     response.data.data32[3] = 0; // w, h
     response.data.data32[4] = toXdndAction(qt_response.acceptedAction()); // action

-
+    accepted_drop_action = qt_response.acceptedAction();

     if (answerRect.left() < 0)
         answerRect.setLeft(0);
@@ -780,8 +780,6 @@ void QXcbDrag::handle_xdnd_position(QWindow *w, const xcb_client_message_event_t
     if (answerRect.height() < 0)
         answerRect.setHeight(0);

-    response.data.data32[4] = toXdndAction(qt_response.acceptedAction());
-
     // reset
     target_time = XCB_CURRENT_TIME;

@@ -955,7 +953,7 @@ void QXcbDrag::handleDrop(QWindow *, const xcb_client_message_event_t *event)
     // this could be a same-application drop, just proxied due to
     // some XEMBEDding, so try to find the real QMimeData used
     // based on the timestamp for this drop.
-    Qt::DropActions supported_drop_actions(l[4]);
+
     QMimeData *dropData = 0;
     if (currentDrag()) {
         dropData = currentDrag()->mimeData();
@@ -971,7 +969,7 @@ void QXcbDrag::handleDrop(QWindow *, const xcb_client_message_event_t *event)
     //            dropData = QDragManager::dragPrivate(X11->dndDropTransactions.at(at).object)->data;
     // if we can't find it, then use the data in the drag manager

-    QPlatformDropQtResponse response = QWindowSystemInterface::handleDrop(currentWindow.data(),dropData,currentPosition,supported_drop_actions);
+    QPlatformDropQtResponse response = QWindowSystemInterface::handleDrop(currentWindow.data(),dropData,currentPosition,accepted_drop_action);
     setExecutedDropAction(response.acceptedAction());
________________________________
From: development-bounces+gatis.paeglis=nokia.com at qt-project.org [development-bounces+gatis.paeglis=nokia.com at qt-project.org] on behalf of ext Stephen Kelly [stephen.kelly at kdab.com]
Sent: Monday, August 13, 2012 2:35 PM
To: development at qt-project.org
Subject: [Development] Help with Xcb drag and drop code?




Hi there,



In trying to fix



https://bugreports.qt-project.org/browse/QTBUG-26832



I hit a wall of not knowing anything about the xcb drag and drop code. Does anyone know that code and can comment on the bug?



Thanks,



--

Stephen Kelly <stephen.kelly at kdab.com> | Software Engineer

KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company

www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090

KDAB - Qt Experts - Platform-Independent Software Solutions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120814/75107836/attachment.html>


More information about the Development mailing list