DRAWMUX(2)                                             DRAWMUX(2)

     NAME
          drawmux - multiplex stream of draw requests

     SYNOPSIS
          include "drawmux.m";
          drawmux := load Drawmux Drawmux->PATH;

          init:         fn(): (string, ref Draw->Display);
          newviewer:  fn(fd: ref Sys->FD);

     DESCRIPTION
          Drawmux puts itself between the invoking application and
          /dev/draw (see draw(3)), so that the contents of the current
          display can be replicated elsewhere.

          Init returns a new Display (see draw-display(2)) represent-
          ing a connection to a virtual display device.  Subsequent
          Draw requests to that display (see draw-intro(2)) are for-
          warded to the underlying draw(3) device to appear on the
          physical display, but can also replicated elsewhere, typi-
          cally in a window on a remote display.

          Newviewer prepares the virtual display end of a Drawmux con-
          nection for each new viewer of the display created by a pre-
          vious 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-
          dial(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.

     SEE ALSO
          wm-dmview(1), draw-intro(2), draw(3)

     Page 1                       Plan 9            (printed 12/21/24)