InputEvent.Keyboard emits keydown, keyup, and keypress events. This looks like the browser keyboard event api. But it behaves differently.
In browser, a physical depress and release gives a keydown-keypress pair, and then a keyup. A keyboard autorepeat gives just a keydown-keypress pair (it used to give a keyup as well).
EV_KEY is different. Value 1 is physical depress. Value 0 is physical release. Value 2 is autorepeat.
These EV_KEYs are currently emitted as keydown, keyup, and keypress. So you don't get keydown (or keyup) from autorepeats. And you don't get a keypress from any physical key depresses, only from autorepeats.
So while this looks like the browser api, it behaves differently. Which is confusing.
Some possibilities include: (a) document that you don't get keydown for autorepeats, and don't get keypress for physical presses; (b) rename keypress to repeat; (c) rename keyup and keydown to depress and release. (Or to keyrepeat, keydepress, keyrelease?)
Thanks for your work!
InputEvent.Keyboard emits
keydown,keyup, andkeypressevents. This looks like the browser keyboard event api. But it behaves differently.In browser, a physical depress and release gives a keydown-keypress pair, and then a keyup. A keyboard autorepeat gives just a keydown-keypress pair (it used to give a keyup as well).
EV_KEY is different. Value 1 is physical depress. Value 0 is physical release. Value 2 is autorepeat.
These EV_KEYs are currently emitted as
keydown,keyup, andkeypress. So you don't getkeydown(orkeyup) from autorepeats. And you don't get akeypressfrom any physical key depresses, only from autorepeats.So while this looks like the browser api, it behaves differently. Which is confusing.
Some possibilities include: (a) document that you don't get
keydownfor autorepeats, and don't getkeypressfor physical presses; (b) renamekeypresstorepeat; (c) renamekeyupandkeydowntodepressandrelease. (Or tokeyrepeat,keydepress,keyrelease?)Thanks for your work!