summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2015-02-11 12:14:13 +0100
committerShawn Rutledge <shawn.rutledge@digia.com>2015-02-12 13:24:33 +0000
commit98aae7428d86155a596c4318643752477d7726ad (patch)
treed14361b023bf75bfb601b50e7f95fe3ad0a2a50b /src/plugins
parent69d46a3e205e3533c8bdcf1a1f4e5ce92604759d (diff)
xcb: QSystemTrayIcon: grab background pixmap for compositing only once
Followup to 2203d9d93e24e00d6e9bc9bda0e65a0c7f9923cc: clearRegion takes a little time, so doing grabWindow() too soon afterwards can result in grabbing a pixmap with undesired leftovers. And doing it every time we render the icon causes flicker. So, do clearRegion() ASAP when showing the icon, wait for it to happen, then grabWindow() only the first time we render, and reuse the resulting pixmap for all future calls to paintEvent(). (The downside is, if there is any corruption during the first grabWindow(), it's going to stay there as long as the app is running.) Task-number: QTBUG-35658 Change-Id: If881ab192dba43758dcbb0d080663ff42057fa4f Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp10
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.h1
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp5
3 files changed, 5 insertions, 11 deletions
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index 7d950f8dee..14f5cd0747 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -191,16 +191,6 @@ bool QXcbNativeInterface::systrayVisualHasAlphaChannel() {
}
}
-void QXcbNativeInterface::clearRegion(const QWindow *qwindow, const QRect& rect)
-{
- if (const QPlatformWindow *platformWindow = qwindow->handle()) {
- const QXcbWindow *qxwindow = static_cast<const QXcbWindow *>(platformWindow);
- xcb_connection_t *xcb_conn = qxwindow->xcb_connection();
-
- xcb_clear_area(xcb_conn, false, qxwindow->xcb_window(), rect.x(), rect.y(), rect.width(), rect.height());
- }
-}
-
void QXcbNativeInterface::setParentRelativeBackPixmap(const QWindow *qwindow)
{
if (const QPlatformWindow *platformWindow = qwindow->handle()) {
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h
index 742984ae36..388d774853 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.h
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h
@@ -104,7 +104,6 @@ public:
Q_INVOKABLE void beep();
Q_INVOKABLE bool systemTrayAvailable(const QScreen *screen) const;
- Q_INVOKABLE void clearRegion(const QWindow *qwindow, const QRect& rect);
Q_INVOKABLE void setParentRelativeBackPixmap(const QWindow *window);
Q_INVOKABLE bool systrayVisualHasAlphaChannel();
Q_INVOKABLE bool requestSystemTrayWindowDock(const QWindow *window);
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 9298e874b8..34289fb90e 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -2307,6 +2307,11 @@ void QXcbWindow::handleXEmbedMessage(const xcb_client_message_event_t *event)
case XEMBED_EMBEDDED_NOTIFY:
Q_XCB_CALL(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.
+ Q_XCB_CALL(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;