[AD] Allegro 3.xx keyboard problem and fix |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Hi,
I've come accross some strange problem with the Allegro keyboard handler,
when compiling and running the following code:
#include <stdio.h>
#include <stdlib.h>
#include <allegro.h>
int main(int argc, char *argv[])
{
unsigned int i=0;
allegro_init();
install_keyboard();
while (!keypressed())
printf("%d\r", i++);
printf("\nkey pressed.\n");
exit(EXIT_SUCCESS);
}
In a DOS box under Win 95 and in a Dosemu box under Linux/X11, it's ok.
But in plain DOS or in a Dosemu console, sometimes (not every time) the
counter doesn't stop after a key stroke.
I've tried various combinations of Allegro/GCC versions and the problem
occurs with all Allegro versions >= 3.1 (including 3.9.28 WIP), not with the
3.0 version.
The 3.1 version has a partially new djgpp/keyboard.c module, with rewritten
kb_wait_for_write_ready(), kb_wait_for_read_ready() and kb_send_data()
functions. Now if I replace these three 3.1 functions by the 3.0 ones, the
problem goes away (fix tested with Allegro 3.1, 3.11 and 3.12).
(For completeness, my system is a very old P133, with a brand new Win 95
keyboard)
--
Eric Botcazou (ebotcazou@xxxxxxxxxx)
Page Web: www.multimania.com/ebotcazou