From c55a36cb9015cf1eebd49eaa5b1b4f4ec9b28451 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 7 Oct 2015 16:58:09 +0300 Subject: xcb: Fix DnD for separate X screens Recreate QShapedPixmapWindow when the cursor goes to another X screen. Change-Id: Ifd4c4281971b23abc45a9f6c0509832a45c31521 Reviewed-by: Lars Knoll --- src/gui/kernel/qsimpledrag.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'src/gui/kernel/qsimpledrag.cpp') diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index b02f1dd8bd..6acac4cade 100644 --- a/src/gui/kernel/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -203,25 +203,15 @@ void QBasicDrag::restoreCursor() void QBasicDrag::startDrag() { - // ### TODO Check if its really necessary to have m_drag_icon_window - // when QDrag is used without a pixmap - QDrag::setPixmap() - if (!m_drag_icon_window) - m_drag_icon_window = new QShapedPixmapWindow(); - - m_drag_icon_window->setPixmap(m_drag->pixmap()); - m_drag_icon_window->setHotspot(m_drag->hotSpot()); - + QPoint pos; #ifndef QT_NO_CURSOR - QPoint pos = QCursor::pos(); + pos = QCursor::pos(); if (pos.x() == int(qInf())) { // ### fixme: no mouse pos registered. Get pos from touch... pos = QPoint(); } - m_drag_icon_window->updateGeometry(pos); #endif - - m_drag_icon_window->setVisible(true); - + recreateShapedPixmapWindow(Q_NULLPTR, pos); enableEventFilter(); } @@ -229,6 +219,19 @@ void QBasicDrag::endDrag() { } +void QBasicDrag::recreateShapedPixmapWindow(QScreen *screen, const QPoint &pos) +{ + delete m_drag_icon_window; + // ### TODO Check if its really necessary to have m_drag_icon_window + // when QDrag is used without a pixmap - QDrag::setPixmap() + m_drag_icon_window = new QShapedPixmapWindow(screen); + + m_drag_icon_window->setPixmap(m_drag->pixmap()); + m_drag_icon_window->setHotspot(m_drag->hotSpot()); + m_drag_icon_window->updateGeometry(pos); + m_drag_icon_window->setVisible(true); +} + void QBasicDrag::cancel() { disableEventFilter(); -- cgit v1.2.3