package matrix

  1. Overview
  2. Docs

Module Input.MouseSource

Mouse buttons and motion events.

Buttons

Sourcetype button =
  1. | Left
  2. | Middle
  3. | Right
  4. | Wheel_up
  5. | Wheel_down
  6. | Wheel_left
  7. | Wheel_right
  8. | Button of int
    (*

    Extended button (4+). In legacy tracking modes (X10/Normal, URXVT) release events do not encode which button was released; these are reported as Button 0.

    *)

The type for mouse buttons.

Sourceval equal_button : button -> button -> bool

equal_button a b is true iff a and b are the same button.

Sourceval pp_button : Format.formatter -> button -> unit

pp_button formats mouse buttons for debugging.

Button state

Sourcetype button_state = {
  1. left : bool;
  2. middle : bool;
  3. right : bool;
}

The type for primary button state during motion events.

Sourceval equal_button_state : button_state -> button_state -> bool

equal_button_state a b is true iff all fields are equal.

Sourceval pp_button_state : Format.formatter -> button_state -> unit

pp_button_state formats button state for debugging.

Scroll direction

Sourcetype scroll_direction =
  1. | Scroll_up
  2. | Scroll_down
  3. | Scroll_left
  4. | Scroll_right
    (*

    The type for normalized scroll direction.

    *)
Sourceval equal_scroll_direction : scroll_direction -> scroll_direction -> bool

equal_scroll_direction a b is true iff a and b are the same direction.

Sourceval pp_scroll_direction : Format.formatter -> scroll_direction -> unit

pp_scroll_direction formats scroll directions for debugging.

Mouse events

Sourcetype event =
  1. | Button_press of int * int * button * Key.modifier
    (*

    Button_press (x, y, button, mods) is a button press at (x, y). Coordinates are 0-based, top-left origin.

    *)
  2. | Button_release of int * int * button * Key.modifier
    (*

    Button_release (x, y, button, mods) is a button release at (x, y). In legacy tracking modes (X10/Normal, URXVT) button is Button 0 because the protocol does not encode which button was released.

    *)
  3. | Motion of int * int * button_state * Key.modifier
    (*

    Motion (x, y, state, mods) is mouse motion to (x, y) with primary button state and mods.

    *)

The type for mouse events. Coordinates are 0-based with top-left origin.

Sourceval equal_event : event -> event -> bool

equal_event a b is true iff a and b are structurally equal.

Sourceval pp_event : Format.formatter -> event -> unit

pp_event formats mouse events for debugging.