pub struct Mouse {
pub x: u16,
pub y: u16,
pub button: MouseButton,
pub modifiers: KeyModifiers,
}Expand description
Mouse-event payload with position, button, and modifier state.
Coordinates are zero-based; (0, 0) is the upper-left corner of the
terminal. In normal mouse modes, x and y are cell coordinates. When the
application has enabled SGR-Pixel encoding (DEC mode 1016), the same fields
contain pixel offsets instead; call mouse_pixel_to_cell if cell
coordinates are needed.
Fields§
§x: u16Horizontal coordinate.
Interpreted as a column in normal mouse modes and a pixel offset in SGR-Pixel mode.
y: u16Vertical coordinate.
Interpreted as a row in normal mouse modes and a pixel offset in SGR-Pixel mode.
Button, wheel direction, or no-button marker associated with the event.
modifiers: KeyModifiersKeyboard modifiers that were active when the mouse event was reported.
Implementations§
Source§impl Mouse
impl Mouse
Sourcepub fn new(x: u16, y: u16, button: MouseButton, modifiers: KeyModifiers) -> Self
pub fn new(x: u16, y: u16, button: MouseButton, modifiers: KeyModifiers) -> Self
Construct a mouse payload from decoded coordinates, button, and modifiers.
The constructor stores its arguments unchanged. Pass zero-based cell coordinates for ordinary mouse modes, or zero-based pixel offsets for SGR-Pixel mode. It never allocates or panics.