From 9a397a01c1bd434fe56472e666bc35c55d4fe780 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 1 Dec 2013 18:28:03 +0000 Subject: [PATCH] Fix mouse buttons 4 and 5 on SDL2/Windows. git-svn-id: https://svn.eduke32.com/eduke32@4190 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/sdlayer.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index ba479ecd7..c7dcbacff 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -2231,15 +2231,30 @@ int32_t handleevents(void) j = 1; break; case SDL_BUTTON_MIDDLE: j = 2; break; - case 8 /*SDL_BUTTON_X1*/: // 8 --> 3 + +#if SDL_MAJOR_VERSION==1 || !defined _WIN32 + // NOTE: SDL1 does have SDL_BUTTON_X1, but that's not what is + // generated. Neither with SDL2 on Linux. (Other OSs: not tested.) + case 8: // 8 --> 3 +#else + // On SDL2/Windows, everything is as it should be. + case SDL_BUTTON_X1: +#endif j = 3; break; + #if SDL_MAJOR_VERSION==1 case SDL_BUTTON_WHEELUP: // 4 case SDL_BUTTON_WHEELDOWN: // 5 j = ev.button.button; break; #endif - case 9 /*SDL_BUTTON_X2*/: // 9 --> 6 + +#if SDL_MAJOR_VERSION==1 || !defined _WIN32 + case 9: // 9 --> 6 +#else + case SDL_BUTTON_X2: +#endif j = 6; break; + } if (j<0) break;