changeset 33304:d63bf64a2094

Support up to 20 mouse buttons, there really seem to be input devices with at least 12.
author reimar
date Sat, 07 May 2011 10:44:57 +0000
parents c9a13a381946
children ddb45e9443ec
files input/input.c input/mouse.h mp_fifo.c
diffstat 3 files changed, 44 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/input/input.c	Fri May 06 15:50:49 2011 +0000
+++ b/input/input.c	Sat May 07 10:44:57 2011 +0000
@@ -268,6 +268,16 @@
   { MOUSE_BTN7, "MOUSE_BTN7" },
   { MOUSE_BTN8, "MOUSE_BTN8" },
   { MOUSE_BTN9, "MOUSE_BTN9" },
+  { MOUSE_BTN10, "MOUSE_BTN10" },
+  { MOUSE_BTN11, "MOUSE_BTN11" },
+  { MOUSE_BTN12, "MOUSE_BTN12" },
+  { MOUSE_BTN13, "MOUSE_BTN13" },
+  { MOUSE_BTN14, "MOUSE_BTN14" },
+  { MOUSE_BTN15, "MOUSE_BTN15" },
+  { MOUSE_BTN16, "MOUSE_BTN16" },
+  { MOUSE_BTN17, "MOUSE_BTN17" },
+  { MOUSE_BTN18, "MOUSE_BTN18" },
+  { MOUSE_BTN19, "MOUSE_BTN19" },
   { MOUSE_BTN0_DBL, "MOUSE_BTN0_DBL" },
   { MOUSE_BTN1_DBL, "MOUSE_BTN1_DBL" },
   { MOUSE_BTN2_DBL, "MOUSE_BTN2_DBL" },
@@ -278,6 +288,16 @@
   { MOUSE_BTN7_DBL, "MOUSE_BTN7_DBL" },
   { MOUSE_BTN8_DBL, "MOUSE_BTN8_DBL" },
   { MOUSE_BTN9_DBL, "MOUSE_BTN9_DBL" },
+  { MOUSE_BTN10_DBL, "MOUSE_BTN10_DBL" },
+  { MOUSE_BTN11_DBL, "MOUSE_BTN11_DBL" },
+  { MOUSE_BTN12_DBL, "MOUSE_BTN12_DBL" },
+  { MOUSE_BTN13_DBL, "MOUSE_BTN13_DBL" },
+  { MOUSE_BTN14_DBL, "MOUSE_BTN14_DBL" },
+  { MOUSE_BTN15_DBL, "MOUSE_BTN15_DBL" },
+  { MOUSE_BTN16_DBL, "MOUSE_BTN16_DBL" },
+  { MOUSE_BTN17_DBL, "MOUSE_BTN17_DBL" },
+  { MOUSE_BTN18_DBL, "MOUSE_BTN18_DBL" },
+  { MOUSE_BTN19_DBL, "MOUSE_BTN19_DBL" },
   { JOY_AXIS1_MINUS, "JOY_UP" },
   { JOY_AXIS1_PLUS, "JOY_DOWN" },
   { JOY_AXIS0_MINUS, "JOY_LEFT" },
--- a/input/mouse.h	Fri May 06 15:50:49 2011 +0000
+++ b/input/mouse.h	Sat May 07 10:44:57 2011 +0000
@@ -30,6 +30,17 @@
 #define MOUSE_BTN7 (MOUSE_BASE+7)
 #define MOUSE_BTN8 (MOUSE_BASE+8)
 #define MOUSE_BTN9 (MOUSE_BASE+9)
+#define MOUSE_BTN10 (MOUSE_BASE+10)
+#define MOUSE_BTN11 (MOUSE_BASE+11)
+#define MOUSE_BTN12 (MOUSE_BASE+12)
+#define MOUSE_BTN13 (MOUSE_BASE+13)
+#define MOUSE_BTN14 (MOUSE_BASE+14)
+#define MOUSE_BTN15 (MOUSE_BASE+15)
+#define MOUSE_BTN16 (MOUSE_BASE+16)
+#define MOUSE_BTN17 (MOUSE_BASE+17)
+#define MOUSE_BTN18 (MOUSE_BASE+18)
+#define MOUSE_BTN19 (MOUSE_BASE+19)
+#define MOUSE_BTN_LAST MOUSE_BTN19
 
 #define MOUSE_BASE_DBL (0x300|MP_NO_REPEAT_KEY)
 #define MOUSE_BTN0_DBL (MOUSE_BASE_DBL+0)
@@ -42,5 +53,16 @@
 #define MOUSE_BTN7_DBL (MOUSE_BASE_DBL+7)
 #define MOUSE_BTN8_DBL (MOUSE_BASE_DBL+8)
 #define MOUSE_BTN9_DBL (MOUSE_BASE_DBL+9)
+#define MOUSE_BTN10_DBL (MOUSE_BASE_DBL+10)
+#define MOUSE_BTN11_DBL (MOUSE_BASE_DBL+11)
+#define MOUSE_BTN12_DBL (MOUSE_BASE_DBL+12)
+#define MOUSE_BTN13_DBL (MOUSE_BASE_DBL+13)
+#define MOUSE_BTN14_DBL (MOUSE_BASE_DBL+14)
+#define MOUSE_BTN15_DBL (MOUSE_BASE_DBL+15)
+#define MOUSE_BTN16_DBL (MOUSE_BASE_DBL+16)
+#define MOUSE_BTN17_DBL (MOUSE_BASE_DBL+17)
+#define MOUSE_BTN18_DBL (MOUSE_BASE_DBL+18)
+#define MOUSE_BTN19_DBL (MOUSE_BASE_DBL+19)
+#define MOUSE_BTN_LAST_DBL MOUSE_BTN19_DBL
 
 #endif /* MPLAYER_MOUSE_H */
--- a/mp_fifo.c	Fri May 06 15:50:49 2011 +0000
+++ b/mp_fifo.c	Sat May 07 10:44:57 2011 +0000
@@ -72,7 +72,7 @@
 unsigned doubleclick_time = 300;
 
 static void put_double(int code) {
-  if (code >= MOUSE_BTN0 && code <= MOUSE_BTN9)
+  if (code >= MOUSE_BTN0 && code <= MOUSE_BTN_LAST)
     mplayer_put_key_internal(code - MOUSE_BTN0 + MOUSE_BTN0_DBL);
 }
 
@@ -83,7 +83,7 @@
   // ignore system-doubleclick if we generate these events ourselves
   if (doubleclick_time &&
       (code & ~MP_KEY_DOWN) >= MOUSE_BTN0_DBL &&
-      (code & ~MP_KEY_DOWN) <= MOUSE_BTN9_DBL)
+      (code & ~MP_KEY_DOWN) <= MOUSE_BTN_LAST_DBL)
     return;
   mplayer_put_key_internal(code);
   if (code & MP_KEY_DOWN) {