X11InputExtensionCommands.mesa
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Christian Jacobi, January 23, 1991 12:53 pm PST
Christian Jacobi, November 23, 1992 9:48 am PST
DIRECTORY
Rope,
Commander,
CommanderOps,
IO,
X11CommanderOps,
XlInputExtension,
Xl;
X11InputExtensionCommands: CEDAR MONITOR
IMPORTS X11CommanderOps, Xl, XlInputExtension, Commander, CommanderOps, IO =
BEGIN
BoolRope: PROC [b: BOOL] RETURNS [r: Rope.ROPE] = {
r ¬ SELECT b FROM
TRUE => "T",
FALSE => "F",
ENDCASE => "?"
};
CurrentUseRope: PROC [cu: XlInputExtension.CurrentUse] RETURNS [r: Rope.ROPE] = {
r ¬ SELECT cu FROM
isXPointer => "isXPointer",
isXKeyboard => "isXKeyboard",
isExtensionDevice => "isExtensionDevice",
ENDCASE => "?"
};
InputClassRope: PROC [ic: XlInputExtension.InputClass] RETURNS [r: Rope.ROPE] = {
r ¬ SELECT ic FROM
keyClass => "keyClass",
buttonClass => "buttonClass",
valuatorClass => "valuatorClass",
feedbackClass => "feedbackClass",
proximityClass => "proximityClass",
focusClass => "focusClass",
otherClass => "otherClass",
ENDCASE => IO.PutFR1["undefinedClass(%g)", IO.int[ORD[ic]]]
};
ListInputDevicesCommand: Commander.CommandProc = {
Inner: X11CommanderOps.ConnectionProc = {
InfoForDevice: PROC [di: XlInputExtension.DeviceInfo] = {
typeName: Rope.ROPE ¬ Xl.GetAtomName[connection, di.type];
IO.PutF[cmd.out, "Device: %g type: %g name: %g, ", IO.int[di.id], IO.rope[typeName], IO.rope[di.name]];
IO.PutF[cmd.out, "classes: %g\n CurrentUse: %g \n", IO.int[di.numClasses], IO.rope[CurrentUseRope[di.use]]];
FOR l: LIST OF REF XlInputExtension.InputInfo ¬ di.info, l.rest WHILE l#NIL DO
IO.PutF1[cmd.out, " Class: %g \n", IO.rope[InputClassRope[l.first.class]]];
WITH l.first SELECT FROM
ki: REF keyInfo XlInputExtension.InputInfo => {
IO.PutF[cmd.out, " min: %g max: %g, number: %g\n", IO.int[ki.min], IO.int[ki.max], IO.int[ki.number]];
};
bi: REF buttonInfo XlInputExtension.InputInfo => {
IO.PutF1[cmd.out, " number: %g\n", IO.int[bi.number]];
};
vi: REF valuatorInfo XlInputExtension.InputInfo => {
IO.PutF[cmd.out, " supportsRelative: %g, supportsAbsolute %g, motionBufferSize: %g", IO.rope[BoolRope[vi.supportsRelative]], IO.rope[BoolRope[vi.supportsAbsolute]], IO.int[vi.motionBufferSize]];
IO.PutF1[cmd.out, ", Axis: %g\n", IO.int[vi.numberOfAxis]];
FOR axis: INT IN [0..vi.numberOfAxis) DO
IO.PutF[cmd.out, " resolution: %g, min %g, max: %g\n", IO.card[vi.axisInfo[axis].resolution], IO.card[vi.axisInfo[axis].min], IO.card[vi.axisInfo[axis].max]];
ENDLOOP
};
ENDCASE => {};
ENDLOOP;
};
count: INT ¬ 0;
list: LIST OF XlInputExtension.DeviceInfo;
list ¬ XlInputExtension.ListInputDevices[connection];
IF list=NIL THEN CommanderOps.Failed["Extension not available (or supports no device)"];
FOR l: LIST OF XlInputExtension.DeviceInfo ¬ list, l.rest WHILE l#NIL DO
count ¬ count+1
ENDLOOP;
IO.PutF1[cmd.out, "%g extension devices available\n", IO.int[count]];
FOR l: LIST OF XlInputExtension.DeviceInfo ¬ list, l.rest WHILE l#NIL DO
InfoForDevice[l.first];
ENDLOOP;
};
X11CommanderOps.DoWithConnection[Inner, TRUE, NIL];
};
doc: Rope.ROPE = "print available devices from x input extension";
Commander.Register[key: "X11ListInputDevices", proc: ListInputDevicesCommand, doc: doc];
END.