summaryrefslogtreecommitdiff
path: root/usr.sbin/wsmoused
diff options
context:
space:
mode:
authorJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-06-21 16:13:19 +0000
committerJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-06-21 16:13:19 +0000
commit885502a9764bdcc25b6329dbfd29eceee57eeb69 (patch)
treefc84e1e1a36b1f125764642453fcc49160efbf3c /usr.sbin/wsmoused
parenta3e9aa1c62bdd4c50b28eaf86e3d3b01ad4f5a99 (diff)
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