Skip to content

Commit

Permalink
Handle Colemak swapping of CapsLock and Backspace
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Aug 4, 2024
1 parent 978e5fc commit 5e90430
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/video/windows/SDL_windowskeyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,18 @@ void WIN_UpdateKeymap(SDL_bool send_event)
if (scancode == SDL_SCANCODE_UNKNOWN ||
scancode == SDL_SCANCODE_DELETE ||
(SDL_GetDefaultKeyFromScancode(scancode, SDL_KMOD_NONE) & SDLK_SCANCODE_MASK)) {

/* The Colemak mapping swaps Backspace and CapsLock */
if (mods[m] == SDL_KMOD_NONE &&
(scancode == SDL_SCANCODE_CAPSLOCK ||
scancode == SDL_SCANCODE_BACKSPACE)) {
vk = LOBYTE(MapVirtualKey(i, MAPVK_VSC_TO_VK));
if (vk == VK_CAPITAL) {
SDL_SetKeymapEntry(keymap, scancode, mods[m], SDLK_CAPSLOCK);
} else if (vk == VK_BACK) {
SDL_SetKeymapEntry(keymap, scancode, mods[m], SDLK_BACKSPACE);
}
}
continue;
}

Expand Down

0 comments on commit 5e90430

Please sign in to comment.