Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-2-0]: src/sys/dev/wscons Pull up revision 1.77 (requested by rech...



details:   https://anonhg.NetBSD.org/src/rev/9902bfdde740
branches:  netbsd-2-0
changeset: 561304:9902bfdde740
user:      tron <tron%NetBSD.org@localhost>
date:      Mon Jun 07 09:38:12 2004 +0000

description:
Pull up revision 1.77 (requested by recht in ticket #451):
PR/19925: David Ferlier: Add scrolling support to wscons.

diffstat:

 sys/dev/wscons/wsdisplay.c |  73 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 71 insertions(+), 2 deletions(-)

diffs (129 lines):

diff -r f0eb52b57d4f -r 9902bfdde740 sys/dev/wscons/wsdisplay.c
--- a/sys/dev/wscons/wsdisplay.c        Mon Jun 07 09:38:04 2004 +0000
+++ b/sys/dev/wscons/wsdisplay.c        Mon Jun 07 09:38:12 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay.c,v 1.76 2003/09/21 18:47:59 manu Exp $ */
+/* $NetBSD: wsdisplay.c,v 1.76.2.1 2004/06/07 09:38:12 tron Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.76 2003/09/21 18:47:59 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.76.2.1 2004/06/07 09:38:12 tron Exp $");
 
 #include "opt_wsdisplay_compat.h"
 #include "opt_compat_netbsd.h"
@@ -114,6 +114,9 @@
        void    *sc_accesscookie;
 
        const struct wsscreen_list *sc_scrdata;
+#ifdef WSDISPLAY_SCROLLSUPPORT
+       struct wsdisplay_scroll_data sc_scroll_values;
+#endif
 
        struct wsscreen *sc_scr[WSDISPLAY_MAXSCREEN];
        int sc_focusidx;        /* available only if sc_focus isn't null */
@@ -135,6 +138,15 @@
 #endif /* NWSKBD > 0 */
 };
 
+#ifdef WSDISPLAY_SCROLLSUPPORT
+
+struct wsdisplay_scroll_data wsdisplay_default_scroll_values = {
+       WSDISPLAY_SCROLL_DOALL,
+       25,
+       2,
+};
+#endif
+
 extern struct cfdriver wsdisplay_cd;
 
 /* Autoconfiguration definitions. */
@@ -406,6 +418,30 @@
        vdevgone(maj, mn, mn, VCHR);
 }
 
+#ifdef WSDISPLAY_SCROLLSUPPORT
+void
+wsdisplay_scroll(void *arg, int op)
+{
+       struct wsdisplay_softc *sc = arg;
+       int lines;
+
+       if (op == WSDISPLAY_SCROLL_RESET)
+               lines = 0;
+       else {
+               lines = (op & WSDISPLAY_SCROLL_LOW) ?
+                       sc->sc_scroll_values.slowlines :
+                       sc->sc_scroll_values.fastlines;
+               if (op & WSDISPLAY_SCROLL_BACKWARD)
+                       lines = -(lines);
+       }
+       
+       if (sc->sc_accessops->scroll) {
+               (*sc->sc_accessops->scroll)(sc->sc_accesscookie,
+                   sc->sc_focus->scr_dconf->emulcookie, lines);
+       }
+}
+#endif
+
 int
 wsdisplay_delscreen(struct wsdisplay_softc *sc, int idx, int flags)
 {
@@ -622,6 +658,10 @@
        sc->sc_accesscookie = accesscookie;
        sc->sc_scrdata = scrdata;
 
+#ifdef WSDISPLAY_SCROLLSUPPORT
+       sc->sc_scroll_values = wsdisplay_default_scroll_values;
+#endif
+
        /*
         * Set up a number of virtual screens if wanted. The
         * WSDISPLAYIO_ADDSCREEN ioctl is more flexible, so this code
@@ -979,6 +1019,9 @@
        int error;
        char namebuf[16];
        struct wsdisplay_font fd;
+#ifdef WSDISPLAY_SCROLLSUPPORT
+       struct wsdisplay_scroll_data *ksdp, *usdp;
+#endif
 
 #if NWSKBD > 0
        struct wsevsrc *inp;
@@ -1028,6 +1071,32 @@
            return (0);
 #undef d
 
+#ifdef WSDISPLAY_SCROLLSUPPORT
+#define        SETSCROLLLINES(dstp, srcp, dfltp)                               \
+    do {                                                               \
+       (dstp)->fastlines = ((srcp)->which &                            \
+                            WSDISPLAY_SCROLL_DOFASTLINES) ?            \
+                            (srcp)->fastlines : (dfltp)->fastlines;    \
+       (dstp)->slowlines = ((srcp)->which &                            \
+                            WSDISPLAY_SCROLL_DOSLOWLINES) ?            \
+                            (srcp)->slowlines : (dfltp)->slowlines;    \
+       (dstp)->which = WSDISPLAY_SCROLL_DOALL;                         \
+    } while (0)
+
+
+       case WSDISPLAYIO_DSSCROLL:
+               usdp = (struct wsdisplay_scroll_data *)data;
+               ksdp = &sc->sc_scroll_values;
+               SETSCROLLLINES(ksdp, usdp, ksdp);
+               return (0);
+
+       case WSDISPLAYIO_DGSCROLL:
+               usdp = (struct wsdisplay_scroll_data *)data;
+               ksdp = &sc->sc_scroll_values;
+               SETSCROLLLINES(usdp, ksdp, ksdp);
+               return (0);
+#endif
+
        case WSDISPLAYIO_SFONT:
 #define d ((struct wsdisplay_usefontdata *)data)
                if (!sc->sc_accessops->load_font)



Home | Main Index | Thread Index | Old Index