diff options
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbsystemtraytracker.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbsystemtraytracker.cpp | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/src/plugins/platforms/xcb/qxcbsystemtraytracker.cpp b/src/plugins/platforms/xcb/qxcbsystemtraytracker.cpp index c98879c7df..684e603fab 100644 --- a/src/plugins/platforms/xcb/qxcbsystemtraytracker.cpp +++ b/src/plugins/platforms/xcb/qxcbsystemtraytracker.cpp @@ -91,8 +91,7 @@ xcb_window_t QXcbSystemTrayTracker::locateTrayWindow(const QXcbConnection *conne return reply->owner; } -// API for QPlatformNativeInterface/QPlatformSystemTrayIcon: Request a window -// to be docked on the tray. +// Request a window to be docked on the tray. void QXcbSystemTrayTracker::requestSystemTrayWindowDock(xcb_window_t window) const { xcb_client_message_event_t trayRequest; @@ -122,23 +121,6 @@ xcb_window_t QXcbSystemTrayTracker::trayWindow() return m_trayWindow; } -// API for QPlatformNativeInterface/QPlatformSystemTrayIcon: Return the geometry of a -// a window parented on the tray. Determines the global geometry via XCB since mapToGlobal -// does not work for the QWindow parented on the tray. -QRect QXcbSystemTrayTracker::systemTrayWindowGlobalGeometry(xcb_window_t window) const -{ - xcb_connection_t *conn = m_connection->xcb_connection(); - auto geomReply = Q_XCB_REPLY(xcb_get_geometry, conn, window); - if (!geomReply) - return QRect(); - - auto translateReply = Q_XCB_REPLY(xcb_translate_coordinates, conn, window, m_connection->rootWindow(), 0, 0); - if (!translateReply) - return QRect(); - - return QRect(QPoint(translateReply->dst_x, translateReply->dst_y), QSize(geomReply->width, geomReply->height)); -} - inline void QXcbSystemTrayTracker::emitSystemTrayWindowChanged() { if (const QPlatformScreen *ps = m_connection->primaryScreen()) @@ -162,10 +144,18 @@ void QXcbSystemTrayTracker::handleDestroyNotifyEvent(const xcb_destroy_notify_ev } } -bool QXcbSystemTrayTracker::visualHasAlphaChannel() +xcb_visualid_t QXcbSystemTrayTracker::visualId() +{ + xcb_visualid_t visual = netSystemTrayVisual(); + if (visual == XCB_NONE) + visual = m_connection->primaryScreen()->screen()->root_visual; + return visual; +} + +xcb_visualid_t QXcbSystemTrayTracker::netSystemTrayVisual() { if (m_trayWindow == XCB_WINDOW_NONE) - return false; + return XCB_NONE; xcb_atom_t tray_atom = m_connection->atom(QXcbAtom::_NET_SYSTEM_TRAY_VISUAL); @@ -174,7 +164,7 @@ bool QXcbSystemTrayTracker::visualHasAlphaChannel() false, m_trayWindow, tray_atom, XCB_ATOM_VISUALID, 0, 1); if (!systray_atom_reply) - return false; + return XCB_NONE; xcb_visualid_t systrayVisualId = XCB_NONE; if (systray_atom_reply->value_len > 0 && xcb_get_property_value_length(systray_atom_reply.get()) > 0) { @@ -182,12 +172,7 @@ bool QXcbSystemTrayTracker::visualHasAlphaChannel() systrayVisualId = vids[0]; } - if (systrayVisualId != XCB_NONE) { - quint8 depth = m_connection->primaryScreen()->depthOfVisual(systrayVisualId); - return depth == 32; - } - - return false; + return systrayVisualId; } QT_END_NAMESPACE |