Skip to content

Commit

Permalink
Ignore Mouse Capture when Left Ctrl or Left ALT is mapped to a Dreamc…
Browse files Browse the repository at this point in the history
…ast Key
  • Loading branch information
vkedwardli committed Sep 22, 2023
1 parent dddd712 commit ec303a3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/sdl/sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ void input_sdl_handle()
checkRawInput();
if (event.key.repeat == 0)
{
auto is_key_mapped = [](u32 code) -> bool { 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 +274,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 ec303a3

Please sign in to comment.