Re: [AD] Bug in readkey() with numeric keypad?

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


On Thu, 2005-12-01 at 23:26 +0000, Chris Jones wrote:
> Hey,
> 
> I recently upgraded from Allegro 4.1.12 to 4.2.0 Final, but readkey is now
> giving me different results with the numeric keypad keys.
> 
> Let's take the numpad 4 key as an example.
> If numlock is OFF, then it used to return 0 in the lower byte and the
> scancode (41) in the upper byte, thus mimicing the normal left arrow key.
> However, with the latest version it returns the ASCII code for the 4 key
> (52) in the lower byte and the scancode in the upper byte.
> 
> This means that now the left arrow key and the left numpad key are no longer
> consistent with each other when numlock is off (though the key does
> correctly function as a 4 key when numlock is on) -- and that therefore a
> lot of user code which checks if the lower byte is non-zero to determine
> what type of key was pressed, will now fail with these keys.
> 
> Was this by design or an oversight somewhere?

The driver was rewritten, and the documentation nowhere states the above
behavior. So it simply was an undocumented feature. It shouldn't be hard
to add it back though. I don't have Windows anymore though. But if you
look at src/win/wkeybd.c, there's some special checks for numpad keys
starting around like 213. Maybe simply removing those will restore the
old behavior?

-- 
Elias Pschernig





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