aboutsummaryrefslogtreecommitdiff
path: root/sys/teken
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>2017-08-18 15:40:40 +0000
committerBruce Evans <bde@FreeBSD.org>2017-08-18 15:40:40 +0000
commit15e0c6511ac1ea694aee312d4553539998d80f59 (patch)
treeb865836400985068f733c8de3c54f45843ff151e /sys/teken
parent5651294282461de8e6c26c195528e420546beddf (diff)
downloadsrc-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/teken')
-rw-r--r--sys/teken/sequences3
-rw-r--r--sys/teken/teken.h2
-rw-r--r--sys/teken/teken_subr_compat.h26
3 files changed, 28 insertions, 3 deletions
diff --git a/sys/teken/sequences b/sys/teken/sequences
index 76eebd185296..0891f17e06b7 100644
--- a/sys/teken/sequences
+++ b/sys/teken/sequences
@@ -103,9 +103,10 @@ VPA Vertical Position Absolute ^[ [ d n
# Cons25 compatibility sequences
C25BLPD Cons25 set bell pitch duration ^[ [ = B r r
C25BORD Cons25 set border ^[ [ = A r
-C25CURS Cons25 set cursor type ^[ [ = S r
C25DBG Cons25 set default background ^[ [ = G r
C25DFG Cons25 set default foreground ^[ [ = F r
+C25GCS Cons25 set global cursor shape ^[ [ = C v
+C25LCT Cons25 set local cursor type ^[ [ = S r
C25MODE Cons25 set terminal mode ^[ [ = T r
C25SGR Cons25 set graphic rendition ^[ [ x r r
C25VTSW Cons25 switch virtual terminal ^[ [ z r
diff --git a/sys/teken/teken.h b/sys/teken/teken.h
index e1ea13673554..61efe5417c0c 100644
--- a/sys/teken/teken.h
+++ b/sys/teken/teken.h
@@ -102,6 +102,8 @@ typedef void tf_param_t(void *, int, unsigned int);
#define TP_SETBELLPD_DURATION(pd) ((pd) & 0xffff)
#define TP_MOUSE 6
#define TP_SETBORDER 7
+#define TP_SETLOCALCURSOR 8
+#define TP_SETGLOBALCURSOR 9
typedef void tf_respond_t(void *, const void *, size_t);
typedef struct {
diff --git a/sys/teken/teken_subr_compat.h b/sys/teken/teken_subr_compat.h
index 64341eec6d17..6142c7958f9f 100644
--- a/sys/teken/teken_subr_compat.h
+++ b/sys/teken/teken_subr_compat.h
@@ -34,10 +34,32 @@ teken_subr_cons25_set_border(teken_t *t, unsigned int c)
}
static void
-teken_subr_cons25_set_cursor_type(teken_t *t, unsigned int type)
+teken_subr_cons25_set_global_cursor_shape(teken_t *t, unsigned int ncmds,
+ unsigned int cmds[])
+{
+ unsigned int code, i;
+
+ /*
+ * Pack the args to work around API deficiencies. This requires
+ * knowing too much about the low level to be fully compatible.
+ * Returning when ncmds > 3 is necessary and happens to be
+ * compatible. Discarding high bits is necessary and happens to
+ * be incompatible only for invalid args when ncmds == 3.
+ */
+ if (ncmds > 3)
+ return;
+ code = 0;
+ for (i = ncmds; i > 0; i--)
+ code = (code << 8) | (cmds[i - 1] & 0xff);
+ code = (code << 8) | ncmds;
+ teken_funcs_param(t, TP_SETGLOBALCURSOR, code);
+}
+
+static void
+teken_subr_cons25_set_local_cursor_type(teken_t *t, unsigned int type)
{
- teken_funcs_param(t, TP_SHOWCURSOR, type != 1);
+ teken_funcs_param(t, TP_SETLOCALCURSOR, type);
}
static const teken_color_t cons25_colors[8] = { TC_BLACK, TC_BLUE,