gui, qt: brintToFront workaround for Wayland

This commit is contained in:
pablomartin4btc 2024-07-30 17:24:36 -03:00
parent d367a4e36f
commit 15aa7d0236

View file

@ -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();
}
}