Incorrect labeling on BR-ABNT keyboard layout
I was trying out keys and it turns out SDL can't label correctly diacritic keys ~ and ´, displaying them same as the key in the scancode. In addition, brazilian keyboards have a comma instead of a dot on the keypad and the keycode appears as a dot, while the actual dot key has the same keycode and scancode.
Tried on LMDE6 with a freshly compiled SDL 3.2.24. I have not tried it on other OSes yet.
Can you run the SDL checkkeys test program and show the output along with the keys that you actually pressed?
Here it is. I pressed the keys in the following order: KP, KP. ´ ~ The ´ and ~ keys had to be pressed twice to appear and didn't output raw data, so I then pressed both again while holding Right Alt
Initial state: modifiers: NUM
Keymap changed!
Key pressed : raw 0x5b, scancode 99 = Keypad ., keycode 0x40000063 = Keypad . modifiers: NUM
Keys down: 1
INPUT Text (\x2c): ","
Key released: raw 0x5b, scancode 99 = Keypad ., keycode 0x40000063 = Keypad . modifiers: NUM
Keys down: 0
Key pressed : raw 0x81, scancode 99 = Keypad ., keycode 0x40000063 = Keypad . modifiers: NUM
Keys down: 1
INPUT Text (\x2e): "."
Key released: raw 0x81, scancode 99 = Keypad ., keycode 0x40000063 = Keypad . modifiers: NUM
Keys down: 0
INPUT Text (\x7e): "~"
INPUT Text (\xc2\xb4): "´"
Key pressed : raw 0x6c, scancode 230 = Right Alt, keycode 0x40000101 = ModeSwitch modifiers: NUM MODE
Keys down: 1
Key pressed : raw 0x30, scancode 52 = ', keycode 0x40000034 = ' modifiers: NUM MODE
Keys down: 2
INPUT Text (\x7e): "~"
Key released: raw 0x30, scancode 52 = ', keycode 0x40000034 = ' modifiers: NUM MODE
Keys down: 1
Key pressed : raw 0x22, scancode 47 = [, keycode 0x4000002F = [ modifiers: NUM MODE
Keys down: 2
INPUT Text (\xc2\xb4): "´"
Key released: raw 0x22, scancode 47 = [, keycode 0x4000002F = [ modifiers: NUM MODE
Keys down: 1
Key released: raw 0x6c, scancode 230 = Right Alt, keycode 0x40000101 = ModeSwitch modifiers: NUM
Keys down: 0
This looks correct to me, or at least what I would expect knowing how the system works. The keypad keys use the correct scancode and keycode, and they generate the input text that you'd see in the terminal when you press them. The IME eats the ´ and ~ keys, just sending text input, and delivers them as expected when you're holding down right alt.
?
It's not the IME i'm trying to use but reading inputs through SDL_Event which labels incorrecly ´ ~ and KP, while also not being able to distinguish between KP. and KP,
SDL gets input through the OS, including the IME, so that's not something that can be changed.
I've never seen a keyboard with a KP, key. I'll see if I can add support for that here.
Does this fix the KP, key for you?
diff --git a/src/events/SDL_keysym_to_scancode.c b/src/events/SDL_keysym_to_scancode.c
index 8d43ca350..c561d6a84 100644
--- a/src/events/SDL_keysym_to_scancode.c
+++ b/src/events/SDL_keysym_to_scancode.c
@@ -42,6 +42,7 @@ static const struct {
{ 0xFF9A, SDL_SCANCODE_KP_9 }, // XK_KP_Prior
{ 0xFF9E, SDL_SCANCODE_KP_0 }, // XK_KP_Insert
{ 0xFF9F, SDL_SCANCODE_KP_PERIOD }, // XK_KP_Delete
+ { 0xFFAC, SDL_SCANCODE_KP_COMMA }, // XK_KP_Separator
{ 0xFF62, SDL_SCANCODE_EXECUTE }, // XK_Execute
{ 0xFFEE, SDL_SCANCODE_APPLICATION }, // XK_Hyper_R
{ 0xFE03, SDL_SCANCODE_RALT }, // XK_ISO_Level3_Shift
If not, can you run xev, and show the output of pressing both the KP. and KP, keys?
Ping? I'd like to get this in for 3.4, but it can bump out of the milestone if necessary.