aboutsummaryrefslogtreecommitdiff
path: root/backends/events/sdl/sdl-events.cpp
diff options
context:
space:
mode:
authorMartin Kiewitz2016-07-03 19:43:56 +0200
committerMartin Kiewitz2016-07-03 19:43:56 +0200
commit29c31f830850fa40bb039640b1995bcc13966af7 (patch)
tree4629c75584b73fecd20684da90366b6bc551cf59 /backends/events/sdl/sdl-events.cpp
parent9aa7174218983bb1cf6fd98325082ca7d37f50fb (diff)
downloadscummvm-rg350-29c31f830850fa40bb039640b1995bcc13966af7.tar.gz
scummvm-rg350-29c31f830850fa40bb039640b1995bcc13966af7.tar.bz2
scummvm-rg350-29c31f830850fa40bb039640b1995bcc13966af7.zip
Revert "SDL: Fix keyboard on macOS, fix directional keypad"
This reverts commit 9aa7174218983bb1cf6fd98325082ca7d37f50fb. For now.
Diffstat (limited to 'backends/events/sdl/sdl-events.cpp')
-rw-r--r--backends/events/sdl/sdl-events.cpp22
1 files changed, 1 insertions, 21 deletions
diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp
index d65fc7cccd..00e2f25cbc 100644
--- a/backends/events/sdl/sdl-events.cpp
+++ b/backends/events/sdl/sdl-events.cpp
@@ -109,34 +109,14 @@ SdlEventSource::~SdlEventSource() {
int SdlEventSource::mapKey(SDLKey sdlKey, SDLMod mod, Uint16 unicode) {
Common::KeyCode key = SDLToOSystemKeycode(sdlKey);
-
- // Attention:
- // When using SDL1.x, we will get scancodes via sdlKey, that are raw scancodes, so NOT adjusted to keyboard layout/
- // mapping. So for example for certain locales, we will get KEYCODE_y, when 'z' is pressed and so on.
- // When using SDL2.x however, we will get scancodes based on the keyboard layout.
if (key >= Common::KEYCODE_F1 && key <= Common::KEYCODE_F9) {
return key - Common::KEYCODE_F1 + Common::ASCII_F1;
} else if (key >= Common::KEYCODE_KP0 && key <= Common::KEYCODE_KP9) {
- if ((mod & KMOD_NUM) == 0)
- return 0; // In case Num-Lock is NOT enabled, return 0 for ascii, so that directional keys on numpad work
return key - Common::KEYCODE_KP0 + '0';
} else if (key >= Common::KEYCODE_UP && key <= Common::KEYCODE_PAGEDOWN) {
return key;
- } else if ((unicode >= 0x20) && ((unicode <= 0x7E) || (key == Common::KEYCODE_INVALID))) {
- // Return unicode in case it's regular ASCII text or in case we didn't get a valid keycode
- //
- // We need to use unicode in those cases, simply because SDL1.x passes us non-layout-adjusted keycodes.
- // So unicode is the only way to get layout-adjusted keys.
- //
- // We need to restrict unicode to only up to 0x7E, because on macOS the option/alt key will switch to
- // an alternate keyboard, which will cause us to receive Unicode characters for some keys, which are outside
- // of the ASCII range (e.g. alt-x will get us U+2248). We need to return 'x' for alt-x, so using unicode
- // in that case would break alt-shortcuts.
- // The latter check for KEYCODE_INVALID is needed for special characters like umlauts, otherwise
- // we wouldn't pass such characters anymore.
- //
- // TODO: Maybe never return unicode in case it's > 255? Does any engine need such?
+ } else if (unicode) {
return unicode;
} else if (key >= 'a' && key <= 'z' && (mod & KMOD_SHIFT)) {
return key & ~0x20;