mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-03-15 03:39:56 +01:00
prevent weirdness when ctrl/shift/alt key event is canceled
This commit is contained in:
parent
1536736b33
commit
79aef1dab6
@ -1646,18 +1646,6 @@ void GameView::OnKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl,
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case SDLK_LALT:
|
||||
case SDLK_RALT:
|
||||
enableAltBehaviour();
|
||||
break;
|
||||
case SDLK_LCTRL:
|
||||
case SDLK_RCTRL:
|
||||
enableCtrlBehaviour();
|
||||
break;
|
||||
case SDLK_LSHIFT:
|
||||
case SDLK_RSHIFT:
|
||||
enableShiftBehaviour();
|
||||
break;
|
||||
case SDLK_TAB: //Tab
|
||||
c->ChangeBrush();
|
||||
break;
|
||||
@ -1691,21 +1679,6 @@ void GameView::OnKeyRelease(int key, int scan, bool repeat, bool shift, bool ctr
|
||||
c->SetZoomEnabled(false);
|
||||
return;
|
||||
}
|
||||
switch(key)
|
||||
{
|
||||
case SDLK_LALT:
|
||||
case SDLK_RALT:
|
||||
disableAltBehaviour();
|
||||
break;
|
||||
case SDLK_LCTRL:
|
||||
case SDLK_RCTRL:
|
||||
disableCtrlBehaviour();
|
||||
break;
|
||||
case SDLK_LSHIFT:
|
||||
case SDLK_RSHIFT:
|
||||
disableShiftBehaviour();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GameView::OnBlur()
|
||||
@ -1857,13 +1830,25 @@ void GameView::DoTextInput(String text)
|
||||
|
||||
void GameView::DoKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt)
|
||||
{
|
||||
if (shift && !shiftBehaviour)
|
||||
enableShiftBehaviour();
|
||||
if (ctrl && !ctrlBehaviour)
|
||||
enableCtrlBehaviour();
|
||||
if (alt && !altBehaviour)
|
||||
enableAltBehaviour();
|
||||
if (c->KeyPress(key, scan, repeat, shift, ctrl, alt))
|
||||
Window::DoKeyPress(key, scan, repeat, shift, ctrl, alt);
|
||||
}
|
||||
|
||||
void GameView::DoKeyRelease(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt)
|
||||
{
|
||||
if(c->KeyRelease(key, scan, repeat, shift, ctrl, alt))
|
||||
if (!shift && shiftBehaviour)
|
||||
disableShiftBehaviour();
|
||||
if (!ctrl && ctrlBehaviour)
|
||||
disableCtrlBehaviour();
|
||||
if (!alt && altBehaviour)
|
||||
disableAltBehaviour();
|
||||
if (c->KeyRelease(key, scan, repeat, shift, ctrl, alt))
|
||||
Window::DoKeyRelease(key, scan, repeat, shift, ctrl, alt);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user