Skip to content

Commit

Permalink
Issue eclipse-platform#214 - Incorrect keycode conversion displayed w…
Browse files Browse the repository at this point in the history
…hen key pressed in Snippet 25

+ get translated keyval from GTK

The issue was that in GTK4, keyval and keycode are auto translated without requiring a keymap.
This was a very trivial fix of getting keyval and converting it into keycode using gdk_keyval_to_unicode

Signed-off-by: Jason Wang <[email protected]>
  • Loading branch information
Jason Wang committed Jun 20, 2022
1 parent 6f2f07c commit 6752bfa
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1981,7 +1981,8 @@ boolean setKeyState (Event javaEvent, long event) {
short [] keyCode = new short [1];
if (GTK.GTK4) {
keyCode[0] = (short) GDK.gdk_key_event_get_keycode(event);
javaEvent.keyCode = keyCode[0];
keyval[0] = (short) GDK.gdk_key_event_get_keyval(event);
javaEvent.keyCode = (int) GDK.gdk_keyval_to_unicode (keyval [0]);
} else {
GDK.gdk_event_get_keycode(event, keyCode);
if (GDK.gdk_keymap_translate_keyboard_state (keymap, keyCode[0],
Expand Down

0 comments on commit 6752bfa

Please sign in to comment.