From 15aa7d023688700a47997b92108de95f2d864f5a Mon Sep 17 00:00:00 2001 From: pablomartin4btc Date: Tue, 30 Jul 2024 17:24:36 -0300 Subject: [PATCH] gui, qt: brintToFront workaround for Wayland --- src/qt/guiutil.cpp | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index ee841ce626b..7d725be73cb 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -406,19 +406,26 @@ bool isObscured(QWidget *w) void bringToFront(QWidget* w) { -#ifdef Q_OS_MACOS - ForceActivation(); -#endif - if (w) { - // activateWindow() (sometimes) helps with keyboard focus on Windows - if (w->isMinimized()) { - w->showNormal(); - } else { + if (QGuiApplication::platformName() == "wayland") { + auto flags = w->windowFlags(); + w->setWindowFlags(flags|Qt::WindowStaysOnTopHint); + w->show(); + w->setWindowFlags(flags); w->show(); + } else { +#ifdef Q_OS_MACOS + ForceActivation(); +#endif + // activateWindow() (sometimes) helps with keyboard focus on Windows + if (w->isMinimized()) { + w->showNormal(); + } else { + w->show(); + } + w->activateWindow(); + w->raise(); } - w->activateWindow(); - w->raise(); } }