Skip to content

SgrMouseToken ​

Namespace: Hex1b.Tokens

Assembly: Hex1b.dll

Represents an SGR (1006) mouse protocol sequence. Format: ESC [ < Cb ; Cx ; Cy M (press) or ESC [ < Cb ; Cx ; Cy m (release)

csharp
public sealed record SgrMouseToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<SgrMouseToken>

Inheritance ​

Object → AnsiToken → SgrMouseToken

Implements ​

Constructors ​

SgrMouseToken(MouseButton, MouseAction, int, int, Hex1bModifiers, int) ​

Represents an SGR (1006) mouse protocol sequence. Format: ESC [ < Cb ; Cx ; Cy M (press) or ESC [ < Cb ; Cx ; Cy m (release)

Parameters:

  • Button (MouseButton): The decoded mouse button.
  • Action (MouseAction): The mouse action (press, release, move, drag).
  • X (Int32): The X coordinate (0-based).
  • Y (Int32): The Y coordinate (0-based).
  • Modifiers (Hex1bModifiers): The modifier keys held during the event.
  • RawButtonCode (Int32): The raw button code from the sequence for serialization.
csharp
public SgrMouseToken(MouseButton Button, MouseAction Action, int X, int Y, Hex1bModifiers Modifiers, int RawButtonCode)

Properties ​

Action ​

The mouse action (press, release, move, drag).

Returns: MouseAction

csharp
public MouseAction Action { get; init; }

Button ​

The decoded mouse button.

Returns: MouseButton

csharp
public MouseButton Button { get; init; }

Modifiers ​

The modifier keys held during the event.

Returns: Hex1bModifiers

csharp
public Hex1bModifiers Modifiers { get; init; }

RawButtonCode ​

The raw button code from the sequence for serialization.

Returns: Int32

csharp
public int RawButtonCode { get; init; }

X ​

The X coordinate (0-based).

Returns: Int32

csharp
public int X { get; init; }

Y ​

The Y coordinate (0-based).

Returns: Int32

csharp
public int Y { get; init; }

Remarks ​

The SGR mouse protocol (mode 1006) uses the following button encoding: 0 = Left button1 = Middle button2 = Right button32 = Motion with button held (add to button code)64 = Scroll up65 = Scroll down

Modifier keys are encoded as bit flags added to the button code: +4 = Shift+8 = Alt/Meta+16 = Control

Released under the MIT License.