diff options
| author | Bruce Evans <bde@FreeBSD.org> | 2017-03-11 11:31:06 +0000 |
|---|---|---|
| committer | Bruce Evans <bde@FreeBSD.org> | 2017-03-11 11:31:06 +0000 |
| commit | ad530aa98b4e0f84546ee370c347bd557a214d34 (patch) | |
| tree | a84f6af84cf99337de95998fe1bc28e8e65e535f | |
| parent | ffeeb2ab3f5700cece24b508bd3b70d07fdf6686 (diff) | |
Notes
| -rw-r--r-- | sys/dev/syscons/scterm-teken.c | 21 | ||||
| -rw-r--r-- | sys/dev/syscons/syscons.c | 21 | ||||
| -rw-r--r-- | sys/dev/syscons/syscons.h | 2 |
3 files changed, 27 insertions, 17 deletions
diff --git a/sys/dev/syscons/scterm-teken.c b/sys/dev/syscons/scterm-teken.c index 0f26fdc6548f..046325ef0325 100644 --- a/sys/dev/syscons/scterm-teken.c +++ b/sys/dev/syscons/scterm-teken.c @@ -62,6 +62,7 @@ static sc_term_default_attr_t scteken_default_attr; static sc_term_clear_t scteken_clear; static sc_term_input_t scteken_input; static sc_term_fkeystr_t scteken_fkeystr; +static sc_term_set_cursor_t scteken_set_cursor; static void scteken_nop(void); typedef struct { @@ -88,6 +89,7 @@ static sc_term_sw_t sc_term_scteken = { (sc_term_notify_t *)scteken_nop, scteken_input, scteken_fkeystr, + scteken_set_cursor, }; SCTERM_MODULE(scteken, sc_term_scteken); @@ -140,13 +142,6 @@ scteken_init(scr_stat *scp, void **softc, int code) tp.tp_row = scp->ysize; tp.tp_col = scp->xsize; teken_set_winsize(&ts->ts_teken, &tp); - - if (scp->cursor_pos < scp->ysize * scp->xsize) { - /* Valid old cursor position. */ - tp.tp_row = scp->cursor_pos / scp->xsize; - tp.tp_col = scp->cursor_pos % scp->xsize; - teken_set_cursor(&ts->ts_teken, &tp); - } break; } @@ -234,6 +229,7 @@ scteken_clear(scr_stat *scp) { sc_move_cursor(scp, 0, 0); + scteken_set_cursor(scp, 0, 0); sc_vtb_clear(&scp->vtb, scp->sc->scr_map[0x20], SC_NORM_ATTR << 8); mark_all(scp); } @@ -296,6 +292,17 @@ scteken_fkeystr(scr_stat *scp, int c) } static void +scteken_set_cursor(scr_stat *scp, int col, int row) +{ + teken_stat *ts = scp->ts; + teken_pos_t tp; + + tp.tp_col = col; + tp.tp_row = row; + teken_set_cursor(&ts->ts_teken, &tp); +} + +static void scteken_nop(void) { diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index d3a5899ad34d..47a16d614d73 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -3140,16 +3140,6 @@ scinit(int unit, int flags) init_scp(sc, sc->first_vty, scp); sc_vtb_init(&scp->vtb, VTB_MEMORY, scp->xsize, scp->ysize, (void *)sc_buffer, FALSE); - - /* move cursors to the initial positions */ - if (col >= scp->xsize) - col = 0; - if (row >= scp->ysize) - row = scp->ysize - 1; - scp->xpos = col; - scp->ypos = row; - scp->cursor_pos = scp->cursor_oldpos = row*scp->xsize + col; - if (sc_init_emulator(scp, SC_DFLT_TERM)) sc_init_emulator(scp, "*"); (*scp->tsw->te_default_attr)(scp, SC_NORM_ATTR, SC_NORM_REV_ATTR); @@ -3171,6 +3161,17 @@ scinit(int unit, int flags) sc_vtb_copy(&scp->scr, 0, &scp->vtb, 0, scp->xsize*scp->ysize); #endif + /* Sync h/w cursor position to s/w (sc and teken). */ + if (col >= scp->xsize) + col = 0; + if (row >= scp->ysize) + row = scp->ysize - 1; + scp->xpos = col; + scp->ypos = row; + scp->cursor_pos = scp->cursor_oldpos = row*scp->xsize + col; + (*scp->tsw->te_set_cursor)(scp, col, row); + + /* Sync BIOS cursor shape to s/w (sc only). */ if (bios_value.cursor_end < scp->font_size) sc->dflt_curs_attr.base = scp->font_size - bios_value.cursor_end - 1; diff --git a/sys/dev/syscons/syscons.h b/sys/dev/syscons/syscons.h index 443792717ec0..bae38b5c0a47 100644 --- a/sys/dev/syscons/syscons.h +++ b/sys/dev/syscons/syscons.h @@ -394,6 +394,7 @@ typedef void sc_term_notify_t(scr_stat *scp, int event); #define SC_TE_NOTIFY_VTSWITCH_OUT 1 typedef int sc_term_input_t(scr_stat *scp, int c, struct tty *tp); typedef const char *sc_term_fkeystr_t(scr_stat *scp, int c); +typedef void sc_term_set_cursor_t(scr_stat *scp, int col, int row); typedef struct sc_term_sw { LIST_ENTRY(sc_term_sw) link; @@ -412,6 +413,7 @@ typedef struct sc_term_sw { sc_term_notify_t *te_notify; sc_term_input_t *te_input; sc_term_fkeystr_t *te_fkeystr; + sc_term_set_cursor_t *te_set_cursor; } sc_term_sw_t; #define SCTERM_MODULE(name, sw) \ |
