Skip to content

Commit

Permalink
sdl_window: Support international keys on SDL2
Browse files Browse the repository at this point in the history
  • Loading branch information
LekKit committed Mar 17, 2024
1 parent 866f9ea commit 82a8b39
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions src/devices/sdl_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,6 @@ static const hid_key_t sdl_key_to_hid_byte_map[] = {
[SDL_SCANCODE_PERIOD] = HID_KEY_DOT,
[SDL_SCANCODE_SLASH] = HID_KEY_SLASH,
[SDL_SCANCODE_CAPSLOCK] = HID_KEY_CAPSLOCK,
[SDL_SCANCODE_LCTRL] = HID_KEY_LEFTCTRL,
[SDL_SCANCODE_LSHIFT] = HID_KEY_LEFTSHIFT,
[SDL_SCANCODE_LALT] = HID_KEY_LEFTALT,
[SDL_SCANCODE_LGUI] = HID_KEY_LEFTMETA,
[SDL_SCANCODE_RCTRL] = HID_KEY_RIGHTCTRL,
[SDL_SCANCODE_RSHIFT] = HID_KEY_RIGHTSHIFT,
[SDL_SCANCODE_RALT] = HID_KEY_RIGHTALT,
[SDL_SCANCODE_RGUI] = HID_KEY_RIGHTMETA,
[SDL_SCANCODE_F1] = HID_KEY_F1,
[SDL_SCANCODE_F2] = HID_KEY_F2,
[SDL_SCANCODE_F3] = HID_KEY_F3,
Expand Down Expand Up @@ -124,7 +116,28 @@ static const hid_key_t sdl_key_to_hid_byte_map[] = {
[SDL_SCANCODE_KP_9] = HID_KEY_KP9,
[SDL_SCANCODE_KP_0] = HID_KEY_KP0,
[SDL_SCANCODE_KP_PERIOD] = HID_KEY_KPDOT,
[SDL_SCANCODE_APPLICATION] = HID_KEY_COMPOSE,
[SDL_SCANCODE_KP_EQUALS] = HID_KEY_KPEQUAL,
[SDL_SCANCODE_INTERNATIONAL1] = HID_KEY_RO,
[SDL_SCANCODE_INTERNATIONAL2] = HID_KEY_KATAKANAHIRAGANA,
[SDL_SCANCODE_INTERNATIONAL3] = HID_KEY_YEN,
[SDL_SCANCODE_INTERNATIONAL4] = HID_KEY_HENKAN,
[SDL_SCANCODE_INTERNATIONAL5] = HID_KEY_MUHENKAN,
[SDL_SCANCODE_INTERNATIONAL6] = HID_KEY_KPJPCOMMA,
[SDL_SCANCODE_LANG1] = HID_KEY_HANGEUL,
[SDL_SCANCODE_LANG2] = HID_KEY_HANJA,
[SDL_SCANCODE_LANG3] = HID_KEY_KATAKANA,
[SDL_SCANCODE_LANG4] = HID_KEY_HIRAGANA,
[SDL_SCANCODE_LANG5] = HID_KEY_ZENKAKUHANKAKU,
[SDL_SCANCODE_MENU] = HID_KEY_MENU,
[SDL_SCANCODE_LCTRL] = HID_KEY_LEFTCTRL,
[SDL_SCANCODE_LSHIFT] = HID_KEY_LEFTSHIFT,
[SDL_SCANCODE_LALT] = HID_KEY_LEFTALT,
[SDL_SCANCODE_LGUI] = HID_KEY_LEFTMETA,
[SDL_SCANCODE_RCTRL] = HID_KEY_RIGHTCTRL,
[SDL_SCANCODE_RSHIFT] = HID_KEY_RIGHTSHIFT,
[SDL_SCANCODE_RALT] = HID_KEY_RIGHTALT,
[SDL_SCANCODE_RGUI] = HID_KEY_RIGHTMETA,
};

#else
Expand Down

0 comments on commit 82a8b39

Please sign in to comment.