old-www/HOWTO/archived/MGR-HOWTO/MGR-HOWTO-5.html

80 lines
2.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>The MGR Window System HOWTO: Programming for MGR</TITLE>
<LINK HREF="MGR-HOWTO-6.html" REL=next>
<LINK HREF="MGR-HOWTO-4.html" REL=previous>
<LINK HREF="MGR-HOWTO.html#toc5" REL=contents>
</HEAD>
<BODY>
<A HREF="MGR-HOWTO-6.html">Next</A>
<A HREF="MGR-HOWTO-4.html">Previous</A>
<A HREF="MGR-HOWTO.html#toc5">Contents</A>
<HR>
<H2><A NAME="s5">5. Programming for MGR</A></H2>
<P>The <B>MGR</B> programmers manual, the C language applications interface,
is found in the doc directory in troff/nroff form. It covers
general concepts, the function/macro calls controlling the server,
a sample application, with an index and glossary.
<P>Porting client code used with older versions of <B>MGR</B> sometimes
requires the substitution of
<BLOCKQUOTE><CODE>
<PRE>
#include &lt;mgr/mgr.h>
</PRE>
</CODE></BLOCKQUOTE>
for
<BLOCKQUOTE><CODE>
<PRE>
#include &lt;term.h>
#include &lt;dump.h>
</PRE>
</CODE></BLOCKQUOTE>
and clients using old-style B_XOR, B_CLEAR, et al instead of
BIT_XOR, BIT_CLR, et al can be accommodated by writing
<BLOCKQUOTE><CODE>
<PRE>
#define OLDMGRBITOPS
#include &lt;mgr/mgr.h>
</PRE>
</CODE></BLOCKQUOTE>
<P>Compiling client code generally requires compiler options like
the following.
<BLOCKQUOTE><CODE>
<PRE>
-I/usr/mgr/include -L/usr/mgr/lib -lmgr
</PRE>
</CODE></BLOCKQUOTE>
<P>One can get some interactive feel for the <B>MGR</B> server functions by
reading and experimenting with the <CODE>mgr.el</CODE> terminal driver for GNU
Emacs which implements the <B>MGR</B> interface library in ELisp.
<P>The usual method of inquiring state from the server has the
potential of stumbling on a race condition if the client also
expects a large volume of event notifications. The problem arises
if an (asynchronous) event notification arrives when a
(synchronous) inquiry response was expected. If this arises in
practice (unusual) then the <B>MGR</B> state inquiry functions would have
to be integrated with your event handling loop.
<P>The only major drawing function missing from the <B>MGR</B> protocol, it
seems, is an area fill for areas other than upright rectangles.
There is new code for manipulating the global colormap, as well as
(advisory) allocation and freeing of color indices owned by windows.
<P>If you are thinking of hacking on the server, you can find the mouse
driver in <CODE>mouse.*</CODE> and <CODE>mouse_get.*</CODE>,
the grotty parts of the keyboard
interface in <CODE>kbd.c</CODE>, and the interface to the display in the
<CODE>src/libbitblit/*</CODE> directories. The main procedure, much
initialization, and the top level input loop are in <CODE>mgr.c</CODE>, and the
interpretation of escape sequences is in <CODE>put_window.c</CODE>.
<P>
<HR>
<A HREF="MGR-HOWTO-6.html">Next</A>
<A HREF="MGR-HOWTO-4.html">Previous</A>
<A HREF="MGR-HOWTO.html#toc5">Contents</A>
</BODY>
</HTML>