diff options
| author | 2016-05-27 16:02:01 +1000 | |
|---|---|---|
| committer | 2016-05-27 16:03:03 +1000 | |
| commit | 73153c3387a8f0bc628b8f0ee3a63ba8bb6717e8 (patch) | |
| tree | fd8c90af5704ce62c605f61075c16f88e541be4d /src/osd/modules/input/input_sdl.cpp | |
| parent | 14ad4244485b2f719e471522fa890e1bc17c0898 (diff) | |
ui refactoring [Vas Crabb]
* Make ARRAY_LENGTH cause a compile error if used with a pointer/vector
* Clean up text input code, move common operations to inline templates
* Fix numerous one-byte buffer overruns
* Don't flat-out ignore input beyond the C1 hole
* Fix decoding of SDL text input
Diffstat (limited to 'src/osd/modules/input/input_sdl.cpp')
| -rw-r--r-- | src/osd/modules/input/input_sdl.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/osd/modules/input/input_sdl.cpp b/src/osd/modules/input/input_sdl.cpp index 2101623fe6c..6ba3ccb2be2 100644 --- a/src/osd/modules/input/input_sdl.cpp +++ b/src/osd/modules/input/input_sdl.cpp @@ -156,11 +156,23 @@ public: { auto window = GET_FOCUS_WINDOW(&event.text); //printf("Focus window is %p - wl %p\n", window, sdl_window_list); - unicode_char result; if (window != nullptr) { - osd_uchar_from_osdchar(&result, sdlevent.text.text, 1); - machine().ui_input().push_char_event(window->target(), result); + auto ptr = sdlevent.text.text; + auto len = std::strlen(sdlevent.text.text); + while (len) + { + unicode_char ch; + auto chlen = uchar_from_utf8(&ch, ptr, len); + if (0 > chlen) + { + ch = 0x0fffd; + chlen = 1; + } + ptr += chlen; + len -= chlen; + machine().ui_input().push_char_event(window->target(), ch); + } } } break; |
