mouse5 support
mike at vinge.mine.nu
mike at vinge.mine.nu
Sun Feb 10 20:13:14 EST 2002
I noticed the recent mouse4 checkin, and i have a 5th mouse button, so i
decided to copy the patch for a 5th mouse- this patch works, although
i'm not totally sure if it's correct, since i just copied the design of
the other one, mostly
--
To smash a single atom, all mankind was intent.
Now any day the atom may return the compliment.
-------------- next part --------------
Index: src/client/keys.c
===================================================================
diff -u -r1.3 keys.c
--- src/client/keys.c 2002/02/09 20:52:34 1.3
+++ src/client/keys.c 2002/02/11 00:57:48
@@ -89,6 +89,7 @@
{"MOUSE2", K_MOUSE2},
{"MOUSE3", K_MOUSE3},
{"MOUSE4", K_MOUSE4},
+ {"MOUSE5", K_MOUSE5},
{"JOY1", K_JOY1},
Index: src/client/keys.h
===================================================================
diff -u -r1.3 keys.h
--- src/client/keys.h 2002/02/09 20:52:34 1.3
+++ src/client/keys.h 2002/02/11 00:57:49
@@ -80,7 +80,8 @@
K_MOUSE2 = 201,
K_MOUSE3 = 202,
K_MOUSE4 = 241,
-
+ K_MOUSE5 = 242,
+
//
// joystick buttons
//
Index: src/client/menu.c
===================================================================
diff -u -r1.5 menu.c
--- src/client/menu.c 2002/02/09 20:52:34 1.5
+++ src/client/menu.c 2002/02/11 00:57:50
@@ -208,6 +208,7 @@
case K_MOUSE2:
case K_MOUSE3:
case K_MOUSE4:
+ case K_MOUSE5:
case K_JOY1:
case K_JOY2:
case K_JOY3:
Index: src/linux/rw_sdl.c
===================================================================
diff -u -r1.8 rw_sdl.c
--- src/linux/rw_sdl.c 2002/02/09 20:52:34 1.8
+++ src/linux/rw_sdl.c 2002/02/11 00:57:51
@@ -173,6 +173,12 @@
if ( !(mouse_buttonstate & (1<<3)) && (mouse_oldbuttonstate & (1<<3)) )
in_state->Key_Event_fp (K_MOUSE4, false);
+ if ( (mouse_buttonstate & (1<<4)) && !(mouse_oldbuttonstate & (1<<4)) )
+ in_state->Key_Event_fp (K_MOUSE5, true);
+
+ if ( !(mouse_buttonstate & (1<<4)) && (mouse_oldbuttonstate & (1<<4)) )
+ in_state->Key_Event_fp (K_MOUSE5, false);
+
mouse_oldbuttonstate = mouse_buttonstate;
}
@@ -396,6 +402,13 @@
keyq[keyq_head].key = K_MOUSE4;
keyq[keyq_head].down = false;
keyq_head = (keyq_head + 1) & 63;
+ } else if (event->button.button == 7) {
+ keyq[keyq_head].key = K_MOUSE5;
+ keyq[keyq_head].down = true;
+ keyq_head = (keyq_head + 1) & 63;
+ keyq[keyq_head].key = K_MOUSE5;
+ keyq[keyq_head].down = false;
+ keyq_head = (keyq_head + 1) & 63;
}
break;
case SDL_MOUSEBUTTONUP:
@@ -877,6 +890,8 @@
mouse_buttonstate |= (1 << 2);
if (SDL_BUTTON(6) & bstate)
mouse_buttonstate |= (1 << 3);
+ if (SDL_BUTTON(7) & bstate)
+ mouse_buttonstate |= (1 << 4);
if (old_windowed_mouse != _windowed_mouse->value) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
URL: <http://icculus.org/pipermail/quake2/attachments/20020210/b2844a9b/attachment.pgp>
More information about the quake2
mailing list