diff options
author | Aaron Campbell <aaron@cvs.openbsd.org> | 2000-11-15 20:00:41 +0000 |
---|---|---|
committer | Aaron Campbell <aaron@cvs.openbsd.org> | 2000-11-15 20:00:41 +0000 |
commit | b242a000586aeef1118d824d212752f2220fd979 (patch) | |
tree | 690c4ac8e1c71478f8da4bd6bc7d1ede2680aad7 /sys/dev/wscons | |
parent | 8976373b5268c34134baf8c8254d3e5068fac336 (diff) |
Support console scrollback in wscons through a new "scrollback" accessop that
hooks into the lower-level display driver. The updated vga(4) driver I'm about
to commit has support for this. This is a fairly unobtrusive way to implement
scrollback while maintaining the abstraction of the wscons system.
Diffstat (limited to 'sys/dev/wscons')
-rw-r--r-- | sys/dev/wscons/wsdisplay.c | 24 | ||||
-rw-r--r-- | sys/dev/wscons/wsdisplayvar.h | 11 | ||||
-rw-r--r-- | sys/dev/wscons/wskbd.c | 27 |
3 files changed, 53 insertions, 9 deletions
diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c index dfb4c70a660..8fbc7e34c71 100644 --- a/sys/dev/wscons/wsdisplay.c +++ b/sys/dev/wscons/wsdisplay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsdisplay.c,v 1.6 2000/08/01 16:44:33 mickey Exp $ */ +/* $OpenBSD: wsdisplay.c,v 1.7 2000/11/15 20:00:39 aaron Exp $ */ /* $NetBSD: wsdisplay.c,v 1.37.4.1 2000/06/30 16:27:53 simonb Exp $ */ /* @@ -1497,7 +1497,7 @@ wsdisplay_switch1(arg, error, waitok) } if (error) { - sc->sc_flags &= ~SC_SWITCHPENDING; + sc->sc_flags &= ~SC_SWITCHPENDING; return (error); } @@ -1508,8 +1508,8 @@ wsdisplay_switch1(arg, error, waitok) sc->sc_isconsole && wsdisplay_cons_pollmode ? 0 : wsswitch_cb2, sc); if (error == EAGAIN) { /* switch will be done asynchronously */ - return (0); -} + return (0); + } return (wsdisplay_switch2(sc, error, waitok)); } @@ -1800,6 +1800,22 @@ wsdisplay_switchtoconsole() 0, 0); } +void +wsscrollback(arg, op) + void *arg; + int op; +{ + struct wsdisplay_softc *sc = arg; + int lines; + + lines = sc->sc_focus->scr_dconf->scrdata->nrows - 1; + if (op == WSCONS_SCROLL_BACKWARD) + lines = -lines; + + (*sc->sc_accessops->scrollback)(sc->sc_accesscookie, + sc->sc_focus->scr_dconf->emulcookie, lines); +} + /* * Switch the console at shutdown. */ diff --git a/sys/dev/wscons/wsdisplayvar.h b/sys/dev/wscons/wsdisplayvar.h index 9c17be47862..413a774fb79 100644 --- a/sys/dev/wscons/wsdisplayvar.h +++ b/sys/dev/wscons/wsdisplayvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wsdisplayvar.h,v 1.2 2000/08/01 13:51:18 mickey Exp $ */ +/* $OpenBSD: wsdisplayvar.h,v 1.3 2000/11/15 20:00:39 aaron Exp $ */ /* $NetBSD: wsdisplayvar.h,v 1.14.4.1 2000/06/30 16:27:53 simonb Exp $ */ /* @@ -111,6 +111,7 @@ struct wsdisplay_accessops { int (*show_screen) __P((void *, void *, int, void (*) (void *, int, int), void *)); int (*load_font) __P((void *, void *, struct wsdisplay_font *)); + void (*scrollback) __P((void *, void *, int)); }; /* @@ -198,3 +199,11 @@ int wsdisplay_cfg_ioctl __P((struct wsdisplay_softc *sc, * for general use */ void wsdisplay_switchtoconsole __P((void)); + +/* + * for use by wskbd + */ +void wsscrollback __P((void *, int op)); + +#define WSCONS_SCROLL_BACKWARD 0 +#define WSCONS_SCROLL_FORWARD 1 diff --git a/sys/dev/wscons/wskbd.c b/sys/dev/wscons/wskbd.c index 37381dd4068..16be7a19ebe 100644 --- a/sys/dev/wscons/wskbd.c +++ b/sys/dev/wscons/wskbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wskbd.c,v 1.2 2000/08/01 13:51:18 mickey Exp $ */ +/* $OpenBSD: wskbd.c,v 1.3 2000/11/15 20:00:40 aaron Exp $ */ /* $NetBSD: wskbd.c,v 1.38 2000/03/23 07:01:47 thorpej Exp $ */ /* @@ -107,6 +107,7 @@ #include <dev/wscons/wsksymvar.h> #include <dev/wscons/wseventvar.h> #include <dev/wscons/wscons_callbacks.h> +#include <dev/wscons/wsdisplayvar.h> #include "wsdisplay.h" #include "wsmux.h" @@ -1296,9 +1297,27 @@ internal_command(sc, type, ksym) break; } - if (*type != WSCONS_EVENT_KEY_DOWN || - (! MOD_ONESET(sc->id, MOD_COMMAND) && - ! MOD_ALLSET(sc->id, MOD_COMMAND1 | MOD_COMMAND2))) + if (*type != WSCONS_EVENT_KEY_DOWN) + return (0); + +#if NWSDISPLAY > 0 + switch (ksym) { + case KS_Cmd_ScrollBack: + if (MOD_ONESET(sc->id, MOD_ANYSHIFT)) { + wsscrollback(sc->sc_displaydv, WSCONS_SCROLL_BACKWARD); + return (1); + } + + case KS_Cmd_ScrollFwd: + if (MOD_ONESET(sc->id, MOD_ANYSHIFT)) { + wsscrollback(sc->sc_displaydv, WSCONS_SCROLL_FORWARD); + return (1); + } + } +#endif + + if (!MOD_ONESET(sc->id, MOD_COMMAND) && + !MOD_ALLSET(sc->id, MOD_COMMAND1 | MOD_COMMAND2)) return (0); switch (ksym) { |