diff options
author | David Robillard <d@drobilla.net> | 2015-02-15 03:13:11 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-02-15 03:27:44 -0500 |
commit | e5778fc5f9c59db23c9039c2c21d2e42a4ddb08d (patch) | |
tree | a24ead3e062e6caef81a42ecee3ccb5ac5363bda | |
parent | b940da411bff04af2bed713b730546ef4378e457 (diff) | |
download | pugl-e5778fc5f9c59db23c9039c2c21d2e42a4ddb08d.tar.gz pugl-e5778fc5f9c59db23c9039c2c21d2e42a4ddb08d.tar.bz2 pugl-e5778fc5f9c59db23c9039c2c21d2e42a4ddb08d.zip |
Use Xutf8LookupString if present.
This is wrong in some ways, and XmbLookupString is wrong in others.
I have no idea why.
-rw-r--r-- | pugl/pugl_x11.c | 12 |
1 files 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); } |