Skip to content

Commit

Permalink
Returned to handling ctrl, lalt and gui modifiers in kyeDownEvent().
Browse files Browse the repository at this point in the history
  • Loading branch information
najlkin committed Sep 19, 2024
1 parent 031ca5c commit f241d4d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,17 @@ void SdlWindow::keyDownEvent(SDL_Keysym& ks)
// events to be processed there.
// Note: the same condition has to be used in signalKeyDown().
const char *scan_name = SDL_GetScancodeName(ks.scancode);
if ((scan_name[0] >= 32 && scan_name[0] < 127) && scan_name[1] == '\0')
if ((scan_name[0] >= 32 && scan_name[0] < 127) && scan_name[1] == '\0'
&& (ks.mod & (KMOD_CTRL | KMOD_LALT | KMOD_GUI)) == 0)
{
lastKeyDownProcessed = false;
lastKeyDownMods = ks.mod;
lastKeyDownChar = ks.sym;
return;
}
// If the key is not in the range [32,127) then we processed the event here.
// If any 'mod' key other than KMOD_SHIFT, KMOD_CAPS or KMOD_RALT is
// pressed, or the key is not in the range [32,127) then we processed the
// event here.
lastKeyDownProcessed = true;
if (onKeyDown[ks.sym])
{
Expand Down Expand Up @@ -647,7 +650,7 @@ void SdlWindow::signalKeyDown(SDL_Keycode k, SDL_Keymod m)
queueEvents({ event });

// The same condition as in keyDownEvent().
if (k >= 32 && k < 127)
if ((k >= 32 && k < 127) && (m & (KMOD_CTRL | KMOD_LALT | KMOD_GUI)) == 0)
{
event.type = SDL_TEXTINPUT;
event.text.windowID = window_id;
Expand Down

0 comments on commit f241d4d

Please sign in to comment.