[comp.sys.amiga.tech] Keyboard input

brett@pigpen (Brett S Bourbin) (08/31/88)

Does anyone know what the best method is for checking certain key presses
if you don't open an Intuition Window?  I have created my own screen using
ViewPorts and wish to receive input.  The RKM says that you should not open
the keyboard.device with the input.device running, since it will miss many
keys.  Do I have to open another input.device at a high priority than 
Intuition just to get the function keys?

Whatever method I use, it has to be one that is offically supported (will NOT
break under 1.3 and above).  I am taking over the screen and turning off the
Intuition mouse for as long as you are in my program.  I don't want to shut
down the Intuition input.device unless I have to.

Thanks in advance.


- Brett 
 __  __   _  __  _
|  ||  | / ||  || \   Brett S Bourbin
|  ||  ||  ||  ||  |  INTERNET: brett@PIGPEN.UMD.EDU
|  ||  ||  ||  ||  |
 \_||_/ |__||__||__|  Instructional Computing Programs    
     College Park 

koster@cory.Berkeley.EDU (David Ashley) (09/01/88)

In article <4033@umd5.umd.edu> brett@pigpen.UMD.EDU (Brett S Bourbin) writes:
>
>Does anyone know what the best method is for checking certain key presses
>if you don't open an Intuition Window?  I have created my own screen using
>ViewPorts and wish to receive input.

Read in the RKM Volume #1, the chapter on the input.device. What you want
to do is install an input handler at higher priority than intuition, which
is at 50. It will require writing a small routine in assembly language.

The small routine is the input handler itself. It is passed a pointer to
a chain of input events in a0, and you may trash a0,a1 and d1. You must
exit with d0 pointing to the list of input events that you want to pass on.

What I do is scan the list looking for anything interesting, like raw keys
or mouse moves. Then pass a 0 in d0, so no one gets anything. That way, I
get all events, and the user cannot try and mess up my display by trying
to pull down windows, screens, and the software overhead imposed by
intuition when the mouse is moved is avoided. Most programs slow down
when the mouse is moved.

The drawback is that the mouse pointer is stuck wherever it was when the
program was run, and it cannot be moved. It would be nice if you could
turn sprite #0 off without having to open an intuition window and calling
SetPointer() with a null figure.

Maybe you could:
Forbid()
Find the Active window
Mess with its sprite information (What it looks like, height, etc)
Install the input handler, effectively turning off intuition
Permit()

Although sometimes your program could be run with no visible windows (like
from the Workbench.)

koster@cory.berkeley.edu
David Ashley