From 737b0dfd424c90d9d65409222a30f3283932c552 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Wed, 21 Jul 2021 01:57:24 +0200 Subject: [PATCH] Qt: use last window state when leaving fullscreen --- rpcs3/rpcs3qt/gs_frame.cpp | 10 +++++++++- rpcs3/rpcs3qt/gs_frame.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/rpcs3/rpcs3qt/gs_frame.cpp b/rpcs3/rpcs3qt/gs_frame.cpp index 3601a14274..c3f6ac6d61 100644 --- a/rpcs3/rpcs3qt/gs_frame.cpp +++ b/rpcs3/rpcs3qt/gs_frame.cpp @@ -262,10 +262,18 @@ void gs_frame::toggle_fullscreen() { if (visibility() == FullScreen) { - setVisibility(Windowed); + // Change to the last recorded visibility. Sanitize it just in case. + if (m_last_visibility != Visibility::Maximized && m_last_visibility != Visibility::Windowed) + { + m_last_visibility = Visibility::Windowed; + } + setVisibility(m_last_visibility); } else { + // Backup visibility for exiting fullscreen mode later. Don't do this in the visibilityChanged slot, + // since entering fullscreen from maximized will first change the visibility to windowed. + m_last_visibility = visibility(); setVisibility(FullScreen); } }); diff --git a/rpcs3/rpcs3qt/gs_frame.h b/rpcs3/rpcs3qt/gs_frame.h index c42d35f9c4..fbdf755b87 100644 --- a/rpcs3/rpcs3qt/gs_frame.h +++ b/rpcs3/rpcs3qt/gs_frame.h @@ -40,6 +40,7 @@ private: u64 m_frames = 0; std::string m_window_title; + QWindow::Visibility m_last_visibility = Visibility::Windowed; atomic_t m_show_mouse = true; bool m_disable_mouse = false; bool m_disable_kb_hotkeys = false;