Skip to content

Commit 15aa7d0

Browse files
gui, qt: brintToFront workaround for Wayland
1 parent d367a4e commit 15aa7d0

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

src/qt/guiutil.cpp

+17-10
Original file line numberDiff line numberDiff line change
@@ -406,19 +406,26 @@ bool isObscured(QWidget *w)
406406

407407
void bringToFront(QWidget* w)
408408
{
409-
#ifdef Q_OS_MACOS
410-
ForceActivation();
411-
#endif
412-
413409
if (w) {
414-
// activateWindow() (sometimes) helps with keyboard focus on Windows
415-
if (w->isMinimized()) {
416-
w->showNormal();
417-
} else {
410+
if (QGuiApplication::platformName() == "wayland") {
411+
auto flags = w->windowFlags();
412+
w->setWindowFlags(flags|Qt::WindowStaysOnTopHint);
413+
w->show();
414+
w->setWindowFlags(flags);
418415
w->show();
416+
} else {
417+
#ifdef Q_OS_MACOS
418+
ForceActivation();
419+
#endif
420+
// activateWindow() (sometimes) helps with keyboard focus on Windows
421+
if (w->isMinimized()) {
422+
w->showNormal();
423+
} else {
424+
w->show();
425+
}
426+
w->activateWindow();
427+
w->raise();
419428
}
420-
w->activateWindow();
421-
w->raise();
422429
}
423430
}
424431

0 commit comments

Comments
 (0)