mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-05-29 16:25:20 +00:00
vt: add mouse encoding C API
Expose the internal mouse encoding functionality through the C API, following the same pattern as the existing key encoding API. This allows external consumers of libvt to encode mouse events into terminal escape sequences (X10, UTF-8, SGR, URxvt, SGR-Pixels). The API is split into two opaque handle types: GhosttyMouseEvent for building normalized mouse events (action, button, modifiers, position) and GhosttyMouseEncoder for converting those events into escape sequences. The encoder is configured via a setopt interface supporting tracking mode, output format, renderer geometry, button state, and optional motion deduplication by last cell. Encoder state can also be bulk-configured from a terminal handle via ghostty_mouse_encoder_setopt_from_terminal. Failed encodes due to insufficient buffer space report the required size without mutating deduplication state.
This commit is contained in:
@@ -4,7 +4,7 @@ const std = @import("std");
|
||||
/// from ButtonState because button state is simply the current state
|
||||
/// of a mouse button but an action is something that triggers via
|
||||
/// an GUI event and supports more.
|
||||
pub const Action = enum { press, release, motion };
|
||||
pub const Action = enum(c_int) { press, release, motion };
|
||||
|
||||
/// The state of a mouse button.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user