summaryrefslogtreecommitdiff
path: root/sys/dev/wscons/wsdisplay.c
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-11-04 21:58:33 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-11-04 21:58:33 +0000
commit1850051cfd8bf1e29df55c9c15db029ec9c35d41 (patch)
treef06895349524011643fef1c53e5b9216a53122a9 /sys/dev/wscons/wsdisplay.c
parente273d9496ba2803c0c4c70e16afea88fc9ae23ee (diff)
Only compile the mouse pasting code if wsmouse is configured in the kernel;
shaves a few dozens of KB on installation media.
Diffstat (limited to 'sys/dev/wscons/wsdisplay.c')
-rw-r--r--sys/dev/wscons/wsdisplay.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c
index 79ef18629a8..ed5fa0f5a3b 100644
--- a/sys/dev/wscons/wsdisplay.c
+++ b/sys/dev/wscons/wsdisplay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsdisplay.c,v 1.54 2004/09/21 18:36:23 miod Exp $ */
+/* $OpenBSD: wsdisplay.c,v 1.55 2004/11/04 21:58:32 miod Exp $ */
/* $NetBSD: wsdisplay.c,v 1.37.4.1 2000/06/30 16:27:53 simonb Exp $ */
/*
@@ -108,6 +108,7 @@ struct wsscreen {
struct wsdisplay_softc *sc;
+#if NWSMOUSE > 0
/* mouse console support via wsmoused(8) */
unsigned short mouse; /* mouse cursor position */
unsigned short cursor; /* selection cursor position (if
@@ -135,6 +136,7 @@ struct wsscreen {
#define IS_SEL_BY_WORD(ws) ((ws)->mouse_flags & SEL_BY_WORD)
#define IS_SEL_BY_LINE(ws) ((ws)->mouse_flags & SEL_BY_LINE)
unsigned char mouse_flags; /* flags, status of the mouse */
+#endif /* NWSMOUSE > 0 */
};
struct wsscreen *wsscreen_attach(struct wsdisplay_softc *, int,
@@ -182,8 +184,10 @@ struct wsdisplay_softc {
#endif
#endif /* NWSKBD > 0 */
+#if NWSMOUSE > 0
dev_t wsmoused_dev; /* device opened by wsmoused(8), when active */
int wsmoused_sleep; /* true when wsmoused(8) is sleeping */
+#endif /* NWSMOUSE > 0 */
};
extern struct cfdriver wsdisplay_cd;
@@ -259,9 +263,11 @@ int wsdisplay_switch3(void *, int, int);
int wsdisplay_clearonclose;
+#if NWSMOUSE > 0
char *Copybuffer;
u_int Copybuffer_size;
char Paste_avail;
+#endif
struct wsscreen *
wsscreen_attach(sc, console, emul, type, cookie, ccol, crow, defattr)
@@ -323,7 +329,9 @@ wsscreen_attach(sc, console, emul, type, cookie, ccol, crow, defattr)
scr->scr_syncops = 0;
scr->sc = sc;
+#if NWSMOUSE > 0
scr->mouse_flags = 0;
+#endif
#ifdef WSDISPLAY_COMPAT_RAWKBD
scr->scr_rawkbd = 0;
#endif
@@ -436,7 +444,9 @@ wsdisplay_addscreen(sc, idx, screentype, emul)
}
splx(s);
+#if NWSMOUSE > 0
allocate_copybuffer(sc); /* enlarge the copy buffer is necessary */
+#endif
return (0);
}
@@ -889,10 +899,12 @@ wsdisplayclose(dev, flag, mode, p)
scr->scr_flags &= ~SCR_OPEN;
+#if NWSMOUSE > 0
/* remove the selection at logout */
if (Copybuffer)
bzero(Copybuffer, Copybuffer_size);
Paste_avail = 0;
+#endif
return (0);
}
@@ -1086,11 +1098,13 @@ wsdisplay_internal_ioctl(sc, scr, cmd, data, flag, p)
((d == WSDISPLAYIO_MODE_DUMBFB) ?
SCR_DUMBFB : 0);
+#if NWSMOUSE > 0
/*
* wsmoused cohabitation with X-Window support
* X-Window is starting
*/
wsmoused_release(sc);
+#endif
/* disable the burner while X is running */
if (sc->sc_burnout)
@@ -1101,12 +1115,14 @@ wsdisplay_internal_ioctl(sc, scr, cmd, data, flag, p)
if (!sc->sc_burnman)
wsdisplay_burn(sc, sc->sc_burnflags);
+#if NWSMOUSE > 0
/*
* wsmoused cohabitation with X-Window support
* X-Window is ending
*/
wsmoused_wakeup(sc);
+#endif
}
} else if (d == WSDISPLAYIO_MODE_EMUL)
return (EINVAL);
@@ -1211,9 +1227,11 @@ wsdisplay_cfg_ioctl(sc, cmd, data, flag, p)
#endif
switch (cmd) {
+#if NWSMOUSE > 0
case WSDISPLAYIO_WSMOUSED:
error = wsmoused(sc, cmd, data, flag, p);
return (error);
+#endif
case WSDISPLAYIO_ADDSCREEN:
#define d ((struct wsdisplay_addscreendata *)data)
if ((error = wsdisplay_addscreen(sc, d->idx,
@@ -1415,6 +1433,7 @@ wsdisplaystart(tp)
if (!(scr->scr_flags & SCR_GRAPHICS)) {
KASSERT(WSSCREEN_HAS_EMULATOR(scr));
wsdisplay_burn(sc, WSDISPLAY_BURN_OUTPUT);
+#if NWSMOUSE > 0
if (scr == sc->sc_focus) {
if (IS_SEL_EXISTS(sc->sc_focus))
/* hide a potential selection */
@@ -1422,6 +1441,7 @@ wsdisplaystart(tp)
/* hide a potential mouse cursor */
mouse_hide(sc);
}
+#endif
(*scr->scr_dconf->wsemul->output)(scr->scr_dconf->wsemulcookie,
buf, n, 0);
}
@@ -1782,6 +1802,7 @@ wsdisplay_switch(dev, no, waitok)
sc->sc_oldscreen = sc->sc_focusidx;
+#if NWSMOUSE > 0
/*
* wsmoused cohabitation with X-Window support
*
@@ -1822,6 +1843,7 @@ wsdisplay_switch(dev, no, waitok)
wsmoused_wakeup(sc);
}
+#endif /* NWSMOUSE > 0 */
#define wsswitch_cb1 ((void (*)(void *, int, int))wsdisplay_switch1)
if (scr->scr_syncops) {
@@ -2165,11 +2187,11 @@ wsdisplay_shutdownhook(arg)
wsdisplay_switchtoconsole();
}
+#if NWSMOUSE > 0
/*
* wsmoused(8) support functions
*/
-
/* pointer to the current screen wsdisplay_softc structure */
static struct wsdisplay_softc *sc = NULL;
@@ -3154,13 +3176,10 @@ mouse_remove(struct wsdisplay_softc *sc)
mouse_hide(sc);
}
-
-
/* Send a wscons event to notify wsmoused(8) to release the mouse device */
void
wsmoused_release(struct wsdisplay_softc *sc)
{
-#if NWSMOUSE > 0
struct device *wsms_dev = NULL;
struct device **wsms_dev_list;
int is_wsmouse = 0;
@@ -3216,17 +3235,15 @@ wsmoused_release(struct wsdisplay_softc *sc)
WSMOUSE_INPUT_WSMOUSED_CLOSE);
}
-#endif /* NWSMOUSE > 0 */
}
/* Wakeup wsmoused(8), so that the mouse device can be reopened */
void
wsmoused_wakeup(struct wsdisplay_softc *sc)
{
-#if NWSMOUSE > 0
if (sc->wsmoused_dev) {
sc->wsmoused_sleep = 0;
wakeup(&sc->wsmoused_sleep);
}
-#endif /* NWSMOUSE > 0 */
}
+#endif /* NWSMOUSE > 0 */