- Fix SC_ALT_MOUSE_IMAGE; don't blink the mouse cursor.
- Fix non-destructive, underline text cursor.
This commit is contained in:
parent
c1cdadfffe
commit
091323598f
@ -207,6 +207,67 @@ vga_txtcursor_shape(scr_stat *scp, int base, int height, int blink)
|
||||
scp->font_size, blink);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_txtcharcursor(scr_stat *scp, int at, u_short c, u_short a, int flip)
|
||||
{
|
||||
sc_softc_t *sc;
|
||||
|
||||
sc = scp->sc;
|
||||
scp->cursor_saveunder_char = c;
|
||||
scp->cursor_saveunder_attr = a;
|
||||
|
||||
#ifndef SC_NO_FONT_LOADING
|
||||
if (sc->flags & SC_CHAR_CURSOR) {
|
||||
unsigned char *font;
|
||||
int h;
|
||||
int i;
|
||||
|
||||
if (scp->font_size < 14) {
|
||||
font = sc->font_8;
|
||||
h = 8;
|
||||
} else if (scp->font_size >= 16) {
|
||||
font = sc->font_16;
|
||||
h = 16;
|
||||
} else {
|
||||
font = sc->font_14;
|
||||
h = 14;
|
||||
}
|
||||
if (scp->cursor_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) {
|
||||
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 */
|
||||
{
|
||||
if ((a & 0x7000) == 0x7000) {
|
||||
a &= 0x8f00;
|
||||
if ((a & 0x0700) == 0)
|
||||
a |= 0x0700;
|
||||
} else {
|
||||
a |= 0x7000;
|
||||
if ((a & 0x0700) == 0x0700)
|
||||
a &= 0xf000;
|
||||
}
|
||||
if (flip)
|
||||
a = (a & 0x8800)
|
||||
| ((a & 0x7000) >> 4) | ((a & 0x0700) << 4);
|
||||
sc_vtb_putc(&scp->scr, at, c, a);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
vga_txtcursor(scr_stat *scp, int at, int blink, int on, int flip)
|
||||
{
|
||||
@ -234,25 +295,10 @@ vga_txtcursor(scr_stat *scp, int at, int blink, int on, int flip)
|
||||
scp->status &= ~VR_CURSOR_BLINK;
|
||||
if (on) {
|
||||
scp->status |= VR_CURSOR_ON;
|
||||
cursor_attr = sc_vtb_geta(&scp->vtb, at);
|
||||
scp->cursor_saveunder_char = sc_vtb_getc(&scp->scr, at);
|
||||
scp->cursor_saveunder_attr = cursor_attr;
|
||||
if ((cursor_attr & 0x7000) == 0x7000) {
|
||||
cursor_attr &= 0x8f00;
|
||||
if ((cursor_attr & 0x0700) == 0)
|
||||
cursor_attr |= 0x0700;
|
||||
} else {
|
||||
cursor_attr |= 0x7000;
|
||||
if ((cursor_attr & 0x0700) == 0x0700)
|
||||
cursor_attr &= 0xf000;
|
||||
}
|
||||
if (flip)
|
||||
cursor_attr = (cursor_attr & 0x8800)
|
||||
| ((cursor_attr & 0x7000) >> 4)
|
||||
| ((cursor_attr & 0x0700) << 4);
|
||||
sc_vtb_putc(&scp->scr, at,
|
||||
sc_vtb_getc(&scp->scr, at),
|
||||
cursor_attr);
|
||||
draw_txtcharcursor(scp, at,
|
||||
sc_vtb_getc(&scp->scr, at),
|
||||
sc_vtb_geta(&scp->scr, at),
|
||||
flip);
|
||||
} else {
|
||||
cursor_attr = scp->cursor_saveunder_attr;
|
||||
if (flip)
|
||||
@ -289,15 +335,15 @@ draw_txtmouse(scr_stat *scp, int x, int y)
|
||||
|
||||
/* prepare mousepointer char's bitmaps */
|
||||
pos = (y/scp->font_size - scp->yoff)*scp->xsize + x/8 - scp->xoff;
|
||||
bcopy(scp->font + sc_vtb_getc(&scp->vtb, pos)*scp->font_size,
|
||||
bcopy(scp->font + sc_vtb_getc(&scp->scr, pos)*scp->font_size,
|
||||
&font_buf[0], scp->font_size);
|
||||
bcopy(scp->font + sc_vtb_getc(&scp->vtb, pos + 1)*scp->font_size,
|
||||
bcopy(scp->font + sc_vtb_getc(&scp->scr, pos + 1)*scp->font_size,
|
||||
&font_buf[32], scp->font_size);
|
||||
bcopy(scp->font
|
||||
+ sc_vtb_getc(&scp->vtb, pos + scp->xsize)*scp->font_size,
|
||||
+ sc_vtb_getc(&scp->scr, pos + scp->xsize)*scp->font_size,
|
||||
&font_buf[64], scp->font_size);
|
||||
bcopy(scp->font
|
||||
+ sc_vtb_getc(&scp->vtb, pos + scp->xsize + 1)*scp->font_size,
|
||||
+ sc_vtb_getc(&scp->scr, pos + scp->xsize + 1)*scp->font_size,
|
||||
&font_buf[96], scp->font_size);
|
||||
for (i = 0; i < scp->font_size; ++i) {
|
||||
cursor[i] = font_buf[i]<<8 | font_buf[i+32];
|
||||
|
@ -119,13 +119,14 @@ sc_mouse_move(scr_stat *scp, int x, int y)
|
||||
int s;
|
||||
|
||||
s = spltty();
|
||||
scp->mouse_xpos = x;
|
||||
scp->mouse_ypos = y;
|
||||
if (ISGRAPHSC(scp))
|
||||
scp->mouse_xpos = scp->mouse_oldxpos = x;
|
||||
scp->mouse_ypos = scp->mouse_oldypos = y;
|
||||
if (scp->font_size <= 0)
|
||||
scp->mouse_pos = scp->mouse_oldpos = 0;
|
||||
else
|
||||
scp->mouse_pos = scp->mouse_oldpos =
|
||||
(y/scp->font_size - scp->yoff)*scp->xsize + x/8 - scp->xoff;
|
||||
scp->status |= MOUSE_MOVED;
|
||||
splx(s);
|
||||
}
|
||||
|
||||
@ -133,8 +134,6 @@ sc_mouse_move(scr_stat *scp, int x, int y)
|
||||
static void
|
||||
set_mouse_pos(scr_stat *scp)
|
||||
{
|
||||
static int last_xpos = -1, last_ypos = -1;
|
||||
|
||||
if (scp->mouse_xpos < scp->xoff*8)
|
||||
scp->mouse_xpos = scp->xoff*8;
|
||||
if (scp->mouse_ypos < scp->yoff*scp->font_size)
|
||||
@ -152,7 +151,7 @@ set_mouse_pos(scr_stat *scp)
|
||||
scp->mouse_ypos = (scp->ysize + scp->yoff)*scp->font_size - 1;
|
||||
}
|
||||
|
||||
if (scp->mouse_xpos != last_xpos || scp->mouse_ypos != last_ypos) {
|
||||
if (scp->mouse_xpos != scp->mouse_oldxpos || scp->mouse_ypos != scp->mouse_oldypos) {
|
||||
scp->status |= MOUSE_MOVED;
|
||||
scp->mouse_pos =
|
||||
(scp->mouse_ypos/scp->font_size - scp->yoff)*scp->xsize
|
||||
@ -175,6 +174,9 @@ sc_draw_mouse_image(scr_stat *scp)
|
||||
++scp->sc->videoio_in_progress;
|
||||
(*scp->rndr->draw_mouse)(scp, scp->mouse_xpos, scp->mouse_ypos, TRUE);
|
||||
scp->mouse_oldpos = scp->mouse_pos;
|
||||
scp->mouse_oldxpos = scp->mouse_xpos;
|
||||
scp->mouse_oldypos = scp->mouse_ypos;
|
||||
scp->status |= MOUSE_VISIBLE;
|
||||
--scp->sc->videoio_in_progress;
|
||||
}
|
||||
|
||||
@ -206,6 +208,7 @@ sc_remove_mouse_image(scr_stat *scp)
|
||||
mark_for_update(scp, i + 1);
|
||||
}
|
||||
#endif /* PC98 */
|
||||
scp->status &= ~MOUSE_VISIBLE;
|
||||
--scp->sc->videoio_in_progress;
|
||||
}
|
||||
|
||||
@ -666,10 +669,9 @@ sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
|
||||
s = spltty();
|
||||
if (!(scp->sc->flags & SC_MOUSE_ENABLED)) {
|
||||
scp->sc->flags |= SC_MOUSE_ENABLED;
|
||||
if (!ISGRAPHSC(cur_scp)) {
|
||||
cur_scp->status |= MOUSE_VISIBLE;
|
||||
cur_scp->status &= ~MOUSE_HIDDEN;
|
||||
if (!ISGRAPHSC(cur_scp))
|
||||
mark_all(cur_scp);
|
||||
}
|
||||
splx(s);
|
||||
return 0;
|
||||
} else {
|
||||
@ -749,10 +751,7 @@ sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
|
||||
sc_touch_scrn_saver();
|
||||
}
|
||||
|
||||
#ifndef SC_NO_CUTPASTE
|
||||
if (!ISGRAPHSC(cur_scp) && (cur_scp->sc->flags & SC_MOUSE_ENABLED))
|
||||
cur_scp->status |= MOUSE_VISIBLE;
|
||||
#endif /* SC_NO_CUTPASTE */
|
||||
cur_scp->status &= ~MOUSE_HIDDEN;
|
||||
|
||||
if (cur_scp->mouse_signal) {
|
||||
/* has controlling process died? */
|
||||
@ -806,10 +805,7 @@ sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
|
||||
if (mouse->u.event.value > 0)
|
||||
sc_touch_scrn_saver();
|
||||
|
||||
#ifndef SC_NO_CUTPASTE
|
||||
if (!ISGRAPHSC(cur_scp) && (cur_scp->sc->flags & SC_MOUSE_ENABLED))
|
||||
cur_scp->status |= MOUSE_VISIBLE;
|
||||
#endif /* SC_NO_CUTPASTE */
|
||||
cur_scp->status &= ~MOUSE_HIDDEN;
|
||||
|
||||
if (cur_scp->mouse_signal) {
|
||||
if (cur_scp->mouse_proc &&
|
||||
|
@ -207,6 +207,67 @@ vga_txtcursor_shape(scr_stat *scp, int base, int height, int blink)
|
||||
scp->font_size, blink);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_txtcharcursor(scr_stat *scp, int at, u_short c, u_short a, int flip)
|
||||
{
|
||||
sc_softc_t *sc;
|
||||
|
||||
sc = scp->sc;
|
||||
scp->cursor_saveunder_char = c;
|
||||
scp->cursor_saveunder_attr = a;
|
||||
|
||||
#ifndef SC_NO_FONT_LOADING
|
||||
if (sc->flags & SC_CHAR_CURSOR) {
|
||||
unsigned char *font;
|
||||
int h;
|
||||
int i;
|
||||
|
||||
if (scp->font_size < 14) {
|
||||
font = sc->font_8;
|
||||
h = 8;
|
||||
} else if (scp->font_size >= 16) {
|
||||
font = sc->font_16;
|
||||
h = 16;
|
||||
} else {
|
||||
font = sc->font_14;
|
||||
h = 14;
|
||||
}
|
||||
if (scp->cursor_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) {
|
||||
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 */
|
||||
{
|
||||
if ((a & 0x7000) == 0x7000) {
|
||||
a &= 0x8f00;
|
||||
if ((a & 0x0700) == 0)
|
||||
a |= 0x0700;
|
||||
} else {
|
||||
a |= 0x7000;
|
||||
if ((a & 0x0700) == 0x0700)
|
||||
a &= 0xf000;
|
||||
}
|
||||
if (flip)
|
||||
a = (a & 0x8800)
|
||||
| ((a & 0x7000) >> 4) | ((a & 0x0700) << 4);
|
||||
sc_vtb_putc(&scp->scr, at, c, a);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
vga_txtcursor(scr_stat *scp, int at, int blink, int on, int flip)
|
||||
{
|
||||
@ -234,25 +295,10 @@ vga_txtcursor(scr_stat *scp, int at, int blink, int on, int flip)
|
||||
scp->status &= ~VR_CURSOR_BLINK;
|
||||
if (on) {
|
||||
scp->status |= VR_CURSOR_ON;
|
||||
cursor_attr = sc_vtb_geta(&scp->vtb, at);
|
||||
scp->cursor_saveunder_char = sc_vtb_getc(&scp->scr, at);
|
||||
scp->cursor_saveunder_attr = cursor_attr;
|
||||
if ((cursor_attr & 0x7000) == 0x7000) {
|
||||
cursor_attr &= 0x8f00;
|
||||
if ((cursor_attr & 0x0700) == 0)
|
||||
cursor_attr |= 0x0700;
|
||||
} else {
|
||||
cursor_attr |= 0x7000;
|
||||
if ((cursor_attr & 0x0700) == 0x0700)
|
||||
cursor_attr &= 0xf000;
|
||||
}
|
||||
if (flip)
|
||||
cursor_attr = (cursor_attr & 0x8800)
|
||||
| ((cursor_attr & 0x7000) >> 4)
|
||||
| ((cursor_attr & 0x0700) << 4);
|
||||
sc_vtb_putc(&scp->scr, at,
|
||||
sc_vtb_getc(&scp->scr, at),
|
||||
cursor_attr);
|
||||
draw_txtcharcursor(scp, at,
|
||||
sc_vtb_getc(&scp->scr, at),
|
||||
sc_vtb_geta(&scp->scr, at),
|
||||
flip);
|
||||
} else {
|
||||
cursor_attr = scp->cursor_saveunder_attr;
|
||||
if (flip)
|
||||
@ -289,15 +335,15 @@ draw_txtmouse(scr_stat *scp, int x, int y)
|
||||
|
||||
/* prepare mousepointer char's bitmaps */
|
||||
pos = (y/scp->font_size - scp->yoff)*scp->xsize + x/8 - scp->xoff;
|
||||
bcopy(scp->font + sc_vtb_getc(&scp->vtb, pos)*scp->font_size,
|
||||
bcopy(scp->font + sc_vtb_getc(&scp->scr, pos)*scp->font_size,
|
||||
&font_buf[0], scp->font_size);
|
||||
bcopy(scp->font + sc_vtb_getc(&scp->vtb, pos + 1)*scp->font_size,
|
||||
bcopy(scp->font + sc_vtb_getc(&scp->scr, pos + 1)*scp->font_size,
|
||||
&font_buf[32], scp->font_size);
|
||||
bcopy(scp->font
|
||||
+ sc_vtb_getc(&scp->vtb, pos + scp->xsize)*scp->font_size,
|
||||
+ sc_vtb_getc(&scp->scr, pos + scp->xsize)*scp->font_size,
|
||||
&font_buf[64], scp->font_size);
|
||||
bcopy(scp->font
|
||||
+ sc_vtb_getc(&scp->vtb, pos + scp->xsize + 1)*scp->font_size,
|
||||
+ sc_vtb_getc(&scp->scr, pos + scp->xsize + 1)*scp->font_size,
|
||||
&font_buf[96], scp->font_size);
|
||||
for (i = 0; i < scp->font_size; ++i) {
|
||||
cursor[i] = font_buf[i]<<8 | font_buf[i+32];
|
||||
|
@ -191,8 +191,8 @@ sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode, int xsize, int ysize,
|
||||
* This is a kludge to fend off scrn_update() while we
|
||||
* muck around with scp. XXX
|
||||
*/
|
||||
scp->status |= UNKNOWN_MODE;
|
||||
scp->status &= ~(GRAPHICS_MODE | PIXEL_MODE);
|
||||
scp->status |= UNKNOWN_MODE | MOUSE_HIDDEN;
|
||||
scp->status &= ~(GRAPHICS_MODE | PIXEL_MODE | MOUSE_VISIBLE);
|
||||
scp->mode = mode;
|
||||
scp->xsize = xsize;
|
||||
scp->ysize = ysize;
|
||||
@ -258,8 +258,8 @@ sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode)
|
||||
}
|
||||
|
||||
/* set up scp */
|
||||
scp->status |= (UNKNOWN_MODE | GRAPHICS_MODE);
|
||||
scp->status &= ~PIXEL_MODE;
|
||||
scp->status |= (UNKNOWN_MODE | GRAPHICS_MODE | MOUSE_HIDDEN);
|
||||
scp->status &= ~(PIXEL_MODE | MOUSE_VISIBLE);
|
||||
scp->mode = mode;
|
||||
/*
|
||||
* Don't change xsize and ysize; preserve the previous vty
|
||||
@ -388,8 +388,8 @@ sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize, int ysize,
|
||||
sc_hist_save(scp);
|
||||
#endif
|
||||
prev_ysize = scp->ysize;
|
||||
scp->status |= (UNKNOWN_MODE | PIXEL_MODE);
|
||||
scp->status &= ~GRAPHICS_MODE;
|
||||
scp->status |= (UNKNOWN_MODE | PIXEL_MODE | MOUSE_HIDDEN);
|
||||
scp->status &= ~(GRAPHICS_MODE | MOUSE_VISIBLE);
|
||||
scp->xsize = xsize;
|
||||
scp->ysize = ysize;
|
||||
scp->xoff = (scp->xpixel/8 - xsize)/2;
|
||||
@ -676,7 +676,7 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
return error;
|
||||
}
|
||||
#ifndef PC98
|
||||
scp->status |= UNKNOWN_MODE;
|
||||
scp->status |= UNKNOWN_MODE | MOUSE_HIDDEN;
|
||||
splx(s);
|
||||
/* no restore fonts & palette */
|
||||
if (scp == scp->sc->cur_scp)
|
||||
@ -705,7 +705,7 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
splx(s);
|
||||
return error;
|
||||
}
|
||||
scp->status |= (UNKNOWN_MODE | PIXEL_MODE);
|
||||
scp->status |= (UNKNOWN_MODE | PIXEL_MODE | MOUSE_HIDDEN);
|
||||
splx(s);
|
||||
if (scp == scp->sc->cur_scp) {
|
||||
set_mode(scp);
|
||||
@ -724,7 +724,7 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
splx(s);
|
||||
return error;
|
||||
}
|
||||
scp->status |= UNKNOWN_MODE;
|
||||
scp->status |= UNKNOWN_MODE | MOUSE_HIDDEN;
|
||||
splx(s);
|
||||
#ifdef PC98
|
||||
if (scp == scp->sc->cur_scp)
|
||||
|
@ -633,12 +633,7 @@ sckbdevent(keyboard_t *thiskbd, int event, void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef SC_NO_CUTPASTE
|
||||
if (sc->cur_scp->status & MOUSE_VISIBLE) {
|
||||
sc_remove_mouse_image(sc->cur_scp);
|
||||
sc->cur_scp->status &= ~MOUSE_VISIBLE;
|
||||
}
|
||||
#endif /* SC_NO_CUTPASTE */
|
||||
sc->cur_scp->status |= MOUSE_HIDDEN;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1479,6 +1474,7 @@ sccncheckc(dev_t dev)
|
||||
static void
|
||||
sccndbctl(dev_t dev, int on)
|
||||
{
|
||||
/* assert(sc_console_unit >= 0) */
|
||||
/* try to switch to the kernel console screen */
|
||||
if (on && debugger == 0) {
|
||||
/*
|
||||
@ -1489,8 +1485,10 @@ sccndbctl(dev_t dev, int on)
|
||||
scrn_timer(NULL);
|
||||
if (!cold
|
||||
&& sc_console->sc->cur_scp->smode.mode == VT_AUTO
|
||||
&& sc_console->smode.mode == VT_AUTO)
|
||||
&& sc_console->smode.mode == VT_AUTO) {
|
||||
sc_console->sc->cur_scp->status |= MOUSE_HIDDEN;
|
||||
sc_switch_scr(sc_console->sc, sc_console->index);
|
||||
}
|
||||
}
|
||||
if (on)
|
||||
++debugger;
|
||||
@ -1719,12 +1717,18 @@ scrn_update(scr_stat *scp, int show_cursor)
|
||||
|
||||
#ifndef SC_NO_CUTPASTE
|
||||
/* remove the previous mouse pointer image if necessary */
|
||||
if ((scp->status & (MOUSE_VISIBLE | MOUSE_MOVED))
|
||||
== (MOUSE_VISIBLE | MOUSE_MOVED)) {
|
||||
/* FIXME: I don't like this... XXX */
|
||||
sc_remove_mouse_image(scp);
|
||||
if (scp->end >= scp->xsize*scp->ysize)
|
||||
scp->end = scp->xsize*scp->ysize - 1;
|
||||
if (scp->status & MOUSE_VISIBLE) {
|
||||
s = scp->mouse_pos;
|
||||
e = scp->mouse_pos + scp->xsize + 1;
|
||||
if ((scp->status & (MOUSE_MOVED | MOUSE_HIDDEN))
|
||||
|| and_region(&s, &e, scp->start, scp->end)
|
||||
|| ((scp->status & CURSOR_ENABLED) &&
|
||||
(and_region(&s, &e, scp->cursor_pos, scp->cursor_pos)
|
||||
|| and_region(&s, &e, scp->cursor_oldpos, scp->cursor_oldpos)))) {
|
||||
sc_remove_mouse_image(scp);
|
||||
if (scp->end >= scp->xsize*scp->ysize)
|
||||
scp->end = scp->xsize*scp->ysize - 1;
|
||||
}
|
||||
}
|
||||
#endif /* !SC_NO_CUTPASTE */
|
||||
|
||||
@ -1784,49 +1788,33 @@ scrn_update(scr_stat *scp, int show_cursor)
|
||||
|
||||
/* update cursor image */
|
||||
if (scp->status & CURSOR_ENABLED) {
|
||||
s = scp->start;
|
||||
e = scp->end;
|
||||
/* did cursor move since last time ? */
|
||||
if (scp->cursor_pos != scp->cursor_oldpos) {
|
||||
/* do we need to remove old cursor image ? */
|
||||
if (scp->cursor_oldpos < scp->start ||
|
||||
scp->cursor_oldpos > scp->end) {
|
||||
if (!and_region(&s, &e, scp->cursor_oldpos, scp->cursor_oldpos))
|
||||
sc_remove_cursor_image(scp);
|
||||
}
|
||||
sc_draw_cursor_image(scp);
|
||||
}
|
||||
else {
|
||||
/* cursor didn't move, has it been overwritten ? */
|
||||
if (scp->cursor_pos >= scp->start && scp->cursor_pos <= scp->end) {
|
||||
sc_draw_cursor_image(scp);
|
||||
} else {
|
||||
/* if its a blinking cursor, we may have to update it */
|
||||
if (scp->sc->flags & SC_BLINK_CURSOR)
|
||||
(*scp->rndr->blink_cursor)(scp, scp->cursor_pos,
|
||||
sc_inside_cutmark(scp,
|
||||
scp->cursor_pos));
|
||||
}
|
||||
} else {
|
||||
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)
|
||||
/* if it's a blinking cursor, update it */
|
||||
(*scp->rndr->blink_cursor)(scp, scp->cursor_pos,
|
||||
sc_inside_cutmark(scp,
|
||||
scp->cursor_pos));
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef SC_NO_CUTPASTE
|
||||
/* update "pseudo" mouse pointer image */
|
||||
if (scp->status & MOUSE_VISIBLE) {
|
||||
/* did mouse move since last time ? */
|
||||
if (scp->status & MOUSE_MOVED) {
|
||||
/* the previous pointer image has been removed, see above */
|
||||
scp->status &= ~MOUSE_MOVED;
|
||||
sc_draw_mouse_image(scp);
|
||||
} else {
|
||||
/* mouse didn't move, has it been overwritten ? */
|
||||
if (scp->mouse_pos + scp->xsize + 1 >= scp->start &&
|
||||
scp->mouse_pos <= scp->end) {
|
||||
sc_draw_mouse_image(scp);
|
||||
} else if (scp->cursor_pos == scp->mouse_pos ||
|
||||
scp->cursor_pos == scp->mouse_pos + 1 ||
|
||||
scp->cursor_pos == scp->mouse_pos + scp->xsize ||
|
||||
scp->cursor_pos == scp->mouse_pos + scp->xsize + 1) {
|
||||
sc_draw_mouse_image(scp);
|
||||
}
|
||||
}
|
||||
if (scp->sc->flags & SC_MOUSE_ENABLED) {
|
||||
if (!(scp->status & (MOUSE_VISIBLE | MOUSE_HIDDEN))) {
|
||||
scp->status &= ~MOUSE_MOVED;
|
||||
sc_draw_mouse_image(scp);
|
||||
}
|
||||
}
|
||||
#endif /* SC_NO_CUTPASTE */
|
||||
|
||||
@ -2346,6 +2334,7 @@ exchange_scr(sc_softc_t *sc)
|
||||
else
|
||||
sc_vtb_init(&scp->scr, VTB_FRAMEBUFFER, scp->xsize, scp->ysize,
|
||||
(void *)sc->adp->va_window, FALSE);
|
||||
scp->status |= MOUSE_HIDDEN;
|
||||
sc_move_cursor(scp, scp->xpos, scp->ypos);
|
||||
if (!ISGRAPHSC(scp))
|
||||
sc_set_cursor_image(scp);
|
||||
@ -2408,7 +2397,7 @@ update_cursor_image(scr_stat *scp)
|
||||
int blink;
|
||||
|
||||
if (scp->sc->flags & SC_CHAR_CURSOR) {
|
||||
scp->cursor_base = scp->sc->cursor_base;
|
||||
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;
|
||||
@ -2430,7 +2419,7 @@ void
|
||||
sc_set_cursor_image(scr_stat *scp)
|
||||
{
|
||||
if (scp->sc->flags & SC_CHAR_CURSOR) {
|
||||
scp->cursor_base = scp->sc->cursor_base;
|
||||
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;
|
||||
@ -2566,7 +2555,6 @@ scinit(int unit, int flags)
|
||||
sc_vtb_copy(&scp->scr, 0, &scp->vtb, 0, scp->xsize*scp->ysize);
|
||||
|
||||
/* move cursors to the initial positions */
|
||||
scp->mouse_pos = scp->mouse_oldpos = 0;
|
||||
if (col >= scp->xsize)
|
||||
col = 0;
|
||||
if (row >= scp->ysize)
|
||||
@ -2580,6 +2568,9 @@ scinit(int unit, int flags)
|
||||
sc->cursor_base = 0;
|
||||
i = bios_value.cursor_end - bios_value.cursor_start + 1;
|
||||
sc->cursor_height = imin(i, scp->font_size);
|
||||
#ifndef SC_NO_SYSMOUSE
|
||||
sc_mouse_move(scp, scp->xpixel/2, scp->ypixel/2);
|
||||
#endif
|
||||
if (!ISGRAPHSC(scp)) {
|
||||
sc_set_cursor_image(scp);
|
||||
sc_draw_cursor_image(scp);
|
||||
@ -2725,7 +2716,8 @@ sc_clean_up(scr_stat *scp)
|
||||
if ((error = wait_scrn_saver_stop(scp->sc)))
|
||||
return error;
|
||||
#endif /* NSPLASH */
|
||||
scp->status &= ~MOUSE_VISIBLE;
|
||||
scp->status |= MOUSE_HIDDEN;
|
||||
sc_remove_mouse_image(scp);
|
||||
sc_remove_cutmarking(scp);
|
||||
return 0;
|
||||
}
|
||||
@ -2844,8 +2836,6 @@ init_scp(sc_softc_t *sc, int vty, scr_stat *scp)
|
||||
scp->border = BG_BLACK;
|
||||
scp->cursor_base = sc->cursor_base;
|
||||
scp->cursor_height = imin(sc->cursor_height, scp->font_size);
|
||||
scp->mouse_xpos = scp->xoff*8 + scp->xsize*8/2;
|
||||
scp->mouse_ypos = (scp->ysize + scp->yoff)*scp->font_size/2;
|
||||
scp->mouse_cut_start = scp->xsize*scp->ysize;
|
||||
scp->mouse_cut_end = -1;
|
||||
scp->mouse_signal = 0;
|
||||
@ -2855,7 +2845,7 @@ init_scp(sc_softc_t *sc, int vty, scr_stat *scp)
|
||||
scp->bell_pitch = bios_value.bell_pitch;
|
||||
scp->bell_duration = BELL_DURATION;
|
||||
scp->status |= (bios_value.shift_state & NLKED);
|
||||
scp->status |= CURSOR_ENABLED;
|
||||
scp->status |= CURSOR_ENABLED | MOUSE_HIDDEN;
|
||||
scp->pid = 0;
|
||||
scp->proc = NULL;
|
||||
scp->smode.mode = VT_AUTO;
|
||||
|
@ -56,10 +56,19 @@
|
||||
#undef SC_PIXEL_MODE
|
||||
#endif
|
||||
|
||||
#ifndef SC_CURSOR_CHAR
|
||||
#define SC_CURSOR_CHAR (0x07)
|
||||
#endif
|
||||
|
||||
#ifndef SC_MOUSE_CHAR
|
||||
#define SC_MOUSE_CHAR (0xd0)
|
||||
#endif
|
||||
|
||||
#if SC_MOUSE_CHAR <= SC_CURSOR_CHAR && SC_CURSOR_CHAR < (SC_MOUSE_CHAR + 4)
|
||||
#undef SC_CURSOR_CHAR
|
||||
#define SC_CURSOR_CHAR (SC_MOUSE_CHAR + 4)
|
||||
#endif
|
||||
|
||||
#ifndef SC_DEBUG_LEVEL
|
||||
#define SC_DEBUG_LEVEL 0
|
||||
#endif
|
||||
@ -88,19 +97,20 @@
|
||||
}
|
||||
|
||||
/* vty status flags (scp->status) */
|
||||
#define UNKNOWN_MODE 0x00010
|
||||
#define SWITCH_WAIT_REL 0x00080
|
||||
#define SWITCH_WAIT_ACQ 0x00100
|
||||
#define BUFFER_SAVED 0x00200
|
||||
#define CURSOR_ENABLED 0x00400
|
||||
#define MOUSE_MOVED 0x01000
|
||||
#define MOUSE_CUTTING 0x02000
|
||||
#define MOUSE_VISIBLE 0x04000
|
||||
#define GRAPHICS_MODE 0x08000
|
||||
#define PIXEL_MODE 0x10000
|
||||
#define SAVER_RUNNING 0x20000
|
||||
#define VR_CURSOR_BLINK 0x40000
|
||||
#define VR_CURSOR_ON 0x80000
|
||||
#define UNKNOWN_MODE 0x00010 /* unknown video mode */
|
||||
#define SWITCH_WAIT_REL 0x00080 /* waiting for vty release */
|
||||
#define SWITCH_WAIT_ACQ 0x00100 /* waiting for vty ack */
|
||||
#define BUFFER_SAVED 0x00200 /* vty buffer is saved */
|
||||
#define CURSOR_ENABLED 0x00400 /* text cursor is enabled */
|
||||
#define MOUSE_MOVED 0x01000 /* mouse cursor has moved */
|
||||
#define MOUSE_CUTTING 0x02000 /* mouse cursor is cutting text */
|
||||
#define MOUSE_VISIBLE 0x04000 /* mouse cursor is showing */
|
||||
#define GRAPHICS_MODE 0x08000 /* vty is in a graphics mode */
|
||||
#define PIXEL_MODE 0x10000 /* vty is in a raster text mode */
|
||||
#define SAVER_RUNNING 0x20000 /* screen saver is running */
|
||||
#define VR_CURSOR_BLINK 0x40000 /* blinking text cursor */
|
||||
#define VR_CURSOR_ON 0x80000 /* text cursor is on */
|
||||
#define MOUSE_HIDDEN 0x100000 /* mouse cursor is temporarily hidden */
|
||||
|
||||
/* misc defines */
|
||||
#define FALSE 0
|
||||
@ -204,6 +214,7 @@ typedef struct sc_softc {
|
||||
u_char *font_16;
|
||||
#endif
|
||||
|
||||
u_char cursor_char;
|
||||
u_char mouse_char;
|
||||
|
||||
} sc_softc_t;
|
||||
@ -248,6 +259,8 @@ typedef struct scr_stat {
|
||||
int mouse_oldpos; /* mouse old buffer position */
|
||||
short mouse_xpos; /* mouse x coordinate */
|
||||
short mouse_ypos; /* mouse y coordinate */
|
||||
short mouse_oldxpos; /* mouse previous x coordinate */
|
||||
short mouse_oldypos; /* mouse previous y coordinate */
|
||||
short mouse_buttons; /* mouse buttons */
|
||||
int mouse_cut_start; /* mouse cut start pos */
|
||||
int mouse_cut_end; /* mouse cut end pos */
|
||||
|
@ -129,6 +129,7 @@ sc_softc_t
|
||||
if (!(sc->flags & SC_INIT_DONE)) {
|
||||
sc->keyboard = -1;
|
||||
sc->adapter = -1;
|
||||
sc->cursor_char = SC_CURSOR_CHAR;
|
||||
sc->mouse_char = SC_MOUSE_CHAR;
|
||||
}
|
||||
return sc;
|
||||
|
Loading…
Reference in New Issue
Block a user