From e375c956b03f3921f222598f5bc28a44268826b3 Mon Sep 17 00:00:00 2001 From: yokota Date: Tue, 10 Jul 2001 14:13:34 +0000 Subject: Fix dependencies between kernel options: - When both SC_PIXEL_MODE and SC_NO_FONT_LOADING are defined, quietly drop SC_NO_FONT_LOADING, because the pixel(raster) console requires font. - When SC_NO_FONT_LOADING is defined, force SC_ALT_MOUSE_IMAGE. Without font, the arrow-shaped mouse cursor cannot be drawn. - Fiddle and simplify some internal macros. MFC after: 2 weeks --- sys/dev/syscons/scgfbrndr.c | 7 +++++-- sys/dev/syscons/scmouse.c | 2 -- sys/dev/syscons/scvgarndr.c | 7 +++++-- sys/dev/syscons/syscons.c | 7 ++----- sys/dev/syscons/syscons.h | 20 ++++++++++++++------ 5 files changed, 26 insertions(+), 17 deletions(-) diff --git a/sys/dev/syscons/scgfbrndr.c b/sys/dev/syscons/scgfbrndr.c index 6767610..5dd4d60 100644 --- a/sys/dev/syscons/scgfbrndr.c +++ b/sys/dev/syscons/scgfbrndr.c @@ -325,6 +325,7 @@ static void draw_txtmouse(scr_stat *scp, int x, int y) { #ifndef SC_ALT_MOUSE_IMAGE + if (ISMOUSEAVAIL(scp->sc->adp->va_flags)) { u_char font_buf[128]; u_short cursor[32]; u_char c; @@ -384,7 +385,9 @@ draw_txtmouse(scr_stat *scp, int x, int y) sc_vtb_putc(&scp->scr, pos + scp->xsize + 1, c + 3, sc_vtb_geta(&scp->scr, pos + scp->xsize + 1)); } -#else /* SC_ALT_MOUSE_IMAGE */ + } else +#endif /* SC_ALT_MOUSE_IMAGE */ + { /* Red, magenta and brown are mapped to green to to keep it readable */ static const int col_conv[16] = { 6, 6, 6, 6, 2, 2, 2, 6, 14, 14, 14, 14, 10, 10, 10, 14 @@ -401,7 +404,7 @@ draw_txtmouse(scr_stat *scp, int x, int y) else color = ((a & 0xf000) >> 4) | ((a & 0x0f00) << 4); sc_vtb_putc(&scp->scr, pos, sc_vtb_getc(&scp->scr, pos), color); -#endif /* SC_ALT_MOUSE_IMAGE */ + } } static void diff --git a/sys/dev/syscons/scmouse.c b/sys/dev/syscons/scmouse.c index 7d4180e..b8bb5d1 100644 --- a/sys/dev/syscons/scmouse.c +++ b/sys/dev/syscons/scmouse.c @@ -669,8 +669,6 @@ sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, return 0; case MOUSE_SHOW: - if (!ISMOUSEAVAIL(scp->sc->adp->va_flags)) - return EINVAL; s = spltty(); if (!(scp->sc->flags & SC_MOUSE_ENABLED)) { scp->sc->flags |= SC_MOUSE_ENABLED; diff --git a/sys/dev/syscons/scvgarndr.c b/sys/dev/syscons/scvgarndr.c index 6767610..5dd4d60 100644 --- a/sys/dev/syscons/scvgarndr.c +++ b/sys/dev/syscons/scvgarndr.c @@ -325,6 +325,7 @@ static void draw_txtmouse(scr_stat *scp, int x, int y) { #ifndef SC_ALT_MOUSE_IMAGE + if (ISMOUSEAVAIL(scp->sc->adp->va_flags)) { u_char font_buf[128]; u_short cursor[32]; u_char c; @@ -384,7 +385,9 @@ draw_txtmouse(scr_stat *scp, int x, int y) sc_vtb_putc(&scp->scr, pos + scp->xsize + 1, c + 3, sc_vtb_geta(&scp->scr, pos + scp->xsize + 1)); } -#else /* SC_ALT_MOUSE_IMAGE */ + } else +#endif /* SC_ALT_MOUSE_IMAGE */ + { /* Red, magenta and brown are mapped to green to to keep it readable */ static const int col_conv[16] = { 6, 6, 6, 6, 2, 2, 2, 6, 14, 14, 14, 14, 10, 10, 10, 14 @@ -401,7 +404,7 @@ draw_txtmouse(scr_stat *scp, int x, int y) else color = ((a & 0xf000) >> 4) | ((a & 0x0f00) << 4); sc_vtb_putc(&scp->scr, pos, sc_vtb_getc(&scp->scr, pos), color); -#endif /* SC_ALT_MOUSE_IMAGE */ + } } static void diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 56e09e5..a970b3b 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -412,9 +412,7 @@ scmeminit(void *arg) sc_alloc_scr_buffer(sc_console, FALSE, FALSE); #ifndef SC_NO_CUTPASTE - /* cut buffer is available only when the mouse pointer is used */ - if (ISMOUSEAVAIL(sc_console->sc->adp->va_flags)) - sc_alloc_cut_buffer(sc_console, FALSE); + sc_alloc_cut_buffer(sc_console, FALSE); #endif #ifndef SC_NO_HISTORY @@ -2801,8 +2799,7 @@ static scr_stat sc_init_emulator(scp, "*"); #ifndef SC_NO_CUTPASTE - if (ISMOUSEAVAIL(sc->adp->va_flags)) - sc_alloc_cut_buffer(scp, TRUE); + sc_alloc_cut_buffer(scp, TRUE); #endif #ifndef SC_NO_HISTORY diff --git a/sys/dev/syscons/syscons.h b/sys/dev/syscons/syscons.h index 5944e34..46dde5f 100644 --- a/sys/dev/syscons/syscons.h +++ b/sys/dev/syscons/syscons.h @@ -56,6 +56,20 @@ #undef SC_PIXEL_MODE #endif +/* Always load font data if the pixel (raster text) mode is to be used. */ +#ifdef SC_PIXEL_MODE +#undef SC_NO_FONT_LOADING +#endif + +/* + * If font data is not available, the `arrow'-shaped mouse cursor cannot + * be drawn. Use the alternative drawing method. + */ +#ifdef SC_NO_FONT_LOADING +#undef SC_ALT_MOUSE_IMAGE +#define SC_ALT_MOUSE_IMAGE 1 +#endif + #ifndef SC_CURSOR_CHAR #define SC_CURSOR_CHAR (0x07) #endif @@ -456,15 +470,9 @@ typedef struct { == PIXEL_MODE) #define ISUNKNOWNSC(scp) ((scp)->status & UNKNOWN_MODE) -#ifndef ISMOUSEAVAIL -#ifdef SC_ALT_MOUSE_IMAGE -#define ISMOUSEAVAIL(af) (1) -#else #define ISMOUSEAVAIL(af) ((af) & V_ADP_FONT) -#endif /* SC_ALT_MOUSE_IMAGE */ #define ISFONTAVAIL(af) ((af) & V_ADP_FONT) #define ISPALAVAIL(af) ((af) & V_ADP_PALETTE) -#endif /* ISMOUSEAVAIL */ #define ISSIGVALID(sig) ((sig) > 0 && (sig) < NSIG) -- cgit v1.1