diff options
author | Alexander Volkov <a.volkov@rusbitech.ru> | 2015-04-13 14:13:34 +0300 |
---|---|---|
committer | Alexander Volkov <a.volkov@rusbitech.ru> | 2015-10-14 18:41:19 +0000 |
commit | e9121328866efa6ba3eb78a991fef785338fd55e (patch) | |
tree | a02ee5eba3d263dccc2d81ad2f6343b302070d1d /src/plugins/platforms/xcb/qxcbscreen.cpp | |
parent | 4b9cdf90ca4299ffd4ec602571944ace10ef9cdc (diff) |
xcb: Use XShape for DnD when a compositing manager is not running
Otherwise transparent areas of the drag'n'drop pixmap are painted
with the black color.
Task-number: QTBUG-45193
Change-Id: I55b7c7caababe13584fa1c7a52835f112e20f920
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbscreen.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbscreen.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 64645b92f6..0aa5810a72 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -54,6 +54,10 @@ QXcbVirtualDesktop::QXcbVirtualDesktop(QXcbConnection *connection, xcb_screen_t , m_number(number) , m_xSettings(Q_NULLPTR) { + QByteArray cmAtomName("_NET_WM_CM_S"); + cmAtomName += QByteArray::number(m_number); + m_net_wm_cm_atom = connection->internAtom(cmAtomName.constData()); + m_compositingActive = connection->getSelectionOwner(m_net_wm_cm_atom); } QXcbVirtualDesktop::~QXcbVirtualDesktop() @@ -79,6 +83,30 @@ QXcbXSettings *QXcbVirtualDesktop::xSettings() const return m_xSettings; } +bool QXcbVirtualDesktop::compositingActive() const +{ + if (connection()->hasXFixes()) + return m_compositingActive; + else + return connection()->getSelectionOwner(m_net_wm_cm_atom); +} + +void QXcbVirtualDesktop::handleXFixesSelectionNotify(xcb_xfixes_selection_notify_event_t *notify_event) +{ + if (notify_event->selection == m_net_wm_cm_atom) + m_compositingActive = notify_event->owner; +} + +void QXcbVirtualDesktop::subscribeToXFixesSelectionNotify() +{ + if (connection()->hasXFixes()) { + const uint32_t mask = XCB_XFIXES_SELECTION_EVENT_MASK_SET_SELECTION_OWNER | + XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_WINDOW_DESTROY | + XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_CLIENT_CLOSE; + Q_XCB_CALL(xcb_xfixes_select_selection_input_checked(xcb_connection(), connection()->getQtSelectionOwner(), m_net_wm_cm_atom, mask)); + } +} + QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDesktop, xcb_randr_output_t outputId, xcb_randr_get_output_info_reply_t *output, QString outputName) |