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/qxcbwindow.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/qxcbwindow.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 38 |
1 files changed, 7 insertions, 31 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 33395bdfdb..316adb8fa9 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -558,6 +558,9 @@ void QXcbWindow::create() QByteArray wmWindowRole = window()->property(wm_window_role_property_id).toByteArray(); setWmWindowRole(wmWindowRole); } + + if (m_trayIconWindow) + m_embedded = requestSystemTrayWindowDock(); } QXcbWindow::~QXcbWindow() @@ -792,7 +795,7 @@ void QXcbWindow::show() else if (connection()->time() != XCB_TIME_CURRENT_TIME) updateNetWmUserTime(connection()->time()); - if (window()->objectName() == QLatin1String("QSystemTrayIconSysWindow")) + if (m_trayIconWindow) return; // defer showing until XEMBED_EMBEDDED_NOTIFY xcb_map_window(xcb_connection(), m_window); @@ -1793,12 +1796,6 @@ void QXcbWindow::setWmWindowRole(const QByteArray &role) role.size(), role.constData()); } -void QXcbWindow::setParentRelativeBackPixmapStatic(QWindow *window) -{ - if (window->handle()) - static_cast<QXcbWindow *>(window->handle())->setParentRelativeBackPixmap(); -} - void QXcbWindow::setParentRelativeBackPixmap() { const quint32 mask = XCB_CW_BACK_PIXMAP; @@ -1806,14 +1803,7 @@ void QXcbWindow::setParentRelativeBackPixmap() xcb_change_window_attributes(xcb_connection(), m_window, mask, values); } -bool QXcbWindow::requestSystemTrayWindowDockStatic(const QWindow *window) -{ - if (window->handle()) - return static_cast<QXcbWindow *>(window->handle())->requestSystemTrayWindowDock(); - return false; -} - -bool QXcbWindow::requestSystemTrayWindowDock() const +bool QXcbWindow::requestSystemTrayWindowDock() { if (!connection()->systemTrayTracker()) return false; @@ -1821,20 +1811,6 @@ bool QXcbWindow::requestSystemTrayWindowDock() const return true; } -QRect QXcbWindow::systemTrayWindowGlobalGeometryStatic(const QWindow *window) -{ - if (window->handle()) - return static_cast<QXcbWindow *>(window->handle())->systemTrayWindowGlobalGeometry(); - return QRect(); -} - -QRect QXcbWindow::systemTrayWindowGlobalGeometry() const -{ - if (!connection()->systemTrayTracker()) - return QRect(); - return connection()->systemTrayTracker()->systemTrayWindowGlobalGeometry(m_window); -} - class ExposeCompressor { public: @@ -2094,7 +2070,7 @@ void QXcbWindow::handleButtonPressEvent(int event_x, int event_y, int root_x, in updateNetWmUserTime(timestamp); - if (m_embedded) { + if (m_embedded && !m_trayIconWindow) { if (window() != QGuiApplication::focusWindow()) { const QXcbWindow *container = static_cast<const QXcbWindow *>(parent()); Q_ASSERT(container != 0); @@ -2554,7 +2530,7 @@ bool QXcbWindow::windowEvent(QEvent *event) { switch (event->type()) { case QEvent::FocusIn: - if (m_embedded && !event->spontaneous()) { + if (m_embedded && !m_trayIconWindow && !event->spontaneous()) { QFocusEvent *focusEvent = static_cast<QFocusEvent *>(event); switch (focusEvent->reason()) { case Qt::TabFocusReason: |