Terminal Guide

DEC Locator Activate/Deactivate

ESC1B[5B cmd ;3b pixel '27 z7a
xterm
🔧
cmd = 0
pixel = 0

Enable or disable the DEC locator feature.

The DEC locator feature is a mouse tracking mode. If cmd = 1 or cmd = 2 it is activated. Otherwise it's disabled. If pixel = 1 the reports will be send in pixels otherwise in cells.

If cmd = 2 the locator will be enabled in single shot mode. In this mode it's automatically disabled after one report. Otherwise enable the locator until it's disabled by a later use of this sequence (or terminal reset).

On pointer events the terminal sends the following:

ESC1b [5b event ;3b state ;3b ;3b &26 w77 

Where event is either a 0, 1, 10 or one of the following:

eventMeaning
0pointer is outside the terminal (either on dec locator report current position, dec locator watch pointer leave or a mouse button event
1on dec locator report current position with pointer inside the terminal and reporting enabled
2left button pressed
3left button released
4middle button pressed
5middle button released
6right button pressed
7right button released
9scroll wheel up
11scroll wheel down
10pointer left watch rectangle or pointer entered terminal (while watching for pointer enter)
16button 8 pressed
17button 8 released
18button 9 pressed
18button 9 released

and state encodes the pressed buttons after the event (e.g. on release of the last button it is 0, on press of the left button it is 4). The left button is bit 2, the middle button is bit 1 and the right button is bit 0. Other buttons show up in state as bit (button number - 1) but only if that button was pressed/release in this event.

x and y are the pointer coordinates. If pixel mode was selected in pixels otherwise in cells.

When a pointer press or release event is reported while watching the pointer the DEC locator is deactivated.

See also dec locator watch pointer leave, dec locator select events and dec locator report current position.

This page is possibly incomplete. Please report an issue if you see something is missing or you have further information.