After testing my application on a Linux system I get some strange behavior of keyboard events.
Here is a MWE to illustrate it:
win = GtkWindow("Key Test", 300, 300)
eck = GtkEventControllerKey(win)
signal_connect(eck, "modifiers") do controller, state
println("modifier = ", state)
end
signal_connect(eck, "key-pressed") do controller, keyval, keycode, state
println("key pressed: ", keyval, " modifier: ", state)
end
show(win)
If I press first the shift key, then release it and then press the Ctrl key I get the following output on a Windows system, which is also what I would expect:
modifier = 1
key pressed: 65505 modifier: 1
modifier = 0
modifier = 4
key pressed: 65507 modifier: 4
modifier = 0
On a Xubuntu 2.22 (x86-64) system the output is:
modifier = 0
key pressed: 65505 modifier: 0
modifier = 1
modifier = 0
key pressed: 65507 modifier: 0
modifier = 4
So it seems the modifier values lag one event behind, which gives surprising results on application level…
This is with Gtk4 0.7.7 and tested under Julia 1.10.9 and 1.11.5 all giving the same results.
Can anybody reproduce this? Hopefully there is an easy fix, because after a lot of coding to migrate from Gtk3 to Gtk4 I would not want to go back for Linux systems and maintain two version…