pull in upstream drag-n-drop related fixes (QTBUG-45812, QTBUG-51215)

This commit is contained in:
Rex Dieter 2016-05-13 10:41:52 -05:00
parent 4852b13975
commit 580f183d5a
4 changed files with 238 additions and 2 deletions

View File

@ -0,0 +1,88 @@
From 78ad8f208d8dbe3575194bb9b97d4e42efdc32d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= <spaz16@wp.pl>
Date: Mon, 15 Feb 2016 20:50:16 +0100
Subject: [PATCH 087/652] xcb: Fix drag and drop between xcb screens
Set the proper screen before creating a shaped pixmap window in
QBasicDrag::startDrag(). Grab mouse again when D&D window is
recreated.
Task-number: QTBUG-51215
Change-Id: I5cb47d3b11672b56d17b32072d84a722bdcdcd9a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
---
src/gui/kernel/qsimpledrag.cpp | 5 +++--
src/gui/kernel/qsimpledrag_p.h | 3 +++
src/plugins/platforms/xcb/qxcbdrag.cpp | 4 ++++
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp
index 9f38c9b..00589d2 100644
--- a/src/gui/kernel/qsimpledrag.cpp
+++ b/src/gui/kernel/qsimpledrag.cpp
@@ -88,7 +88,8 @@ static QWindow* topLevelAt(const QPoint &pos)
QBasicDrag::QBasicDrag() :
m_restoreCursor(false), m_eventLoop(0),
m_executed_drop_action(Qt::IgnoreAction), m_can_drop(false),
- m_drag(0), m_drag_icon_window(0), m_useCompositing(true)
+ m_drag(0), m_drag_icon_window(0), m_useCompositing(true),
+ m_screen(Q_NULLPTR)
{
}
@@ -211,7 +212,7 @@ void QBasicDrag::startDrag()
pos = QPoint();
}
#endif
- recreateShapedPixmapWindow(Q_NULLPTR, pos);
+ recreateShapedPixmapWindow(m_screen, pos);
enableEventFilter();
}
diff --git a/src/gui/kernel/qsimpledrag_p.h b/src/gui/kernel/qsimpledrag_p.h
index 055136c..b208c8c 100644
--- a/src/gui/kernel/qsimpledrag_p.h
+++ b/src/gui/kernel/qsimpledrag_p.h
@@ -90,6 +90,8 @@ protected:
bool useCompositing() const { return m_useCompositing; }
void setUseCompositing(bool on) { m_useCompositing = on; }
+ void setScreen(QScreen *screen) { m_screen = screen; }
+
Qt::DropAction executedDropAction() const { return m_executed_drop_action; }
void setExecutedDropAction(Qt::DropAction da) { m_executed_drop_action = da; }
@@ -108,6 +110,7 @@ private:
QDrag *m_drag;
QShapedPixmapWindow *m_drag_icon_window;
bool m_useCompositing;
+ QScreen *m_screen;
};
class Q_GUI_EXPORT QSimpleDrag : public QBasicDrag
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index 9296a6d..aa6445d 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -193,6 +193,7 @@ void QXcbDrag::startDrag()
XCB_ATOM_ATOM, 32, drag_types.size(), (const void *)drag_types.constData());
setUseCompositing(current_virtual_desktop->compositingActive());
+ setScreen(current_virtual_desktop->screens().constFirst()->screen());
QBasicDrag::startDrag();
if (connection()->mouseGrabber() == Q_NULLPTR)
shapedPixmapWindow()->setMouseGrabEnabled(true);
@@ -322,6 +323,9 @@ void QXcbDrag::move(const QPoint &globalPos)
if (virtualDesktop != current_virtual_desktop) {
setUseCompositing(virtualDesktop->compositingActive());
recreateShapedPixmapWindow(static_cast<QPlatformScreen*>(screen)->screen(), deviceIndependentPos);
+ if (connection()->mouseGrabber() == Q_NULLPTR)
+ shapedPixmapWindow()->setMouseGrabEnabled(true);
+
current_virtual_desktop = virtualDesktop;
} else {
QBasicDrag::moveShapedPixmapWindow(deviceIndependentPos);
--
2.7.4

View File

@ -0,0 +1,98 @@
From 269fdbdd2bedda5f5eacb751224d3a3fc3eed5bc Mon Sep 17 00:00:00 2001
From: Urs Fleisch <ufleisch@users.sourceforge.net>
Date: Fri, 26 Feb 2016 17:46:09 +0100
Subject: [PATCH 508/652] xcb: Fix drag and drop to applications like Emacs and
Chromium.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Drops without matching time stamp do not work. I have fixed the issue by
reanimating the findXdndAwareParent() function (adapted to XCB) and
using it to find a matching transaction if all else fails.
Task-number: QTBUG-45812
Change-Id: Ibca15bbab02ccf2f25280418e9edf36972ebf9a0
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
---
src/plugins/platforms/xcb/qxcbdrag.cpp | 55 +++++++++++++++++++++++++++-------
1 file changed, 44 insertions(+), 11 deletions(-)
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index f5cc873..f1428d0 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -1072,6 +1072,40 @@ void QXcbDrag::cancel()
send_leave();
}
+// find an ancestor with XdndAware on it
+static xcb_window_t findXdndAwareParent(QXcbConnection *c, xcb_window_t window)
+{
+ xcb_window_t target = 0;
+ forever {
+ // check if window has XdndAware
+ xcb_get_property_cookie_t gpCookie = Q_XCB_CALL(
+ xcb_get_property(c->xcb_connection(), false, window,
+ c->atom(QXcbAtom::XdndAware), XCB_GET_PROPERTY_TYPE_ANY, 0, 0));
+ xcb_get_property_reply_t *gpReply = xcb_get_property_reply(
+ c->xcb_connection(), gpCookie, 0);
+ bool aware = gpReply && gpReply->type != XCB_NONE;
+ free(gpReply);
+ if (aware) {
+ target = window;
+ break;
+ }
+
+ // try window's parent
+ xcb_query_tree_cookie_t qtCookie = Q_XCB_CALL(
+ xcb_query_tree_unchecked(c->xcb_connection(), window));
+ xcb_query_tree_reply_t *qtReply = xcb_query_tree_reply(
+ c->xcb_connection(), qtCookie, NULL);
+ if (!qtReply)
+ break;
+ xcb_window_t root = qtReply->root;
+ xcb_window_t parent = qtReply->parent;
+ free(qtReply);
+ if (window == root)
+ break;
+ window = parent;
+ }
+ return target;
+}
void QXcbDrag::handleSelectionRequest(const xcb_selection_request_event_t *event)
{
@@ -1099,17 +1133,16 @@ void QXcbDrag::handleSelectionRequest(const xcb_selection_request_event_t *event
// xcb_convert_selection() that we sent the XdndDrop event to.
at = findTransactionByWindow(event->requestor);
}
-// if (at == -1 && event->time == XCB_CURRENT_TIME) {
-// // previous Qt versions always requested the data on a child of the target window
-// // using CurrentTime... but it could be asking for either drop data or the current drag's data
-// Window target = findXdndAwareParent(event->requestor);
-// if (target) {
-// if (current_target && current_target == target)
-// at = -2;
-// else
-// at = findXdndDropTransactionByWindow(target);
-// }
-// }
+
+ if (at == -1 && event->time == XCB_CURRENT_TIME) {
+ xcb_window_t target = findXdndAwareParent(connection(), event->requestor);
+ if (target) {
+ if (current_target == target)
+ at = -2;
+ else
+ at = findTransactionByWindow(target);
+ }
+ }
}
QDrag *transactionDrag = 0;
--
2.7.4

