Fix regression where F11 doesn't change fullscreen menu bar option

This commit is contained in:
Crementif 2025-07-20 13:44:57 +02:00
parent 62bbebf836
commit 83dba9c708
2 changed files with 9 additions and 7 deletions

View File

@ -4,6 +4,7 @@
#include <config/ActiveSettings.h>
#include "input/InputManager.h"
#include "HotkeySettings.h"
#include "MainWindow.h"
#include <wx/clipbrd.h>
@ -113,9 +114,9 @@ std::optional<std::string> SaveScreenshot(std::vector<uint8> data, int width, in
extern WindowSystem::WindowInfo g_window_info;
const std::unordered_map<sHotkeyCfg*, std::function<void(void)>> 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<T, ControllerHotkey_t>)
}
else if constexpr (std::is_same_v<T, ControllerHotkey_t>)
{
inputButton->SetLabelText(To_wxString(cfgHotkey.controller));
}

View File

@ -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<sHotkeyCfg*, std::function<void(void)>> s_cfgHotkeyToFuncMap;
inline static std::unordered_map<uint16, std::function<void(void)>> s_keyboardHotkeyToFuncMap{};
inline static std::unordered_map<uint16, std::function<void(void)>> s_controllerHotkeyToFuncMap{};