From e5778fc5f9c59db23c9039c2c21d2e42a4ddb08d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 15 Feb 2015 03:13:11 -0500 Subject: Use Xutf8LookupString if present. This is wrong in some ways, and XmbLookupString is wrong in others. I have no idea why. --- pugl/pugl_x11.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pugl/pugl_x11.c b/pugl/pugl_x11.c index 9262404..6289166 100644 --- a/pugl/pugl_x11.c +++ b/pugl/pugl_x11.c @@ -329,9 +329,17 @@ translateKey(PuglView* view, XEvent* xevent, PuglEvent* event) event->key.character = str[0]; } } else { - Status status = 0; - const int n = XmbLookupString( + /* TODO: Not sure about this. On my system, some characters work with + Xutf8LookupString but not with XmbLookupString, and some are the + opposite. */ + Status status = 0; +#ifdef X_HAVE_UTF8_STRING + const int n = Xutf8LookupString( view->impl->xic, &xevent->xkey, str, 7, &sym, &status); +#else + const int n = XmbLookupString( + view->impl->xic, &xevent->xkey, str, 7, &sym, &status); +#endif if (n > 0) { event->key.character = puglDecodeUTF8((const uint8_t*)str); } -- cgit v1.2.3