summaryrefslogtreecommitdiff
path: root/src/w32inevt.c
diff options
context:
space:
mode:
authorJason Rumney <jasonr@gnu.org>2000-05-30 21:49:28 +0000
committerJason Rumney <jasonr@gnu.org>2000-05-30 21:49:28 +0000
commit1f2fca4bd1d9cae1085e4fea45f9dce4099af83a (patch)
treee5d24f71968d7d141c06ca4ce692d5aaabd9e743 /src/w32inevt.c
parentaf3a67854b367830661511f213e3105e96cdea32 (diff)
downloademacs-1f2fca4bd1d9cae1085e4fea45f9dce4099af83a.tar.gz
(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.
Diffstat (limited to 'src/w32inevt.c')
-rw-r--r--src/w32inevt.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/w32inevt.c b/src/w32inevt.c
index 1b2b6624314..99e3ead3ae3 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -550,9 +550,10 @@ mouse_moved_to (int x, int y)
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 @@ do_mouse_event (MOUSE_EVENT_RECORD *event,
/* 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) |