module
Tput::Output::Mouse
Included Modules
- Crystallabs::Helpers::Alias_Methods
Direct including types
Defined in:
tput/output/mouse.crInstance Method Summary
-
#decefr(*arguments)
A bare
*only opens the keyword-only section — there is nothing to forward for it. -
#decelr(*arguments)
A bare
*only opens the keyword-only section — there is nothing to forward for it. -
#decsle(*arguments)
A bare
*only opens the keyword-only section — there is nothing to forward for it. -
#disable_mouse(focus : Bool = false)
Disables the xterm mouse reporting modes enabled by
#enable_mouse(including SGR-Pixels 1016 and its cached cell size, and focus reporting mode 1004 if it was enabled viaenable_mouse(focus: true)). -
#enable_filter_rectangle(*arguments)
CSI Pt ; Pl ; Pb ; Pr ' w Enable Filter Rectangle (DECEFR), VT420 and up.
-
#enable_locator_reporting(*arguments)
CSI Ps ; Pu ' z Enable Locator Reporting (DECELR).
-
#enable_mouse(focus : Bool | Nil = nil, pixels : Tuple(Int32, Int32) | Bool | Nil = nil)
Enables xterm mouse reporting (button + drag + all-motion tracking with the modern SGR encoding): * 1000 - report button press and release * 1002 - additionally report motion while a button is held (drag) * 1003 - additionally report all motion * 1006 - SGR extended encoding (coordinates beyond column/row 223, and unambiguous press/release)
-
#set_locator_events(*arguments)
CSI Pm ' { Select Locator Events (DECSLE).
-
#set_mouse(x10 : Bool | Nil = nil, vt200 : Bool | Nil = nil, vt200_hilite : Bool | Nil = nil, cell_motion : Bool | Nil = nil, all_motion : Bool | Nil = nil, send_focus : Bool | Nil = nil, utf : Bool | Nil = nil, sgr : Bool | Nil = nil, urxvt : Bool | Nil = nil, pixels : Bool | Nil = nil, dec : Bool | Nil = nil, pterm : Bool | Nil = nil, jsbterm : Bool | Nil = nil, normal : Bool | Nil = nil, hilite_tracking : Bool | Nil = nil)
General mouse-mode setter.
Instance Method Detail
A bare * only opens the keyword-only section — there is nothing to
forward for it. Everything after it must be passed by name.
:nodoc:
A bare * only opens the keyword-only section — there is nothing to
forward for it. Everything after it must be passed by name.
:nodoc:
A bare * only opens the keyword-only section — there is nothing to
forward for it. Everything after it must be passed by name.
:nodoc:
Disables the xterm mouse reporting modes enabled by #enable_mouse
(including SGR-Pixels 1016 and its cached cell size, and focus reporting
mode 1004 if it was enabled via enable_mouse(focus: true)).
CSI Pt ; Pl ; Pb ; Pr ' w Enable Filter Rectangle (DECEFR), VT420 and up. Parameters are [top;left;bottom;right]. Defines the coordinates of a filter rectangle and activates it. Anytime the locator is detected outside of the filter rectangle, an outside rectangle event is generated and the rectangle is disabled. Filter rectangles are always treated as "one-shot" events. Any parameters that are omitted default to the current locator position. If all parameters are omit- ted, any locator motion will be reported. DECELR always can- cels any prevous rectangle definition.
CSI Ps ; Pu ' z Enable Locator Reporting (DECELR). Valid values for the first parameter: Ps = 0 -> Locator disabled (default). Ps = 1 -> Locator enabled. Ps = 2 -> Locator enabled for one report, then disabled. The second parameter specifies the coordinate unit for locator reports. Valid values for the second parameter: Pu = 0 <- or omitted -> default to character cells. Pu = 1 <- device physical pixels. Pu = 2 <- character cells.
Enables xterm mouse reporting (button + drag + all-motion tracking with the modern SGR encoding):
- 1000 - report button press and release
- 1002 - additionally report motion while a button is held (drag)
- 1003 - additionally report all motion
- 1006 - SGR extended encoding (coordinates beyond column/row 223, and unambiguous press/release)
1006 is what makes Tput::Input#listen receive the modern \e[<…M/m
reports. Pass focus true to also enable FocusIn/FocusOut (mode 1004).
Pass pixels the terminal's cell size ({cell_w, cell_h} in pixels) to
additionally enable SGR-Pixels reporting (DEC 1016): reports then carry
pixel coordinates, and the parser (#read_sgr) uses this cell size to
derive cell coordinates while surfacing the raw pixels on the event's
px/py. 1006 stays enabled as a cell-coordinate fallback.
pixels and focus are three-state, so a bare re-assert (this method is re-invoked to re-send the enable sequences) cannot silently desync the terminal from the parser:
- pixels
nil/ focusnil(the defaults) — leave the mode as it is: an active SGR-Pixels session keeps its cached cell size, an active 1004 stays on. - pixels
{w, h}/ focustrue— enable the mode. - pixels
false/ focusfalse— turn the mode off, sending the DECRST only when it is actually active.
CSI Pm ' { Select Locator Events (DECSLE). Valid values for the first (and any additional parameters) are: Ps = 0 -> only respond to explicit host requests (DECRQLP). (This is default). It also cancels any filter rectangle. Ps = 1 -> report button down transitions. Ps = 2 -> do not report button down transitions. Ps = 3 -> report button up transitions. Ps = 4 -> do not report button up transitions.
General mouse-mode setter. Each argument selects a reporting mode; pass
true to enable it, false to disable it, or leave it nil to not
touch it. This is the equivalent of Blessed's Program#setMouse.
- x10 —
?9, X10 compatibility (press only). - vt200 —
?1000, normal tracking (press + release). - vt200_hilite —
?1001, highlight tracking. - cell_motion —
?1002, button-event tracking (motion while pressed). - all_motion —
?1003, any-event tracking. Under tmux this is passed through directly (tmux gates?1003). - send_focus —
?1004, FocusIn/FocusOut reporting. - utf —
?1005, UTF-8 extended coordinates. - sgr —
?1006, SGR extended encoding (the modern default). - urxvt —
?1015, urxvt extended encoding. - pixels —
?1016, SGR-Pixels encoding (DEC 1016). Identical wire format tosgr(\e[< Cb ; Cx ; Cy M|m) but the coordinates are pixels rather than cells. Supersedes 1006 when both are on, so a caller wanting pixel resolution should still leavesgrenabled as a fallback. Enabling here only toggles the mode byte; the cell size needed to derive cell coordinates is set separately via#mouse_cell_pixels=(see#enable_mouse). - dec — DEC locator mode (DECELR/DECSLE).
- pterm, jsbterm — pterm / jsbterm private mouse protocols.
- normal — convenience for
vt200+all_motion. - hilite_tracking — alias of vt200_hilite.
GPM (Linux console) is not handled here: it's not a terminal-sequence
mode and is managed one layer up (e.g. Crysterm's gpm integration),
converting into the same Tput::Mouse::Event.