wl_keyboard::enter
has key state information that Winit ignores
#3909
Labels
wl_keyboard::enter
has key state information that Winit ignores
#3909
Description
The state of a
wl_keyboard
object generally has this cycle, to my understanding:wl_keyboard
object) is unfocused and you cannot know what is pressed. It is undefined, and you should not assume anything. In practice, applications just keep their last state.wl_keyboard::enter
key
events whenever the logical state of a key is changed (i.e. pressed or released)This repeats. When the keyboard gains focus (
enter
), we get the full state immediately, and we get any further updates. Theenter
event has a field calledkeys
, which is an array of the currently pressed keys.Winit doesn't handle the
enter
event properly, itskeys
field is not even bound to any name, and thus dropped immediately:winit/src/platform_impl/linux/wayland/seat/keyboard/mod.rs
Line 62 in dfea49f
This, in general, means that
winit
consumers don't get accurate key state events unless that key has been pressed after the lastenter
event. Furthermore (and this isn't a winit issue), some clients then handle this incorrectly, assuming different semantics to the key events sent by winit. This has been plaguing me for months in the Smithay winit backend, and i only just now traced it back to winit. See Smithay/smithay#1353 (comment). Smithay's way to handle it is basically just wrong for thewl_keyboard
interface, but it is worth noting that if winit were to keep track of pressed keys, and synthesize key press/release events upon theenter
event for the keys whose state changed, then Smithay's current code would actually work as-is.Debugging output
No response
Window isn't shown unless you draw
Winit version
The text was updated successfully, but these errors were encountered: