summaryrefslogtreecommitdiffstats
path: root/usr.sbin/wsmoused
diff options
context:
space:
mode:
authorjacekm <jacekm@openbsd.org>2009-06-21 16:13:18 +0000
committerjacekm <jacekm@openbsd.org>2009-06-21 16:13:18 +0000
commit5015c596e1f1f0ddabc6ba6d17955f2c4100569e (patch)
treeb38f839b05450f2c629f83e76bef08e80f8b8151 /usr.sbin/wsmoused
parentUpgrade to sudo 1.7.2 (diff)
downloadwireguard-openbsd-5015c596e1f1f0ddabc6ba6d17955f2c4100569e.tar.xz
wireguard-openbsd-5015c596e1f1f0ddabc6ba6d17955f2c4100569e.zip
Support mouses with lots of buttons. Also, fix a crash when pressing
a button that's outside of the hardcoded range; miod@ ok
Diffstat (limited to 'usr.sbin/wsmoused')
-rw-r--r--usr.sbin/wsmoused/wsmoused.c5
-rw-r--r--usr.sbin/wsmoused/wsmoused.h12
2 files changed, 13 insertions, 4 deletions
diff --git a/usr.sbin/wsmoused/wsmoused.c b/usr.sbin/wsmoused/wsmoused.c
index 6c0d29a221b..ccf55e898e1 100644
--- a/usr.sbin/wsmoused/wsmoused.c
+++ b/usr.sbin/wsmoused/wsmoused.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsmoused.c,v 1.24 2009/06/05 03:37:10 miod Exp $ */
+/* $OpenBSD: wsmoused.c,v 1.25 2009/06/21 16:13:18 jacekm Exp $ */
/*
* Copyright (c) 2001 Jean-Baptiste Marchand, Julien Montagne and Jerome Verdon
@@ -343,7 +343,8 @@ treat_event(struct wscons_event *event)
if (IS_MOTION_EVENT(event->type)) {
ioctl(mouse.cfd, WSDISPLAYIO_WSMOUSED, event);
return 1;
- } else if (IS_BUTTON_EVENT(event->type)) {
+ } else if (IS_BUTTON_EVENT(event->type) &&
+ (uint)event->value < MOUSE_MAXBUTTON) {
mouse_map(event, &mapped_event);
mouse_click(&mapped_event);
return 1;
diff --git a/usr.sbin/wsmoused/wsmoused.h b/usr.sbin/wsmoused/wsmoused.h
index 0401b76d8e0..c42c564071c 100644
--- a/usr.sbin/wsmoused/wsmoused.h
+++ b/usr.sbin/wsmoused/wsmoused.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsmoused.h,v 1.7 2009/06/05 03:37:10 miod Exp $ */
+/* $OpenBSD: wsmoused.h,v 1.8 2009/06/21 16:13:18 jacekm Exp $ */
/*
* Copyright (c) 2001 Jean-Baptiste Marchand, Julien Montagne and Jerome Verdon
@@ -119,4 +119,12 @@ typedef struct mouse_s {
#define MOUSE_BUTTON6 5
#define MOUSE_BUTTON7 6
#define MOUSE_BUTTON8 7
-#define MOUSE_MAXBUTTON 8
+#define MOUSE_BUTTON9 8
+#define MOUSE_BUTTON10 9
+#define MOUSE_BUTTON11 10
+#define MOUSE_BUTTON12 11
+#define MOUSE_BUTTON13 12
+#define MOUSE_BUTTON14 13
+#define MOUSE_BUTTON15 14
+#define MOUSE_BUTTON16 15
+#define MOUSE_MAXBUTTON 16