[comp.sys.amiga.tech] input device questions

pl@kaarne.tut.fi (Lehtinen Pertti) (05/30/89)

	When using input.device some questions arise to me:

	- I can generate input events and send them to inputdevice ok,
	  but who put's QUALIFIERS on their place?
	  I don't like to sneak keyboard just to get them.

	- Should I generate correct timestamp to event?
	  Do I have to open timer device in order to get it?

					Pertti Lehtinen
					pl@tut.fi

pl@tut.fi				! -------------------------------- !
Pertti Lehtinen				!  Alone at the edge of the world  !
Tampere University of Technology	! -------------------------------- !
Software Systems Laboratory

jeh@elmgate.UUCP (Ed J Hanway CUST) (06/02/89)

In article <7271@etana.tut.fi> pl@kaarne.tut.fi (Lehtinen Pertti) writes:
>
>	When using input.device some questions arise to me:
>
>	- I can generate input events and send them to inputdevice ok,
>	  but who put's QUALIFIERS on their place?
>	  I don't like to sneak keyboard just to get them.

The qualifier should be set in order to support shift-clicking. The method I
use is to open keyboard.device, then issue KBD_READMATRIX like so:

	UBYTE keys[13];

	kbd_ior->io_Command = KBD_READMATRIX;
	kbd_ior->io_Length = 13;		/* SEE NOTE BELOW */
	kbd_ior->io_Data = (APTR) keys;
	DoIO(kbd_ior);

	event.ie_Qualifier |= keys[12];

The bits in the keys[12] are conveniently in the same order as the
qualifier bits.

NOTE: 13 is the only length that works, although if that's documented
      anywhere, it's news to me.

>	- Should I generate correct timestamp to event?
>	  Do I have to open timer device in order to get it?
>
You need to time stamp the events in order for double-clicking to work
correctly. I use timer.device, but I think you could also call Intuition
and get the same thing.

This goes for general mouse events. If you have a specific need just to move
the mouse under program control and you're not doing any clicking, then I
think it's safe to forget about the time stamps and the qualifiers.

-- 
Ed Hanway
Eastman Kodak Company	       ...{cornell,rutgers}!rochester!kodak!elmgate!jeh