89 lines
3.5 KiB
Diff
89 lines
3.5 KiB
Diff
|
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
|
||
|
|