summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authoraugustss <augustss@NetBSD.org>2005-11-23 09:38:02 +0000
committeraugustss <augustss@NetBSD.org>2005-11-23 09:38:02 +0000
commit5b71c2bf99bc00bb76cda4cf30ca3e00ea83434c (patch)
tree576dac6ae24c6265aa1ea788b4c715c8eff223c2 /sys
parentf0b7793c4b160f99d7beb097034067f17b5b8326 (diff)
Some devices provide more than three (X, Y, and Z) "directions". So add
a W "coordinate" that can be used for these. This changes the type of wsmouse_input(). To avoid changing a lot of drivers a compatibilty #define is provided. Maybe changing all drivers would have been better?
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/wscons/wsconsio.h4
-rw-r--r--sys/dev/wscons/wsmouse.c31
-rw-r--r--sys/dev/wscons/wsmousevar.h10
3 files changed, 37 insertions, 8 deletions
diff --git a/sys/dev/wscons/wsconsio.h b/sys/dev/wscons/wsconsio.h
index 38b55f9847c..5c965cd2d5b 100644
--- a/sys/dev/wscons/wsconsio.h
+++ b/sys/dev/wscons/wsconsio.h
@@ -1,4 +1,4 @@
-/* $NetBSD: wsconsio.h,v 1.75 2005/08/28 13:08:16 tsutsui Exp $ */
+/* $NetBSD: wsconsio.h,v 1.76 2005/11/23 09:38:02 augustss Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -72,6 +72,8 @@ struct wscons_event {
#define WSCONS_EVENT_MOUSE_ABSOLUTE_Z 11 /* Z location */
#define WSCONS_EVENT_SCREEN_SWITCH 12 /* New screen number */
#define WSCONS_EVENT_ASCII 13 /* key code is already ascii */
+#define WSCONS_EVENT_MOUSE_DELTA_W 14 /* W delta amount */
+#define WSCONS_EVENT_MOUSE_ABSOLUTE_W 15 /* W location */
/*
diff --git a/sys/dev/wscons/wsmouse.c b/sys/dev/wscons/wsmouse.c
index 1b50325a2f6..819345115d0 100644
--- a/sys/dev/wscons/wsmouse.c
+++ b/sys/dev/wscons/wsmouse.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wsmouse.c,v 1.36 2005/06/21 14:01:13 ws Exp $ */
+/* $NetBSD: wsmouse.c,v 1.37 2005/11/23 09:38:02 augustss Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.36 2005/06/21 14:01:13 ws Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.37 2005/11/23 09:38:02 augustss Exp $");
#include "wsmouse.h"
#include "wsdisplay.h"
@@ -124,9 +124,11 @@ struct wsmouse_softc {
int sc_dx; /* delta-x */
int sc_dy; /* delta-y */
int sc_dz; /* delta-z */
+ int sc_dw; /* delta-w */
int sc_x; /* absolute-x */
int sc_y; /* absolute-y */
int sc_z; /* absolute-z */
+ int sc_w; /* absolute-w */
int sc_refcnt;
u_char sc_dying; /* device is being detached */
@@ -283,8 +285,8 @@ wsmouse_detach(struct device *self, int flags)
}
void
-wsmouse_input(struct device *wsmousedev, u_int btns /* 0 is up */,
- int x, int y, int z, u_int flags)
+wsmouse_input_xyzw(struct device *wsmousedev, u_int btns /* 0 is up */,
+ int x, int y, int z, int w, u_int flags)
{
struct wsmouse_softc *sc = (struct wsmouse_softc *)wsmousedev;
struct wscons_event *ev;
@@ -317,6 +319,8 @@ wsmouse_input(struct device *wsmousedev, u_int btns /* 0 is up */,
sc->sc_dy += y;
if (!(flags & WSMOUSE_INPUT_ABSOLUTE_Z))
sc->sc_dz += z;
+ if (!(flags & WSMOUSE_INPUT_ABSOLUTE_W))
+ sc->sc_dw += w;
/*
* We have at least one event (mouse button, delta-X, or
@@ -411,6 +415,25 @@ wsmouse_input(struct device *wsmousedev, u_int btns /* 0 is up */,
sc->sc_dz = 0;
}
}
+ if (flags & WSMOUSE_INPUT_ABSOLUTE_W) {
+ if (sc->sc_w != w) {
+ NEXT;
+ ev->type = WSCONS_EVENT_MOUSE_ABSOLUTE_W;
+ ev->value = w;
+ TIMESTAMP;
+ ADVANCE;
+ sc->sc_w = w;
+ }
+ } else {
+ if (sc->sc_dw) {
+ NEXT;
+ ev->type = WSCONS_EVENT_MOUSE_DELTA_W;
+ ev->value = sc->sc_dw;
+ TIMESTAMP;
+ ADVANCE;
+ sc->sc_dw = 0;
+ }
+ }
mb = sc->sc_mb;
while ((d = mb ^ ub) != 0) {
diff --git a/sys/dev/wscons/wsmousevar.h b/sys/dev/wscons/wsmousevar.h
index 7c589bfd799..8ea774d7c5e 100644
--- a/sys/dev/wscons/wsmousevar.h
+++ b/sys/dev/wscons/wsmousevar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: wsmousevar.h,v 1.5 2001/10/13 15:56:16 augustss Exp $ */
+/* $NetBSD: wsmousevar.h,v 1.6 2005/11/23 09:38:02 augustss Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -72,5 +72,9 @@ int wsmousedevprint(void *, const char *);
#define WSMOUSE_INPUT_ABSOLUTE_X (1<<0)
#define WSMOUSE_INPUT_ABSOLUTE_Y (1<<1)
#define WSMOUSE_INPUT_ABSOLUTE_Z (1<<2)
-void wsmouse_input(struct device *kbddev, u_int btns,
- int x, int y, int z, u_int flags);
+#define WSMOUSE_INPUT_ABSOLUTE_W (1<<3)
+void wsmouse_input_xyzw(struct device *kbddev, u_int btns,
+ int x, int y, int z, int w, u_int flags);
+/* Provide a define all the old mouse drivers that don't want w. */
+#define wsmouse_input(kbddev, btns, x, y, z, flags) \
+ wsmouse_input_xyzw(kbddev, btns, x, y, z, 0, flags)