Skip to content

Commit

Permalink
Merge pull request #264 from flyinghead/master
Browse files Browse the repository at this point in the history
[pull] gdxsv-master from flyinghead:master
  • Loading branch information
pull[bot] authored Sep 24, 2023
2 parents ee91519 + f75a16f commit ddfe82e
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion core/sdl/sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,28 @@ void input_sdl_handle()
checkRawInput();
if (event.key.repeat == 0)
{
auto is_key_mapped = [](u32 code) -> bool {
#if defined(_WIN32) && !defined(TARGET_UWP)
if (config::UseRawInput)
{
for (int i = 0; i < GamepadDevice::GetGamepadCount(); i++)
{
auto gamepad = GamepadDevice::GetGamepad(i);
if (dynamic_cast<rawinput::RawKeyboard*>(gamepad.get()) != nullptr)
{
bool mapped = (gamepad->get_input_mapping()->get_button_id(0, code) != EMU_BTN_NONE);
if (mapped) return true;
}
}
return false;
}
else
#endif
{
return (sdl_keyboard->get_input_mapping()->get_button_id(0, code) != EMU_BTN_NONE);
}
};

if (event.type == SDL_KEYDOWN
&& ((event.key.keysym.sym == SDLK_RETURN && (event.key.keysym.mod & KMOD_ALT))
|| (event.key.keysym.sym == SDLK_F11 && (event.key.keysym.mod & (KMOD_ALT | KMOD_CTRL | KMOD_SHIFT | KMOD_GUI)) == 0)))
Expand All @@ -272,7 +294,7 @@ void input_sdl_handle()
}
window_fullscreen = !window_fullscreen;
}
else if (event.type == SDL_KEYDOWN && (event.key.keysym.mod & KMOD_LALT) && (event.key.keysym.mod & KMOD_LCTRL))
else if (event.type == SDL_KEYDOWN && (event.key.keysym.mod & KMOD_LALT) && (event.key.keysym.mod & KMOD_LCTRL) && !(is_key_mapped(SDL_SCANCODE_LALT) || is_key_mapped(SDL_SCANCODE_LCTRL)) )
{
captureMouse(!mouseCaptured);
}
Expand Down

0 comments on commit ddfe82e

Please sign in to comment.