[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Hi all.
I have just been fleshing out my keyboard handling after I found that my
driver had to do more than I expected. There are certain things like
capitalisation and handling of the alt and caps lock keys that a driver has
to do that I would have thought could have been done by Allegro.
Anyway, everything is working now, except one thing. In the allegro.txt
documentation it gives the following example:
int val = readkey();
if ((val & 0xff) == 3) /* ctrl+letter */
allegro_message("You pressed Control+C\n");
This doesn't work for me and I can't see what the driver can do to make it
work. Is this a problem on other platforms? KEY_C is already 3 and
_key_shifts has been updated with KB_CTRL_FLAG when the control key was
pressed. I noticed that when calling _handle_key_press() to report a key
when alt is pressed I have to report 0 as being pressed (strange! see first
paragraph) - is there something similar that needs to be done for control?
I didn't see anything obvious in the Linux source.
Also, the examples/exkeys.c is horribly broken! It uses the
keyboard_lowlevel_callback function callback, the documentation for which
explicitly says:
"This routine executes in an interrupt context"
Now I know that we don't use interrupts any more in "modern" ports, but it
can be expected that some ports use a different thread for keyboard
handling, which means that the same rules apply as for interrupts. Namely,
do as little as possible and don't call Allegro functions for drawing to
the screen! I spent quite a time tracking down the "bug" in my graphics
routines, to finally realise that it was exkeys.c, not me. I might look at
making a patch for this.
Multithreading on Allegro 4 is a hazy subject; has there been thought put
into making it a bit more robust in Allegro 5?
--
/-------------------------------------------------------------------\
[Hitman/Code HQ - 6502/z80/68000/604e/80x86/ARM coder - Amiga rulez!]
[VZ-200/VIC-20/MZ-700/c16/c64*10/c128*8/Plus-4/CPC464/CD32/500*2 ]
[600/1000/1200*2/A4000/SNES/N64/Dreamcast/Athlon 1100/AmigaOne ]
[Assembly Language: The most fun you can have with your clothes on! ]
\-------------------------------------------------------------------/