summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/input
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2020-01-10 12:06:08 -0500
committer AJR <ajrhacker@users.noreply.github.com>2020-01-10 12:09:15 -0500
commit197c94ceacbc05a8fc9785592a6ccfbb7f585047 (patch)
treee6b40959f3f3f219eadedbf249da196f4a1841ec /src/osd/modules/input
parent2b4c203d88e672e7c117d6266c5bb6ed7ef5bd00 (diff)
input_sdl: Process control characters so that the natural keyboard can see them (SDL normally strips these out)
Don't strip linefeed characters (Ctrl-J) from natural keyboard input except when pasting strings
Diffstat (limited to 'src/osd/modules/input')
-rw-r--r--src/osd/modules/input/input_sdl.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/osd/modules/input/input_sdl.cpp b/src/osd/modules/input/input_sdl.cpp
index 596895e9e39..4d09441b24e 100644
--- a/src/osd/modules/input/input_sdl.cpp
+++ b/src/osd/modules/input/input_sdl.cpp
@@ -386,6 +386,19 @@ public:
keyboard.state[sdlevent.key.keysym.scancode] = 0x80;
if (sdlevent.key.keysym.sym < 0x20)
machine().ui_input().push_char_event(osd_common_t::s_window_list.front()->target(), sdlevent.key.keysym.sym);
+ else if (keyboard.state[SDL_SCANCODE_LCTRL] == 0x80 || keyboard.state[SDL_SCANCODE_RCTRL] == 0x80)
+ {
+ // SDL filters out control characters for text input, so they are decoded here
+ if (sdlevent.key.keysym.sym >= 0x40 && sdlevent.key.keysym.sym < 0x7f)
+ machine().ui_input().push_char_event(osd_common_t::s_window_list.front()->target(), sdlevent.key.keysym.sym & 0x1f);
+ else if (keyboard.state[SDL_SCANCODE_LSHIFT] == 0x80 || keyboard.state[SDL_SCANCODE_RSHIFT] == 0x80)
+ {
+ if (sdlevent.key.keysym.sym == SDLK_6) // Ctrl-^ (RS)
+ machine().ui_input().push_char_event(osd_common_t::s_window_list.front()->target(), 0x1e);
+ else if (sdlevent.key.keysym.sym == SDLK_MINUS) // Ctrl-_ (US)
+ machine().ui_input().push_char_event(osd_common_t::s_window_list.front()->target(), 0x1f);
+ }
+ }
break;
case SDL_KEYUP: