What it does
macXserver implements the X11 SHAPE extension (major opcode 128). Clients that use SHAPE to give themselves a non-rectangular outline render with that outline:
- oclock renders as an actual circle.
- xeyes renders as a bare oval with no surrounding rectangle.
- xclock -shape if you ask for it.
- Any other client that builds itself a shaped top-level via
XShapeCombineMaskorXShapeCombineRectangles.
The optional Motif frame plays along too: if a shaped client is wrapped in
a Motif-style frame, the frame’s SetFrameShape policy reshapes the frame
to follow the client’s shape.
The two canonical SHAPE clients are oclock and xeyes, both old X.org demos. They’re not heavily-used, but they’re nearly universally recognized as “the things X can do that other window systems can’t” demos. An X server that displays oclock as a square clock or xeyes as a rectangle with white corners is visibly wrong in a way that anyone who’s used X11 will spot immediately.

More substantively, modern X clients still use SHAPE for tooltips, drop-down menus, and various floating widgets. Without SHAPE, those render with rectangular halos around them.
Technical detail
SHAPE has three logical pieces: the bounding shape (the outline of the window), the clip shape (the region within the bounding shape that’s drawable), and per-window shape (the same but for child windows). macXserver implements all three; the bounding shape on top-levels is the visually most important and is fully integrated with the AppKit window system.
The trick on the Mac side: NSWindow doesn’t natively support non-rectangular
window shapes. The implementation:
- The X client sends
XShapeCombineMaskwith a 1-bit pixmap. - The server converts the mask region to a
CGPath. - The
NSWindowopaque region gets set to that path so the window background shows through outside the shape. - The window’s
NSViewhonors the same path as itsmaskso drawing is clipped to the shape too.
For descendant windows (children of a shaped top-level), the same clipping is
applied through the server’s ClipListEngine rather than AppKit, so the X
clipping semantics match the spec exactly.
