home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 15 / CD_ASCQ_15_070894.iso / vrac / how_to.zip / MGR.HOW < prev    next >
Text File  |  1994-04-29  |  22KB  |  471 lines

  1. Archive-name: linux/howto/MGR
  2. Last-modified: 15 Apr 94
  3.  
  4.        The MGR Window System HOWTO
  5.      Draft 17 Feb 1994
  6.       Copyright Vincent Broman 1994
  7.        Permission granted to make and distribute
  8.       verbatim (unaltered) copies for any purpose.
  9.  
  10. .0 This HOWTO
  11.  
  12.     .01 Table of Contents
  13.  
  14.  This HOWTO   .0
  15.  What is the MGR window system? .1
  16.  Installing MGR   .2
  17.  Running MGR   .3
  18.  Programming for MGR  .4
  19.  More Documentation  .5
  20.  Credit for MGR   .6
  21.  
  22.     .02 Archiving
  23.  
  24.  This HOWTO is temporarily archived for anonymous FTP on
  25.  bugs.nosc.mil in pub/Mgr/MGR-HOWTO, and more permanently
  26.  on sunsite.unc.edu in pub/Linux/docs/HOWTO .
  27.  
  28.     .03 Credit for the HOWTO
  29.  
  30.  While Vincent Broman first put together this HOWTO,
  31.  much of the information and text was obtained from FAQs,
  32.  READMEs, etc. written by Stephen Uhler, Michael Haardt,
  33.  and other public-spirited net-persons.
  34.  Email corrections and suggested changes to broman@nosc.mil .
  35.  
  36.  Uhler was the main architect of MGR -- see the Credit section below.
  37.  
  38. .1 What is the MGR window system?
  39.  
  40.     .11 Function
  41.  
  42.  MGR (ManaGeR) is a graphical window system.  The MGR server
  43.  provides a builtin window manager and windowed graphics terminal
  44.  emulation on color and monochrome bitmap displays.  MGR is
  45.  controlled by mousing pop-up menus, by keyboard interaction, and by
  46.  escape sequences written on pseudo-terminals by client software.
  47.  
  48.  MGR provides each client window with: termcap-style terminal
  49.  control functions, graphics primitives such as line and circle
  50.  drawing; facilities for manipulating bitmaps, fonts, icons, and
  51.  pop-up menus; commands to reshape and position windows; and a
  52.  message passing facility enabling client programs to rendezvous
  53.  and exchange messages.  Client programs may ask to be informed
  54.  when a change in the window system occurs, such as a reshaped
  55.  window, a pushed mouse button, or a message sent from another
  56.  client program.  These changes are called events.  MGR notifies a
  57.  client program of an event by sending it an ASCII character string
  58.  in a format specified by the client program.  Existing
  59.  applications can be integrated into the windowing environment
  60.  without modification by having MGR imitate keystrokes in response
  61.  to user defined menu selections or other events.
  62.  
  63.     .12 Requirements
  64.  
  65.  MGR currently runs on Linux, Sun 3/4 workstations with SunOS, and
  66.  Coherent.  Various older versions of MGR run on the Macintosh,
  67.  Atari ST MiNT, Xenix, 386-Minix, DEC 3100, and the 3b1 Unix-pc.
  68.  The programming interface is implemented in C and in ELisp,
  69.  although supporting clients written in other languages is quite
  70.  easy.
  71.  
  72.  Running MGR requires much less in resources than X, or even gcc.
  73.  It does not have the user-base, software repertory, or high-level
  74.  libraries of X or MS-Windows, say, but it is quite elegant
  75.  and approachable.
  76.  
  77.  It has been said that MGR is to X as Unix was to Multics.
  78.  
  79.     .13 How do MGR, X11 and 8.5 compare?
  80.  
  81.         MGR consists of a server with builtin window manager and terminal
  82.  emulator, and clients which run in this terminal emulator and use it
  83.  to communicate with the server.  No resource multiplexing is done.
  84.  
  85.  X11 consists of a server and clients, which usually connect to the
  86.  server using a socket.  All user visible things like terminal
  87.  emulators, window managers etc are done using clients.  No resource
  88.  multiplexing is done.
  89.  
  90.  8.5, the Plan 9 window system, is a resource multiplexer, as each
  91.  process running in a window can access /dev/bitblt, /dev/mouse and
  92.  /dev/kbd in its own namespace.  These are multiplexed to the
  93.  /dev/bitblit, /dev/mouse and /dev/kbd in the namespace of 8.5.
  94.  This approach allows one to run 8.5 in an 8.5 window,
  95.  a very clean design.  8.5 further has an integrated window manager
  96.  and terminal emulator.
  97.  
  98. .2 Installing MGR
  99.  
  100.     The latest version can be FTPed from bugs.nosc.mil:pub/Mgr/62 .
  101.     You can get older MGR sources from ftp.thp.uni-koeln.de[134.95.64.1]
  102.     in pub/linux/mgr, or on [134.95.80.1] in pub/thp/linux/mgr, if you
  103.     can't reach the first site.  Even older versions of this distribution
  104.     from Haardt can be found on tsx-11.mit.edu and elsewhere.  Pre-Linux
  105.     versions of MGR from Uhler and others (prior to Haardt) can be
  106.     found at bellcore.com:pub/mgr, although no one seems to maintain
  107.     things there.  MGR has been through a lot of versions and releases,
  108.     but the current *Linux* version number is 0.62.  This version number
  109.     ought to arrive at 1.0 when 256-color VGA code for Linux appears.
  110.  
  111.     Required tools to build this distribution of MGR are m4 (GNU, or
  112.     perhaps another supporting the -D option), make (GNU, or perhaps
  113.     another supporting include) and *roff for the docs.  Also sh,
  114.     awk, and POSIX install.  Binary distributions have not been assembled
  115.     yet, so you need an ANSI C compiler environment, e.g. gcc + gas.
  116.  
  117.     A Linux installation requires Linux 0.99.10 or better, an HGC,
  118.     EGA, VGA, or SVGA graphics card, and a mouse.  Mouses supported
  119.     are: serial Microsoft mouse, serial MouseSystems 3 and 5 byte
  120.     mouse, serial MMSeries mouse, serial Logitech mouse, PS/2 mouse,
  121.     or a bus mouse.  The VGA 640x480 monochrome graphics mode is
  122.     supported out of the box, as is 640x350 and 640x200.  To run
  123.     800x600, or other modes that your BIOS can initialize and which
  124.     do not require bank-switching, you need to run a small program
  125.     (supplied as src/vgamisc/regs.exe) under DOS to read the VGA registers
  126.     while that mode is set and write a header file which you place in the
  127.     directory src/libbitblit/linux.  Some VGA cards can use 128k
  128.     windows, and these can run higher resolutions.  The Linux code
  129.     does not yet support more than two colors.
  130.  
  131.     Suns with SunOS 4.1.2 and bwtwo, cgthree, or cgsix frame buffers
  132.     are supported.  Coherent installations should refer to the
  133.     README.Coh file in the source distribution.  Porting the
  134.     latest-and-greatest MGR to another POSIX-like system which
  135.     provides select() and pty's and direct access to a bitmapped
  136.     frame-buffer ought to be straightforward, just implementing the
  137.     libbitblit library based on the sunmono or colorport code, say.
  138.     
  139.     If you want to install everything, you need 4.8 MB disk space for
  140.     binaries, fonts, manual pages etc.  The sources are about 2 MB,
  141.     plus object files during compilation.
  142.  
  143.     Normally, /usr/mgr should be either the directory or a link to the
  144.     directory where you install MGR stuff for runtime use.  Typing
  145.     "chdir /usr/mgr; gunzip < whereveryouputit/mgrusr.tgz | tar xvf -"
  146.     and optionally
  147.     "chdir /usr/mgr; gunzip < wherever/morefonts.tgz | tar xvf -"
  148.     will unpack these.  The source can be put anywhere, e.g. typing
  149.     "chdir /usr/src/local/mgr; gunzip < wherever/mgrsrc.tgz | tar xvf -"
  150.     to unpack the sources from bugs.nosc.mil.
  151.  
  152.     The source tree can be compiled from one top-level Makefile which
  153.     invokes lower-level Makefiles, all of which "include" a "Configfile"
  154.     at the top level.  The Configfile is created by an interactive sh
  155.     script named Configure, which runs m4 on a Configfile.m4,
  156.     so you do something like this:
  157.  
  158.     chdir /usr/src/local/mgr
  159.     sh ./Configure
  160.     make first
  161.     make depend
  162.     make install
  163.     make clean
  164.  
  165.     It might be wise, before running make, to eyeball the Configfile
  166.     generated by the Configure script, checking that it looks reasonable.
  167.     (At least one m4 poops out, creating a very short Configfile.
  168.     If this happens, try editing a copy of Configfile.sun or Configfile.lx)
  169.     Several flags in MGRFLAGS can be added/omitted to change some
  170.     optional features in the server, viz:
  171.  -DWHO:  muck utmp file so "who" works
  172.  -DVI  code for clicking the mouse in vi moving the cursor
  173.  -DDEBUG  enable debugging output selectable with -d options.
  174.  -DFASTMOUSE XOR the mouse track
  175.  -DBUCKEY for hot-key server commands without mousing
  176.  -DPRIORITY for priority window scheduling instead of 
  177.    round-robin; the active window gets higher priority
  178.  -DCUT  for cut/paste between windows and a global snarf buffer
  179.  -DALIGN  forces window alignment for fast scrolling (monochr)
  180.  -DKILL  kills windows upon tty i/o errors
  181.  -DSHRINK use only some of the screen ($MGRSIZE in environment)
  182.  -DNOSTACK don't permit event stacking 
  183.  -DBELL  really ring the bell
  184.  -DKBD  read mgr input from the sun kbd, instead of stdin.
  185.    This permits redirection of console msgs to a window.
  186.  -DFRACCHAR fractional character movement for proportional fonts
  187.  -DXMENU  extended menu stuff (experimental)
  188.  -DMOVIE  movie making extension which logs all operations to a
  189.    file for later replay -- not quite working under Linux
  190.         -DEMUMIDMSBUT Emulate a missing middle mouse button by chording
  191.  
  192.     Not all combinations of these options work on all systems.
  193.  
  194.     If a make complains about the lack of a default_font.h or an
  195.     icon_server.h in the directory src/mgr, then just do a
  196.     "make default_font.h icon_server.h" in that directory.
  197.     C code for the static variables containing icons and fonts
  198.     is generated by a translator from icon and font files.
  199.  
  200.     Not all the clients are compiled and installed by the Makefiles.
  201.     Clients found under src/clients having capitalized names or
  202.     not compiled by the supplied Makefiles may have problems compiling
  203.     and/or running, but they may be interesting to hack on.
  204.     Several screen drivers found under the libbitblit directory are
  205.     of mainly archeological interest. Grave robbing can be profitable.
  206.  
  207.     At some point check that your /etc/termcap and/or terminfo file
  208.     contain entries for MGR terminals such as found in the misc
  209.     directory.  If all your software checks $TERMCAP in the environment,
  210.     this is not needed, as long as you run set_termcap in each window.
  211.  
  212.     MGR works better if run setuid root, because it wants to chown
  213.     ptys and write in the utmp file.  This helps the ify iconifier
  214.     client work better and the event passing mechanism be more secure.
  215.     On Linux, root permissions are required in order to do in/out on the
  216.     screen device.  Otherwise, you decide whether to trust it.
  217.  
  218.     In versions around 0.62 there are troubles on the Sun with using
  219.     the csh as the default shell.  Programs seem to run in a different
  220.     process group than the foreground process group of the window's pty.
  221.     There is no trouble with bash, sh, or rc.  Ideas why?
  222.  
  223. .3 Running MGR
  224.  
  225.     The only file =required= in an MGR installation is the server
  226.     itself.  That would give you terminal emulator windows with shells
  227.     running in them, but no nice clocks, extra fonts, fancy graphics,
  228.     etc.  Depending on options, the server needs about 200K of RAM
  229.     plus dynamic space for windows, bitmaps, etc.
  230.  
  231.     If /usr/mgr/bin is in your PATH, then just type "mgr" to start up.
  232.     When the hatched background and mouse pointer appear, hold down
  233.     the left mouse button, highlight the "new window" menu item, and
  234.     release the button.  Then drag the mouse from corner to corner
  235.     where you want a window to appear.  The window will have your
  236.     default shell running in it.  Hold down the left mouse button over
  237.     an existing window to see another menu for doing things to that
  238.     window.  The menu you saw that pops-up over the empty background
  239.     includes the quit command.  For people with a two button mouse:
  240.     press both buttons together to emulate the missing middle button.
  241.  
  242.     ** When trying to run MGR, if you get:
  243.  
  244.     - can't find the screen
  245.       make sure you have a /dev entry for your display device, e.g. on
  246.       a Sun /dev/bwtwo0.  If not, as root cd to /dev, and type
  247.       "MAKEDEV bwtwo0".  Otherwise, you might need the -S/dev/bwtwo0
  248.       or (on Linux) the -S640x480 command line option when starting mgr.
  249.  
  250.     - Can't find the mouse
  251.       make sure /dev/mouse exists, usually as a symbolic link to the
  252.       real device name for your mouse.  If you haven't permission to
  253.       write in /dev, then something like a -m/dev/cua0 option can be
  254.       given when starting mgr.  Also, make sure you've supplied the
  255.       right mouse protocol choice when you configured mgr.  The mouse
  256.       may speak Microsoft, even if that is not the brand name.
  257.  
  258.     - can't get a pty
  259.       make sure all of /dev/[tp]ty[pq]? are owned by root, mode 666
  260.       and all programs referenced with the "shell" option in your
  261.       .mgrc startup file (if any) exist and are executable.
  262.  
  263.     - none but the default font, make sure MGR is looking in the right
  264.       place for its fonts.  Check the Configfile in the source or
  265.       see whether a -f/usr/mgr/font option to mgr fixes the problem.
  266.  
  267.     - completely hung (not even the mouse track moves)
  268.       login to your machine from another terminal (or rlogin) and kill the
  269.       mgr process.  A buckey-Q key will quit MGR if the keyboard still works.
  270.       Sometimes you can switch to another virtual terminal with an alt-F key
  271.       and kill mgr from there.
  272.  
  273.     .31 Applications not aware of MGR
  274.  
  275.  Any tty-oriented application can be run in an MGR window
  276.  without further ado.  Screen-oriented applications using
  277.  termcap or curses can get the correct number of lines and
  278.  columns by your using shape(1) to reshape the window or using
  279.  set_termcap(1) or set_emacs(1) to obtain the correct termcap.
  280.  
  281.     .32 MGR Applications (clients) distributed with the server
  282.  
  283.  bounce, grav, grid, hilbert, mgreyes, stringart, walk - graphics demos
  284.  browse - an icon browser
  285.  bury - bury this window
  286.  clock - digital display of time of day
  287.  clock2 - analog display of time of day
  288.  close - close this window, iconify
  289.  cmenu - vi menus from C compiler errors
  290.  color - set the foreground and background color for text in this window
  291.  cursor - change appearance of the character cursor
  292.  cut - cut text from this window into the cut buffer
  293.  cycle - display a sequence of icons
  294.  dmgr - crude ditroff previewer
  295.  fade - fade a home movie script from one scene to another
  296.  font - change to a new font in this window
  297.  hpmgr - hp 2621 terminal emulator
  298.  ico - animate an icosahedron or other polyhedron
  299.  iconmail - notification of mail arrival
  300.  iconmsgs - message arrival notification
  301.  ify - iconify and deiconify windows
  302.  loadfont - load a font from the file system
  303.  maze -  a maze game
  304.  mclock - micky mouse clock
  305.  menu - create or select a pop-up menu
  306.  mgr - bellcore window manager and server
  307.  mgrbd - boulder-dash game
  308.  mgrbiff - watch mailbox for mail and notify
  309.  mgrload - graph of system load average
  310.  mgrlock - lock the console
  311.  mgrlogin - graphical login controller
  312.  mgrmag - magnify a part of the screen, optionally dump to file
  313.  mgrmail - notification of mail arrival
  314.  mgrmode - set or clear window modes
  315.  mgrmsgs - message arrival notification
  316.  mgrplot - Unix "plot" graphics filter
  317.  mgrsclock - sandclock
  318.  mgrshowfont - browse through mgr fonts
  319.  mgrsketch - a sketching/drawing program
  320.  mgrview - view mgr bitmap images
  321.  mless - start up less/more in separate window, menu added for less
  322.  mvi - start up vi in a separate window, mouse pointing
  323.  oclose - (old) close a window
  324.  omgrmail - (old) notification of mail arrival
  325.  pbmrawtomgr - convert pbm raw bitmap to mgr bitmap format
  326.  pbmstream - split out a stream of bitmaps
  327.  pbmtoprt - printer output from PBM
  328.  pilot - a bitmap browser
  329.  resetwin - cleanup window state after client crashes messily
  330.  rotate - rotate a bitmap 90 degrees.
  331.  screendump - write graphics screen dump to a bitmap file
  332.  set_console - redirect console messages to this window
  333.  set_termcap, set_emacs - output an appropriate TERMCAP value
  334.  setname - name a window, for messages and iconifying
  335.  shape - reshape this window
  336.  square - square this window
  337.  squeeze - compress mgr bitmap using run-length encoding
  338.  startup - produce a skeleton startup file for current window layout
  339.  texmgr - tex dvi file previewer
  340.  text2font, font2text - convert between mgr font format and text dump
  341.  unsqueeze - uncompress mgr bitmap using run length encoding
  342.  window_print - print an image of a window
  343.  zoom - an icon editor
  344.  
  345.     .33 MGR-aware clients distributed separately, see "SUPPORT" file
  346.  
  347.  chess - frontend to /usr/games/chess
  348.  gnu emacs - editor with lisp/term/mgr.el mouse & menu support
  349.  gnuplot - universal scientific data plotting
  350.  metafont - font design and creation
  351.  origami - folding editor
  352.  pbmplus - portable bitmap format conversions, manipulations
  353.  pgs - ghostscript patch and front end
  354.  plplot - slick scientific data plotting
  355.  ? - a groff PBM driver using Hershey fonts
  356.  
  357. .4 Programming for MGR
  358.  
  359.     The MGR programmers manual, the C language applications interface,
  360.     is found in the doc directory in troff/nroff form.  It covers
  361.     general concepts, the function/macro calls controlling the server,
  362.     a sample application, with an index and glossary.
  363.  
  364.     Porting client code used with older versions of MGR sometimes
  365.     requires the substitution of
  366.     #include <mgr/mgr.h>
  367.     for
  368.     #include <term.h>
  369.     and substituting or redefining BIT_XOR, BIT_AND, et al
  370.     for B_XOR, B_AND, et al in the bitblt operations.
  371.  
  372.     Compiling client code generally requires compiler options like
  373.     -I/usr/mgr/include   -L/usr/mgr/lib -lmgr
  374.     as well as an occasional -DOLDMGR or -DOLDLIBMGR for some dusty decks.
  375.  
  376.     One can get some interactive feel for the MGR server functions by
  377.     reading and experimenting with the mgr.el terminal driver for GNU
  378.     Emacs which implements the MGR interface library in ELisp.
  379.  
  380.     The usual method of inquiring state from the server has the
  381.     potential of stumbling on a race condition if the client also
  382.     expects a large volume of event notifications.  The problem arises
  383.     if an (asynchronous) event notification arrives when a
  384.     (synchronous) inquiry response was expected.  If this arises in
  385.     practice (unusual) then the MGR state inquiry functions would have
  386.     to be integrated with your event handling loop.
  387.  
  388.     The only major drawing function missing from the MGR protocol, it
  389.     seems, is an area fill for areas other than upright rectangles.
  390.     At present, the color palette itself is manipulated by
  391.     programs external to MGR, but version 0.62 has experimental code
  392.     for clients to get MGR to manipulate the color palette.
  393.  
  394.     If you are thinking of hacking on the server, you can find the mouse
  395.     driver in mouse.* and mouse_get.*, the grotty parts of the keyboard
  396.     interface in kbd.c, and the interface to the display in the
  397.     src/libbitblit/linux directory.  The main procedure, much
  398.     initialization, and the top level input loop are in mgr.c, and the
  399.     interpretation of escape sequences is in put_window.c .
  400.  
  401. .5 More documentation
  402.  
  403.     The programmer's manual is essential for concepts.
  404.  
  405.     Nearly all the clients supplied come with a man page which is installed
  406.     into /usr/mgr/man/man1 or man6.
  407.     Other useful man pages are bitblit.3, font.5, and bitmap.5 .
  408.     There is some ambiguity in the docs in distinguishing the
  409.     internal bitmap format found in your frame-buffer and the external
  410.     bitmap format found in files, e.g. icons.
  411.  
  412.     The mgr.1 man page covers command line options, commands in the
  413.     ~/.mgrc startup file, mouse and menu interaction with the server,
  414.     and hot-key shortcuts available on systems with such hot-keys.
  415.  
  416.     Many of the fonts in /usr/mgr/font/* are described to some
  417.     extent in /usr/mgr/font/*.txt, e.g. /usr/mgr/font/FONTDIR.txt
  418.     gives X-style font descriptions for the fonts obtained
  419.     in .bdf format.  Font names end in WxH, where W and H are the
  420.     decimal width and height in pixels of each character box.
  421.  
  422. .6 Credit for MGR
  423.  
  424.     Stephen Uhler, with others working at Bellcore, was the original
  425.     designer and implementer of MGR, so Bellcore has copyrighted much
  426.     of the code and documentation for MGR under the following conditions.
  427.  
  428.     * Permission is granted to copy or use this program, EXCEPT that it
  429.     * may not be sold for profit, the copyright notice must be reproduced
  430.     * on copies, and credit should be given to Bellcore where it is due.
  431.  
  432.     One required showing of the copyright notice is the startup title screen.
  433.  
  434.     Other credits to:
  435.  
  436.     Stephen Hawley for his wonderful icons.
  437.     Tommy Frandsen for the VGA linux library.
  438.     Tom Heller for his Gasblit library.
  439.     Andrew Haylett for the Mouse driver code.
  440.     Dan McCrackin for his gasblit->linux patches.
  441.     Dave Gymer, dgp@cs.nott.ac.uk, for the Startrek effect fix.
  442.     Alex Liu for first releasing a working Linux version of MGR.
  443.     Lars Aronsson (aronsson@lysator.liu.se) for text2font and
  444.     an ISO8859-1 8-bit font.
  445.     Harry Pulley (hcpiv@grumpy.cis.uoguelph.ca,
  446.     hcpiv@snowhite.cis.uoguelph.ca) for the Coherent port.
  447.     Vance Petree & Grant Edwards & Udo Munk for their work on Hercules.
  448.     Udo Munk for his work on serial mouse initialization & select.
  449.     Norman Bartek & Hal Snyder at Mark Williams Co.  for their help
  450.     with some bugs & with Coherent device drivers.
  451.     Extra thanks to Zeyd Ben Halim for lots of helpful patches,
  452.     especially the adaptation of selection.
  453.     Bradley Bosch <brad@lachman.com> for lots of patches from his 3b1
  454.     port, which fix bugs and implement new and desirable features.
  455.     Andrew Morton <applix@runxtsa.runx.oz.au> who first wrote the
  456.     cut-word code.
  457.     Kapil Paranjape <kapil@motive.math.tifr.res.in> for the EGA
  458.     support.
  459.     Michael Haardt for MOVIE support fixes, bug fixes, separation of the
  460.     libbitblit code into output drivers, origami folding of the code.
  461.     Yossi Gil for many fonts.
  462.     Vincent Broman for middle mouse-button emulation, linting, Sun cgsix
  463.     support, VGA colormap acess, and integration of the sunport code
  464.     into Haardt's layering scheme.
  465.  
  466.     All bitmap fonts from any source are strictly public domain in the
  467.     USA.  The 450 fixed-width fonts supplied with MGR were obtained
  468.     from Uhler, the X distribution, Yossi Gil, and elsewhere.
  469.     The Hershey vector fonts and the code for rendering them
  470.     are probably freely redistributable.
  471.