UI: Implement hotkey for "Exit application" (#1756)

This commit is contained in:
kevinmmccormick 2025-12-26 14:38:50 -08:00 committed by GitHub
parent d86dc5e5f5
commit 07371327f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 1 deletions

View File

@ -161,6 +161,7 @@ HotkeySettings::HotkeySettings(wxWindow* parent)
#ifdef CEMU_DEBUG_ASSERT #ifdef CEMU_DEBUG_ASSERT
CreateHotkeyRow(_tr("End emulation"), s_cfgHotkeys.endEmulation); CreateHotkeyRow(_tr("End emulation"), s_cfgHotkeys.endEmulation);
#endif #endif
CreateHotkeyRow(_tr("Exit application"), s_cfgHotkeys.exitApplication);
m_controllerTimer = new wxTimer(this); m_controllerTimer = new wxTimer(this);
Bind(wxEVT_TIMER, &HotkeySettings::OnControllerTimer, this); Bind(wxEVT_TIMER, &HotkeySettings::OnControllerTimer, this);
@ -196,6 +197,9 @@ void HotkeySettings::Init(MainWindow* mainWindowFrame)
{&s_cfgHotkeys.toggleFastForward, [](void) { {&s_cfgHotkeys.toggleFastForward, [](void) {
ActiveSettings::SetTimerShiftFactor((ActiveSettings::GetTimerShiftFactor() < 3) ? 3 : 1); ActiveSettings::SetTimerShiftFactor((ActiveSettings::GetTimerShiftFactor() < 3) ? 3 : 1);
}}, }},
{&s_cfgHotkeys.exitApplication, [](void) {
s_mainWindow->Close(true);
}},
#ifdef CEMU_DEBUG_ASSERT #ifdef CEMU_DEBUG_ASSERT
{&s_cfgHotkeys.endEmulation, [](void) { {&s_cfgHotkeys.endEmulation, [](void) {
wxTheApp->CallAfter([]() { wxTheApp->CallAfter([]() {

View File

@ -115,6 +115,7 @@ void wxCemuConfig::Load(XMLConfigParser& parser)
hotkeys.toggleFullscreenAlt = xml_hotkeys.get("ToggleFullscreenAlt", sHotkeyCfg{uKeyboardHotkey{WXK_CONTROL_M, true}}); // ALT+ENTER hotkeys.toggleFullscreenAlt = xml_hotkeys.get("ToggleFullscreenAlt", sHotkeyCfg{uKeyboardHotkey{WXK_CONTROL_M, true}}); // ALT+ENTER
hotkeys.takeScreenshot = xml_hotkeys.get("TakeScreenshot", sHotkeyCfg{uKeyboardHotkey{WXK_F12}}); hotkeys.takeScreenshot = xml_hotkeys.get("TakeScreenshot", sHotkeyCfg{uKeyboardHotkey{WXK_F12}});
hotkeys.toggleFastForward = xml_hotkeys.get("ToggleFastForward", sHotkeyCfg{}); hotkeys.toggleFastForward = xml_hotkeys.get("ToggleFastForward", sHotkeyCfg{});
hotkeys.exitApplication = xml_hotkeys.get("ExitApplication", sHotkeyCfg{});
#ifdef CEMU_DEBUG_ASSERT #ifdef CEMU_DEBUG_ASSERT
hotkeys.endEmulation = xml_hotkeys.get("EndEmulation", sHotkeyCfg{uKeyboardHotkey{WXK_F5}}); hotkeys.endEmulation = xml_hotkeys.get("EndEmulation", sHotkeyCfg{uKeyboardHotkey{WXK_F5}});
#endif #endif
@ -185,4 +186,5 @@ void wxCemuConfig::Save(XMLConfigParser& config)
xml_hotkeys.set("ToggleFullscreenAlt", hotkeys.toggleFullscreenAlt); xml_hotkeys.set("ToggleFullscreenAlt", hotkeys.toggleFullscreenAlt);
xml_hotkeys.set("TakeScreenshot", hotkeys.takeScreenshot); xml_hotkeys.set("TakeScreenshot", hotkeys.takeScreenshot);
xml_hotkeys.set("ToggleFastForward", hotkeys.toggleFastForward); xml_hotkeys.set("ToggleFastForward", hotkeys.toggleFastForward);
xml_hotkeys.set("ExitApplication", hotkeys.exitApplication);
} }

View File

@ -127,6 +127,7 @@ struct wxCemuConfig
sHotkeyCfg exitFullscreen; sHotkeyCfg exitFullscreen;
sHotkeyCfg takeScreenshot; sHotkeyCfg takeScreenshot;
sHotkeyCfg toggleFastForward; sHotkeyCfg toggleFastForward;
sHotkeyCfg exitApplication;
#ifdef CEMU_DEBUG_ASSERT #ifdef CEMU_DEBUG_ASSERT
sHotkeyCfg endEmulation; sHotkeyCfg endEmulation;
#endif #endif
@ -151,4 +152,4 @@ inline XMLWxCemuConfig_t& GetWxGuiConfigHandle()
inline wxCemuConfig& GetWxGUIConfig() inline wxCemuConfig& GetWxGUIConfig()
{ {
return GetWxGuiConfigHandle().Data(); return GetWxGuiConfigHandle().Data();
} }