I know I'm barely around here anymore, but this one's a serious problem and after MANY hours of testing, I've traced the problem to Allegro itself, possibly a result of my hardware configuration and how I'm using Allegro so I've included those details:
I'm running Allegro 5.0.10, compiling through MSVC2010, forcing the usage of OpenGL, running Windows 8.1 Pro, 16 GB RAM, 200 GB of HD space free, 4 GHz CPU and a GeForce GTX 660 video card.
The Problem, In Short: If you create an event buffer for joysticks, but continue to press keyboard keys, sooner or later, the keyboard state completely freezes... SYSTEM-WIDE! :O
The Problem, In Long:
So here's the situation: I've created a unified controls system for my current and future projects built on top of Allegro, the goal of which being to simplify all control input so that I simply set which interfaces access which controls, then when writing game code, instead of referencing specific keys or joystick functions, I simply reference the control and how I want to read it, either as a boolean, a floating point value, buffered, one-shot, etc.
Up until now, the system's been flawless. Even after instigating joystick support it's worked perfectly. Then I went back to using keyboard controls as I started getting some more work done with an editor I built for the project I'm working on and suddenly at one moment, my keyboard keys froze up. Nothing I was pushing was doing anything. So I went into the debugger to try and track the problem down. I spent a solid 10 minutes scouting variables and tracing program flow but nothing seemed out of the ordinary... until I tried to type something into the debugger and nothing happened!
At this point I realized the keyboard state was frozen for everything, not just my program. I tried unplugging my keyboard and plugging it back in. This unfroze the keyboard for everything, including my own project. I continued doing my editor work and it happened again... and eventually again. I thought maybe my keyboard was broken so I stopped work on my stuff for a number of hours and did other tasks and ran into no issues.
I've spent the past couple hours carefully enabling and disabling tiny fragments of my code and ultimately discovered that so long as I don't create an ALLEGRO_EVENT_QUEUE and attach the joystick event source to it, nothing goes wrong with the keyboard. Having the joystick and keyboard going together creates no issues so long as there's no joystick queue.
I've also discovered that you actually have to press keys for anything to go wrong. I tried running my program with all the event queues doing their things and just leaving it sit doing nothing for twice as long as it was taking for my keyboard to freeze up, then going back to it and finding the keyboard still functioning. Also, when the freeze occurs, not only do joysticks continue to function properly, along with joystick events, but non-standard keyboard controls continue to function, such as media keys, volume sliders, gaming keys, etc. The only keys frozen are the actual keys Allegro would normally read.
As a work-around to this, since my project could very well be ready for commercial launch in only a matter of months, I'm just going to disable the joystick event handling internally to my program and instead of allowing immediate hot-swapping of joysticks, I'm going to have a button in my controls configuration menu to refresh all detected joysticks, since you don't need an event queue to read the joystick states, nor do you need it to reconfigure joysticks, it's just a lot more convenient to automatically detect if joysticks need to be reconfigured with ALLEGRO_EVENT_JOYSTICK_CONFIGURATION.
With over 12,000 lines of code in place for my project thus-far (over 50% ready for initial public release) it would be difficult to post chunks of code but really, the entire problem can be traced to this single line of code, which is only called once and either seconds or minutes prior to the problem occurring:
I know you guys might be thinking my event handler might have something wrong with it, but even if I completely comment it out and flush the event queue every frame so that it doesn't get jammed up, the problem still occurs.
If there's any additional testing you guys want me to try, let me know. All you need to do to recreate the same circumstances leading to this problem is:
Force Allegro into OpenGL mode on Windows 8.1 in a window
Create two event queues: One with a keyboard source, one with a joystick source
Do any kind of code you want, just so long as you can see both joystick and keyboard input
Press a bunch of keyboard keys for 30 seconds to 5 minutes (yes, it can take that long for anything to go wrong) and at some point, the keyboard will freeze up for the entire system but joystick functions will still work
Unplug your keyboard and plug it back in to fix it (any keys held down when it froze will need to be pressed again to unstick them)