summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2019-11-09 17:32:15 +0100
committerAndre Weissflog <floooh@gmail.com>2019-11-09 17:32:15 +0100
commit71590e5d24fd2530f4ec4ab276f2daa2c4178453 (patch)
tree4513b566228e4954a3cdec49493cc380cff8ff2c /util
parentfee3fdb83c0c45a8ed4d9a1120c88da17718857d (diff)
sokol_imgui.h: don't forward 'special keys' as character codes to imgui
Diffstat (limited to 'util')
-rw-r--r--util/sokol_imgui.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h
index f17be692..d57d6996 100644
--- a/util/sokol_imgui.h
+++ b/util/sokol_imgui.h
@@ -1075,11 +1075,17 @@ SOKOL_API_IMPL bool simgui_handle_event(const sapp_event* ev) {
io->KeysDown[ev->key_code] = false;
break;
case SAPP_EVENTTYPE_CHAR:
- #if defined(__cplusplus)
- io->AddInputCharacter((ImWchar)ev->char_code);
- #else
- ImGuiIO_AddInputCharacter(io, (ImWchar)ev->char_code);
- #endif
+ /* on some platforms, special keys may be reported as
+ characters, which may confuse some ImGui widgets,
+ drop those
+ */
+ if ((ev->char_code >= 32) && (ev->char_code != 127)) {
+ #if defined(__cplusplus)
+ io->AddInputCharacter((ImWchar)ev->char_code);
+ #else
+ ImGuiIO_AddInputCharacter(io, (ImWchar)ev->char_code);
+ #endif
+ }
break;
default:
break;