From 83dba9c708c5516298ebb574a105d29552bddc33 Mon Sep 17 00:00:00 2001 From: Crementif <26669564+Crementif@users.noreply.github.com> Date: Sun, 20 Jul 2025 13:44:57 +0200 Subject: [PATCH] Fix regression where F11 doesn't change fullscreen menu bar option --- src/gui/wxgui/input/HotkeySettings.cpp | 12 +++++++----- src/gui/wxgui/input/HotkeySettings.h | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/gui/wxgui/input/HotkeySettings.cpp b/src/gui/wxgui/input/HotkeySettings.cpp index a31233d1..f900a195 100644 --- a/src/gui/wxgui/input/HotkeySettings.cpp +++ b/src/gui/wxgui/input/HotkeySettings.cpp @@ -4,6 +4,7 @@ #include #include "input/InputManager.h" #include "HotkeySettings.h" +#include "MainWindow.h" #include @@ -113,9 +114,9 @@ std::optional SaveScreenshot(std::vector data, int width, in extern WindowSystem::WindowInfo g_window_info; const std::unordered_map> HotkeySettings::s_cfgHotkeyToFuncMap{ - {&s_cfgHotkeys.toggleFullscreen, [](void) { s_mainWindow->ShowFullScreen(!s_mainWindow->IsFullScreen()); }}, - {&s_cfgHotkeys.toggleFullscreenAlt, [](void) { s_mainWindow->ShowFullScreen(!s_mainWindow->IsFullScreen()); }}, - {&s_cfgHotkeys.exitFullscreen, [](void) { s_mainWindow->ShowFullScreen(false); }}, + {&s_cfgHotkeys.toggleFullscreen, [](void) { s_mainWindow->SetFullScreen(!s_mainWindow->IsFullScreen()); }}, + {&s_cfgHotkeys.toggleFullscreenAlt, [](void) { s_mainWindow->SetFullScreen(!s_mainWindow->IsFullScreen()); }}, + {&s_cfgHotkeys.exitFullscreen, [](void) { s_mainWindow->SetFullScreen(false); }}, {&s_cfgHotkeys.takeScreenshot, [](void) { if(g_renderer) g_renderer->RequestScreenshot(SaveScreenshot); }}, {&s_cfgHotkeys.toggleFastForward, [](void) { ActiveSettings::SetTimerShiftFactor((ActiveSettings::GetTimerShiftFactor() < 3) ? 3 : 1); }}, }; @@ -177,7 +178,7 @@ HotkeySettings::~HotkeySettings() } } -void HotkeySettings::Init(wxFrame* mainWindowFrame) +void HotkeySettings::Init(MainWindow* mainWindowFrame) { s_keyboardHotkeyToFuncMap.reserve(s_cfgHotkeyToFuncMap.size()); for (const auto& [cfgHotkey, func] : s_cfgHotkeyToFuncMap) @@ -397,7 +398,8 @@ void HotkeySettings::FinalizeInput(wxButton* inputButton) { inputButton->Unbind(wxEVT_KEY_UP, &HotkeySettings::OnKeyUp, this); inputButton->SetLabelText(To_wxString(cfgHotkey.keyboard)); - } else if constexpr (std::is_same_v) + } + else if constexpr (std::is_same_v) { inputButton->SetLabelText(To_wxString(cfgHotkey.controller)); } diff --git a/src/gui/wxgui/input/HotkeySettings.h b/src/gui/wxgui/input/HotkeySettings.h index c9395b5a..8bb1e859 100644 --- a/src/gui/wxgui/input/HotkeySettings.h +++ b/src/gui/wxgui/input/HotkeySettings.h @@ -9,7 +9,7 @@ class HotkeyEntry; class HotkeySettings : public wxFrame { public: - static void Init(wxFrame* mainWindowFrame); + static void Init(class MainWindow* mainWindow); static void CaptureInput(wxKeyEvent& event); static void CaptureInput(const ControllerState& currentState, const ControllerState& lastState); @@ -18,7 +18,7 @@ public: ~HotkeySettings(); private: - inline static wxFrame* s_mainWindow = nullptr; + inline static class MainWindow* s_mainWindow = nullptr; static const std::unordered_map> s_cfgHotkeyToFuncMap; inline static std::unordered_map> s_keyboardHotkeyToFuncMap{}; inline static std::unordered_map> s_controllerHotkeyToFuncMap{};