Just to clear up any confusion: I'm not suggesting Allegro start sending automatic KEY_UP events on switch-out (this would be unexpected, as pointed out), just to not make the state get "stuck" if the app suddenly loses focus while a key is pressed.
I believe this would even worse behavior.
Now allegro's keyboard state and the keyboard event queue don't match.
If the keyboard state changes, there darn well better be a corresponding key_up/key_dn event generated in the event queue.
I make frequent use of both Polling keystate and listening for events simultaneously, and I'm not doing unholy sorcery, you might simply want to check if somebody is holding down LSHIFT, etc.
Otherwise nobody can ALT+tab out of an allegro app because it risks breaking the input state.
Regardless of which behavior you choose as default, allegro should not contradict itself.
It's not always the programmer's fault if focus is lost--sometimes other apps on the system steal it.
What if the end user wants it. Suppose I want to walk from the west coast to the east in my RPG and it takes 15min. You're telling me I can't press RIGHT and alt+tab away, go make a mohito and come back later. I can't even ALT+TAB to my browser and read until my character reaches the destination. Now I have to sit and hold the key for 15min
or hire a day-laborer to hold the key down for me (economy, jobs, durka-dur! XP).
Ok, that's facetious, but you get my point. I'm not disagreeing the default behavior
you desire is probably what the end-user wants most of the time, but an app/user can be doing anything, so it's certainly not right for everyone all of the time.