include "drawmux.m"; drawmux := load Drawmux Drawmux->PATH; init: fn(): (string, ref Draw->Display); newviewer: fn(fd: ref Sys->FD);
Init returns a new Display (see draw-display(2)) representing a connection to a virtual display device. Subsequent Draw requests to that display (see draw-intro(2)) are forwarded to the underlying draw(3) device to appear on the physical display, but can also replicated elsewhere, typically in a window on a remote display.
Newviewer prepares the virtual display end of a Drawmux connection for each new viewer of the display created by a previous call to init. The file descriptor fd is a connection to the viewer. The remote viewer must first write 24 bytes on that connection, containing two decimal numbers (each 11 digits and a space), giving the identifier of a public screen on the viewer's display, on which newviewer will replicate the Drawmux display, and the log (base 2) of the number of bits per pixel for windows created on that screen. The remote viewer must then use Sys->export (see sys-export(2)) to export its /dev/draw, which newviewer expects to find as the root of the exported hierarchy. Subsequent draw operations on the Drawmux display will be replicated on the public screen exported by the viewer. Shutting down the connection shuts down the multiplexor for that viewer.
|DRAWMUX(2 )||Rev: Tue Mar 31 02:42:39 GMT 2015|