Re: [AD] Windows keyboard state bug in 5.0.2.1 when switching display?

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Mon, 2011-05-23 at 00:20 +0100, Omar Cornut wrote:
> 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?)
> 

Indeed. The keyboard state functions are implemented on top of the
events in the Windows version right now, they have no extra information.
(And events are generated in response to WM_KEYDOWN messages of the
Win32 API.) I don't know a lot about the Windows port, but likely those
WM_KEYDOWN messages are only generated when there's a window - so I'm
not surprised it can go out of sync while re-creating the display
(meaning there's a short time without any window).

To fix your use case we could create fake release events for all
currently held keys when the last display is destroyed. Or maybe even
better read the actual keyboard state from Windows and make it
completely independent of the events (if Windows has a function for it).

-- 
Elias Pschernig <elias.pschernig@xxxxxxxxxx>





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/