diff --git a/src/duckstation-qt/qtutils.cpp b/src/duckstation-qt/qtutils.cpp index 339a9fe78..b1a609630 100644 --- a/src/duckstation-qt/qtutils.cpp +++ b/src/duckstation-qt/qtutils.cpp @@ -370,7 +370,17 @@ std::optional GetWindowInfoForWidget(QWidget* widget) wi.surface_scale = static_cast(dpr); // Query refresh rate, we need it for sync. - wi.surface_refresh_rate = WindowInfo::QueryRefreshRateForWindow(wi).value_or(0.0f); + std::optional surface_refresh_rate = WindowInfo::QueryRefreshRateForWindow(wi); + if (!surface_refresh_rate.has_value()) + { + // Fallback to using the screen, getting the rate for Wayland is an utter mess otherwise. + const QScreen* widget_screen = widget->screen(); + if (!widget_screen) + widget_screen = QGuiApplication::primaryScreen(); + surface_refresh_rate = widget_screen ? static_cast(widget_screen->refreshRate()) : 0.0f; + } + + wi.surface_refresh_rate = surface_refresh_rate.value(); INFO_LOG("Surface refresh rate: {} hz", wi.surface_refresh_rate); return wi;