From 7a05b7c03c3819b2e8f4edcbcc40803a0d808111 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 23 Jul 2017 11:10:33 +0200 Subject: Send zero instead of replacement char for invalid key strings --- pugl/pugl_osx.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pugl/pugl_osx.m b/pugl/pugl_osx.m index c087a1c..d911441 100644 --- a/pugl/pugl_osx.m +++ b/pugl/pugl_osx.m @@ -437,6 +437,7 @@ keySymToSpecial(PuglView* view, NSEvent* ev) const NSPoint rloc = [NSEvent mouseLocation]; const NSString* chars = [event characters]; const char* str = [chars UTF8String]; + const uint32_t code = puglDecodeUTF8((const uint8_t*)str); PuglEventKey ev = { PUGL_KEY_PRESS, puglview, @@ -448,7 +449,7 @@ keySymToSpecial(PuglView* view, NSEvent* ev) [[NSScreen mainScreen] frame].size.height - rloc.y, getModifiers(puglview, event), [event keyCode], - puglDecodeUTF8((const uint8_t*)str), + (code != 0xFFFD) ? code : 0, keySymToSpecial(puglview, event), { 0, 0, 0, 0, 0, 0, 0, 0 }, false -- cgit v1.2.3