[MPlayer-cvslog] r33391 - in trunk: input/input.c input/mouse.h mp_fifo.c

reimar subversion at mplayerhq.hu
Sat May 7 12:44:58 CEST 2011


Author: reimar
Date: Sat May  7 12:44:57 2011
New Revision: 33391

Log:
Support up to 20 mouse buttons, there really seem to be input devices
with at least 12.

Modified:
   trunk/input/input.c
   trunk/input/mouse.h
   trunk/mp_fifo.c

Modified: trunk/input/input.c
==============================================================================
--- trunk/input/input.c	Fri May  6 17:50:49 2011	(r33390)
+++ trunk/input/input.c	Sat May  7 12:44:57 2011	(r33391)
@@ -268,6 +268,16 @@ static const mp_key_name_t key_names[] =
   { 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 @@ static const mp_key_name_t key_names[] =
   { 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" },

Modified: trunk/input/mouse.h
==============================================================================
--- trunk/input/mouse.h	Fri May  6 17:50:49 2011	(r33390)
+++ trunk/input/mouse.h	Sat May  7 12:44:57 2011	(r33391)
@@ -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 */

Modified: trunk/mp_fifo.c
==============================================================================
--- trunk/mp_fifo.c	Fri May  6 17:50:49 2011	(r33390)
+++ trunk/mp_fifo.c	Sat May  7 12:44:57 2011	(r33391)
@@ -72,7 +72,7 @@ int mplayer_get_key(int fd){
 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 @@ void mplayer_put_key(int code) {
   // 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) {


More information about the MPlayer-cvslog mailing list