Module Brr.Key

module Key: sig .. end
User keyboard.


Physical keys

Note. Physical keys can be used when a keyboard is used as a controller but they must not be used to derive text input: they are unrelated to the user's keyboard layout for text entry.

type code = int 
The type for physical key codes.
type t = [ `Alt of [ `Left | `Right ]
| `Arrow of [ `Down | `Left | `Right | `Up ]
| `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 [ `Down | `Up ]
| `Return
| `Shift of [ `Left | `Right ]
| `Spacebar
| `Tab ]
The type for physical keys.

Warning. This type is overdefined for now. For example except for `Meta, `Left and `Right modifiers cannot be distinguished; `Left is always returned. `Enter and `Return cannot be distinguished, `Return is returned.

val equal : t -> t -> bool
equal k0 k1 is true iff k0 and k1 are equal.
val compare : t -> t -> int
compare is a total order on keys compatible with Brr.Key.equal.
val pp : Format.formatter -> t -> unit
pp formats keys.

Events


val of_ev : Dom_html.keyboardEvent Brr.Ev.t -> t
of_ev e is the physical key of e.
val down : Dom_html.keyboardEvent Brr.Ev.kind
down is Brr.Ev.keydown.
val up : Dom_html.keyboardEvent Brr.Ev.kind
up is Brr.Ev.keyup.
val for_target : ?capture:bool ->
?propagate:bool ->
?default:bool ->
#Dom_html.eventTarget Brr.Ev.target ->
Dom_html.keyboardEvent Brr.Ev.kind -> t Note.event
for_target t k is Brr.Ev.for_target t k of_ev.
val for_el : ?capture:bool ->
?propagate:bool ->
?default:bool ->
Brr.El.t -> Dom_html.keyboardEvent Brr.Ev.kind -> t Note.event
for_el (`El t) k is event k t.