diff options
author | StapleButter <thetotalworm@gmail.com> | 2017-10-03 02:52:30 +0200 |
---|---|---|
committer | StapleButter <thetotalworm@gmail.com> | 2017-10-03 02:52:30 +0200 |
commit | 012a7d61a713b0e200c4f81558df4d3bababf2fe (patch) | |
tree | 43d0d064af69bd6d863a6ddb8a9a785070643a4f /src/libui_sdl/libui | |
parent | 9527499124f9da3924c5202cf82c2a8fa834e41d (diff) |
actually make uiKeyName() work
Diffstat (limited to 'src/libui_sdl/libui')
-rw-r--r-- | src/libui_sdl/libui/unix/area.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/libui_sdl/libui/unix/area.c b/src/libui_sdl/libui/unix/area.c index fd45371..035675d 100644 --- a/src/libui_sdl/libui/unix/area.c +++ b/src/libui_sdl/libui/unix/area.c @@ -509,7 +509,18 @@ static gboolean areaWidget_key_release_event(GtkWidget *w, GdkEventKey *e) char* uiKeyName(int scancode) { - return "TODO"; + scancode = scancode_normal2unix(scancode); + + guint* keyvals; int num; + GdkKeymap* keymap = gdk_keymap_get_default(); + gdk_keymap_get_entries_for_keycode(keymap, scancode, NULL, &keyvals, &num); + + // TODO: pick smarter?? + int keyval = keyvals[0]; + + g_free(keyvals); + + return uiUnixStrdupText(gdk_keyval_name(keyval)); } enum { |