summaryrefslogtreecommitdiffstats
path: root/sys/dev/syscons
diff options
context:
space:
mode:
authoryokota <yokota@FreeBSD.org>2001-08-02 08:30:40 +0000
committeryokota <yokota@FreeBSD.org>2001-08-02 08:30:40 +0000
commit09383e1eceec397ac112cfaf1db425e914d8b259 (patch)
treec79575ae9a6fb28b44160934e3aadd6359c8977f /sys/dev/syscons
parent1d105403d04e4606c3ab825795b3eb9c0a32dee4 (diff)
downloadFreeBSD-src-09383e1eceec397ac112cfaf1db425e914d8b259.zip
FreeBSD-src-09383e1eceec397ac112cfaf1db425e914d8b259.tar.gz
Refine cursor type/shape control escape sequences and
ioctls. We can now add ve, vi and vs capabilities to cons25 in termcap. Discussed with and tested by: ache
Diffstat (limited to 'sys/dev/syscons')
-rw-r--r--sys/dev/syscons/scgfbrndr.c28
-rw-r--r--sys/dev/syscons/scterm-sc.c86
-rw-r--r--sys/dev/syscons/scvgarndr.c28
-rw-r--r--sys/dev/syscons/syscons.c164
-rw-r--r--sys/dev/syscons/syscons.h20
5 files changed, 215 insertions, 111 deletions
diff --git a/sys/dev/syscons/scgfbrndr.c b/sys/dev/syscons/scgfbrndr.c
index 5dd4d60..e14341f 100644
--- a/sys/dev/syscons/scgfbrndr.c
+++ b/sys/dev/syscons/scgfbrndr.c
@@ -199,8 +199,8 @@ vga_txtcursor_shape(scr_stat *scp, int base, int height, int blink)
return;
/* the caller may set height <= 0 in order to disable the cursor */
#if 0
- scp->cursor_base = base;
- scp->cursor_height = height;
+ scp->curs_attr.base = base;
+ scp->curs_attr.height = height;
#endif
(*vidsw[scp->sc->adapter]->set_hw_cursor_shape)(scp->sc->adp,
base, height,
@@ -217,7 +217,7 @@ draw_txtcharcursor(scr_stat *scp, int at, u_short c, u_short a, int flip)
scp->cursor_saveunder_attr = a;
#ifndef SC_NO_FONT_LOADING
- if (sc->flags & SC_CHAR_CURSOR) {
+ if (scp->curs_attr.flags & CONS_CHAR_CURSOR) {
unsigned char *font;
int h;
int i;
@@ -232,22 +232,20 @@ draw_txtcharcursor(scr_stat *scp, int at, u_short c, u_short a, int flip)
font = sc->font_14;
h = 14;
}
- if (scp->cursor_base >= h)
+ if (scp->curs_attr.base >= h)
return;
if (flip)
a = (a & 0x8800)
| ((a & 0x7000) >> 4) | ((a & 0x0700) << 4);
bcopy(font + c*h, font + sc->cursor_char*h, h);
font = font + sc->cursor_char*h;
- for (i = imax(h - scp->cursor_base - scp->cursor_height, 0);
- i < h - scp->cursor_base; ++i) {
+ for (i = imax(h - scp->curs_attr.base - scp->curs_attr.height, 0);
+ i < h - scp->curs_attr.base; ++i) {
font[i] ^= 0xff;
}
- sc->font_loading_in_progress = TRUE;
/* XXX */
(*vidsw[sc->adapter]->load_font)(sc->adp, 0, h, font,
sc->cursor_char, 1);
- sc->font_loading_in_progress = FALSE;
sc_vtb_putc(&scp->scr, at, sc->cursor_char, a);
} else
#endif /* SC_NO_FONT_LOADING */
@@ -274,7 +272,7 @@ vga_txtcursor(scr_stat *scp, int at, int blink, int on, int flip)
video_adapter_t *adp;
int cursor_attr;
- if (scp->cursor_height <= 0) /* the text cursor is disabled */
+ if (scp->curs_attr.height <= 0) /* the text cursor is disabled */
return;
adp = scp->sc->adp;
@@ -621,8 +619,8 @@ vga_pxlcursor_shape(scr_stat *scp, int base, int height, int blink)
return;
/* the caller may set height <= 0 in order to disable the cursor */
#if 0
- scp->cursor_base = base;
- scp->cursor_height = height;
+ scp->curs_attr.base = base;
+ scp->curs_attr.height = height;
#endif
}
@@ -644,7 +642,7 @@ draw_pxlcursor(scr_stat *scp, int at, int on, int flip)
+ scp->yoff*scp->font_size*line_width
+ (at%scp->xsize)
+ scp->font_size*line_width*(at/scp->xsize)
- + (scp->font_size - scp->cursor_base - 1)*line_width;
+ + (scp->font_size - scp->curs_attr.base - 1)*line_width;
outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */
outw(GDCIDX, 0x0003); /* data rotate/function select */
@@ -666,8 +664,8 @@ draw_pxlcursor(scr_stat *scp, int at, int on, int flip)
col = (on) ? ((a & 0xf000) >> 4) : (a & 0x0f00);
outw(GDCIDX, col | 0x00); /* set/reset */
f = &(scp->font[sc_vtb_getc(&scp->vtb, at)*scp->font_size
- + scp->font_size - scp->cursor_base - 1]);
- height = imin(scp->cursor_height, scp->font_size);
+ + scp->font_size - scp->curs_attr.base - 1]);
+ height = imin(scp->curs_attr.height, scp->font_size);
for (i = 0; i < height; ++i, --f) {
outw(GDCIDX, (*f << 8) | 0x08); /* bit mask */
writeb(d, 0);
@@ -683,7 +681,7 @@ static int pxlblinkrate = 0;
static void
vga_pxlcursor(scr_stat *scp, int at, int blink, int on, int flip)
{
- if (scp->cursor_height <= 0) /* the text cursor is disabled */
+ if (scp->curs_attr.height <= 0) /* the text cursor is disabled */
return;
if (on) {
diff --git a/sys/dev/syscons/scterm-sc.c b/sys/dev/syscons/scterm-sc.c
index ebd0ddc..fb02b92 100644
--- a/sys/dev/syscons/scterm-sc.c
+++ b/sys/dev/syscons/scterm-sc.c
@@ -189,7 +189,21 @@ scterm_scan_esc(scr_stat *scp, term_stat *tcp, u_char c)
FG_LIGHTBLUE, FG_LIGHTMAGENTA, FG_LIGHTCYAN, FG_WHITE
#endif
};
+ 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 */
+ };
sc_softc_t *sc;
+ int v0, v1, v2;
int i, n;
i = n = 0;
@@ -231,6 +245,8 @@ scterm_scan_esc(scr_stat *scp, term_stat *tcp, u_char c)
= tcp->dflt_std_color;
tcp->rev_color = tcp->dflt_rev_color;
tcp->cur_attr = mask2attr(tcp);
+ sc_change_cursor_shape(scp,
+ CONS_RESET_CURSOR | CONS_LOCAL_CURSOR, -1, -1);
sc_clear_screen(scp);
break;
@@ -562,33 +578,34 @@ scterm_scan_esc(scr_stat *scp, term_stat *tcp, u_char c)
}
break;
- case 'C': /* set cursor type & shape */
+ case 'C': /* set global/parmanent cursor type & shape */
i = spltty();
- if (!ISGRAPHSC(sc->cur_scp))
- sc_remove_cursor_image(sc->cur_scp);
- if (tcp->num_param == 1) {
- if (tcp->param[0] & 0x01)
- sc->flags |= SC_BLINK_CURSOR;
- else
- sc->flags &= ~SC_BLINK_CURSOR;
- if (tcp->param[0] & 0x02)
- sc->flags |= SC_CHAR_CURSOR;
- else
- sc->flags &= ~SC_CHAR_CURSOR;
- } else if (tcp->num_param == 2) {
- sc->cursor_base = scp->font_size
- - (tcp->param[1] & 0x1F) - 1;
- sc->cursor_height = (tcp->param[1] & 0x1F)
- - (tcp->param[0] & 0x1F) + 1;
- }
- /*
- * The cursor shape is global property;
- * all virtual consoles are affected.
- * Update the cursor in the current console...
- */
- if (!ISGRAPHSC(sc->cur_scp)) {
- sc_set_cursor_image(sc->cur_scp);
- sc_draw_cursor_image(sc->cur_scp);
+ n = tcp->num_param;
+ v0 = tcp->param[0];
+ v1 = tcp->param[1];
+ v2 = tcp->param[2];
+ 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;
}
splx(i);
break;
@@ -624,6 +641,23 @@ scterm_scan_esc(scr_stat *scp, term_stat *tcp, u_char c)
tcp->cur_attr = mask2attr(tcp);
}
break;
+
+ case 'S': /* set local/temporary cursor type & shape */
+ i = spltty();
+ n = tcp->num_param;
+ v0 = tcp->param[0];
+ switch (n) {
+ case 0:
+ v0 = 0;
+ /* FALL THROUGH */
+ case 1:
+ if (v0 < sizeof(tcattrs)/sizeof(tcattrs[0]))
+ sc_change_cursor_shape(scp,
+ tcattrs[v0], -1, -1);
+ break;
+ }
+ splx(i);
+ break;
}
#if notyet
} else if (tcp->esc == 4) { /* seen ESC Q */
diff --git a/sys/dev/syscons/scvgarndr.c b/sys/dev/syscons/scvgarndr.c
index 5dd4d60..e14341f 100644
--- a/sys/dev/syscons/scvgarndr.c
+++ b/sys/dev/syscons/scvgarndr.c
@@ -199,8 +199,8 @@ vga_txtcursor_shape(scr_stat *scp, int base, int height, int blink)
return;
/* the caller may set height <= 0 in order to disable the cursor */
#if 0
- scp->cursor_base = base;
- scp->cursor_height = height;
+ scp->curs_attr.base = base;
+ scp->curs_attr.height = height;
#endif
(*vidsw[scp->sc->adapter]->set_hw_cursor_shape)(scp->sc->adp,
base, height,
@@ -217,7 +217,7 @@ draw_txtcharcursor(scr_stat *scp, int at, u_short c, u_short a, int flip)
scp->cursor_saveunder_attr = a;
#ifndef SC_NO_FONT_LOADING
- if (sc->flags & SC_CHAR_CURSOR) {
+ if (scp->curs_attr.flags & CONS_CHAR_CURSOR) {
unsigned char *font;
int h;
int i;
@@ -232,22 +232,20 @@ draw_txtcharcursor(scr_stat *scp, int at, u_short c, u_short a, int flip)
font = sc->font_14;
h = 14;
}
- if (scp->cursor_base >= h)
+ if (scp->curs_attr.base >= h)
return;
if (flip)
a = (a & 0x8800)
| ((a & 0x7000) >> 4) | ((a & 0x0700) << 4);
bcopy(font + c*h, font + sc->cursor_char*h, h);
font = font + sc->cursor_char*h;
- for (i = imax(h - scp->cursor_base - scp->cursor_height, 0);
- i < h - scp->cursor_base; ++i) {
+ for (i = imax(h - scp->curs_attr.base - scp->curs_attr.height, 0);
+ i < h - scp->curs_attr.base; ++i) {
font[i] ^= 0xff;
}
- sc->font_loading_in_progress = TRUE;
/* XXX */
(*vidsw[sc->adapter]->load_font)(sc->adp, 0, h, font,
sc->cursor_char, 1);
- sc->font_loading_in_progress = FALSE;
sc_vtb_putc(&scp->scr, at, sc->cursor_char, a);
} else
#endif /* SC_NO_FONT_LOADING */
@@ -274,7 +272,7 @@ vga_txtcursor(scr_stat *scp, int at, int blink, int on, int flip)
video_adapter_t *adp;
int cursor_attr;
- if (scp->cursor_height <= 0) /* the text cursor is disabled */
+ if (scp->curs_attr.height <= 0) /* the text cursor is disabled */
return;
adp = scp->sc->adp;
@@ -621,8 +619,8 @@ vga_pxlcursor_shape(scr_stat *scp, int base, int height, int blink)
return;
/* the caller may set height <= 0 in order to disable the cursor */
#if 0
- scp->cursor_base = base;
- scp->cursor_height = height;
+ scp->curs_attr.base = base;
+ scp->curs_attr.height = height;
#endif
}
@@ -644,7 +642,7 @@ draw_pxlcursor(scr_stat *scp, int at, int on, int flip)
+ scp->yoff*scp->font_size*line_width
+ (at%scp->xsize)
+ scp->font_size*line_width*(at/scp->xsize)
- + (scp->font_size - scp->cursor_base - 1)*line_width;
+ + (scp->font_size - scp->curs_attr.base - 1)*line_width;
outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */
outw(GDCIDX, 0x0003); /* data rotate/function select */
@@ -666,8 +664,8 @@ draw_pxlcursor(scr_stat *scp, int at, int on, int flip)
col = (on) ? ((a & 0xf000) >> 4) : (a & 0x0f00);
outw(GDCIDX, col | 0x00); /* set/reset */
f = &(scp->font[sc_vtb_getc(&scp->vtb, at)*scp->font_size
- + scp->font_size - scp->cursor_base - 1]);
- height = imin(scp->cursor_height, scp->font_size);
+ + scp->font_size - scp->curs_attr.base - 1]);
+ height = imin(scp->curs_attr.height, scp->font_size);
for (i = 0; i < height; ++i, --f) {
outw(GDCIDX, (*f << 8) | 0x08); /* bit mask */
writeb(d, 0);
@@ -683,7 +681,7 @@ static int pxlblinkrate = 0;
static void
vga_pxlcursor(scr_stat *scp, int at, int blink, int on, int flip)
{
- if (scp->cursor_height <= 0) /* the text cursor is disabled */
+ if (scp->curs_attr.height <= 0) /* the text cursor is disabled */
return;
if (on) {
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index e499461..f8787a6 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -176,6 +176,7 @@ static int finish_vt_rel(scr_stat *scp, int release, int *s);
static int finish_vt_acq(scr_stat *scp);
static void exchange_scr(sc_softc_t *sc);
static void update_cursor_image(scr_stat *scp);
+static void change_cursor_shape(scr_stat *scp, int flags, int base, int height);
static int save_kbd_state(scr_stat *scp);
static int update_kbd_state(scr_stat *scp, int state, int mask);
static int update_kbd_leds(scr_stat *scp, int which);
@@ -697,26 +698,29 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
splx(s);
return 0;
- case CONS_CURSORTYPE: /* set cursor type blink/noblink */
+ case CONS_CURSORTYPE: /* set cursor type (obsolete) */
s = spltty();
- if (!ISGRAPHSC(sc->cur_scp))
- sc_remove_cursor_image(sc->cur_scp);
- if ((*(int*)data) & 0x01)
- sc->flags |= SC_BLINK_CURSOR;
- else
- sc->flags &= ~SC_BLINK_CURSOR;
- if ((*(int*)data) & 0x02) {
- sc->flags |= SC_CHAR_CURSOR;
- } else
- sc->flags &= ~SC_CHAR_CURSOR;
- /*
- * The cursor shape is global property; all virtual consoles
- * are affected. Update the cursor in the current console...
- */
- if (!ISGRAPHSC(sc->cur_scp)) {
- sc_set_cursor_image(sc->cur_scp);
- sc_draw_cursor_image(sc->cur_scp);
+ *(int *)data &= CONS_CURSOR_ATTRS;
+ sc_change_cursor_shape(scp, *(int *)data, -1, -1);
+ splx(s);
+ return 0;
+
+ case CONS_GETCURSORSHAPE: /* get cursor shape (new interface) */
+ if (((int *)data)[0] & CONS_LOCAL_CURSOR) {
+ ((int *)data)[0] = scp->curr_curs_attr.flags;
+ ((int *)data)[1] = scp->curr_curs_attr.base;
+ ((int *)data)[2] = scp->curr_curs_attr.height;
+ } else {
+ ((int *)data)[0] = sc->curs_attr.flags;
+ ((int *)data)[1] = sc->curs_attr.base;
+ ((int *)data)[2] = sc->curs_attr.height;
}
+ return 0;
+
+ case CONS_SETCURSORSHAPE: /* set cursor shape (new interface) */
+ s = spltty();
+ sc_change_cursor_shape(scp, ((int *)data)[0],
+ ((int *)data)[1], ((int *)data)[2]);
splx(s);
return 0;
@@ -1791,7 +1795,7 @@ scrn_update(scr_stat *scp, int show_cursor)
if (and_region(&s, &e, scp->cursor_pos, scp->cursor_pos))
/* cursor didn't move, but has been overwritten */
sc_draw_cursor_image(scp);
- else if (scp->sc->flags & SC_BLINK_CURSOR)
+ else if (scp->curs_attr.flags & CONS_BLINK_CURSOR)
/* if it's a blinking cursor, update it */
(*scp->rndr->blink_cursor)(scp, scp->cursor_pos,
sc_inside_cutmark(scp,
@@ -2408,7 +2412,7 @@ sc_draw_cursor_image(scr_stat *scp)
/* assert(scp == scp->sc->cur_scp); */
++scp->sc->videoio_in_progress;
(*scp->rndr->draw_cursor)(scp, scp->cursor_pos,
- scp->sc->flags & SC_BLINK_CURSOR, TRUE,
+ scp->curs_attr.flags & CONS_BLINK_CURSOR, TRUE,
sc_inside_cutmark(scp, scp->cursor_pos));
scp->cursor_oldpos = scp->cursor_pos;
--scp->sc->videoio_in_progress;
@@ -2420,7 +2424,7 @@ sc_remove_cursor_image(scr_stat *scp)
/* assert(scp == scp->sc->cur_scp); */
++scp->sc->videoio_in_progress;
(*scp->rndr->draw_cursor)(scp, scp->cursor_oldpos,
- scp->sc->flags & SC_BLINK_CURSOR, FALSE,
+ scp->curs_attr.flags & CONS_BLINK_CURSOR, FALSE,
sc_inside_cutmark(scp, scp->cursor_oldpos));
--scp->sc->videoio_in_progress;
}
@@ -2428,43 +2432,96 @@ sc_remove_cursor_image(scr_stat *scp)
static void
update_cursor_image(scr_stat *scp)
{
- int blink;
+ /* assert(scp == scp->sc->cur_scp); */
+ sc_remove_cursor_image(scp);
+ sc_set_cursor_image(scp);
+ sc_draw_cursor_image(scp);
+}
- if (scp->sc->flags & SC_CHAR_CURSOR) {
- scp->cursor_base = imax(0, scp->sc->cursor_base);
- scp->cursor_height = imin(scp->sc->cursor_height, scp->font_size);
- } else {
- scp->cursor_base = 0;
- scp->cursor_height = scp->font_size;
+void
+sc_set_cursor_image(scr_stat *scp)
+{
+ scp->curs_attr.flags = scp->curr_curs_attr.flags;
+ if (scp->curs_attr.flags & CONS_HIDDEN_CURSOR) {
+ /* hidden cursor is internally represented as zero-height underline */
+ scp->curs_attr.flags = CONS_CHAR_CURSOR;
+ scp->curs_attr.base = scp->curs_attr.height = 0;
+ } else if (scp->curs_attr.flags & CONS_CHAR_CURSOR) {
+ scp->curs_attr.base = imin(scp->curr_curs_attr.base,
+ scp->font_size - 1);
+ scp->curs_attr.height = imin(scp->curr_curs_attr.height,
+ scp->font_size - scp->curs_attr.base);
+ } else { /* block cursor */
+ scp->curs_attr.base = 0;
+ scp->curs_attr.height = scp->font_size;
}
- blink = scp->sc->flags & SC_BLINK_CURSOR;
/* assert(scp == scp->sc->cur_scp); */
++scp->sc->videoio_in_progress;
- (*scp->rndr->draw_cursor)(scp, scp->cursor_oldpos, blink, FALSE,
- sc_inside_cutmark(scp, scp->cursor_pos));
- (*scp->rndr->set_cursor)(scp, scp->cursor_base, scp->cursor_height, blink);
- (*scp->rndr->draw_cursor)(scp, scp->cursor_pos, blink, TRUE,
- sc_inside_cutmark(scp, scp->cursor_pos));
+ (*scp->rndr->set_cursor)(scp, scp->curs_attr.base, scp->curs_attr.height,
+ scp->curs_attr.flags & CONS_BLINK_CURSOR);
--scp->sc->videoio_in_progress;
}
+static void
+change_cursor_shape(scr_stat *scp, int flags, int base, int height)
+{
+ if ((scp == scp->sc->cur_scp) && !ISGRAPHSC(scp))
+ sc_remove_cursor_image(scp);
+
+ if (base >= 0)
+ scp->curr_curs_attr.base = base;
+ if (height >= 0)
+ scp->curr_curs_attr.height = height;
+ if (flags & CONS_RESET_CURSOR)
+ scp->curr_curs_attr = scp->dflt_curs_attr;
+ else
+ scp->curr_curs_attr.flags = flags & CONS_CURSOR_ATTRS;
+
+ if ((scp == scp->sc->cur_scp) && !ISGRAPHSC(scp)) {
+ sc_set_cursor_image(scp);
+ sc_draw_cursor_image(scp);
+ }
+}
+
void
-sc_set_cursor_image(scr_stat *scp)
+sc_change_cursor_shape(scr_stat *scp, int flags, int base, int height)
{
- if (scp->sc->flags & SC_CHAR_CURSOR) {
- scp->cursor_base = imax(0, scp->sc->cursor_base);
- scp->cursor_height = imin(scp->sc->cursor_height, scp->font_size);
- } else {
- scp->cursor_base = 0;
- scp->cursor_height = scp->font_size;
+ sc_softc_t *sc;
+ dev_t dev;
+ int s;
+ int i;
+
+ s = spltty();
+ if ((flags != -1) && (flags & CONS_LOCAL_CURSOR)) {
+ /* local (per vty) change */
+ change_cursor_shape(scp, flags, base, height);
+ splx(s);
+ return;
}
- /* assert(scp == scp->sc->cur_scp); */
- ++scp->sc->videoio_in_progress;
- (*scp->rndr->set_cursor)(scp, scp->cursor_base, scp->cursor_height,
- scp->sc->flags & SC_BLINK_CURSOR);
- --scp->sc->videoio_in_progress;
+ /* global change */
+ sc = scp->sc;
+ if (base >= 0)
+ sc->curs_attr.base = base;
+ if (height >= 0)
+ sc->curs_attr.height = height;
+ if (flags != -1) {
+ if (flags & CONS_RESET_CURSOR)
+ sc->curs_attr = sc->dflt_curs_attr;
+ else
+ sc->curs_attr.flags = flags & CONS_CURSOR_ATTRS;
+ }
+
+ for (i = sc->first_vty; i < sc->first_vty + sc->vtys; ++i) {
+ if ((dev = SC_DEV(sc, i)) == NODEV)
+ continue;
+ if ((scp = SC_STAT(dev)) == NULL)
+ continue;
+ scp->dflt_curs_attr = sc->curs_attr;
+ change_cursor_shape(scp, CONS_RESET_CURSOR, -1, -1);
+ }
+ splx(s);
}
static void
@@ -2595,12 +2652,18 @@ scinit(int unit, int flags)
scp->xpos = col;
scp->ypos = row;
scp->cursor_pos = scp->cursor_oldpos = row*scp->xsize + col;
+
if (bios_value.cursor_end < scp->font_size)
- sc->cursor_base = scp->font_size - bios_value.cursor_end - 1;
+ sc->dflt_curs_attr.base = scp->font_size -
+ bios_value.cursor_end - 1;
else
- sc->cursor_base = 0;
+ sc->dflt_curs_attr.base = 0;
i = bios_value.cursor_end - bios_value.cursor_start + 1;
- sc->cursor_height = imin(i, scp->font_size);
+ sc->dflt_curs_attr.height = imin(i, scp->font_size);
+ sc->dflt_curs_attr.flags = 0;
+ sc->curs_attr = sc->dflt_curs_attr;
+ scp->curr_curs_attr = scp->dflt_curs_attr = sc->curs_attr;
+
#ifndef SC_NO_SYSMOUSE
sc_mouse_move(scp, scp->xpixel/2, scp->ypixel/2);
#endif
@@ -2868,8 +2931,7 @@ init_scp(sc_softc_t *sc, int vty, scr_stat *scp)
scp->ts = NULL;
scp->rndr = NULL;
scp->border = BG_BLACK;
- scp->cursor_base = sc->cursor_base;
- scp->cursor_height = imin(sc->cursor_height, scp->font_size);
+ scp->curr_curs_attr = scp->dflt_curs_attr = sc->curs_attr;
scp->mouse_cut_start = scp->xsize*scp->ysize;
scp->mouse_cut_end = -1;
scp->mouse_signal = 0;
diff --git a/sys/dev/syscons/syscons.h b/sys/dev/syscons/syscons.h
index 46dde5f..5f424d5 100644
--- a/sys/dev/syscons/syscons.h
+++ b/sys/dev/syscons/syscons.h
@@ -155,6 +155,13 @@ typedef struct sc_vtb {
int vtb_tail; /* valid for VTB_RINGBUFFER only */
} sc_vtb_t;
+/* text cursor attributes */
+struct cursor_attr {
+ int flags;
+ int base;
+ int height;
+};
+
/* softc */
struct keyboard;
@@ -172,8 +179,10 @@ typedef struct sc_softc {
int flags; /* status flags */
#define SC_VISUAL_BELL (1 << 0)
#define SC_QUIET_BELL (1 << 1)
+#if 0 /* not used anymore */
#define SC_BLINK_CURSOR (1 << 2)
#define SC_CHAR_CURSOR (1 << 3)
+#endif
#define SC_MOUSE_ENABLED (1 << 4)
#define SC_SCRN_IDLE (1 << 5)
#define SC_SCRN_BLANKED (1 << 6)
@@ -205,8 +214,8 @@ typedef struct sc_softc {
long scrn_time_stamp;
- char cursor_base;
- char cursor_height;
+ struct cursor_attr dflt_curs_attr;
+ struct cursor_attr curs_attr;
u_char scr_map[256];
u_char scr_rmap[256];
@@ -267,8 +276,9 @@ typedef struct scr_stat {
int cursor_oldpos; /* cursor old buffer position */
u_short cursor_saveunder_char; /* saved char under cursor */
u_short cursor_saveunder_attr; /* saved attr under cursor */
- char cursor_base; /* cursor base line # */
- char cursor_height; /* cursor height */
+ struct cursor_attr dflt_curs_attr;
+ struct cursor_attr curr_curs_attr;
+ struct cursor_attr curs_attr;
int mouse_pos; /* mouse buffer position */
int mouse_oldpos; /* mouse old buffer position */
@@ -517,6 +527,8 @@ void sc_puts(scr_stat *scp, u_char *buf, int len);
void sc_draw_cursor_image(scr_stat *scp);
void sc_remove_cursor_image(scr_stat *scp);
void sc_set_cursor_image(scr_stat *scp);
+void sc_change_cursor_shape(scr_stat *scp, int flags,
+ int base, int height);
int sc_clean_up(scr_stat *scp);
int sc_switch_scr(sc_softc_t *sc, u_int next_scr);
void sc_alloc_scr_buffer(scr_stat *scp, int wait, int discard);
OpenPOWER on IntegriCloud