[comp.sys.amiga.tech] RAWKEYS question

nsw@cord.UUCP (Neil Weinstock) (02/06/89)

First of all, thanks to those who helped out with my vblank server.  Moving
right along to my next exciting adventure...

Here's the short form:  my program needs to have raw keyboard input.  Since
I have my own Intuition screen, I thought that RAWKEY messages would solve
my problem.  What happens now is that when I hold a key down, after about
one second my program locks.  When I release the key, everything resumes.
Needless to say, this behavior is undesireable.  Is there a trick to using
RAWKEYs, or should I be using a different method for raw keyboard input?

Additional background:  My program is animating at 30 frames a second.  Each
time through the loop, I empty out my IDCMP port.  All very straightforward.
I've had the same results with and without Dmouse running.  What I don't
understand is that RAWKEYs should only be generating key up/down messages,
so holding down a key should have no effect on anything.  Unless the
keyboard.device or input.device are processing key repeats and somehow bringing
the whole works to a grinding halt.  I still don't see how that could happen.

Aside:  I assumed that getting the RAWKEY messages from my IDCMP was not
appreciably less efficient than going to the keyboard or input.device directly.
Is this a good assumption?  The IDCMP route is certainly much simpler, but
I need quick response (it's a game, after all).

Any insights appreciated.


 /.- -- .. --. .- .-. ..- .-.. . ... .- -- .. --. .- .-. ..- .-.. . ...\
/ Neil Weinstock | att!cord!nsw     | "One man's garbage is another     \
\ AT&T Bell Labs | nsw@cord.att.com | man's prune danish." - Harv Laser /
 \.- -- .. --. .- .-. ..- .-.. . ... .- -- .. --. .- .-. ..- .-.. . .../

aaron@madnix.UUCP (Aaron Avery) (02/08/89)

Intuition gets its RAWKEY events from the input.device. The input.device is
responsible for key repeat. Therefore, you will receive messages at your
IDCMP port for auto-repeated keystrokes (with the REPEAT qualifier set).
For your needs, I'd suggest using the keyboard.device directly. However,
if the input.device is still in use, the key repeat overhead will still
probably slow you down a bit, minus the extra message passing overhead for
getting it to your IDCMP port.
Another thing you can do is to mess with the input.devices key repeat
timeouts. You can set up the key repeat delay and speed ala Preferences by
sending a couple of messages to it. These changes are global, but you can
always put them back when you're through. I'd suggest a key repeat delay
of -1 seconds. I suppose this could be better, since you can still handle
all of your input related events from the one IDCMP port, but be sure to
put things back to normal whenever other things could be getting input from
the keyboard.

-- 
Aaron Avery, ASDG Inc.         "A mime is a terrible thing to waste."
                                                             -- Robin Williams
ARPA: madnix!aaron@cs.wisc.edu   {uunet|ncoast}!marque!
UUCP:   {harvard|rutgers|ucbvax}!uwvax!astroatc!nicmad!madnix!aaron