From ffe669137bdc00a5f13133d17ab5eea0787daf58 Mon Sep 17 00:00:00 2001 From: David Scholberg Date: Thu, 10 Nov 2022 21:28:37 -0500 Subject: [PATCH] Qt: fix inhibit screensaver on Linux (X11) This change fixes https://github.com/PCSX2/pcsx2/issues/7367. xdg-screensaver expects the given window ID to be that of the top level window. --- pcsx2/Frontend/CommonHost.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pcsx2/Frontend/CommonHost.cpp b/pcsx2/Frontend/CommonHost.cpp index 29ef9ebab8..7b76a473bb 100644 --- a/pcsx2/Frontend/CommonHost.cpp +++ b/pcsx2/Frontend/CommonHost.cpp @@ -430,8 +430,9 @@ void CommonHost::UpdateInhibitScreensaver(bool inhibit) return; WindowInfo wi; - if (g_host_display) - wi = g_host_display->GetWindowInfo(); + auto top_level_wi = Host::GetTopLevelWindowInfo(); + if (top_level_wi.has_value()) + wi = top_level_wi.value(); s_screensaver_inhibited = inhibit; if (!WindowInfo::InhibitScreensaver(wi, inhibit) && inhibit)