From 2610bb11cd8b722c831cea8c6fcfaa0b8c10b511 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Wed, 23 Nov 2022 20:14:31 +1000 Subject: [PATCH] Qt: Work around popups opened behind window in Wayland --- src/duckstation-qt/mainwindow.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index ebf44ab1e..770aece71 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -2747,8 +2747,17 @@ MainWindow::SystemLock MainWindow::pauseAndLockSystem() if (was_fullscreen) g_emu_thread->setSurfaceless(true); if (!was_paused) + { g_emu_thread->setSystemPaused(true); + // Need to wait for the pause to go through, and make the main window visible if needed. + while (!s_system_paused) + QApplication::processEvents(QEventLoop::ExcludeUserInputEvents, 1); + + // Ensure it's visible before we try to create any dialogs parented to us. + QApplication::sync(); + } + // We want to parent dialogs to the display widget, except if we were fullscreen, // since it's going to get destroyed by the surfaceless call above. QWidget* dialog_parent = was_fullscreen ? static_cast(this) : getDisplayContainer();