Source-Changes-HG archive

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

[src/trunk]: src/sbin/wsconsctl PR/19925: David Ferlier: add scrolling suppor...



details:   https://anonhg.NetBSD.org/src/rev/588a19239ea0
branches:  trunk
changeset: 567033:588a19239ea0
user:      christos <christos%NetBSD.org@localhost>
date:      Fri May 28 21:44:15 2004 +0000

description:
PR/19925: David Ferlier: add scrolling support to wscons

diffstat:

 sbin/wsconsctl/display.c  |  30 +++++++++++++++++++++++++++++-
 sbin/wsconsctl/keyboard.c |  30 +++++++++++++++++++++++++++++-
 2 files changed, 58 insertions(+), 2 deletions(-)

diffs (130 lines):

diff -r 82db6bb04552 -r 588a19239ea0 sbin/wsconsctl/display.c
--- a/sbin/wsconsctl/display.c  Fri May 28 21:42:29 2004 +0000
+++ b/sbin/wsconsctl/display.c  Fri May 28 21:44:15 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: display.c,v 1.2 2002/04/07 10:40:04 hannken Exp $ */
+/*     $NetBSD: display.c,v 1.3 2004/05/28 21:44:15 christos Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -37,6 +37,7 @@
  */
 
 #include <sys/ioctl.h>
+#include <stdio.h>
 #include <sys/time.h>
 #include <dev/wscons/wsconsio.h>
 #include <err.h>
@@ -44,10 +45,13 @@
 
 static int dpytype;
 static struct wsdisplay_usefontdata font;
+static struct wsdisplay_scroll_data scroll_l;
 
 struct field display_field_tab[] = {
     { "type",                  &dpytype,       FMT_DPYTYPE,    FLG_RDONLY },
     { "font",                  &font.name,     FMT_STRING,     FLG_WRONLY },
+    { "scroll.fastlines",      &scroll_l.fastlines, FMT_UINT, FLG_MODIFY },
+    { "scroll.slowlines",      &scroll_l.slowlines, FMT_UINT, FLG_MODIFY },
 };
 
 int display_field_tab_len = sizeof(display_field_tab)/
@@ -60,6 +64,15 @@
        if (field_by_value(&dpytype)->flags & FLG_GET)
                if (ioctl(fd, WSDISPLAYIO_GTYPE, &dpytype) < 0)
                        err(1, "WSDISPLAYIO_GTYPE");
+       
+       scroll_l.which = 0;
+       if (field_by_value(&scroll_l.fastlines)->flags & FLG_GET)
+               scroll_l.which |= WSDISPLAY_SCROLL_DOFASTLINES;
+       if (field_by_value(&scroll_l.slowlines)->flags & FLG_GET)
+               scroll_l.which |= WSDISPLAY_SCROLL_DOSLOWLINES;
+       if (scroll_l.which != 0 && 
+               ioctl(fd, WSDISPLAYIO_DGSCROLL, &scroll_l) < 0)
+                       err(1, "WSDISPLAYIO_GSCROLL");
 }
 
 void
@@ -71,4 +84,19 @@
                        err(1, "WSDISPLAYIO_SFONT");
                pr_field(field_by_value(&font.name), " -> ");
        }
+       
+       scroll_l.which = 0;
+       if (field_by_value(&scroll_l.fastlines)->flags & FLG_SET)
+               scroll_l.which |= WSDISPLAY_SCROLL_DOFASTLINES;
+       if (field_by_value(&scroll_l.slowlines)->flags & FLG_SET)
+               scroll_l.which |= WSDISPLAY_SCROLL_DOSLOWLINES;
+
+       if (scroll_l.which & WSDISPLAY_SCROLL_DOFASTLINES)
+               pr_field(field_by_value(&scroll_l.fastlines), " -> ");
+       if (scroll_l.which & WSDISPLAY_SCROLL_DOSLOWLINES)
+               pr_field(field_by_value(&scroll_l.slowlines), " -> ");
+       if (scroll_l.which != 0 &&
+               ioctl(fd, WSDISPLAYIO_DSSCROLL, &scroll_l) < 0)
+               err (1, "WSDISPLAYIO_SSCROLL");
+
 }
diff -r 82db6bb04552 -r 588a19239ea0 sbin/wsconsctl/keyboard.c
--- a/sbin/wsconsctl/keyboard.c Fri May 28 21:42:29 2004 +0000
+++ b/sbin/wsconsctl/keyboard.c Fri May 28 21:44:15 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: keyboard.c,v 1.3 2001/09/19 12:45:24 ad Exp $ */
+/*     $NetBSD: keyboard.c,v 1.4 2004/05/28 21:44:15 christos Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -52,6 +52,7 @@
                                                           and in util.c */
 static struct wskbd_keyrepeat_data repeat;
 static struct wskbd_keyrepeat_data dfrepeat;
+static struct wskbd_scroll_data scroll;
 static int ledstate;
 static kbd_t kbdencoding;
 
@@ -71,6 +72,8 @@
     { "ledstate",              &ledstate,      FMT_UINT,       0 },
     { "encoding",              &kbdencoding,   FMT_KBDENC,     FLG_MODIFY },
     { "keyclick",              &keyclick,      FMT_UINT,       FLG_MODIFY },
+       { "scroll.mode",        &scroll.mode,   FMT_UINT,       FLG_MODIFY },
+       { "scroll.modifier",    &scroll.modifier,       FMT_UINT,       FLG_MODIFY },
 };
 
 int keyboard_field_tab_len = sizeof(keyboard_field_tab)/
@@ -141,6 +144,15 @@
                ioctl(fd, WSKBDIO_GETKEYCLICK, &keyclick);
                /* Optional; don't complain. */
        }
+       
+       scroll.which = 0;
+       if (field_by_value(&scroll.mode)->flags & FLG_GET)
+               scroll.which |= WSKBD_SCROLL_DOMODE;
+       if (field_by_value(&scroll.modifier)->flags & FLG_GET)
+               scroll.which |= WSKBD_SCROLL_DOMODIFIER;
+       if (scroll.which != 0 && 
+               ioctl(fd, WSKBDIO_GETSCROLL, &scroll) < 0)
+                       err(1, "WSKBDIO_GETSCROLL");
 }
 
 void
@@ -229,4 +241,20 @@
                        err(1, "WSKBDIO_SETKEYCLICK");
                pr_field(field_by_value(&keyclick), " -> ");
        }
+
+
+       scroll.which = 0;
+       if (field_by_value(&scroll.mode)->flags & FLG_SET)
+               scroll.which |= WSKBD_SCROLL_DOMODE;
+       if (field_by_value(&scroll.modifier)->flags & FLG_SET)
+               scroll.which |= WSKBD_SCROLL_DOMODIFIER;
+
+       if (scroll.which & WSKBD_SCROLL_DOMODE)
+               pr_field(field_by_value(&scroll.mode), " -> ");
+       if (scroll.which & WSKBD_SCROLL_DOMODIFIER)
+               pr_field(field_by_value(&scroll.modifier), " -> ");
+       if (scroll.which != 0 &&
+               ioctl(fd, WSKBDIO_SETSCROLL, &scroll) < 0)
+               err (1, "WSKBDIO_SETSCROLL");
 }
+



Home | Main Index | Thread Index | Old Index