From ab2cf73440e5fbda9e2a3ba15dc1df7895c49679 Mon Sep 17 00:00:00 2001 From: Alberto Mardegan Date: Wed, 13 Apr 2016 16:28:57 +0300 Subject: QXcbDrag: forward mouse release event to initiator window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The mouse release event which ends the drag and drop operation must be forwarded to the window where the drag started, and not to the QShapedPixmapWindow, which is not supposed to handle input events. Task-number: QTBUG-52541 Change-Id: I24a7c7b331a06342ac28b420ff9467aa05fe00dd Reviewed-by: Friedemann Kleint Reviewed-by: Błażej Szczygieł Reviewed-by: Dmitry Shachnev Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbdrag.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/plugins/platforms/xcb/qxcbdrag.cpp') diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index 529f91e1ec..6fa5dfa483 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.cpp +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -50,6 +50,7 @@ #include +#include #include #include #include @@ -170,6 +171,17 @@ QMimeData *QXcbDrag::platformDropData() return dropData; } +bool QXcbDrag::eventFilter(QObject *o, QEvent *e) +{ + /* We are setting a mouse grab on the QShapedPixmapWindow in order not to + * lose the grab when the virtual desktop changes, but + * QBasicDrag::eventFilter() expects the events to be coming from the + * window where the drag was started. */ + if (initiatorWindow && o == shapedPixmapWindow()) + o = initiatorWindow.data(); + return QBasicDrag::eventFilter(o, e); +} + void QXcbDrag::startDrag() { // #fixme enableEventFilter(); @@ -194,6 +206,7 @@ void QXcbDrag::startDrag() setUseCompositing(current_virtual_desktop->compositingActive()); setScreen(current_virtual_desktop->screens().constFirst()->screen()); + initiatorWindow = QGuiApplicationPrivate::currentMouseWindow; QBasicDrag::startDrag(); if (connection()->mouseGrabber() == Q_NULLPTR) shapedPixmapWindow()->setMouseGrabEnabled(true); @@ -202,6 +215,7 @@ void QXcbDrag::startDrag() void QXcbDrag::endDrag() { QBasicDrag::endDrag(); + initiatorWindow.clear(); } static xcb_translate_coordinates_reply_t * -- cgit v1.2.3 From 46f1c4c86bbfe7b6917907700bec998626ad4a8b Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 11 May 2016 18:42:24 +0300 Subject: xcb: Properly interpret data.l[0] field of XdndStatus message The standard https://freedesktop.org/wiki/Specifications/XDND/ states: "In order for the proxy window to behave correctly, the appropriate field of the client messages, window or data.l[0], must contain the ID of the window in which the mouse is located, not the proxy window that is receiving the messages." So compare it with the current target window instead of the current proxy window. Change-Id: Ie31fd3aeadebcf5a9be7b9a9194f35a4ec7bdebb Reviewed-by: Lars Knoll --- src/plugins/platforms/xcb/qxcbdrag.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms/xcb/qxcbdrag.cpp') diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index 6fa5dfa483..f93e420bcf 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.cpp +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -829,7 +829,7 @@ void QXcbDrag::handle_xdnd_status(const xcb_client_message_event_t *event) DEBUG("xdndHandleStatus"); waiting_for_status = false; // ignore late status messages - if (event->data.data32[0] && event->data.data32[0] != current_proxy_target) + if (event->data.data32[0] && event->data.data32[0] != current_target) return; const bool dropPossible = event->data.data32[1]; -- cgit v1.2.3