[AD] Windows keyboard state bug in 5.0.2.1 when switching display? |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Hello,
I haven't investigated this very far but I think I stumbled on a problem
with 5.0.2.1.
- Using precompiled Windows binaries from allegro-5.0.2-1-msvc-9.0.zip
package.
- I am polling keyboard using al_get_keyboard_state() and not using any
event queues.
- Keyboard works fine most of the time, however keyboard events seems to
be "missed" by Allegro internal processing after/during a display change
(it is probably a short amount of time?)
My use case is the following:
- Using different key combo the user of my application can trigger a
screen resolution/fullscreen switch, in which case I destroy and
recreate the display along with all my video bitmaps (because as I
understand it Allegro doesn't allow toggling true full-screen mode
without recreating the display).
After this is done my application resume, however most of the times the
keys that required being pressed to trigger the display switch are kept
marked as down in the keyboard state structure. Which made me think that
Allegro never caught/processed the "key released" message from Windows.
My update code has:
al_get_keyboard_state(&g_keyboard_state);
for (int i = 0; i != ALLEGRO_KEY_MAX; i++)
if (al_key_down(&g_keyboard_state, i))
printf("Pressed key %d\n", i);
And after switching display with an "ESCAPE" shortcut (pressed briefly)
i can often see the ESCAPE keycode marked as down permanently.
If I switch display with a long prolonged press on ESCAPE the key is
properly marked as released once I release it.
I don't have a quick repro off-hand but hopefully based on the 4 lines
above you would agree that it is an Allegro bug rather than an
application bug, because the keyboard state is invalid at this point.
Let me know how I can help,
Regards
Omar