Class MouseEvent
java.lang.Object
org.aesh.terminal.tty.MouseEvent
Represents a mouse event from the terminal.
Mouse events are produced when mouse tracking is enabled via
MouseTracking and the terminal sends mouse reports.
The event includes the type (press, release, drag, move, scroll),
the button involved, the position (1-based), and modifier keys.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe mouse button involved in the event.static enumThe type of mouse event. -
Constructor Summary
ConstructorsConstructorDescriptionMouseEvent(MouseEvent.Type type, MouseEvent.Button button, int x, int y, boolean shift, boolean alt, boolean ctrl) Creates a new mouse event. -
Method Summary
Modifier and TypeMethodDescriptionbooleanalt()Returns true if alt/meta was held.button()Returns the button.booleanctrl()Returns true if ctrl was held.booleaninthashCode()static booleanisSgrMouseEvent(int finalChar, int[] intermediates, int intermediateCount) Checks if a CSI dispatch represents an SGR mouse event.static MouseEventparseSgr(int finalChar, int[] params, int paramCount) Parses an SGR mouse event from a CSI dispatch.booleanshift()Returns true if shift was held.toString()type()Returns the event type.intx()Returns the column (1-based).inty()Returns the row (1-based).
-
Constructor Details
-
MouseEvent
public MouseEvent(MouseEvent.Type type, MouseEvent.Button button, int x, int y, boolean shift, boolean alt, boolean ctrl) Creates a new mouse event.- Parameters:
type- the event typebutton- the buttonx- the column (1-based)y- the row (1-based)shift- true if shift was heldalt- true if alt/meta was heldctrl- true if ctrl was held
-
-
Method Details
-
type
-
button
-
x
public int x()Returns the column (1-based).- Returns:
- the column position
-
y
public int y()Returns the row (1-based).- Returns:
- the row position
-
shift
public boolean shift()Returns true if shift was held.- Returns:
- true if shift was held
-
alt
public boolean alt()Returns true if alt/meta was held.- Returns:
- true if alt/meta was held
-
ctrl
public boolean ctrl()Returns true if ctrl was held.- Returns:
- true if ctrl was held
-
parseSgr
Parses an SGR mouse event from a CSI dispatch.SGR format:
CSI < Pb ; Px ; Py M(press/drag/move/scroll) orCSI < Pb ; Px ; Py m(release).This method is designed to be called directly from a
VtHandler.csiDispatch(int, int[], int, int[], int, boolean)callback when the private marker is<.- Parameters:
finalChar- the final character ('M' for press, 'm' for release)params- the CSI parameters [Pb, Px, Py]paramCount- the number of parameters (must be 3)- Returns:
- the parsed mouse event, or null if the parameters are invalid
-
isSgrMouseEvent
public static boolean isSgrMouseEvent(int finalChar, int[] intermediates, int intermediateCount) Checks if a CSI dispatch represents an SGR mouse event.- Parameters:
finalChar- the CSI final characterintermediates- the intermediate/private-marker charactersintermediateCount- the number of intermediates- Returns:
- true if this is an SGR mouse event
-
equals
-
hashCode
-
toString
-