From 6bb2f81134260694897a729faf43b6aeb4656b30 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sat, 16 Apr 2016 13:10:32 +0200 Subject: [PATCH] fix Inverted Right and Middle button on certain case with SDL --- Sources/Engine/Base/SDL/SDLInput.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Sources/Engine/Base/SDL/SDLInput.cpp b/Sources/Engine/Base/SDL/SDLInput.cpp index 6b39711..8596a5f 100755 --- a/Sources/Engine/Base/SDL/SDLInput.cpp +++ b/Sources/Engine/Base/SDL/SDLInput.cpp @@ -318,8 +318,16 @@ static void sdl_event_handler(const SDL_Event *event) case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: - if (event->button.button <= 5) - _abKeysPressed[KID_MOUSE1 + (event->button.button-1)] = (event->button.state == SDL_PRESSED) ? TRUE : FALSE; + if (event->button.button <= 5) { + int button = KID_MOUSE1; + switch(event->button.button) { + case SDL_BUTTON_RIGHT: button = KID_MOUSE2; break; + case SDL_BUTTON_MIDDLE: button = KID_MOUSE3; break; + case 4: button = KID_MOUSE4; break; + case 5: button = KID_MOUSE5; break; + } + _abKeysPressed[button] = (event->button.state == SDL_PRESSED) ? TRUE : FALSE; + } break; case SDL_MOUSEWHEEL: