From 3d3b6940404f9fb4cdc6cd3553225d84b84f43e4 Mon Sep 17 00:00:00 2001 From: tytan652 <17492366+tytan652@users.noreply.github.com> Date: Thu, 24 Mar 2022 19:43:39 +0100 Subject: [PATCH] Avoid calling XCB functions under non-XCB Linux platform (#405) --- src/DockManager.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/DockManager.cpp b/src/DockManager.cpp index 4b9b6c9..1e43037 100644 --- a/src/DockManager.cpp +++ b/src/DockManager.cpp @@ -547,9 +547,16 @@ bool CDockManager::eventFilter(QObject *obj, QEvent *e) // 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). // So we just do it ourself. - internal::xcb_update_prop(true, _window->window()->winId(), - "_NET_WM_STATE", "_NET_WM_STATE_ABOVE", "_NET_WM_STATE_STAYS_ON_TOP"); - } + if(QGuiApplication::platformName() == QLatin1String("xcb")) + { + internal::xcb_update_prop(true, _window->window()->winId(), + "_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) { @@ -559,8 +566,16 @@ bool CDockManager::eventFilter(QObject *obj, QEvent *e) { continue; } - internal::xcb_update_prop(false, _window->window()->winId(), - "_NET_WM_STATE", "_NET_WM_STATE_ABOVE", "_NET_WM_STATE_STAYS_ON_TOP"); + + if(QGuiApplication::platformName() == QLatin1String("xcb")) + { + internal::xcb_update_prop(false, _window->window()->winId(), + "_NET_WM_STATE", "_NET_WM_STATE_ABOVE", "_NET_WM_STATE_STAYS_ON_TOP"); + } + else + { + _window->setWindowFlag(Qt::WindowStaysOnTopHint, false); + } _window->raise(); } }