diff options
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbdrag.cpp | 13 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbdrag.h | 3 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 9 |
3 files changed, 25 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index dce0cccf87..999ae16897 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.cpp +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -155,6 +155,8 @@ void QXcbDrag::init() dropped = false; canceled = false; + + source_sameanswer = QRect(); } bool QXcbDrag::eventFilter(QObject *o, QEvent *e) @@ -471,6 +473,17 @@ void QXcbDrag::move(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardMod else xcb_send_event(xcb_connection(), false, proxy_target, XCB_EVENT_MASK_NO_EVENT, (const char *)&move); } + + static const bool isUnity = qgetenv("XDG_CURRENT_DESKTOP").toLower() == "unity"; + if (isUnity && xdndCollectionWindow == XCB_NONE) { + QString name = QXcbWindow::windowTitle(connection(), target); + if (name == QStringLiteral("XdndCollectionWindowImp")) + xdndCollectionWindow = target; + } + if (target == xdndCollectionWindow) { + setCanDrop(false); + updateCursor(Qt::IgnoreAction); + } } void QXcbDrag::drop(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods) diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h index bbdf75f170..c19008c04b 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.h +++ b/src/plugins/platforms/xcb/qxcbdrag.h @@ -143,6 +143,9 @@ private: bool dropped; bool canceled; + // A window from Unity DnD Manager, which does not respect the XDnD spec + xcb_window_t xdndCollectionWindow = XCB_NONE; + // top-level window we sent position to last. xcb_window_t current_target; // window to send events to (always valid if current_target) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 97dac4cfc1..4988ed9657 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -2839,6 +2839,15 @@ QString QXcbWindow::windowTitle(const QXcbConnection *conn, xcb_window_t window) const char *name = reinterpret_cast<const char *>(xcb_get_property_value(reply.get())); return QString::fromUtf8(name, xcb_get_property_value_length(reply.get())); } + + reply = Q_XCB_REPLY_UNCHECKED(xcb_get_property, conn->xcb_connection(), + false, window, conn->atom(QXcbAtom::WM_NAME), + XCB_ATOM_STRING, 0, 1024); + if (reply && reply->format == 8 && reply->type == XCB_ATOM_STRING) { + const char *name = reinterpret_cast<const char *>(xcb_get_property_value(reply.get())); + return QString::fromLatin1(name, xcb_get_property_value_length(reply.get())); + } + return QString(); } |