Fix issue where pressing right shift and holding it down continously, then pressing left shift and then releasing it would cause 'speed' to be left on. (Thanks 123DontMessWitMe)

This commit is contained in:
UnknownShadow200 2016-02-04 17:45:27 +11:00
parent 5668b3328f
commit 88613a82ed

View File

@ -261,11 +261,13 @@ namespace OpenTK.Platform.Windows
// The behavior of this key is very strange. Unlike Control and Alt, there is no extended bit
// to distinguish between left and right keys. Moreover, pressing both keys and releasing one
// may result in both keys being held down (but not always).
ushort lShiftState = API.GetKeyState( (int)VirtualKeys.LSHIFT );
ushort rShiftState = API.GetKeyState( (int)VirtualKeys.RSHIFT );
bool lShiftDown = (API.GetKeyState( (int)VirtualKeys.LSHIFT ) >> 15) == 1;
bool rShiftDown = (API.GetKeyState( (int)VirtualKeys.RSHIFT ) >> 15) == 1;
Keyboard[Input.Key.ShiftLeft] = (lShiftState >> 15) == 1;
Keyboard[Input.Key.ShiftRight] = (rShiftState >> 15) == 1;
if( !pressed || lShiftDown != rShiftDown ) {
Keyboard[Input.Key.ShiftLeft] = lShiftDown;
Keyboard[Input.Key.ShiftRight] = rShiftDown;
}
return IntPtr.Zero;
case VirtualKeys.CONTROL: