diff options
author | David Robillard <d@drobilla.net> | 2019-06-29 14:46:26 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-06-30 20:13:25 +0200 |
commit | cf6da599e3ea7cf51f296dac722e3694c53b4ea3 (patch) | |
tree | 36a0696ff731af0bb8e1276a100a568474d2170b | |
parent | f1697241be39550bb873b695a73f0663f084ab7d (diff) |
Make translateKey take a PuglEventKey
-rw-r--r-- | pugl/pugl_x11.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/pugl/pugl_x11.c b/pugl/pugl_x11.c index 47a5738..2d0dd76 100644 --- a/pugl/pugl_x11.c +++ b/pugl/pugl_x11.c @@ -248,15 +248,15 @@ keySymToSpecial(KeySym sym) } static void -translateKey(PuglView* view, XEvent* xevent, PuglEvent* event) +translateKey(PuglView* view, XEvent* xevent, PuglEventKey* event) { KeySym sym = 0; - char* str = (char*)event->key.utf8; + char* str = (char*)event->utf8; memset(str, 0, 8); - event->key.filter = XFilterEvent(xevent, None); - if (xevent->type == KeyRelease || event->key.filter || !view->impl->xic) { + event->filter = XFilterEvent(xevent, None); + if (xevent->type == KeyRelease || event->filter || !view->impl->xic) { if (XLookupString(&xevent->xkey, str, 7, &sym, NULL) == 1) { - event->key.character = str[0]; + event->character = str[0]; } } else { /* TODO: Not sure about this. On my system, some characters work with @@ -271,11 +271,11 @@ translateKey(PuglView* view, XEvent* xevent, PuglEvent* event) view->impl->xic, &xevent->xkey, str, 7, &sym, &status); #endif if (n > 0) { - event->key.character = puglDecodeUTF8((const uint8_t*)str); + event->character = puglDecodeUTF8((const uint8_t*)str); } } - event->key.special = keySymToSpecial(sym); - event->key.keycode = xevent->xkey.keycode; + event->special = keySymToSpecial(sym); + event->keycode = xevent->xkey.keycode; } static uint32_t @@ -389,7 +389,7 @@ translateEvent(PuglView* view, XEvent xevent) event.key.x_root = xevent.xkey.x_root; event.key.y_root = xevent.xkey.y_root; event.key.state = translateModifiers(xevent.xkey.state); - translateKey(view, &xevent, &event); + translateKey(view, &xevent, &event.key); break; case EnterNotify: case LeaveNotify: |