Add a scteken_set_cursor() (sc to teken) method and use it to fix
some cases of initialization and resetting of the teken cursor position. (This bad name is consistent with others, but it is too easy to confuse with scteken_cursor() which goes in the opposite direction.) The following cases were broken: - for booting without a syscons console, the teken and sc positions for ttyv0 were (0, 0), but are supposed to be somewhere in the middle of the screen (after carefully preserved BIOS and loader messages) (at least if there is no mode switch that loses the messages). - after mode switches, the screen is cleared and the cursor is supposed to be moved to (0, 0), but it was only moved there for sc. The following case was hacked to work: - for booting with a syscons console, it was arranged that scteken_init() for the console could see a nonzero cursor position and adjust, although this broke the sc seeing it in the non-console case above.
This commit is contained in:
parent
ffeeb2ab3f
commit
ad530aa98b
@ -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);
|
||||
}
|
||||
@ -295,6 +291,17 @@ scteken_fkeystr(scr_stat *scp, int c)
|
||||
return (teken_get_sequence(&ts->ts_teken, k));
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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) \
|
||||
|
Loading…
Reference in New Issue
Block a user