diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/wscons/wsconsio.h | 6 | ||||
-rw-r--r-- | sys/dev/wscons/wsmouse.c | 25 | ||||
-rw-r--r-- | sys/dev/wscons/wsmouseinput.h | 3 |
3 files changed, 25 insertions, 9 deletions
diff --git a/sys/dev/wscons/wsconsio.h b/sys/dev/wscons/wsconsio.h index d7942ac9238..442bd4542ae 100644 --- a/sys/dev/wscons/wsconsio.h +++ b/sys/dev/wscons/wsconsio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wsconsio.h,v 1.91 2019/03/24 17:55:39 bru Exp $ */ +/* $OpenBSD: wsconsio.h,v 1.92 2019/08/19 21:19:38 bru Exp $ */ /* $NetBSD: wsconsio.h,v 1.74 2005/04/28 07:15:44 martin Exp $ */ /* @@ -292,6 +292,8 @@ enum wsmousecfg { WSMOUSECFG_SWAPXY, /* swap X- and Y-axis */ WSMOUSECFG_X_INV, /* map absolute coordinate X to (INV - X) */ WSMOUSECFG_Y_INV, /* map absolute coordinate Y to (INV - Y) */ + WSMOUSECFG_REVERSE_SCROLLING, + /* reverse scroll directions */ /* * Coordinate handling, applying only in WSMOUSE_COMPAT mode. @@ -343,7 +345,7 @@ enum wsmousecfg { WSMOUSECFG_LOG_INPUT = 256, WSMOUSECFG_LOG_EVENTS, }; -#define WSMOUSECFG_MAX 38 /* max size of param array per ioctl */ +#define WSMOUSECFG_MAX 39 /* max size of param array per ioctl */ struct wsmouse_param { enum wsmousecfg key; diff --git a/sys/dev/wscons/wsmouse.c b/sys/dev/wscons/wsmouse.c index 585b0733f89..97a086d7115 100644 --- a/sys/dev/wscons/wsmouse.c +++ b/sys/dev/wscons/wsmouse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsmouse.c,v 1.56 2019/08/08 02:19:18 cheloha Exp $ */ +/* $OpenBSD: wsmouse.c,v 1.57 2019/08/19 21:19:38 bru Exp $ */ /* $NetBSD: wsmouse.c,v 1.35 2005/02/27 00:27:52 perry Exp $ */ /* @@ -1018,7 +1018,7 @@ wsmouse_motion_sync(struct wsmouseinput *input, struct evq_access *evq) struct motion_state *motion = &input->motion; struct axis_filter *h = &input->filter.h; struct axis_filter *v = &input->filter.v; - int x, y, dx, dy; + int x, y, dx, dy, dz, dw; if (motion->sync & SYNC_DELTAS) { dx = h->inv ? -motion->dx : motion->dx; @@ -1032,16 +1032,20 @@ wsmouse_motion_sync(struct wsmouseinput *input, struct evq_access *evq) if (dy) wsmouse_evq_put(evq, DELTA_Y_EV(input), dy); if (motion->dz) { + dz = (input->flags & REVERSE_SCROLLING) + ? -motion->dz : motion->dz; if (IS_TOUCHPAD(input)) - wsmouse_evq_put(evq, VSCROLL_EV, motion->dz); + wsmouse_evq_put(evq, VSCROLL_EV, dz); else - wsmouse_evq_put(evq, DELTA_Z_EV, motion->dz); + wsmouse_evq_put(evq, DELTA_Z_EV, dz); } if (motion->dw) { + dw = (input->flags & REVERSE_SCROLLING) + ? -motion->dw : motion->dw; if (IS_TOUCHPAD(input)) - wsmouse_evq_put(evq, HSCROLL_EV, motion->dw); + wsmouse_evq_put(evq, HSCROLL_EV, dw); else - wsmouse_evq_put(evq, DELTA_W_EV, motion->dw); + wsmouse_evq_put(evq, DELTA_W_EV, dw); } } if (motion->sync & SYNC_POSITION) { @@ -1471,6 +1475,9 @@ wsmouse_get_params(struct device *sc, case WSMOUSECFG_Y_INV: params[i].value = input->filter.v.inv; break; + case WSMOUSECFG_REVERSE_SCROLLING: + params[i].value = !!(input->flags & REVERSE_SCROLLING); + break; case WSMOUSECFG_DX_MAX: params[i].value = input->filter.h.dmax; break; @@ -1561,6 +1568,12 @@ wsmouse_set_params(struct device *sc, case WSMOUSECFG_Y_INV: input->filter.v.inv = val; break; + case WSMOUSECFG_REVERSE_SCROLLING: + if (val) + input->flags |= REVERSE_SCROLLING; + else + input->flags &= ~REVERSE_SCROLLING; + break; case WSMOUSECFG_DX_MAX: input->filter.h.dmax = val; break; diff --git a/sys/dev/wscons/wsmouseinput.h b/sys/dev/wscons/wsmouseinput.h index 2a337ceb8c1..5cba98ce4a8 100644 --- a/sys/dev/wscons/wsmouseinput.h +++ b/sys/dev/wscons/wsmouseinput.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wsmouseinput.h,v 1.13 2019/03/24 18:04:02 bru Exp $ */ +/* $OpenBSD: wsmouseinput.h,v 1.14 2019/08/19 21:19:38 bru Exp $ */ /* * Copyright (c) 2015, 2016 Ulf Brosziewski @@ -161,6 +161,7 @@ struct wsmouseinput { #define TPAD_COMPAT_MODE (1 << 0) #define TPAD_NATIVE_MODE (1 << 1) #define MT_TRACKING (1 << 2) +#define REVERSE_SCROLLING (1 << 3) #define RESYNC (1 << 16) #define TRACK_INTERVAL (1 << 17) #define CONFIGURED (1 << 18) |