summaryrefslogtreecommitdiff
path: root/sys/dev/wscons/wsdisplay.c
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2013-10-18 13:54:10 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2013-10-18 13:54:10 +0000
commit4f55dcff0a28e263b548fe8048682b41a7affa3e (patch)
tree58ef36f04f1dc7af59ff598ae6b86aa86ea8a462 /sys/dev/wscons/wsdisplay.c
parent0e724c882678c61297f6e6523cd47110e62f5597 (diff)
Introduce a dedicated private header file to control the optional features
of wscons (which usually get disabled for installation kernels, to save space), instead of duplicating parts of it to too many places. No functional change.
Diffstat (limited to 'sys/dev/wscons/wsdisplay.c')
-rw-r--r--sys/dev/wscons/wsdisplay.c59
1 files changed, 27 insertions, 32 deletions
diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c
index bb260788ac3..867be152a9f 100644
--- a/sys/dev/wscons/wsdisplay.c
+++ b/sys/dev/wscons/wsdisplay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsdisplay.c,v 1.112 2013/07/06 14:35:45 kettenis Exp $ */
+/* $OpenBSD: wsdisplay.c,v 1.113 2013/10/18 13:54:08 miod Exp $ */
/* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */
/*
@@ -31,12 +31,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SMALL_KERNEL
-#define WSMOUSED_SUPPORT
-#define BURNER_SUPPORT
-#define SCROLLBACK_SUPPORT
-#endif
-
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/device.h>
@@ -54,6 +48,7 @@
#include <sys/timeout.h>
#include <sys/poll.h>
+#include <dev/wscons/wscons_features.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wsksymvar.h>
@@ -115,7 +110,7 @@ struct wsscreen {
struct wsdisplay_softc *sc;
-#ifdef WSMOUSED_SUPPORT
+#ifdef HAVE_WSMOUSED_SUPPORT
/* mouse console support via wsmoused(8) */
u_int mouse; /* mouse cursor position */
u_int cursor; /* selection cursor position (if
@@ -144,7 +139,7 @@ struct wsscreen {
#define IS_SEL_BY_CHAR(scr) ((scr)->mouse_flags & SEL_BY_CHAR)
#define IS_SEL_BY_WORD(scr) ((scr)->mouse_flags & SEL_BY_WORD)
#define IS_SEL_BY_LINE(scr) ((scr)->mouse_flags & SEL_BY_LINE)
-#endif /* WSMOUSED_SUPPORT */
+#endif /* HAVE_WSMOUSED_SUPPORT */
};
struct wsscreen *wsscreen_attach(struct wsdisplay_softc *, int, const char *,
@@ -173,7 +168,7 @@ struct wsdisplay_softc {
int sc_focusidx; /* available only if sc_focus isn't null */
struct wsscreen *sc_focus;
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
struct timeout sc_burner;
int sc_burnoutintvl;
int sc_burninintvl;
@@ -199,7 +194,7 @@ struct wsdisplay_softc {
#endif
#endif /* NWSKBD > 0 */
-#ifdef WSMOUSED_SUPPORT
+#ifdef HAVE_WSMOUSED_SUPPORT
dev_t wsmoused_dev; /* device opened by wsmoused(8), when active */
int wsmoused_sleep; /* true when wsmoused(8) is sleeping */
@@ -415,7 +410,7 @@ wsdisplay_addscreen(struct wsdisplay_softc *sc, int idx,
}
splx(s);
-#ifdef WSMOUSED_SUPPORT
+#ifdef HAVE_WSMOUSED_SUPPORT
allocate_copybuffer(sc); /* enlarge the copy buffer if necessary */
#endif
return (0);
@@ -618,7 +613,7 @@ wsdisplay_common_detach(struct wsdisplay_softc *sc, int flags)
return (rc);
}
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
timeout_del(&sc->sc_burner);
#endif
@@ -773,7 +768,7 @@ wsdisplay_common_attach(struct wsdisplay_softc *sc, int console, int kbdmux,
if (i > start)
wsdisplay_addscreen_print(sc, start, i-start);
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
sc->sc_burnoutintvl = (hz * WSDISPLAY_DEFBURNOUT) / 1000;
sc->sc_burninintvl = (hz * WSDISPLAY_DEFBURNIN ) / 1000;
sc->sc_burnflags = 0; /* off by default */
@@ -950,7 +945,7 @@ wsdisplayclose(dev_t dev, int flag, int mode, struct proc *p)
scr->scr_flags &= ~SCR_OPEN;
-#ifdef WSMOUSED_SUPPORT
+#ifdef HAVE_WSMOUSED_SUPPORT
/* remove the selection at logout */
if (sc->sc_copybuffer != NULL)
bzero(sc->sc_copybuffer, sc->sc_copybuffer_size);
@@ -1121,7 +1116,7 @@ wsdisplay_internal_ioctl(struct wsdisplay_softc *sc, struct wsscreen *scr,
switch (cmd) {
case WSDISPLAYIO_SMODE:
case WSDISPLAYIO_USEFONT:
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
case WSDISPLAYIO_SVIDEO:
case WSDISPLAYIO_SBURNER:
#endif
@@ -1154,7 +1149,7 @@ wsdisplay_internal_ioctl(struct wsdisplay_softc *sc, struct wsscreen *scr,
scr->scr_flags |= SCR_GRAPHICS |
((d == WSDISPLAYIO_MODE_DUMBFB) ? SCR_DUMBFB : 0);
-#ifdef WSMOUSED_SUPPORT
+#ifdef HAVE_WSMOUSED_SUPPORT
/*
* wsmoused cohabitation with X-Window support
* X-Window is starting
@@ -1166,7 +1161,7 @@ wsdisplay_internal_ioctl(struct wsdisplay_softc *sc, struct wsscreen *scr,
(*scr->scr_dconf->wsemul->reset)
(scr->scr_dconf->wsemulcookie, WSEMUL_CLEARCURSOR);
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
/* enable video _immediately_ if it nedes to be... */
if (sc->sc_burnman)
wsdisplay_burner(sc);
@@ -1177,7 +1172,7 @@ wsdisplay_internal_ioctl(struct wsdisplay_softc *sc, struct wsscreen *scr,
}
#endif
} else {
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
/* reenable the burner after exiting from X */
if (!sc->sc_burnman) {
sc->sc_burnout = sc->sc_burnoutintvl;
@@ -1185,7 +1180,7 @@ wsdisplay_internal_ioctl(struct wsdisplay_softc *sc, struct wsscreen *scr,
}
#endif
-#ifdef WSMOUSED_SUPPORT
+#ifdef HAVE_WSMOUSED_SUPPORT
/*
* wsmoused cohabitation with X-Window support
* X-Window is ending
@@ -1212,7 +1207,7 @@ wsdisplay_internal_ioctl(struct wsdisplay_softc *sc, struct wsscreen *scr,
(scr->scr_dconf->wsemulcookie, WSEMUL_SYNCFONT);
return (error);
#undef d
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
case WSDISPLAYIO_GVIDEO:
*(u_int *)data = !sc->sc_burnman;
break;
@@ -1271,7 +1266,7 @@ wsdisplay_internal_ioctl(struct wsdisplay_softc *sc, struct wsscreen *scr,
}
return (error);
#undef d
-#endif /* BURNER_SUPPORT */
+#endif /* HAVE_BURNER_SUPPORT */
case WSDISPLAYIO_GETSCREEN:
return (wsdisplay_getscreen(sc,
(struct wsdisplay_addscreendata *)data));
@@ -1319,7 +1314,7 @@ wsdisplay_cfg_ioctl(struct wsdisplay_softc *sc, u_long cmd, caddr_t data,
#endif
switch (cmd) {
-#ifdef WSMOUSED_SUPPORT
+#ifdef HAVE_WSMOUSED_SUPPORT
case WSDISPLAYIO_WSMOUSED:
error = wsmoused(sc, cmd, data, flag, p);
return (error);
@@ -1496,10 +1491,10 @@ wsdisplaystart(struct tty *tp)
buf = tp->t_outq.c_cf;
if (!(scr->scr_flags & SCR_GRAPHICS)) {
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
wsdisplay_burn(sc, WSDISPLAY_BURN_OUTPUT);
#endif
-#ifdef WSMOUSED_SUPPORT
+#ifdef HAVE_WSMOUSED_SUPPORT
if (scr == sc->sc_focus) {
if (ISSET(scr->mouse_flags, SEL_EXISTS))
/* hide a potential selection */
@@ -1891,7 +1886,7 @@ wsdisplay_switch(struct device *dev, int no, int waitok)
sc->sc_oldscreen = sc->sc_focusidx;
-#ifdef WSMOUSED_SUPPORT
+#ifdef HAVE_WSMOUSED_SUPPORT
/*
* wsmoused cohabitation with X-Window support
*
@@ -1934,7 +1929,7 @@ wsdisplay_switch(struct device *dev, int no, int waitok)
wsmoused_wakeup(sc);
}
-#endif /* WSMOUSED_SUPPORT */
+#endif /* HAVE_WSMOUSED_SUPPORT */
#ifdef WSDISPLAY_COMPAT_USL
#define wsswitch_cb1 ((void (*)(void *, int, int))wsdisplay_switch1)
@@ -2155,7 +2150,7 @@ wsdisplay_cnputc(dev_t dev, int i)
return;
dc = &wsdisplay_console_conf;
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
/*wsdisplay_burn(wsdisplay_console_device, WSDISPLAY_BURN_OUTPUT);*/
#endif
(void)(*dc->wsemul->output)(dc->wsemulcookie, &c, 1, 1);
@@ -2319,7 +2314,7 @@ wsdisplay_resume_device(struct device *dev)
}
}
-#ifdef SCROLLBACK_SUPPORT
+#ifdef HAVE_SCROLLBACK_SUPPORT
void
wsscrollback(void *arg, int op)
{
@@ -2344,7 +2339,7 @@ wsscrollback(void *arg, int op)
}
#endif
-#ifdef BURNER_SUPPORT
+#ifdef HAVE_BURNER_SUPPORT
void
wsdisplay_burn(void *v, u_int flags)
{
@@ -2381,7 +2376,7 @@ wsdisplay_burner(void *v)
}
#endif
-#ifdef WSMOUSED_SUPPORT
+#ifdef HAVE_WSMOUSED_SUPPORT
/*
* wsmoused(8) support functions
*/
@@ -3463,4 +3458,4 @@ wsmoused_wakeup(struct wsdisplay_softc *sc)
}
#endif /* NWSMOUSE > 0 */
}
-#endif /* WSMOUSED_SUPPORT */
+#endif /* HAVE_WSMOUSED_SUPPORT */