Sync up the caps/numlock state properly without sending key events.

Partially fixes Bugzilla #2736 and #3125.
This commit is contained in:
Ryan C. Gordon 2015-12-28 13:07:44 -05:00
parent d3b323f89d
commit 257b7af247
6 changed files with 26 additions and 45 deletions

View file

@ -845,6 +845,19 @@ SDL_SetModState(SDL_Keymod modstate)
keyboard->modstate = modstate;
}
/* Note that SDL_ToggleModState() is not a public API. SDL_SetModState() is. */
void
SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
if (toggle) {
keyboard->modstate |= modstate;
} else {
keyboard->modstate &= ~modstate;
}
}
SDL_Keycode
SDL_GetKeyFromScancode(SDL_Scancode scancode)
{