Brr_note_kit.KeyUser 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.
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.
val of_ev : Brr.Ev.Keyboard.t Brr.Ev.t -> tof_ev e is the physical key of the keyboard event e.
val on_target : ?capture:bool -> ?propagate:bool -> ?default:bool -> Brr.Ev.target -> eventson_target t is keyboard events for target t. The other parameters are those of Brr_note.Evr.on_target.
on_el e is like on_target but for an element.
val any_down : events -> t Note.eventany_down evs occurs whenever a key goes down on the target.
val any_up : events -> t Note.eventany_down evs occurs whenever a key goes up on the target.
val any_holds : events -> bool Note.signalany_holds evs is true whenever any key is down.
val down : events -> t -> unit Note.eventdown evs k occurs whenever key k goes down on the target.
val up : events -> t -> unit Note.eventup evs k occurs whenever key k goes up on the target.
val holds : events -> t -> bool Note.signalholds evs k is true whenever k is held down on the target.
val alt : events -> bool Note.signalalt evs is true whenver an alt key is down on the target. Equivalent to:
S.Bool.(holds evs (`Alt `Left) || holds evs (`Alt `Right))val ctrl : events -> bool Note.signalctrl evs is true whenver an ctrl key is down on the target. Equivalent to:
S.Bool.(holds evs (`Ctrl `Left) || holds evs (`Ctrl `Right))val meta : events -> bool Note.signalmeta evs is true whenver an meta key is down on the target. Equivalent to:
S.Bool.(holds evs (`Meta `Left) || holds evs (`Meta `Right))val shift : events -> bool Note.signalshift 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.