View File

@ -0,0 +1,41 @@
From c6d041e7ca3eb7945bf143a5c4fffcb2b2afba75 Mon Sep 17 00:00:00 2001
From: Urs Fleisch <ufleisch@users.sourceforge.net>
Date: Sun, 1 May 2016 14:31:48 +0200
Subject: [PATCH 554/652] xcb: Fix drag and drop to Emacs.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Unfortunately, the improved patch for QTBUG-45812 fixed things for
Chromium, but did no longer work for Emacs. This fixes commit [269fdb]
to make it work for both Emacs and Chromium.
Task-number: QTBUG-45812
Change-Id: I2fca708503f27679681bc6959de1ad94943a063e
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
---
src/plugins/platforms/xcb/qxcbdrag.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index f1428d0..529f91e 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -1134,10 +1134,10 @@ void QXcbDrag::handleSelectionRequest(const xcb_selection_request_event_t *event
at = findTransactionByWindow(event->requestor);
}
- if (at == -1 && event->time == XCB_CURRENT_TIME) {
+ if (at == -1) {
xcb_window_t target = findXdndAwareParent(connection(), event->requestor);
if (target) {
- if (current_target == target)
+ if (event->time == XCB_CURRENT_TIME && current_target == target)
at = -2;
else
at = findTransactionByWindow(target);
--
2.7.4

View File

@ -59,7 +59,7 @@
Summary: Qt5 - QtBase components
Name: qt5-qtbase
Version: 5.6.0
Release: 18%{?prerelease:.%{prerelease}}%{?dist}
Release: 19%{?prerelease:.%{prerelease}}%{?dist}
# See LGPL_EXCEPTIONS.txt, for exception details
License: LGPLv2 with exceptions or GPLv3 with exceptions
@ -105,6 +105,7 @@ Patch60: moc-get-the-system-defines-from-the-compiler-itself.patch
# Item views, https://bugreports.qt.io/browse/QTBUG-48870
Patch158: 0058-QtGui-Avoid-rgba64-rgba32-conversion-on-every-pixel-.patch
Patch176: 0076-QListView-fix-skipping-indexes-in-selectedIndexes.patch
Patch187: 0087-xcb-Fix-drag-and-drop-between-xcb-screens.patch
Patch201: 0101-xcb-include-cmath.patch
Patch277: 0177-Fix-GCC-6-Wunused-functions-warnings.patch
Patch278: 0178-qt_common.prf-when-looking-for-GCC-4.6-match-GCC-6-t.patch
@ -112,7 +113,9 @@ Patch301: 0201-alsatest-Fix-the-check-to-treat-alsalib-1.1.x-as-cor.patch
Patch321: 0221-QObject-fix-GCC-6-warning-about-qt_static_metacall-s.patch
Patch393: 0293-Fix-QtDBus-deadlock-inside-kded-kiod.patch
Patch515: 0415-QtDBus-clean-up-signal-hooks-and-object-tree-in-clos.patch
Patch608: 0508-xcb-Fix-drag-and-drop-to-applications-like-Emacs-and.patch
Patch637: 0537-QtDBus-finish-all-pending-call-with-error-if-disconn.patch
Patch654: 0554-xcb-Fix-drag-and-drop-to-Emacs.patch
# macros, be mindful to keep sync'd with macros.qt5
Source10: macros.qt5
@ -367,6 +370,7 @@ RPM macros for building Qt5 packages.
%patch158 -p1 -b .0058
%patch176 -p1 -b .0076
%patch187 -p1 -b .0087
%patch201 -p1 -b .0101
%patch277 -p1 -b .0177
%patch278 -p1 -b .0178
@ -374,7 +378,9 @@ RPM macros for building Qt5 packages.
%patch321 -p1 -b .0221
%patch393 -p1 -b .0293
%patch515 -p1 -b .0415
%patch637 -p1 -b .0637
%patch608 -p1 -b .0508
%patch637 -p1 -b .0537
%patch654 -p1 -b .0554
%define platform linux-g++
@ -965,6 +971,9 @@ fi
%changelog
* Fri May 13 2016 Rex Dieter <rdieter@fedoraproject.org> - 5.6.0-19
- pull in upstream drag-n-drop related fixes (QTBUG-45812, QTBUG-51215)
* Sat May 07 2016 Rex Dieter <rdieter@fedoraproject.org> - 5.6.0-18
- revert out-of-tree build, breaks Qt5*Config.cmake *_PRIVATE_INCLUDE_DIRS entries (all blank)