Merge pull request #18056 from fp64/sdl-ctrl-w

Implement Ctrl-W and Ctrl-B on SDL
This commit is contained in:
Henrik Rydgård 2023-09-03 12:01:29 +02:00 committed by GitHub
commit 42741430bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 1 deletions

View file

@ -863,6 +863,28 @@ static void ProcessSDLEvent(SDL_Window *window, const SDL_Event &event, InputSta
g_rebootEmuThread = true; g_rebootEmuThread = true;
} }
#endif #endif
// Convenience subset of what
// "Enable standard shortcut keys"
// does on Windows.
if(g_Config.bSystemControls) {
bool ctrl = bool(event.key.keysym.mod & KMOD_CTRL);
if (ctrl && (k == SDLK_w))
{
if (Core_IsStepping())
Core_EnableStepping(false);
Core_Stop();
System_PostUIMessage("stop", "");
// NOTE: Unlike Windows version, this
// does not need Core_WaitInactive();
// since SDL does not have a separate
// UI thread.
}
if (ctrl && (k == SDLK_b))
{
System_PostUIMessage("reset", "");
Core_EnableStepping(false);
}
}
break; break;
} }
case SDL_KEYUP: case SDL_KEYUP:

View file

@ -645,8 +645,10 @@ void GameSettingsScreen::CreateControlsSettings(UI::ViewGroup *controlsSettings)
controlsSettings->Add(new Choice(co->T("Control Mapping")))->OnClick.Handle(this, &GameSettingsScreen::OnControlMapping); controlsSettings->Add(new Choice(co->T("Control Mapping")))->OnClick.Handle(this, &GameSettingsScreen::OnControlMapping);
controlsSettings->Add(new Choice(co->T("Calibrate Analog Stick")))->OnClick.Handle(this, &GameSettingsScreen::OnCalibrateAnalogs); controlsSettings->Add(new Choice(co->T("Calibrate Analog Stick")))->OnClick.Handle(this, &GameSettingsScreen::OnCalibrateAnalogs);
#if defined(USING_WIN_UI) #if defined(USING_WIN_UI) || (PPSSPP_PLATFORM(LINUX) && !PPSSPP_PLATFORM(ANDROID))
controlsSettings->Add(new CheckBox(&g_Config.bSystemControls, co->T("Enable standard shortcut keys"))); controlsSettings->Add(new CheckBox(&g_Config.bSystemControls, co->T("Enable standard shortcut keys")));
#endif
#if defined(USING_WIN_UI)
controlsSettings->Add(new CheckBox(&g_Config.bGamepadOnlyFocused, co->T("Ignore gamepads when not focused"))); controlsSettings->Add(new CheckBox(&g_Config.bGamepadOnlyFocused, co->T("Ignore gamepads when not focused")));
#endif #endif