X11Viewers.mesa
Copyright Ó 1989, 1990, 1991, 1992 by Xerox Corporation. All rights reserved.
Christian Jacobi, May 1, 1989 8:13:37 pm PDT
Christian Jacobi, August 16, 1993 12:18 pm PDT
DIRECTORY
Imager USING [Color, Context],
Rope USING [ROPE],
ViewersWorld USING [Ref],
ViewersWorldClasses USING [ViewersWorldClass],
ViewerScreenTypes USING [ContextCreatorProc, Screen],
Xl USING [RGBRec],
XlBitmap USING [Bitmap],
XlColorAccess USING [ColorData],
XTk USING [Widget],
XTkTIPSource USING [TipSourceHandle];
X11Viewers: CEDAR DEFINITIONS = BEGIN
Implements Cedar Viewers on top of X windows.
All screens belong to the same connection. This restriction is motivated by the fact that we will use the X servers timestamp for timing user input.
The whole interface is thought to be private.
Start: PROC [server: Rope.ROPE ¬ NIL];
Start up a viewers world
baseClass: PRIVATE ViewersWorldClasses.ViewersWorldClass;
A class is exported so fields can be filled in independently from different implementor packages. Clients have absolutely nothing to do here.
The class is copied before callbacks will see it. Implementors may change the copies.
debugging: PRIVATE BOOL;
If this boolean is TRUE the X11-viewers-world is beeing debugged. Error handlers then ought to raise errors and not continue to enable finding bugs as close to the source as possible.
If this boolean is FALSE error handlers will try to catch any errors they can to keep the Cedar world alive and running.
The value of this variable is set with the interpreter.
ScreenServerData: TYPE = REF ScreenServerDataRec;
ScreenServerDataRec: PRIVATE TYPE = RECORD [
viewersWorld: ViewersWorld.Ref, --backpointer...
instable: BOOL ¬ TRUE, --TRUE when known problems with widget or connection
top: XTk.Widget,
useBitmap: BOOL ¬ TRUE,
bitmap: XTk.Widget,
focusTarget: XTk.Widget, --either top or bitmap
possibleBitsPerPixel: NAT ¬ 1, --according to widget
preparedBitsPerPixel: NAT ¬ 1,
actualBitsPerPixel: NAT ¬ 0, --of sampleMap
preparedSurfaceUnitsPerPixel: NAT ¬ 1,
actualSurfaceUnitsPerPixel: NAT ¬ 0,
bm: XlBitmap.Bitmap ¬ NIL,
width, height: NAT ¬ 200, --size of world; not widget
imagerCursorColor: Imager.Color ¬ NIL,
xCursorColor: REF Xl.RGBRec ¬ NIL,
tsh: XTkTIPSource.TipSourceHandle ¬ NIL,
contextCreator: ViewerScreenTypes.ContextCreatorProc ¬ NIL,
reservedForColorMap: XlColorAccess.ColorData ¬ NIL,
reservedForColorIndices: REF ¬ NIL,
invGamma: REAL ¬ 0.4545454, --1.0/2.2
cursorInfo: CursorInfo ¬ NIL,
class: ViewersWorldClasses.ViewersWorldClass ¬ NIL,
thisScreen: ViewerScreenTypes.Screen ¬ main,
screens: ARRAY ViewerScreenTypes.Screen OF ScreenServerData ¬ ALL[NIL]
--screens[thisScreen] will point to this ScreenServerDataRec...
];
CursorInfo: TYPE = REF CursorInfoRec;
CursorInfoRec: TYPE;
afterWidgetCreation: <<XTkNotification>>PRIVATE ATOM ~ $X11ViewersAfterWidgetCreation;
Key for procs to be called after widget creation.
callData set to ScreenServerDataRec.
Handy for implementors to set up XTk.RegisterNotifier's.
beforeWindowCreation: <<XTkNotification>>PRIVATE ATOM ~ $X11ViewersBeforeWindowCreation;
Key for proc called before window creation with everything else already initialized.
callData set to ScreenServerDataRec.
Handy for implementors to set up color maps and similar stuff; note that this is called after checkBitsPerPixel.
bitmapReplaced: <<XTkNotification>>PRIVATE ATOM ~ $X11ViewersBitmapReplaced;
Key for proc called when data.bitmap is replaced before it is installed in the widget.
callData set to ScreenServerDataRec.
Handy for implementors to install color maps and similar stuff.
bitsPerPixelOk: PRIVATE ERROR; --raised on success
checkBitsPerPixel: <<XTkNotification>>PRIVATE ATOM ~ $X11ViewersCheckBitsPerPixel;
Key for proc called just before window creation (and before beforeWindowCreation).
callData set to ScreenServerDataRec.
If any registered procedure raises bitsPerPixelOk the bits per pixel value is ok; otherwise a black and white window will be made. If bitsPerPixelOk is ok procedure might also precompute some color specific informations.
This mechanism is used to make the color stuff optional.
Reset: PROC [screenServerData: REF ANY];
Tests for liveness, initializes internal caches and on success sets instable to FALSE
Warning: PROC [screenServerData: REF ANY, screen: INT ¬ -1];
sets instable to TRUE to prevent operations raising ERRORs on non existing windows
screen -1 for all screens
SetGCMode: PROC [doingGC: BOOL];
Probably uses a funny cursor to denote gc...
END.