diff options
author | Alexander Volkov <a.volkov@rusbitech.ru> | 2015-10-27 15:08:41 +0300 |
---|---|---|
committer | Gatis Paeglis <gatis.paeglis@qt.io> | 2018-07-10 20:03:53 +0000 |
commit | 5cf6f51b4c73cb1309279aa42d828097b24aa119 (patch) | |
tree | c5ecc96c74ba59d62c623fc096abacaa11113aad /src/plugins/platforms/xcb/qxcbwindow.cpp | |
parent | d743df975db3403ec83d67bd376d8a6bfea3dfb0 (diff) |
xcb: Fix artifacts on the tray background with lock screens
With the current method of painting the tray icon with 24 bpp
visuals we grab the window's background once on the first show
and then use it in all paint operations. This leads to a wrong
background if an application shows the system tray icon when
the lock screen is active.
We can avoid this by painting with XRender when it's available.
This change introduces QXcbSystemTrayBackingStore and moves the
selection of a suitable painting method from QSystemTrayIconSys
into it. In addition the visual for the window is selected
according to the system tray specification and the platform window
for the tray icon is created without needless OpenGL and Vulkan
support.
Task-number: QTBUG-55540
Change-Id: Ib3ca42bc02dcbdd4ccfe5d6e23f870ef22f0d25a
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 | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index d866ae025f..33395bdfdb 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -299,6 +299,7 @@ void QXcbWindow::create() destroy(); m_windowState = Qt::WindowNoState; + m_trayIconWindow = window()->objectName() == QLatin1String("QSystemTrayIconSysWindow"); Qt::WindowType type = window()->type(); @@ -356,7 +357,9 @@ void QXcbWindow::create() const xcb_visualtype_t *visual = nullptr; - if (connection()->hasDefaultVisualId()) { + if (m_trayIconWindow && connection()->systemTrayTracker()) { + visual = platformScreen->visualForId(connection()->systemTrayTracker()->visualId()); + } else if (connection()->hasDefaultVisualId()) { visual = platformScreen->visualForId(connection()->defaultVisualId()); if (!visual) qWarning() << "Failed to use requested visual id."; @@ -2669,11 +2672,6 @@ void QXcbWindow::handleXEmbedMessage(const xcb_client_message_event_t *event) case XEMBED_EMBEDDED_NOTIFY: xcb_map_window(xcb_connection(), m_window); xcbScreen()->windowShown(this); - // Without Qt::WA_TranslucentBackground, we use a ParentRelative BackPixmap. - // Clear the whole tray icon window to its background color as early as possible - // so that we can get a clean result from grabWindow() later. - xcb_clear_area(xcb_connection(), false, m_window, 0, 0, geometry().width(), geometry().height()); - xcb_flush(xcb_connection()); break; case XEMBED_FOCUS_IN: Qt::FocusReason reason; |