From 1387460130760179bb62909bb7c7696102fdd0e7 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Wed, 18 Sep 2002 17:31:54 +0000 Subject: hurd/ 2002-09-18 Marcus Brinkmann * console.h (struct cons_display): Add a new flag CONS_FLAGS_TRACK_MOUSE. (CONS_MOUSE_BUTTON_MASK, CONS_MOUSE_BUTTON1, CONS_MOUSE_BUTTON2, CONS_MOUSE_BUTTON3, CONS_MOUSE_RELEASE, CONS_MOUSE_MOD_MASK, CONS_MOUSE_MOD_SHIFT, CONS_MOUSE_MOD_META, CONS_MOUSE_MOD_CTRL, CONS_MOUSE_OFFSET_BASE, CONS_MOUSE_EVENT_LENGTH, CONS_MOUSE_EVENT_PREFIX, CONS, MOUSE_EVENT): New macro. (CONS_KEY_B2): New macro. console/ 2002-09-18 Marcus Brinkmann * hurd.ti: Enable and , fix the comments. * display.c (handle_esc_bracket_question_hl): Handle escape bracket 1000 h/l for XTerm-like mouse tracking enable/disable. --- hurd/console.h | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'hurd/console.h') diff --git a/hurd/console.h b/hurd/console.h index 09fd088f..11a40dfc 100644 --- a/hurd/console.h +++ b/hurd/console.h @@ -92,10 +92,20 @@ struct cons_display bits define the age, upper 16 bits the major version. */ + /* Various one bit flags that don't deserve their own field. */ -#define CONS_FLAGS_SCROLL_LOCK 0x00000001 + + /* The output is stopped. The client can display the status of this + flag, but should not otherwise interpret it. */ +#define CONS_FLAGS_SCROLL_LOCK 0x00000001 + + /* Tracking mouse events is requested. See CONS_MOUSE_* macros + further down. */ +#define CONS_FLAGS_TRACK_MOUSE 0x00000002 + uint32_t flags; + struct { uint32_t width; /* Width of screen matrix. */ @@ -257,5 +267,37 @@ struct cons_display #define CONS_KEY_PPAGE "\e[5~" /* Previous page. */ #define CONS_KEY_NPAGE "\e[6~" /* Next page. */ #define CONS_KEY_BTAB "\e[Z" /* Back tab key. */ +#define CONS_KEY_B2 "\e[G" /* Center of keypad. */ + +/* Mouse support is compatible to xterm's mouse tracking feature. */ + +#define CONS_MOUSE_BUTTON_MASK 0x03 +#define CONS_MOUSE_BUTTON1 0x00 +#define CONS_MOUSE_BUTTON2 0x01 +#define CONS_MOUSE_BUTTON3 0x02 +#define CONS_MOUSE_RELEASE 0x03 +#define CONS_MOUSE_MOD_MASK 0x1c +#define CONS_MOUSE_MOD_SHIFT 0x04 +#define CONS_MOUSE_MOD_META 0x08 +#define CONS_MOUSE_MOD_CTRL 0x10 + +/* Screen positions are offset by this value. */ +#define CONS_MOUSE_OFFSET_BASE 0x21 + +#define CONS_MOUSE_EVENT_LENGTH 6 +#define CONS_MOUSE_EVENT_PREFIX "\e[M" + +/* This macro populates STR with the mouse event EVENT at position X + and Y, and returns 1 if successul and 0 if X or Y is out of + range. X and Y start from 0. */ +#define CONS_MOUSE_EVENT(str,event,x,y) \ + (((int)(x) < 0 || (int)(x) + CONS_MOUSE_OFFSET_BASE > 255 \ + || (int)(y) < 0 || (int)(y) + CONS_MOUSE_OFFSET_BASE > 255) ? 0 \ + : ((*(str) = CONS_MOUSE_EVENT_PREFIX[0]), \ + (*((str) + 1) = CONS_MOUSE_EVENT_PREFIX[1]), \ + (*((str) + 2) = CONS_MOUSE_EVENT_PREFIX[2]), \ + (*((str) + 3) = (char)((int)(event) + CONS_MOUSE_OFFSET_BASE)), \ + (*((str) + 4) = (char)((int)(x) + CONS_MOUSE_OFFSET_BASE)), \ + (*((str) + 5) = (char)((int)(y) + CONS_MOUSE_OFFSET_BASE), 1))) #endif /* _HURD_CONSOLE_H */ -- cgit v1.2.3