Skip to content

Commit

Permalink
Fix keyboard handling for SDL1
Browse files Browse the repository at this point in the history
A lot of scancodes in SDL1 are > 256. The current code assumed in a lot
of places that they are less than 256, causing eg. ctrl-key combination
not to work.

Also the the sdl_keymap array for translating keysyms to ascii was only
suitable for SDL2.
  • Loading branch information
th-otto committed Mar 29, 2024
1 parent 77e2da0 commit 6575ed4
Show file tree
Hide file tree
Showing 17 changed files with 853 additions and 1,240 deletions.
2 changes: 1 addition & 1 deletion common/gadget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ KeyNumType GadgetClass::Input(void)
** know the position of the mouse at the exact instant when the click occurred
** rather the the mouse position at the time we get around to this function.
*/
if (((key & 0xFF) == KN_LMOUSE) || ((key & 0xFF) == KN_RMOUSE)) {
if (((key & KN_SCANCODE_MASK) == KN_LMOUSE) || ((key & KN_SCANCODE_MASK) == KN_RMOUSE)) {
mousex = Keyboard->MouseQX;
mousey = Keyboard->MouseQY;
} else {
Expand Down
265 changes: 0 additions & 265 deletions common/sdl_keymap.h

This file was deleted.

Loading

0 comments on commit 6575ed4

Please sign in to comment.