summaryrefslogtreecommitdiffstats
path: root/sys/dev/hil
diff options
context:
space:
mode:
authorbru <bru@openbsd.org>2016-06-05 20:15:54 +0000
committerbru <bru@openbsd.org>2016-06-05 20:15:54 +0000
commit84b8bfafcf081b372c707cc631fb554761be5550 (patch)
treebba85396fcfb25b3428d976d32840a183cc10c66 /sys/dev/hil
parentContinue preparing a future merge of urtwn(4) and rtwn(4). (diff)
downloadwireguard-openbsd-84b8bfafcf081b372c707cc631fb554761be5550.tar.xz
wireguard-openbsd-84b8bfafcf081b372c707cc631fb554761be5550.zip
Use the new input functions of wsmouse in mouse and touchscreen drivers.
ok stsp@ kettenis@
Diffstat (limited to 'sys/dev/hil')
-rw-r--r--sys/dev/hil/hilms.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/sys/dev/hil/hilms.c b/sys/dev/hil/hilms.c
index 4251ae419c2..a59b7949925 100644
--- a/sys/dev/hil/hilms.c
+++ b/sys/dev/hil/hilms.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hilms.c,v 1.5 2007/04/10 22:37:17 miod Exp $ */
+/* $OpenBSD: hilms.c,v 1.6 2016/06/05 20:15:54 bru Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
* All rights reserved.
@@ -219,7 +219,7 @@ void
hilms_callback(struct hildev_softc *dev, u_int buflen, u_int8_t *buf)
{
struct hilms_softc *sc = (struct hilms_softc *)dev;
- int type, flags;
+ int type;
int dx, dy, dz, button;
#ifdef DIAGNOSTIC
int minlen;
@@ -256,9 +256,6 @@ hilms_callback(struct hildev_softc *dev, u_int buflen, u_int8_t *buf)
*/
if (type & HIL_MOUSEMOTION) {
- flags = sc->sc_features & HIL_ABSOLUTE ?
- WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
- WSMOUSE_INPUT_ABSOLUTE_Z : WSMOUSE_INPUT_DELTA;
if (sc->sc_features & HIL_16_BITS) {
dx = *buf++;
dx |= (*buf++) << 8;
@@ -302,8 +299,7 @@ hilms_callback(struct hildev_softc *dev, u_int buflen, u_int8_t *buf)
if ((sc->sc_features & HIL_ABSOLUTE) == 0 &&
sc->sc_buttons == 0)
dy = -dy;
- } else
- dx = dy = dz = flags = 0;
+ }
if (type & HIL_MOUSEBUTTON) {
button = *buf;
@@ -332,7 +328,18 @@ hilms_callback(struct hildev_softc *dev, u_int buflen, u_int8_t *buf)
/* buf++; */
}
- if (sc->sc_wsmousedev != NULL)
- wsmouse_input(sc->sc_wsmousedev,
- sc->sc_buttonstate, dx, dy, dz, 0, flags);
+ if (sc->sc_wsmousedev == NULL)
+ return;
+
+ wsmouse_buttons(sc->sc_wsmousedev, sc->sc_buttonstate);
+ if (type & HIL_MOUSEMOTION) {
+ if ((sc->sc_features & HIL_ABSOLUTE) == 0) {
+ wsmouse_motion(sc->sc_wsmousedev, dx, dy, dz, 0);
+ } else {
+ wsmouse_position(sc->sc_wsmousedev, dx, dy);
+ if (sc->sc_axes > 2)
+ wsmouse_touch(sc->sc_wsmousedev, dz, 0);
+ }
+ }
+ wsmouse_input_sync(sc->sc_wsmousedev);
}