Qt: fix saved gs_frame visibility
Some checks failed
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux-aarch64.sh, gcc, rpcs3/rpcs3-ci-jammy-aarch64:1.6, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.6, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1, rpcs3/rpcs3-binaries-linux-arm64, /rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.6, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (d812f1254a1157c80fd402f94446310560f54e5f, rpcs3/rpcs3-binaries-linux, /rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.6, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (51ae32f468089a8169aaf1567de355ff4a3e0842, rpcs3/rpcs3-binaries-mac, arch -X86_64 .ci/build-mac.sh, Intel) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (8e21bdbc40711a3fccd18fbf17b742348b0f4281, rpcs3/rpcs3-binaries-mac-arm64, .ci/build-mac-arm64.sh, Apple Silicon) (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang (win64, clang, clang64) (push) Waiting to run
Build RPCS3 / RPCS3 FreeBSD (push) Waiting to run
Generate Translation Template / Generate Translation Template (push) Has been cancelled

This commit is contained in:
Megamouse 2025-09-01 20:44:36 +02:00
parent 6d1a85b947
commit c7de9053b4
2 changed files with 12 additions and 7 deletions

View file

@ -122,8 +122,12 @@ gs_frame::gs_frame(QScreen* screen, const QRect& geometry, const QIcon& appIcon,
load_gui_settings(); load_gui_settings();
// Change cursor when in fullscreen. // Change cursor when in fullscreen.
connect(this, &QWindow::visibilityChanged, this, [this](QWindow::Visibility visibility) connect(this, &QWindow::visibilityChanged, this, [this](Visibility visibility)
{ {
if (visibility != Visibility::Minimized && visibility != Visibility::Hidden)
{
m_visibility = visibility; // Only save "visible" visibility
}
handle_cursor(visibility, true, false, true); handle_cursor(visibility, true, false, true);
}); });
@ -567,7 +571,7 @@ void gs_frame::update_cursor()
// Hide the mouse if the idle timeout was reached (which means that the timer isn't running) // Hide the mouse if the idle timeout was reached (which means that the timer isn't running)
show_mouse = false; show_mouse = false;
} }
else if (visibility() == QWindow::Visibility::FullScreen) else if (visibility() == Visibility::FullScreen)
{ {
// Fullscreen: Show or hide the mouse depending on the settings. // Fullscreen: Show or hide the mouse depending on the settings.
show_mouse = m_show_mouse_in_fullscreen; show_mouse = m_show_mouse_in_fullscreen;
@ -596,7 +600,7 @@ void gs_frame::hide_on_close()
{ {
// Make sure not to save the hidden state, which is useless to us. // Make sure not to save the hidden state, which is useless to us.
const Visibility current_visibility = visibility(); const Visibility current_visibility = visibility();
m_gui_settings->SetValue(gui::gs_visibility, current_visibility == Visibility::Hidden ? Visibility::AutomaticVisibility : current_visibility, false); m_gui_settings->SetValue(gui::gs_visibility, current_visibility == Visibility::Hidden ? m_visibility : current_visibility, false);
m_gui_settings->SetValue(gui::gs_geometry, geometry(), true); m_gui_settings->SetValue(gui::gs_geometry, geometry(), true);
if (!g_progr_text) if (!g_progr_text)
@ -1096,7 +1100,7 @@ void gs_frame::mouseDoubleClickEvent(QMouseEvent* ev)
} }
} }
void gs_frame::handle_cursor(QWindow::Visibility visibility, bool visibility_changed, bool active_changed, bool start_idle_timer) void gs_frame::handle_cursor(Visibility visibility, bool visibility_changed, bool active_changed, bool start_idle_timer)
{ {
// Let's reload the gui settings when the visibility or the active window changes. // Let's reload the gui settings when the visibility or the active window changes.
if (visibility_changed || active_changed) if (visibility_changed || active_changed)
@ -1107,7 +1111,7 @@ void gs_frame::handle_cursor(QWindow::Visibility visibility, bool visibility_cha
if (visibility_changed) if (visibility_changed)
{ {
// In fullscreen we default to hiding and locking. In windowed mode we do not want the lock by default. // In fullscreen we default to hiding and locking. In windowed mode we do not want the lock by default.
m_mouse_hide_and_lock = (visibility == QWindow::Visibility::FullScreen) && m_lock_mouse_in_fullscreen; m_mouse_hide_and_lock = (visibility == Visibility::FullScreen) && m_lock_mouse_in_fullscreen;
} }
} }

View file

@ -34,7 +34,8 @@ private:
u64 m_frames = 0; u64 m_frames = 0;
std::string m_window_title; std::string m_window_title;
QWindow::Visibility m_last_visibility = Visibility::Windowed; Visibility m_last_visibility = Visibility::Windowed;
Visibility m_visibility = Visibility::Windowed;
atomic_t<bool> m_is_closing = false; atomic_t<bool> m_is_closing = false;
atomic_t<bool> m_show_mouse = true; atomic_t<bool> m_show_mouse = true;
bool m_disable_mouse = false; bool m_disable_mouse = false;
@ -111,7 +112,7 @@ private:
void toggle_recording(); void toggle_recording();
void toggle_mouselock(); void toggle_mouselock();
void update_cursor(); void update_cursor();
void handle_cursor(QWindow::Visibility visibility, bool visibility_changed, bool active_changed, bool start_idle_timer); void handle_cursor(Visibility visibility, bool visibility_changed, bool active_changed, bool start_idle_timer);
private Q_SLOTS: private Q_SLOTS:
void mouse_hide_timeout(); void mouse_hide_timeout();