On Sat, 23 Jan 2021 16:44:11 GMT, Kevin Rushforth <k...@openjdk.org> wrote:
>> Kevin Rushforth has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Use XkbGetNamedIndicator on Linux instead of relying on the (unreliable) >> GDK method. > > modules/javafx.graphics/src/main/native-glass/gtk/glass_key.cpp line 361: > >> 359: switch (keyCode) { >> 360: case com_sun_glass_events_KeyEvent_VK_CAPS_LOCK: >> 361: lockState = gdk_keymap_get_caps_lock_state(keyMap); > > It seems that `gdk_keymap_get_caps_lock_state` isn't reliable on GTK 3 > either. At least not when I test it on a Linux VM. I may end up using raw > Xlib calls instead (which would have the added benefit of removing the > "ifdef" for GTK 3). I did end going this route. Instead of the `gdk_keymap` functions, I now use `XkbGetNamedIndicator`. It works on both GTK2 and GTK3 (unsurprisingly, since it isn't using GTK / GDK at all), and correctly reports the state of the keys even if the lock state is toggled when the program is not running or does not have focus. ------------- PR: https://git.openjdk.java.net/jfx/pull/385