changeset 29319:2069f3aa4939

(NUM_TRANSLATED_MOUSE_BUTTONS): New constant. (emacs_button_translation): Use it. (do_mouse_event): Allow up to 32 mouse buttons by allowing any bit in `mask' to be set.
author Jason Rumney <jasonr@gnu.org>
date Tue, 30 May 2000 21:49:28 +0000
parents d54d4038df20
children 33aa00975055
files src/w32inevt.c
diffstat 1 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32inevt.c	Tue May 30 21:48:24 2000 +0000
+++ b/src/w32inevt.c	Tue May 30 21:49:28 2000 +0000
@@ -550,9 +550,10 @@
      Right == 2
    Others increase from there.  */
 
-static int emacs_button_translation[NUM_MOUSE_BUTTONS] =
+#define NUM_TRANSLATED_MOUSE_BUTTONS 3
+static int emacs_button_translation[NUM_TRANSLATED_MOUSE_BUTTONS] =
 {
-  0, 2, 1, 3, 4,
+  0, 2, 1
 };
 
 static int 
@@ -581,18 +582,16 @@
   /* Find out what button has changed state since the last button event.  */
   but_change = button_state ^ event->dwButtonState;
   mask = 1;
-  for (i = 0; i < NUM_MOUSE_BUTTONS; i++, mask <<= 1)
+  for (i = 0; mask; i++, mask <<= 1)
     if (but_change & mask)
       {
-	XSETINT (emacs_ev->code, emacs_button_translation[i]);
+        if (i < NUM_TRANSLATED_MOUSE_BUTTONS)
+          XSETINT (emacs_ev->code, emacs_button_translation[i]);
+        else
+          XSETINT (emacs_ev->code, i);
 	break;
       }
 
-  /* If the changed button is out of emacs' range (highly unlikely)
-     ignore this event.  */
-  if (i == NUM_MOUSE_BUTTONS)
-    return 0;
-  
   button_state = event->dwButtonState;
   emacs_ev->timestamp = GetTickCount ();
   emacs_ev->modifiers = w32_kbd_mods_to_emacs (event->dwControlKeyState, 0) |