fix right modifier keys

This commit is contained in:
jacob1 2013-07-27 11:21:42 -04:00
parent 3d16253319
commit 5518a6bcd6
5 changed files with 27 additions and 18 deletions

View File

@ -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);

View File

@ -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':

View File

@ -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

View File

@ -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);
}

View File

@ -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);
}