From 5518a6bcd6f1bd2a70c0f5bd23814e9d79c9bedc Mon Sep 17 00:00:00 2001 From: jacob1 Date: Sat, 27 Jul 2013 11:21:42 -0400 Subject: [PATCH] fix right modifier keys --- src/PowderToySDL.cpp | 4 ++-- src/gui/game/GameView.cpp | 18 ++++++++++++------ src/gui/interface/Keys.h | 15 +++++++++------ src/gui/localbrowser/LocalBrowserView.cpp | 4 ++-- src/gui/search/SearchView.cpp | 4 ++-- 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/PowderToySDL.cpp b/src/PowderToySDL.cpp index cacc38d3b..677426d1e 100644 --- a/src/PowderToySDL.cpp +++ b/src/PowderToySDL.cpp @@ -394,10 +394,10 @@ void EngineProcess() engine->Exit(); break; case SDL_KEYDOWN: - engine->onKeyPress(event.key.keysym.sym, event.key.keysym.unicode, event.key.keysym.mod&KEY_MOD_LSHIFT, event.key.keysym.mod&KEY_MOD_LCONTROL, event.key.keysym.mod&KEY_MOD_LALT); + engine->onKeyPress(event.key.keysym.sym, event.key.keysym.unicode, event.key.keysym.mod&KEY_MOD_SHIFT, event.key.keysym.mod&KEY_MOD_CONTROL, event.key.keysym.mod&KEY_MOD_ALT); break; case SDL_KEYUP: - engine->onKeyRelease(event.key.keysym.sym, event.key.keysym.unicode, event.key.keysym.mod&KEY_MOD_LSHIFT, event.key.keysym.mod&KEY_MOD_LCONTROL, event.key.keysym.mod&KEY_MOD_LALT); + engine->onKeyRelease(event.key.keysym.sym, event.key.keysym.unicode, event.key.keysym.mod&KEY_MOD_SHIFT, event.key.keysym.mod&KEY_MOD_CONTROL, event.key.keysym.mod&KEY_MOD_ALT); break; case SDL_MOUSEMOTION: engine->onMouseMove(event.motion.x*inputScale, event.motion.y*inputScale); diff --git a/src/gui/game/GameView.cpp b/src/gui/game/GameView.cpp index f1b04501c..f7fa6f578 100644 --- a/src/gui/game/GameView.cpp +++ b/src/gui/game/GameView.cpp @@ -1279,11 +1279,13 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool } switch(key) { - case KEY_ALT: + case KEY_LALT: + case KEY_RALT: drawSnap = true; enableAltBehaviour(); break; - case KEY_CTRL: + case KEY_LCTRL: + case KEY_RCTRL: if(!isMouseDown) { if(drawModeReset) @@ -1302,7 +1304,8 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool } enableCtrlBehaviour(); break; - case KEY_SHIFT: + case KEY_LSHIFT: + case KEY_RSHIFT: if(!isMouseDown) { if(drawModeReset) @@ -1500,14 +1503,17 @@ void GameView::OnKeyRelease(int key, Uint16 character, bool shift, bool ctrl, bo drawModeReset = true; switch(key) { - case KEY_ALT: + case KEY_LALT: + case KEY_RALT: drawSnap = false; disableAltBehaviour(); break; - case KEY_CTRL: + case KEY_LCTRL: + case KEY_RCTRL: disableCtrlBehaviour(); break; - case KEY_SHIFT: + case KEY_LSHIFT: + case KEY_RSHIFT: disableShiftBehaviour(); break; case 'z': diff --git a/src/gui/interface/Keys.h b/src/gui/interface/Keys.h index 424dd86b5..c42a89441 100644 --- a/src/gui/interface/Keys.h +++ b/src/gui/interface/Keys.h @@ -14,9 +14,12 @@ #define KEY_ENTER SDLK_KP_ENTER #define KEY_ESCAPE SDLK_ESCAPE -#define KEY_CTRL SDLK_LCTRL -#define KEY_ALT SDLK_LALT -#define KEY_SHIFT SDLK_LSHIFT +#define KEY_LCTRL SDLK_LCTRL +#define KEY_LALT SDLK_LALT +#define KEY_LSHIFT SDLK_LSHIFT +#define KEY_RCTRL SDLK_RCTRL +#define KEY_RALT SDLK_RALT +#define KEY_RSHIFT SDLK_RSHIFT #define KEY_MOD_NONE KMOD_NONE #define KEY_MOD_LSHIFT KMOD_LSHIFT @@ -32,9 +35,9 @@ #define KEY_MOD_MODE KMOD_MODE #define KEY_MOD_RESERVED KMOD_RESERVED -#define KEY_MOD_CONTROL KEY_MOD_RCONTROL | KEY_MOD_LCONTROL -#define KEY_MOD_ALT KEY_MOD_RALT | KEY_MOD_LALT -#define KEY_MOD_SHIFT KEY_MOD_RSHIFT | KEY_MOD_LSHIFT +#define KEY_MOD_CONTROL (KEY_MOD_RCONTROL | KEY_MOD_LCONTROL) +#define KEY_MOD_ALT (KEY_MOD_RALT | KEY_MOD_LALT) +#define KEY_MOD_SHIFT (KEY_MOD_RSHIFT | KEY_MOD_LSHIFT) #define KEY_a SDLK_a #define KEY_d SDLK_d diff --git a/src/gui/localbrowser/LocalBrowserView.cpp b/src/gui/localbrowser/LocalBrowserView.cpp index e1306dcb0..218864cd4 100644 --- a/src/gui/localbrowser/LocalBrowserView.cpp +++ b/src/gui/localbrowser/LocalBrowserView.cpp @@ -206,13 +206,13 @@ void LocalBrowserView::OnKeyPress(int key, Uint16 character, bool shift, bool ct { if(key == KEY_ESCAPE) c->Exit(); - else if (key == KEY_CTRL) + else if (key == KEY_LCTRL || key == KEY_RCTRL) c->SetMoveToFront(false); } void LocalBrowserView::OnKeyRelease(int key, Uint16 character, bool shift, bool ctrl, bool alt) { - if (key == KEY_CTRL) + if (key == KEY_LCTRL || key == KEY_RCTRL) c->SetMoveToFront(true); } diff --git a/src/gui/search/SearchView.cpp b/src/gui/search/SearchView.cpp index a8d3d326f..526592a4a 100644 --- a/src/gui/search/SearchView.cpp +++ b/src/gui/search/SearchView.cpp @@ -714,12 +714,12 @@ void SearchView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bo { if (key == KEY_ESCAPE) c->Exit(); - if (key == KEY_CTRL) + else if (key == KEY_LCTRL || key == KEY_RCTRL) c->InstantOpen(true); } void SearchView::OnKeyRelease(int key, Uint16 character, bool shift, bool ctrl, bool alt) { - if (key == KEY_CTRL) + if (key == KEY_LCTRL || key == KEY_RCTRL) c->InstantOpen(false); }