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 <shawn.rutledge@digia.com>
This commit is contained in:
parent
d1a6de21c3
commit
5016615e33
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user