diff options
author | Bruce Evans <bde@FreeBSD.org> | 2017-08-18 15:40:40 +0000 |
---|---|---|
committer | Bruce Evans <bde@FreeBSD.org> | 2017-08-18 15:40:40 +0000 |
commit | 15e0c6511ac1ea694aee312d4553539998d80f59 (patch) | |
tree | b865836400985068f733c8de3c54f45843ff151e /sys/dev/syscons | |
parent | 5651294282461de8e6c26c195528e420546beddf (diff) | |
download | src-15e0c6511ac1ea694aee312d4553539998d80f59.tar.gz src-15e0c6511ac1ea694aee312d4553539998d80f59.zip |
Fix syscons escape sequence for setting the local cursor type. This sequence
was aliased to a vt sequence, causing and fixing various bugs.
For syscons, this restores support for arg 2 which sets blinking block
too forcefully, and restores bugs for arg 0 and 1. Arg 2 is used for
vs in the cons25 entry in termcap, but I've never noticed an application
that uses this. The bugs involve replacing local settings by global
ones and need better handling of defaults to fix.
For vt, this requires moving the aliasing code from teken to vt where
it belongs. This sequences is very important for cons25 compatibility
in vt since it is used by the cons25 termcap entries for ve, vi and
vs. vt can't properly support vs for either cons25 or xterm since it
doesn't support blinking. For xterm, the termcap entry for vs asks
for something different using 12;25h instead of 25h.
Rename C25CURS for this to C25LCT and change its description to be closer
to echoing the old comment about it. CURS is too generic.
Fix missing syscons escape sequence for setting the global cursor shape
(and type). Only support this in syscons since vt can't emulate anything
in it.
Notes
Notes:
svn path=/head/; revision=322662
Diffstat (limited to 'sys/dev/syscons')
-rw-r--r-- | sys/dev/syscons/scterm-teken.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/sys/dev/syscons/scterm-teken.c b/sys/dev/syscons/scterm-teken.c index 48504757052f..8aebac8e1cb3 100644 --- a/sys/dev/syscons/scterm-teken.c +++ b/sys/dev/syscons/scterm-teken.c @@ -673,8 +673,21 @@ scteken_copy(void *arg, const teken_rect_t *r, const teken_pos_t *p) static void scteken_param(void *arg, int cmd, unsigned int value) { + static int cattrs[] = { + 0, /* block */ + CONS_BLINK_CURSOR, /* blinking block */ + CONS_CHAR_CURSOR, /* underline */ + CONS_CHAR_CURSOR | CONS_BLINK_CURSOR, /* blinking underline */ + CONS_RESET_CURSOR, /* reset to default */ + CONS_HIDDEN_CURSOR, /* hide cursor */ + }; + static int tcattrs[] = { + CONS_RESET_CURSOR | CONS_LOCAL_CURSOR, /* normal */ + CONS_HIDDEN_CURSOR | CONS_LOCAL_CURSOR, /* invisible */ + CONS_BLINK_CURSOR | CONS_LOCAL_CURSOR, /* very visible */ + }; scr_stat *scp = arg; - int flags; + int flags, n, v0, v1, v2; switch (cmd) { case TP_SETBORDER: @@ -682,6 +695,39 @@ scteken_param(void *arg, int cmd, unsigned int value) if (scp == scp->sc->cur_scp) sc_set_border(scp, scp->border); break; + case TP_SETGLOBALCURSOR: + n = value & 0xff; + v0 = (value >> 8) & 0xff; + v1 = (value >> 16) & 0xff; + v2 = (value >> 24) & 0xff; + switch (n) { + case 1: /* flags only */ + if (v0 < sizeof(cattrs) / sizeof(cattrs[0])) + v0 = cattrs[v0]; + else /* backward compatibility */ + v0 = cattrs[v0 & 0x3]; + sc_change_cursor_shape(scp, v0, -1, -1); + break; + case 2: + v2 = 0; + v0 &= 0x1f; /* backward compatibility */ + v1 &= 0x1f; + /* FALL THROUGH */ + case 3: /* base and height */ + if (v2 == 0) /* count from top */ + sc_change_cursor_shape(scp, -1, + scp->font_size - v1 - 1, + v1 - v0 + 1); + else if (v2 == 1) /* count from bottom */ + sc_change_cursor_shape(scp, -1, + v0, v1 - v0 + 1); + break; + } + break; + case TP_SETLOCALCURSOR: + if (value < sizeof(tcattrs) / sizeof(tcattrs[0])) + sc_change_cursor_shape(scp, tcattrs[value], -1, -1); + break; case TP_SHOWCURSOR: if (value != 0) flags = scp->curr_curs_attr.flags & ~CONS_HIDDEN_CURSOR; |