From 5016615e334c56458ad28d66e227094e3b224901 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 27 Jun 2013 12:21:21 +0200 Subject: Fix system tray icon on X11. Observe Qt::BypassWindowManagerHint in XCB and use it for the tray. Remove the call to XSync(), which sometimes was causing the window to appear in the wrong place for a short time. Task-number: QTBUG-31762 Change-Id: I7b4fc5e42b8c8bb9d03b1575be99d6d1c727be37 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbwindow.cpp | 2 +- src/widgets/util/qsystemtrayicon_x11.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index b9a2b0d37b..3a19788316 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -239,7 +239,7 @@ void QXcbWindow::create() // XCB_CW_BACK_PIXMAP XCB_NONE, // XCB_CW_OVERRIDE_REDIRECT - type == Qt::Popup || type == Qt::ToolTip, + type == Qt::Popup || type == Qt::ToolTip || (window()->flags() & Qt::BypassWindowManagerHint), // XCB_CW_SAVE_UNDER type == Qt::Popup || type == Qt::Tool || type == Qt::SplashScreen || type == Qt::ToolTip || type == Qt::Drawer, // XCB_CW_EVENT_MASK diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp index e04656974d..5204b85a9a 100644 --- a/src/widgets/util/qsystemtrayicon_x11.cpp +++ b/src/widgets/util/qsystemtrayicon_x11.cpp @@ -153,16 +153,17 @@ private: QSystemTrayIcon *q; }; -QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *qIn) : - q(qIn) +QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *qIn) + : QWidget(0, Qt::Window | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint) + , q(qIn) { + setObjectName(QStringLiteral("QSystemTrayIconSys")); setToolTip(q->toolTip()); QX11SystemTrayContext *context = qX11SystemTrayContext(); Q_ASSERT(context->isValid()); setAttribute(Qt::WA_AlwaysShowToolTips, true); setAttribute(Qt::WA_TranslucentBackground, true); setAttribute(Qt::WA_QuitOnClose, false); - setWindowFlags(Qt::Window | Qt::FramelessWindowHint); const QSize size(22, 22); // Gnome, standard size setGeometry(QRect(QPoint(0, 0), size)); setMinimumSize(size); @@ -182,7 +183,6 @@ QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *qIn) : ev.xclient.format = 32; memcpy((char *)&ev.xclient.data, (const char *) l, sizeof(l)); XSendEvent(display, ev.xclient.window, False, 0, &ev); - XSync(display, False); show(); } -- cgit v1.2.3