diff options
author | Alexander Volkov <a.volkov@rusbitech.ru> | 2015-10-30 18:15:18 +0300 |
---|---|---|
committer | Gatis Paeglis <gatis.paeglis@qt.io> | 2018-07-10 20:04:09 +0000 |
commit | 556221d97b6c4ca387ca5535ef8f0a2b0f5b7644 (patch) | |
tree | 8eb0a37a1f3f8abb85af30a508aa3ae487436135 /src/plugins/platforms/xcb/qxcbsystemtraytracker.cpp | |
parent | 5cf6f51b4c73cb1309279aa42d828097b24aa119 (diff) |
QSystemTrayIcon/X11: Move platform-specific calls to the xcb plugin
- Detect the tray icon window in the platform plugin by the object
name. This way we don't need
QXcbWindowFunctions::requestSystemTrayWindowDockIdentifier().
- Get rid of unused calls
QXcbIntegrationFunctions::xEmbedSystemTrayVisualHasAlphaChannel()
and QXcbWindowFunctions::setParentRelativeBackPixmap().
- Mark the tray icon window as embedded to be able to get the correct
result from QWindow::mapToGlobal(). It allows to drop
QXcbWindowFunctions::systemTrayWindowGlobalGeometry().
This change allows to remove the intermediate level between
the QSystemTrayIconSys widget and the xcb plugin. The code looks
clearer.
Change-Id: I7d067131287a6dec162b36f0bddc8cb518aaa38c
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbsystemtraytracker.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbsystemtraytracker.cpp | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/src/plugins/platforms/xcb/qxcbsystemtraytracker.cpp b/src/plugins/platforms/xcb/qxcbsystemtraytracker.cpp index 8b9c67e98a..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()) @@ -170,16 +152,6 @@ xcb_visualid_t QXcbSystemTrayTracker::visualId() return visual; } -bool QXcbSystemTrayTracker::visualHasAlphaChannel() -{ - const xcb_visualid_t systrayVisualId = netSystemTrayVisual(); - if (systrayVisualId != XCB_NONE) { - quint8 depth = m_connection->primaryScreen()->depthOfVisual(systrayVisualId); - return depth == 32; - } - return false; -} - xcb_visualid_t QXcbSystemTrayTracker::netSystemTrayVisual() { if (m_trayWindow == XCB_WINDOW_NONE) |