DIRECTORY IO, Rope, X11, X11Conventions, X11WMOps, Process; XlTestImpl2: CEDAR PROGRAM IMPORTS IO, X11, X11Conventions, Process ~ BEGIN OPEN X11; ROPE: TYPE ~ Rope.ROPE; num: BYTE ฌ 0; DetachStart: PROC [] = { TRUSTED{Process.Detach[FORK StartTest[]]} }; DetachStop: PROC [] = { TRUSTED{Process.Detach[FORK StopTest[]]} }; Debug: PROC[] = { stop ฌ FALSE; WHILE ~stop DO Process.PauseMsec[200]; ENDLOOP; }; AddS: PROC [p: Point, s: Size] RETURNS [Point] = { RETURN [[x: p.x+s.width, y: p.y+s.height]] }; EventProc: EventProcType = { td: TestData ~ NARROW[clientData]; WITH event SELECT FROM expose: ExposeEvent => { window: Window ฌ expose.window; SetGCForeground[td.gc, 1]; DrawLine[event.connection, window.drawable, expose.pos, AddS[expose.pos, expose.size], td.gc]; }; buttonPress: ButtonPressEvent => { window: Window ฌ buttonPress.eventWindow; SetGCForeground[td.gc, 1]; SetGCBackground[td.gc, 0]; SetGCFont[td.gc, fontId]; ImageRope[event.connection, window.drawable, buttonPress.pos, td.gc, "abc1234"]; }; motionNotify: MotionNotifyEvent => { window: Window ฌ motionNotify.eventWindow; SetGCForeground[td.gc, 1]; FillRectangle[event.connection, window.drawable, td.gc, motionNotify.pos, [10, 10]]; Flush[event.connection]; }; ENDCASE => {}; }; thread: Thread; TestData: TYPE = REF TestDataRec; TestDataRec: TYPE = RECORD [ gc: GContext ]; con: Connection; wId: Window ฌ nullWindow; out: IO.STREAM ฌ IO.noWhereStream; fontName: Rope.ROPE ฌ "vrb-25"; fontId: Font; events: EventFilter ฌ LongCreateEventFilter[activate: ALL[TRUE]]; nastyUnprotectedConnection: Connection ฌ NIL; stop: BOOL ฌ FALSE; StopTest: PROC [] = { stop ฌ TRUE; }; StartTest: PROC ~ { connection: Connection; Init[]; StopTest[]; connection ฌ con ฌ Xl.CreateConnection[]; IF X11.Alive[connection] THEN { ENABLE ABORTED => {nastyUnprotectedConnection ฌ connection; GOTO close}; status: GrabStatus ฌ frozen; gc: GContext ~ MakeGContext[connection]; td: TestData ~ NEW[TestDataRecฌ[gc: gc]]; window: Window ฌ wId ฌ CreateWindow[c: connection, matchList: LIST[NEW[MatchRep ฌ [proc: EventProc, handles: events, thread: thread, data: td]]], geometry: [pos: [20, 400], size: [400, 300]], attributes: [overrideRedirect: true, eventMask: OREvents[exposureMask, pointerMotionMask, keyPressMask, buttonPressMask], backgroundPixel: FirstScreen[connection].whitePixel] ]; X11Conventions.SetWindowName[connection, window, "Test"]; fontId ฌ OpenFont[connection, fontName]; SetGCForeground[gc, 1]; SetGCFont[gc, fontId]; MapWindow[connection, window]; FillRectangle[connection, window.drawable, gc, [10, 20], [30, 40]]; FillRectangle[connection, window.drawable, gc, [40, 60], [30, 40]]; Flush[connection]; Debug[]; CloseConnection[connection]; }; EXITS close => { c: Connection ฌ nastyUnprotectedConnection; nastyUnprotectedConnection ฌ NIL; IF c#NIL THEN CloseConnection[c]; }; }; init: BOOL ฌ FALSE; Init: PROC [] = { IF init THEN RETURN; init ฌ TRUE; thread ฌ CreateTQ[$X11TestsImpl]; }; END. XlTestImpl2.mesa Copyright ำ 1988, 1989, 1991 by Xerox Corporation. All rights reserved. Christian Jacobi, April 13, 1988 3:02:13 pm PDT Christian Jacobi, October 8, 1992 10:17 pm PDT IO.PutF[out, "created window: %g \n", IO.card[WindowId[window]]]; สค–(cedarcode) style•NewlineDelimiter ˜codešœ™Kšœ ฯeœ=™HK™/K™.K™—šฯk œžœžœ$˜;K˜—šฯn œžœž˜Kšžœžœžœ˜(—šœžœžœžœ˜K˜Kšžœžœžœ˜šœžœ˜K˜—šŸ œžœ˜Kšžœžœ˜)K˜—K˜šŸ œžœ˜Kšžœžœ ˜(K˜—K˜šŸœžœ˜Kšœžœ˜ šžœž˜K˜Kšžœ˜—K˜—K˜šŸœžœžœ ˜2Kšžœ$˜*K˜—K˜šŸ œ˜Kšœžœ ˜"šžœžœž˜˜K˜K˜K˜^K˜—˜"K˜)K˜K˜K˜K˜PK˜—˜$K˜*K˜K˜TK˜K˜—Kšžœ˜—K˜—K˜K˜K˜K˜Kšœ žœžœ ˜!šœ žœžœ˜K˜ K˜—K˜K˜K˜K˜Kšœžœžœžœ˜"Kšœžœ ˜K˜ Kšœ6žœžœ˜AK˜Kšœ)žœ˜-K˜Kšœžœžœ˜K˜šŸœžœ˜Kšœžœ˜ K˜—K˜šŸ œžœ˜K˜K˜K˜ K˜)šžœžœžœ˜Kšžœžœ.žœ˜HK˜K˜(Kšœžœ˜)˜3Kšœ žœžœL˜_K˜-K˜ฎK˜—K˜9K˜(Kšžœ$žœ™AK˜K˜K˜K˜CK˜CK˜K˜K˜K˜—šžœ ˜KšœIžœ˜MKšžœžœžœ˜!K˜—K˜K˜——K˜Kšœžœžœ˜K˜šŸœžœ˜Kšžœžœžœ˜Kšœžœ˜ K˜!K˜—K˜K˜Kšžœ˜K˜—…— ชP