[PROPOSAL] Generic device-dependent events

Bert Freudenberg bert at isg.cs.uni-magdeburg.de
Fri Dec 1 13:19:09 UTC 2000


I play with the idea of introducing generic, device-dependent extension
events (inspired by the X Input Extension - see
http://capderec.udg.es:81/ebt-bin/nph-dweb/dynaweb/SGI_Developer/X11_LibSpc):

An extension device provides keys, buttons, and motion data. 

There is a primitive to list all available extension devices with their
parameters:
 - number of keys, min and max key code
 - number of buttons
 - number of axes, min and max value for each axe

Then there is another primitive to request events for a device ("open" the
device). After this, device events would be fed into the main event queue:
key press/release events, button press/release events, and motion events:
  - Each event: device id and timestamp
  - Key event: key code, pressed/released flag
  - Button: button number, pressed/released flag
  - Motion: current value of each axis
This last event might be too large for the current 8 int array - there
could be a "continuation flag" so two events get read. 

This gives unified access to almost every input device there is. Some
examples:

          Keys:min..max But. Axes:min..max
Keyboard  248:8..255    0    0
Mouse     0             3    2:0..1024,0..768
Tablet    32:8..39      4    5:0..30480,0..24060,0..1023,-64..64,-64..64
Joystick  0             2    2:-128..128,-128..128

(The first three are actual values from my setup - the tablet motion data 
is x, y, pressure, tilt x, tilt y, the buttons are on the stylus, the
keys are regions on the tablet that can be clicked)

This achitecture would easily be supported in X, I guess Windows provides
something similar with DirectInput, don't know about Mac. 

How does that sound?

-- Bert






More information about the Squeak-dev mailing list