Note_brr_kit.KeySourceUser keyboard.
Note. Physical keys are for using the keyboard as a controller. Do not use them to derive text input, they are unrelated to the user's keyboard layout for text entry. Use input events for text entry.
The type for physical key codes.
type t = [ | `Alt of [ `Left | `Right ]| `Arrow of [ `Up | `Down | `Left | `Right ]| `Ascii of Char.t| `Backspace| `Ctrl of [ `Left | `Right ]| `End| `Enter| `Escape| `Func of int| `Home| `Insert| `Key of code| `Meta of [ `Left | `Right ]| `Page of [ `Up | `Down ]| `Return| `Shift of [ `Left | `Right ]| `Spacebar| `Tab ]The type for physical keys.
Warning. This type is overdefined for now. For example except for `Shift, `Ctrl and Alt, `Left and `Right modifiers cannot be distinguished; `Left is always returned. `Enter and `Return cannot be distinguished, `Return is always returned.
of_ev e is the physical key of the keyboard event e.
The type for gathering keyboard events on a given target.
on_target t is keyboard events for target t. The other parameters are those of Brr_note.Evr.on_target.
any_down evs occurs whenever a key goes down on the target.
any_down evs occurs whenever a key goes up on the target.
any_holds evs is true whenever any key is down.
down evs k occurs whenever key k goes down on the target.
up evs k occurs whenever key k goes up on the target.
holds evs k is true whenever k is held down on the target.
alt evs is true whenver an alt key is down on the target. Equivalent to:
S.Bool.(holds evs (`Alt `Left) || holds evs (`Alt `Right))ctrl evs is true whenver an ctrl key is down on the target. Equivalent to:
S.Bool.(holds evs (`Ctrl `Left) || holds evs (`Ctrl `Right))meta evs is true whenver an meta key is down on the target. Equivalent to:
S.Bool.(holds evs (`Meta `Left) || holds evs (`Meta `Right))shift evs is true whenver an shift key is down on the target. Equivalent to:
S.Bool.(holds evs (`Meta `Left) || holds evs (`Meta `Right))holds and any_holds may be initially set to false even though they should be true if on_target is invoked when the corresponding keys are depressed.
Key repeat events are not exposed. There are two main use cases for key repeat. First during text input, but his should be handled by text input events and is out of scope. Second for controlling changes to a variable over time, e.g. scrolling with a keyboard. In the latter case it is better to create a timing signal or event with a known rate while the key is held.