diff options
-rw-r--r-- | console/ChangeLog | 4 | ||||
-rw-r--r-- | console/display.c | 8 | ||||
-rw-r--r-- | console/hurd.ti | 28 | ||||
-rw-r--r-- | hurd/ChangeLog | 11 | ||||
-rw-r--r-- | hurd/console.h | 44 |
5 files changed, 76 insertions, 19 deletions
diff --git a/console/ChangeLog b/console/ChangeLog index 9ba7ff7f..865f8cfd 100644 --- a/console/ChangeLog +++ b/console/ChangeLog @@ -1,5 +1,9 @@ 2002-09-18 Marcus Brinkmann <marcus@gnu.org> + * hurd.ti: Enable <kb2> and <kmouse>, fix the comments. + * display.c (handle_esc_bracket_question_hl): Handle escape + bracket 1000 h/l for XTerm-like mouse tracking enable/disable. + * display.c (handle_esc_bracket): Use scrolling region for <ind>, <indn>, <ri>, <rin>, <il1>, <il>, <dl1> and <dl>. Also fix off-by-one error in <ri>, <rin>. diff --git a/console/display.c b/console/display.c index 985eb759..fd257fe7 100644 --- a/console/display.c +++ b/console/display.c @@ -1427,6 +1427,14 @@ handle_esc_bracket_question_hl (display_t display, int code, int flag) display->user->cursor.status = CONS_CURSOR_INVISIBLE; /* XXX Flag cursor status change. */ break; + case 1000: + /* XTerm mouse tracking. */ + if (flag) + display->user->flags |= CONS_FLAGS_TRACK_MOUSE; + else + display->user->flags &= ~CONS_FLAGS_TRACK_MOUSE; + /* XXX Flag flags change. */ + break; } } diff --git a/console/hurd.ti b/console/hurd.ti index 18c86624..68869d8d 100644 --- a/console/hurd.ti +++ b/console/hurd.ti @@ -7,12 +7,9 @@ hurd|The GNU Hurd console server, # Hard reset. rs1=\EM, -# Compatibility: -# to vt100: We don't specify <xenl>, as we don't have the -# eat_newline_glitch. We don't support scrolling regions. We don't -# support setting/removing tab stops. -# to linux: W, we don't have PC character set. We don't have insert -# mode. +# Note about compatibility to vt100: We don't specify <xenl>, as we +# don't have the eat_newline_glitch. We don't support setting or +# removing tab stops (hts/tbc). # Cursor related capabilities. @@ -82,9 +79,8 @@ hurd|The GNU Hurd console server, il1=\E[L, il=\E[%p1%dL, # Delete one line (P1 lines). dl1=\E[M, dl=\E[%p1%dM, -# Scroll the whole screen one line (P1 lines) upwards. -# XXX Good optimization is to use ^J as Linux, although this will put -# things into the scrollback buffer, which might not be what we want. +# Scroll the whole screen one line (P1 lines) upwards. We don't use +# ^J, because this could put things into the scrollback buffer. ind=\E[S, indn=\E[%p1%dS, # Scroll the whole screen one line (P1 lines) downwards. rin=\E[%p1%dT, ri=\E[T, @@ -116,15 +112,10 @@ hurd|The GNU Hurd console server, khome=\E[1~, kich1=\E[2~, kdch1=\E[3~, kend=\E[4~, # Keycode for previous (next) page key. kpp=\E[5~, knp=\E[6~, -# XXX When we implement this. # Keycode for center of keypad area. -# kb2=\E[G -# XXX When we implement this. + kb2=\E[G, # Mouse event has occured. -# kmous=\E[M, -# XXX How does this come here? We don't have Lower Left. -# kll=\E[F, - + kmous=\E[M, # Text attribute capabilities. acsc=++\,\,--..00ii``aaffgghhjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, @@ -138,7 +129,9 @@ hurd|The GNU Hurd console server, # Video attributes colliding with color. # ORed: A_STANDOUT 1, A_UNDERLINE 2, A_REVERSE 4, A_BLINK 8, A_DIM 16, # A_BOLD 32, A_INVIS 64 -# We do our own display optimization, depending on the display driver. +# We don't define this as we do our own display optimization, +# depending on the display driver. Alternatively, we could provide +# different terminfo entries. # ncv#18, # Set background (foreground) color. setab=\E[4%p1%dm, setaf=\E[3%p1%dm, @@ -161,7 +154,6 @@ hurd|The GNU Hurd console server, # Enable (disable) real bold (not intensity bright) mode. This is a # GNU extension. gsbom=\E[>1h, grbom=\E[>1l, -# XXX Linux has those also for rmpch and smpch. # Enable (disable) alternative character set. smacs=\E[11m, rmacs=\E[10m, # Set all attributes. diff --git a/hurd/ChangeLog b/hurd/ChangeLog index 52ed7006..9cc4999f 100644 --- a/hurd/ChangeLog +++ b/hurd/ChangeLog @@ -1,3 +1,14 @@ +2002-09-18 Marcus Brinkmann <marcus@gnu.org> + + * 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. + 2002-09-16 Marcus Brinkmann <marcus@gnu.org> * console.h (conchar_attr_t): Add bits for italic and bold text 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 */ |