Fixed the French numeric keycode from varying based on shift state
This commit is contained in:
@@ -426,7 +426,6 @@ static SDL_Keycode SDL_ConvertNumpadKeycode(SDL_Keycode keycode, SDL_bool numloc
|
|||||||
|
|
||||||
static SDL_Keycode SDL_GetEventKeycode(SDL_Keyboard *keyboard, SDL_Scancode scancode, SDL_Keymod modstate)
|
static SDL_Keycode SDL_GetEventKeycode(SDL_Keyboard *keyboard, SDL_Scancode scancode, SDL_Keymod modstate)
|
||||||
{
|
{
|
||||||
SDL_bool shifted = (modstate & SDL_KMOD_SHIFT) != 0;
|
|
||||||
SDL_bool numlock = (modstate & SDL_KMOD_NUM) != 0;
|
SDL_bool numlock = (modstate & SDL_KMOD_NUM) != 0;
|
||||||
SDL_Keycode keycode;
|
SDL_Keycode keycode;
|
||||||
|
|
||||||
@@ -441,13 +440,9 @@ static SDL_Keycode SDL_GetEventKeycode(SDL_Keyboard *keyboard, SDL_Scancode scan
|
|||||||
if ((keyboard->keycode_options & KEYCODE_OPTION_FRENCH_NUMBERS) &&
|
if ((keyboard->keycode_options & KEYCODE_OPTION_FRENCH_NUMBERS) &&
|
||||||
keyboard->french_numbers &&
|
keyboard->french_numbers &&
|
||||||
(scancode >= SDL_SCANCODE_1 && scancode <= SDL_SCANCODE_0)) {
|
(scancode >= SDL_SCANCODE_1 && scancode <= SDL_SCANCODE_0)) {
|
||||||
// Invert the shift state to generate the expected keycode
|
// Add the shift state to generate a numeric keycode
|
||||||
if (shifted) {
|
|
||||||
modstate &= ~SDL_KMOD_SHIFT;
|
|
||||||
} else {
|
|
||||||
modstate |= SDL_KMOD_SHIFT;
|
modstate |= SDL_KMOD_SHIFT;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
keycode = SDL_GetKeyFromScancode(scancode, modstate);
|
keycode = SDL_GetKeyFromScancode(scancode, modstate);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user