X11SelectionPrivateImpl.mesa
Copyright Ó 1991 by Xerox Corporation. All rights reserved.
Christian Jacobi, January 30, 1991 1:11:03 pm PST
Christian Jacobi, March 22, 1991 11:50 am PST
DIRECTORY Xl, X11SelectionPrivate;
X11SelectionPrivateImpl:
CEDAR
MONITOR
IMPORTS Xl
EXPORTS X11SelectionPrivate ~
BEGIN OPEN X11SelectionPrivate;
myPropertyKey: REF ATOM ~ NEW[ATOM ¬ $selections];
cache1, cache2: ConnectionData ¬ NEW[ConnectionDataRec]; --Use two caches, typically owner and requestor use different connections
InitConnection: Xl.InitializeProcType = {
--Initializes the per connection data
cd: ConnectionData ¬ NEW[ConnectionDataRec ¬ [connection: c]];
cd.hiddenParent ¬ Xl.CreateWindow[c: c, matchList: NIL, parent: Xl.DefaultRoot[c], class: inputOnly];
cd.atomPairXAtom ¬ Xl.MakeAtom[c, "ATOM←PAIR"];
cd.targetsXAtom ¬ Xl.MakeAtom[c, "TARGETS"];
cd.incrXAtom ¬ Xl.MakeAtom[c, "INCR"];
cd.timeStampXAtom ¬ Xl.MakeAtom[c, "TIMESTAMP"];
cd.multipleXAtom ¬ Xl.MakeAtom[c, "MULTIPLE"];
RETURN [cd]
};
GetConnectionData:
PUBLIC PROC [c: Xl.Connection]
RETURNS [cd: ConnectionData] = {
--Return cached (or eventually created) per connection data
cd ¬ cache1;
IF cd.connection=c THEN RETURN [cd];
cd ¬ cache2;
IF cd.connection=c THEN RETURN [cd];
cd ¬ NARROW[Xl.GetConnectionPropAndInit[c, myPropertyKey, InitConnection]];
cache2 ¬ cache1;
cache1 ¬ cd;
RETURN [cd];
};
END.