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];
IO.PutF[out, "created window: %g \n", IO.card[WindowId[window]]];
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];
};