Fix a weird problem where the arrow keys would sometimes send a shift keypress on Windows, manifesting in odd things like inconsistent turning speeds when using the keyboard, the grid helper lines showing up in Mapster32 when they weren't supposed to, etc. For some reason, an extra raw input keyboard event is generated with an out of bounds VKey value (0xFF) which must be filtered for proper operation. I wasn't able to find any official documentation regarding this but I did find it mentioned in a couple of random newsgroup/forum postings.

git-svn-id: https://svn.eduke32.com/eduke32@3980 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2013-08-06 23:51:10 +00:00
parent b5c5513924
commit 17ba063736

View file

@ -8,7 +8,6 @@
static BOOL rawinput_started = 0;
static uint8_t KeyboardState[256] = {0}; // VKeys
static int8_t MWheel = 0;
extern volatile uint8_t moustat, mousegrab;
extern uint32_t mousewheel[2];
@ -24,6 +23,7 @@ extern void SetKey(int32_t key, int32_t state);
static inline void RI_ProcessMouse(const RAWMOUSE *rmouse)
{
int32_t i, mask;
int8_t MWheel = 0;
if (!mousegrab || !appactive)
return;
@ -145,6 +145,7 @@ static inline void RI_ProcessKeyboard(const RAWKEYBOARD *rkbd)
if (keypresscallback)
keypresscallback(sc_Pause, 1);
case 0xFF:
return;
}
@ -228,8 +229,6 @@ void RI_PollDevices(BOOL loop)
for (i = 0; i < 256; i++)
KeyboardState[i] = GetAsyncKeyState(i) >> 8;
MWheel = 0;
while (loop && PeekMessage(&msg, 0, WM_INPUT, WM_INPUT, PM_REMOVE | PM_QS_INPUT))
RI_ProcessMessage(&msg);