I just tested yesterdays compiled version of my modified ex_keyboard_events again and found that all modifier keys and also extended keys like the arrow keys and numpad enter are correctly detected (you can tell by the white lines that blip up for each key which is correctly detected in a state).
Not even GetKeyState()? It doesn't always give the same result as GetKeyboardState().
I'll check if giving that key special treatment with GetAsyncKeyState or GetKeyState will allow for correct state detection.
Reading one of the other threads, I now know what you're talking about with the switch out/switch in problem and yes that could be easily fixed by clearing the state on switch out/switch in.
Alright, I tested and debugged special GetKeystate and GetAsyncKeyState for the BREAK key. Neither is able to correctly detect the keystate.
I noticed though that Allegro treats that keypress as a so called 'dead key' and that on the windows system level, the window always gets a WM_KEYDOWN and an immediate following WM_KEYUP message for that key, regardless of its' actual physical state.
So yeah, can't ever detect that ones' state properly.
Attached is a new patch which gets rid of the duplicate internal state and also clears the state when the window becomes inactive/loses input focus. That effectively prevents keys from getting 'stuck' in the state on switching away. see updated main post