aboutsummaryrefslogtreecommitdiffstats
path: root/code/unix/sdl_glimp.c
diff options
context:
space:
mode:
authorludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-10-23 15:25:23 +0000
committerludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-10-23 15:25:23 +0000
commit76d96a8cc88b27326fd34a752d05eb60a4faf99b (patch)
tree2ce2dd32a2961f1f887f69c3c5f53520977def54 /code/unix/sdl_glimp.c
parentf357041757ca351908dd57b3d05d880a1c546716 (diff)
downloadioquake3-aero-76d96a8cc88b27326fd34a752d05eb60a4faf99b.tar.gz
ioquake3-aero-76d96a8cc88b27326fd34a752d05eb60a4faf99b.zip
map extra mouse buttons to K_AUX*
git-svn-id: svn://svn.icculus.org/quake3/trunk@174 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/unix/sdl_glimp.c')
-rw-r--r--code/unix/sdl_glimp.c70
1 files changed, 14 insertions, 56 deletions
diff --git a/code/unix/sdl_glimp.c b/code/unix/sdl_glimp.c
index 00c180f..c26ddd7 100644
--- a/code/unix/sdl_glimp.c
+++ b/code/unix/sdl_glimp.c
@@ -327,66 +327,24 @@ static void HandleEvents(void)
break;
case SDL_MOUSEBUTTONDOWN:
- if (e.button.button == 4)
- {
- Sys_QueEvent( t, SE_KEY, K_MWHEELUP, qtrue, 0, NULL );
- } else if (e.button.button == 5)
- {
- Sys_QueEvent( t, SE_KEY, K_MWHEELDOWN, qtrue, 0, NULL );
- } else
- {
- // NOTE TTimo there seems to be a weird mapping for K_MOUSE1 K_MOUSE2 K_MOUSE3 ..
- b=-1;
- if (e.button.button == 1)
- {
- b = 0; // K_MOUSE1
- } else if (e.button.button == 2)
- {
- b = 2; // K_MOUSE3
- } else if (e.button.button == 3)
- {
- b = 1; // K_MOUSE2
- } else if (e.button.button == 6)
- {
- b = 3; // K_MOUSE4
- } else if (e.button.button == 7)
- {
- b = 4; // K_MOUSE5
- };
-
- Sys_QueEvent( t, SE_KEY, K_MOUSE1 + b, qtrue, 0, NULL );
- }
- break;
-
case SDL_MOUSEBUTTONUP:
- if (e.button.button == 4)
- {
- Sys_QueEvent( t, SE_KEY, K_MWHEELUP, qfalse, 0, NULL );
- } else if (e.button.button == 5)
- {
- Sys_QueEvent( t, SE_KEY, K_MWHEELDOWN, qfalse, 0, NULL );
- } else
{
- b=-1;
- if (e.button.button == 1)
- {
- b = 0;
- } else if (e.button.button == 2)
- {
- b = 2;
- } else if (e.button.button == 3)
- {
- b = 1;
- } else if (e.button.button == 6)
- {
- b = 3; // K_MOUSE4
- } else if (e.button.button == 7)
- {
- b = 4; // K_MOUSE5
- };
- Sys_QueEvent( t, SE_KEY, K_MOUSE1 + b, qfalse, 0, NULL );
+ unsigned char b;
+ switch (e.button.button)
+ {
+ case 1: b = K_MOUSE1; break;
+ case 2: b = K_MOUSE3; break;
+ case 3: b = K_MOUSE2; break;
+ case 4: b = K_MWHEELUP; break;
+ case 5: b = K_MWHEELDOWN; break;
+ case 6: b = K_MOUSE4; break;
+ case 7: b = K_MOUSE5; break;
+ default: b = K_AUX1 + (e.button.button - 8)%16; break;
+ }
+ Sys_QueEvent( t, SE_KEY, b, (e.type == SDL_MOUSEBUTTONDOWN?qtrue:qfalse), 0, NULL );
}
break;
+
case SDL_QUIT:
Sys_Quit();
break;