Avoid calling XCB functions under non-XCB Linux platform (#405)

This commit is contained in:
tytan652 2022-03-24 19:43:39 +01:00 committed by GitHub
parent ad06241c9d
commit 3d3b694040
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -547,9 +547,16 @@ bool CDockManager::eventFilter(QObject *obj, QEvent *e)
// setWindowFlags(Qt::WindowStaysOnTopHint) will hide the window and thus requires a show call. // setWindowFlags(Qt::WindowStaysOnTopHint) will hide the window and thus requires a show call.
// This then leads to flickering and a nasty endless loop (also buggy behaviour on Ubuntu). // This then leads to flickering and a nasty endless loop (also buggy behaviour on Ubuntu).
// So we just do it ourself. // So we just do it ourself.
if(QGuiApplication::platformName() == QLatin1String("xcb"))
{
internal::xcb_update_prop(true, _window->window()->winId(), internal::xcb_update_prop(true, _window->window()->winId(),
"_NET_WM_STATE", "_NET_WM_STATE_ABOVE", "_NET_WM_STATE_STAYS_ON_TOP"); "_NET_WM_STATE", "_NET_WM_STATE_ABOVE", "_NET_WM_STATE_STAYS_ON_TOP");
} }
else
{
_window->setWindowFlag(Qt::WindowStaysOnTopHint, true);
}
}
} }
else if (e->type() == QEvent::WindowDeactivate) else if (e->type() == QEvent::WindowDeactivate)
{ {
@ -559,8 +566,16 @@ bool CDockManager::eventFilter(QObject *obj, QEvent *e)
{ {
continue; continue;
} }
if(QGuiApplication::platformName() == QLatin1String("xcb"))
{
internal::xcb_update_prop(false, _window->window()->winId(), internal::xcb_update_prop(false, _window->window()->winId(),
"_NET_WM_STATE", "_NET_WM_STATE_ABOVE", "_NET_WM_STATE_STAYS_ON_TOP"); "_NET_WM_STATE", "_NET_WM_STATE_ABOVE", "_NET_WM_STATE_STAYS_ON_TOP");
}
else
{
_window->setWindowFlag(Qt::WindowStaysOnTopHint, false);
}
_window->raise(); _window->raise();
} }
} }