Tizen 2.0 Release tizen_2.0 accepted/tizen_2.0/20130215.203100 submit/tizen_2.0/20130215.191842
authorHyungKyu Song <hk76.song@samsung.com>
Fri, 15 Feb 2013 15:19:24 +0000 (00:19 +0900)
committerHyungKyu Song <hk76.song@samsung.com>
Fri, 15 Feb 2013 15:19:24 +0000 (00:19 +0900)
83 files changed:
COPYING [new file with mode: 0644]
ChangeLog [new file with mode: 0644]
INSTALL [new file with mode: 0644]
Makefile.am [new file with mode: 0644]
README [new file with mode: 0644]
configure.ac [new file with mode: 0644]
doc/Makefile.am [new file with mode: 0644]
doc/Xmu.xml [new file with mode: 0644]
doc/xlogo.svg [new file with mode: 0644]
docbook.am [new file with mode: 0644]
include/Makefile.am [new file with mode: 0644]
include/X11/Xmu/Atoms.h [new file with mode: 0644]
include/X11/Xmu/CharSet.h [new file with mode: 0644]
include/X11/Xmu/CloseHook.h [new file with mode: 0644]
include/X11/Xmu/Converters.h [new file with mode: 0644]
include/X11/Xmu/CurUtil.h [new file with mode: 0644]
include/X11/Xmu/CvtCache.h [new file with mode: 0644]
include/X11/Xmu/DisplayQue.h [new file with mode: 0644]
include/X11/Xmu/Drawing.h [new file with mode: 0644]
include/X11/Xmu/Editres.h [new file with mode: 0644]
include/X11/Xmu/EditresP.h [new file with mode: 0644]
include/X11/Xmu/Error.h [new file with mode: 0644]
include/X11/Xmu/ExtAgent.h [new file with mode: 0644]
include/X11/Xmu/Initer.h [new file with mode: 0644]
include/X11/Xmu/Lookup.h [new file with mode: 0644]
include/X11/Xmu/Misc.h [new file with mode: 0644]
include/X11/Xmu/StdCmap.h [new file with mode: 0644]
include/X11/Xmu/StdSel.h [new file with mode: 0644]
include/X11/Xmu/SysUtil.h [new file with mode: 0644]
include/X11/Xmu/WhitePoint.h [new file with mode: 0644]
include/X11/Xmu/WidgetNode.h [new file with mode: 0644]
include/X11/Xmu/WinUtil.h [new file with mode: 0644]
include/X11/Xmu/Xct.h [new file with mode: 0644]
include/X11/Xmu/Xmu.h [new file with mode: 0644]
packaging/libXmu.spec [new file with mode: 0644]
src/AllCmap.c [new file with mode: 0644]
src/Atoms.c [new file with mode: 0644]
src/ClientWin.c [new file with mode: 0644]
src/Clip.c [new file with mode: 0644]
src/CloseHook.c [new file with mode: 0644]
src/CmapAlloc.c [new file with mode: 0644]
src/CrCmap.c [new file with mode: 0644]
src/CrPixFBit.c [new file with mode: 0644]
src/CursorName.c [new file with mode: 0644]
src/CvtCache.c [new file with mode: 0644]
src/CvtStdSel.c [new file with mode: 0644]
src/DefErrMsg.c [new file with mode: 0644]
src/DelCmap.c [new file with mode: 0644]
src/DisplayQue.c [new file with mode: 0644]
src/Distinct.c [new file with mode: 0644]
src/DrRndRect.c [new file with mode: 0644]
src/DrawLogo.c [new file with mode: 0644]
src/EditresCom.c [new file with mode: 0644]
src/ExtAgent.c [new file with mode: 0644]
src/FToCback.c [new file with mode: 0644]
src/GetHost.c [new file with mode: 0644]
src/GrayPixmap.c [new file with mode: 0644]
src/Initer.c [new file with mode: 0644]
src/LocBitmap.c [new file with mode: 0644]
src/Lookup.c [new file with mode: 0644]
src/LookupCmap.c [new file with mode: 0644]
src/Lower.c [new file with mode: 0644]
src/Makefile.am [new file with mode: 0644]
src/RdBitF.c [new file with mode: 0644]
src/ScrOfWin.c [new file with mode: 0644]
src/ShapeWidg.c [new file with mode: 0644]
src/StdCmap.c [new file with mode: 0644]
src/StrToBS.c [new file with mode: 0644]
src/StrToBmap.c [new file with mode: 0644]
src/StrToCurs.c [new file with mode: 0644]
src/StrToGrav.c [new file with mode: 0644]
src/StrToJust.c [new file with mode: 0644]
src/StrToLong.c [new file with mode: 0644]
src/StrToOrnt.c [new file with mode: 0644]
src/StrToShap.c [new file with mode: 0644]
src/StrToWidg.c [new file with mode: 0644]
src/UpdMapHint.c [new file with mode: 0644]
src/VisCmap.c [new file with mode: 0644]
src/WidgetNode.c [new file with mode: 0644]
src/Xct.c [new file with mode: 0644]
src/sharedlib.c [new file with mode: 0644]
xmu.pc.in [new file with mode: 0644]
xmuu.pc.in [new file with mode: 0644]

diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..67a8b74
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,74 @@
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+-----------
+
+Xmu/StrToBmap.c and Xmu/GrayPixmap.c also have:
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+-----------
+
+And Xmu/Clip.c has:
+
+Copyright (c) 1998 by The XFree86 Project, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+Except as contained in this notice, the name of the XFree86 Project shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from the
+XFree86 Project.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644 (file)
index 0000000..70626ad
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,978 @@
+commit 6437d834cd66621e4e9f4decf7341b6d7ff45556
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Mon Mar 5 23:00:10 2012 -0800
+
+    libXmu 1.1.1
+
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit ccd9e64515d6fc7b5367d6d98ecd3abf5b084026
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Thu Nov 10 20:34:03 2011 -0800
+
+    Fix gcc -Wwrite-strings warnings (some, not all)
+
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 72ac4c4a464b3aec21cdbe367c9d465cbe0f3ff1
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Thu Nov 10 09:55:07 2011 -0800
+
+    Drop support for pre-ANSI-C89 preprocessors
+
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 004d535c707251bd4fb47426f90712c195c6dfc7
+Author: Matt Dew <marcoz@osource.org>
+Date:   Tue Oct 4 20:51:48 2011 -0600
+
+    Cleanup IDs and links in doc
+
+    1 - fix the capitalization of the ID attributes to match either the
+         <title> or <funcdef> string it goes with.
+    2 - fix any <linkend>'s that were affected by 1.
+    3 - any <function> in the docs that has an actual funcdef,
+    will become an olink.
+
+    Signed-off-by: Matt Dew <marcoz@osource.org>
+
+commit d7d2ad7dde7b2653aa1e08e9339674bc40f1560a
+Author: Jeremy Huddleston <jeremyhu@apple.com>
+Date:   Sat Sep 24 17:00:09 2011 -0700
+
+    Fix build with -DDEBUG
+
+    https://bugs.freedesktop.org/show_bug.cgi?id=1069
+
+    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+
+commit 66492163cb244fbe22c67bebb14c0918dd11eab6
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Fri Sep 16 22:46:25 2011 -0700
+
+    Strip trailing whitespace
+
+    Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}'
+    git diff -w & git diff -b show no diffs from this change
+
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 6ffa7e4bb1e7efdad4dd987e1fe27cdee96f7063
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Wed Sep 14 14:33:24 2011 -0400
+
+    docs: use appropriate markup for copyright statement
+
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 7b2589d66d672d2585d3df4074ce64443f7e4b71
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Sep 12 11:01:19 2011 -0400
+
+    docs: use the &fullrelvers; entity to set X11 release information
+
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 46cc8a399aa16d145a9141d2fa8172282e4b7211
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Thu Sep 8 20:00:00 2011 -0400
+
+    docbook.am: embed css styles inside the HTML HEAD element
+
+    Rather than referring to the external xorg.css stylesheet, embed the content
+    of the file in the html output produced. This is accomplished by using
+    version 1.10 of xorg-xhtml.xsl.
+
+    This makes the whole html docs tree much more relocatable.
+    In addition, it eliminates xorg.css as a runtime file which makes
+    xorg-sgml-doctools a build time only package.
+
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 01d2a55b4fd8e3743b1f396f81be6a06f6345ac5
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Wed Sep 7 10:31:04 2011 -0400
+
+    docbook.am: global maintenance update - entities, images and olinking
+
+    Adding support in libX11 for html chunking caused a reorg of docbook.am
+    as well as the xorg-sgml-doctools masterdb for olinking.
+    The parameter img.src.path is added for pdf images.
+    A searchpath to the root builddir is added for local entities, if present.
+
+    The docbook.am makefile hides all the details and is identical for
+    all 22 modules having DocBook documentation. It is included by a thin
+    Makefile.am which requires no docbook knowledge.
+
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 888135ef815766f0421438430ca40809e4f7e411
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Aug 7 21:20:26 2011 -0400
+
+    docbook pdf: add xsl parameter to locate images
+
+    Unlike html, pdf/ps requires a full path name to find images,
+    but only needs it to make an internal copy of it at build time.
+    The image can later be removed and the image still shows up in the pdf doc.
+    This allows us to use the absolute builddir.
+
+    This parameter must not be used for html which loads the image from disk
+    at user read time. The image is removed from builddir after build is done,
+    and we do not know where the image will be installed by the distro.
+
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 5ba82aec6547513ea182cbc6cb95b472bbfb9dc5
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Aug 7 20:30:58 2011 -0400
+
+    Xmu.xml: Change layout of the X Logo figure
+
+    The floating does not come up right, the figure caption is in the way.
+    Move the figure out of the paragraph and below the text.
+
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 08fb51c1db9c9693125f4c093d07abc94d6ce0f6
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Jun 12 18:39:46 2011 -0400
+
+    Install xml versions of specs even if HAVE_XMLTO is false
+
+    DocBook/XML input source is also a usefull output format that can be viewed
+    with an XML viewer or editor and by some O/S help system.
+
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit a70bedc470f5482dc64b947057e5120c2f322177
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Jun 5 16:27:37 2011 -0400
+
+    Install target dbs alongside generated documents
+
+    This matches a change in xorg-sgml-docs whereby the masterdb will look for
+    the target dbs into the same location as the generated documents.
+
+    The target dbs are now installed alongside the generated documents.
+    Previously they are installed in $prefix/sgml/X11/dbs alongside masterdb which
+    has the potential of installing outside the package prefix and cause
+    distcheck to fail when user does not have write permission in this package.
+
+    Requires XORG_CHECK_SGML_DOCTOOLS(1.8) which was released 2011-06-11
+
+commit 3f3c9a60381371f60a174497ea6d5d90abea4261
+Author: Matt Dew <marcoz@osource.org>
+Date:   Tue May 31 20:03:23 2011 -0600
+
+    Add id attributes to funcsynopsis to allow other docs to olink to them.
+
+    Signed-off-by: Matt Dew <marcoz@osource.org>
+    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+    Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 4000666e864e477e712caa0f0c0a5d09006c7752
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Feb 27 15:06:18 2011 -0500
+
+    Documentation: add Docbook external references support
+
+    When writing technical documentation, it is often necessary to cross
+    reference to other information. When that other information is not in the
+    current document, additional support is needed, namely <olink>.
+
+    A new feature with version 1.7 of xorg-sgml-doctools adds references to
+    other documents within or outside this package.
+
+    This patch adds technical support for this feature but does not change
+    the content of the documentation as seen by the end user.
+
+    Each book or article must generate a database containing the href
+    of sections that can be referred to from another document. This database
+    is installed in DATAROOTDIR/sgml/X11/dbs. There is a requirement that
+    the value of DATAROOTDIR for xorg-sgml-doctools and for the package
+    documentation is the same. This forms a virtual document tree.
+
+    This database is consulted by other documents while they are being generated
+    in order to fulfill the missing information for linking.
+    Refer to the xorg-sgml-doctools for further technical information.
+
+    Co-authored-by: Matt Dew <marcoz@osource.org>
+
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 6ab92082d5f6c842b578a9fe1f9888ed3339336a
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Thu Feb 10 22:06:52 2011 -0800
+
+    Make EditresCom.c identation a lot less random
+
+    2 spaces!  No 4!  2!  3!  No, Blue!  Red!  Aughughurglrgll...
+
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 70ca0ef2cc0ec84308792a7b184e90c5cb358278
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Wed Feb 2 19:51:54 2011 -0500
+
+    config: remove config test for snprintf
+
+    The macro HAS_SNPRINTF is hard coded to always be defined.
+    If it were not defined, Lower.c would include snprintf.c
+    which does not exist. Seems to be relics from IMakefile
+
+    Other modules are using snprintf unconditionally.
+
+    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+    Reviewed-by: Julien Cristau <jcristau@debian.org>
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 9f57096dd0881651de3b710b182db59091e6f421
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Wed Feb 2 11:43:43 2011 -0500
+
+    config: comment, minor upgrade, quote and layout configure.ac
+
+    Group statements per section as per Autoconf standard layout
+    Quote statements where appropriate.
+    Autoconf recommends not using dnl instead of # for comments
+
+    Use AC_CONFIG_FILES to replace the deprecated AC_OUTPUT with parameters.
+
+    This helps automated maintenance and release activities.
+    Details can be found in http://wiki.x.org/wiki/NewModuleGuidelines
+
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 1be35fb51871f314bef673975c2be94e5e427696
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Fri Jan 28 19:41:37 2011 -0500
+
+    config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS
+
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 9bd47f1db85b0c997389609ad26a2766f5aeeff5
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Fri Jan 28 16:34:14 2011 -0500
+
+    config: remove unrequired AC_CONFIG_AUX_DIR
+
+    The default location for the generation of configuation files is the current
+    package root directory. These files are config.* and friends.
+
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 2f00ed22d17592b963fabd925dba90f2a003d801
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Sun Dec 5 00:13:25 2010 -0800
+
+    XmuCvtStringToCursor: sprintf -> snprintf & check for XtMalloc failure
+
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 813ee0dcecc89d3f334d8747b171c71e34a7671e
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Tue Nov 9 13:04:57 2010 -0500
+
+    config: HTML file generation: use the installed copy of xorg.css
+
+    Currenlty the xorg.css file is copied in each location
+    where a DocBook/XML file resides. This produces about
+    70 copies in the $(docdir) install tree.
+
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 5d9b0896bfdfe60656a2d806a06e17c7adf335b5
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Fri Oct 29 16:52:54 2010 -0700
+
+    libXmu 1.1.0
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 28f4666ad88ab736f52c1cb16674226f14bc2a15
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Thu Oct 28 12:24:30 2010 -0700
+
+    Remove unnecessary calls from configure.ac
+    
+    AC_PROG_CC is handled by XORG_DEFAULT_OPTIONS
+    AC_SUBST of *_LIBS & *_CFLAGS are handled by PKG_CHECK_MODULES
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 1ab19053c75b44be9c49700b1190dd5d8da152ce
+Author: Jesse Adkins <jesserayadkins@gmail.com>
+Date:   Tue Sep 28 13:30:03 2010 -0700
+
+    Purge cvs tags.
+    
+    Signed-off-by: Jesse Adkins <jesserayadkins@gmail.com>
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 75a065b9b8145bac20d9080cb5237a25bb3ad190
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Tue Aug 3 13:23:32 2010 -0400
+
+    specs: xsl stylesheet requires abs path to images
+    
+    Using abs_builddir requires automake 1.10 or later.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit b56c3e61038c7cdb49bdb40455c2b3a12ae35d3c
+Author: Fernando Carrijo <fcarrijo@yahoo.com.br>
+Date:   Thu Jul 1 07:00:53 2010 -0300
+
+    Purge macro NEED_EVENTS
+    
+    Signed-off-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
+    Acked-by: Tiago Vignatti <tiago.vignatti@nokia.com>
+    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit e721c444a8268db0406e26d65e0a4746c477750f
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Fri Jun 25 15:06:39 2010 -0400
+
+    config: use HAVE_XMLTO_TEXT from XORG_WITH_XMLTO
+    
+    Skip text format when XMLTO dependencies for text format
+    are missing (lynx, links or w3m)
+    
+    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 449bc79585f324c5695f379def1e57fe9fcec2e6
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Fri Jun 25 15:02:59 2010 -0400
+
+    config: use HAVE_STYLESHEET now defined in XORG_CHECK_SGML_DOCTOOLS
+    
+    Also use STYLESHEET_SRCDIR XSL_STYLESHEET
+    
+    This requires version 1.10 of util-macros
+    
+    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 167c191895d956831f76ece5f2bdbef8cea4ed45
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Fri Jun 25 14:10:58 2010 -0400
+
+    config: move docs ignore from toplevel .gitignore to /doc
+    
+    Also add missing *.css
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 2d8fa1b7905bbbc37f42f651ed1f881359ac6a09
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Wed Jun 23 08:02:08 2010 -0700
+
+    Add xorg.css to CLEANFILES to pass make distcheck
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit f7e752f3842fddff907901cccb45dde77c297d20
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Tue Jun 15 22:06:15 2010 -0700
+
+    Use shared stylesheets from xorg-sgml-doctools instead of a private copy
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit ffef5f4ee489a7f2d228601ee351bc2445436304
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Sat Jun 19 22:34:50 2010 -0700
+
+    Add some cross-reference links and an index to the docs
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 0a198dd15c7963f7b9be094370761cac368d9292
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Wed Jun 9 15:48:58 2010 -0700
+
+    Xmu.xml: Compilers that can't handle void are now ancient history
+    
+    Plus a bonus it's -> its typo fix
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit dc02453cde3047bce48a8ca23c27c807642b1670
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Wed Jun 9 11:30:17 2010 -0700
+
+    Use _X_ATTRIBUTE_PRINTF from Xfuncproto.h in Xmu headers
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+    Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
+    Reviewed-by: Julien Cristau <jcristau@debian.org>
+
+commit eb8ed42cc7f40d8dd506aeebb759dd99dac1552e
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Wed Jun 9 11:25:12 2010 -0700
+
+    Document which functions are in libXmu vs. libXmuu
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit bde1baeddb216b7ab6322646d9bdf3bb629c4c25
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Wed Jun 9 11:04:17 2010 -0700
+
+    Add XmuNCopyISOLatin1Lowered & XmuNCopyISOLatin1Uppered to doc/Xmu.xml
+    
+    Also add notes to the originals warning about buffer overflow
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 6b98e89515ba0ee755bdc9c4783b84b464d2a10c
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Wed Jun 9 10:50:23 2010 -0700
+
+    Update docs to match headers
+    
+    - caddr_t is now XPointer
+    - a number of char * arguments are now unsigned char * or constified
+    - XmuLookup* functions are in Lookup.h, so split into new section
+    
+    There are still a bunch of headers with undocumented functions/#defines:
+     - CvtCache.h
+     - EditresP.h
+     - ExtAgent.h
+     - Misc.h
+     - WhitePoint.h
+     - Xmu.h
+     - some of the functions in Converters.h
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 13409196c36151e4b5212ae08e6cfda6d7c93696
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Wed Jun 9 10:23:08 2010 -0700
+
+    Add XmuSnprintf to doc/Xmu.xml
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit a4a87ddfa4948c3f5c210ab7a472b65569ae0e64
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Tue Jun 8 21:20:58 2010 -0700
+
+    Show X logo as a figure for XmuDrawLogo
+    
+    Because we can.
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 5e22a1fb7c2bae8d5b393b95b253c865c9eed309
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Tue Jun 8 16:51:41 2010 -0700
+
+    Fix distcheck (forgot to mark Xmu.xml as dist_*)
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit f38c2c057ebca8ca4afc2cb8fb835702bdba4fc6
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Tue Jun 8 16:25:49 2010 -0700
+
+    Correct some minor typos in original document
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 70596fce92bd58d46e19de63b6c3faca38cbc181
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Tue Jun 8 16:19:49 2010 -0700
+
+    Convert Xmu.ms to DocBook/xml
+    
+    Bumps xorg-macros requirement to 1.6 for XORG_ENABLE_DOCS & friends
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 868ed2d97150aed414a7fd8f5dc317b8f38b05fd
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Mon Jun 7 15:51:32 2010 -0700
+
+    Move doc/Xmu.ms from xorg-docs module
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit af962b3bed9d3c42cf81946a5732f0d37d1843e8
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Wed May 26 17:01:57 2010 -0400
+
+    config: add WhitePoint.h to the include headers
+    
+    This file was added in commit 8c5b2278580193578cdd0da8c8e948e74f8a3f26
+    because it was missing from the tarball. It was added to
+    EXTRA_DIST so it never got installed in $includedir.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit bae14e85d90a4ea040cb1b25ba89c98a0ebe1670
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Apr 5 20:10:35 2010 -0400
+
+    config: update AC_PREREQ statement to 2.60
+    
+    Unrelated to the previous patches, the new value simply reflects
+    the reality that the minimum level for autoconf to configure
+    all x.org modules is 2.60 dated June 2006.
+    
+    ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit a6210dd05cfe92d0af2e23358851c3a38c2aaca6
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Mar 29 14:53:49 2010 -0400
+
+    config: remove the pkgconfig pc.in file from EXTRA_DIST
+    
+    Automake always includes it in the tarball.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 1de26ffbdec68f8ca6aa2448869a323bcceda26d
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sat Mar 27 16:19:35 2010 -0400
+
+    config: remove execute permission on source C file
+    
+    Introduced in 85f77401635dfa57d40de89aa2c9f39a344a8d3b
+    "Fix build problems on WIN32 platforms"
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit d2702478f3d36fb3053b9796657310750e5e5738
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Fri Nov 27 20:56:04 2009 -0500
+
+    Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES
+    
+    Now that the INSTALL file is generated.
+    Allows running make maintainer-clean.
+
+commit 8d5e9bd04c8cc90a262223f8a16c4ac7c0c66c2d
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Wed Oct 28 14:09:10 2009 -0400
+
+    INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206
+    
+    Add missing INSTALL file. Use standard GNU file on building tarball
+    README may have been updated
+    Remove AUTHORS file as it is empty and no content available yet.
+    Remove NEWS file as it is empty and no content available yet.
+
+commit 80650c71c06b87e8a5ff0122c1f2bf7798ab2e96
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Tue Oct 27 15:07:25 2009 -0400
+
+    Deploy the new XORG_DEFAULT_OPTIONS #24242
+    
+    This macro aggregate a number of existing macros that sets commmon
+    X.Org components configuration options. It shields the configuration file from
+    future changes.
+
+commit 1dba944c770fcc4b276641e0ae01e2e4371dc101
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Oct 26 22:08:43 2009 -0400
+
+    Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432
+    
+    ChangeLog filename is known to Automake and requires no further
+    coding in the makefile.
+
+commit 854456de21a1e722edd5e03ba8467107401fd7b6
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Thu Oct 22 12:34:19 2009 -0400
+
+    .gitignore: use common defaults with custom section # 24239
+    
+    Using common defaults will reduce errors and maintenance.
+    Only the very small or inexistent custom section need periodic maintenance
+    when the structure of the component changes. Do not edit defaults.
+
+commit ab323caeb2b763abc8986fe71531dedb62ec9720
+Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
+Date:   Wed Oct 21 12:47:25 2009 -0700
+
+    This is not a GNU project, so declare it foreign.
+    
+    On Wed, 2009-10-21 at 13:36 +1000, Peter Hutterer wrote:
+    > On Tue, Oct 20, 2009 at 08:23:55PM -0700, Jeremy Huddleston wrote:
+    > > I noticed an INSTALL file in xlsclients and libXvMC today, and it
+    > > was quite annoying to work around since 'autoreconf -fvi' replaces
+    > > it and git wants to commit it.  Should these files even be in git?
+    > > Can I nuke them for the betterment of humanity and since they get
+    > > created by autoreconf anyways?
+    >
+    > See https://bugs.freedesktop.org/show_bug.cgi?id=24206
+    
+    As an interim measure, replace AM_INIT_AUTOMAKE([dist-bzip2]) with
+    AM_INIT_AUTOMAKE([foreign dist-bzip2]). This will prevent the generation
+    of the INSTALL file. It is also part of the 24206 solution.
+    
+    Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
+
+commit c2c76abe51878f55e22c44c747f1243e56a4344b
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Wed Sep 23 17:53:41 2009 -0700
+
+    libXmu 1.0.5
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit 5b31bee92b56147e2c17d19e46e09145d765fdb4
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Wed Sep 23 17:49:27 2009 -0700
+
+    Migrate to xorg macros 1.3 & XORG_DEFAULT_OPTIONS
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit fef063d82e332b96bcb12ce41abefce868821577
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Wed Sep 23 17:47:16 2009 -0700
+
+    Add pointer to API docs in xorg-docs to README
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit 88bd2d387fbb068339b65506331136085082def6
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Tue Mar 31 00:01:48 2009 +0200
+
+    libXmu: check for LONG64, not LONG_64
+    
+    The latter isn't defined anywhere, so editres hasn't been able to read a
+    pointer on 64bit since about 10 years.
+    Admittedly, this should be using stdint types, but...
+    
+    Debian bug#521887 <http://bugs.debian.org/521887>
+    
+    Reported-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
+    Signed-off-by: Julien Cristau <jcristau@debian.org>
+
+commit f1ccbcffc9171868256b5813aa558f6756aca508
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Mon Feb 2 20:34:34 2009 -0800
+
+    Add README with pointers to mailing list, bugzilla & git repos
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit 049534f4eb409bea62b590b436bef78e5eef5b8e
+Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
+Date:   Thu Jan 29 20:02:33 2009 -0200
+
+    Janitor: make distcheck, compiler warnings, .gitignore.
+
+commit fc2096538ff7424bfeb171b1a36e860070594627
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Mon Aug 4 19:42:22 2008 -0700
+
+    Add libX11 to libXmu dependencies
+
+commit 85f77401635dfa57d40de89aa2c9f39a344a8d3b
+Author: Colin Harrison <colin.harrison-at-virgin.net>
+Date:   Tue Apr 29 13:13:06 2008 +0100
+
+    Fix build problems on WIN32 platforms
+
+commit aa6e9793fbb8621ce1f1ed580298621e29638619
+Author: Colin Harrison <colin.harrison-at-virgin.net>
+Date:   Sat Apr 26 08:51:54 2008 +0100
+
+    Switch to winsock2
+
+commit cbfab9d91e17239084ab24b99751bdd1610fcc1b
+Author: Matthieu Herrb <matthieu.herrb@laas.fr>
+Date:   Sun Mar 9 08:32:59 2008 +0100
+
+    nuke RCS Ids
+
+commit 3fe753215b6186e588246220a473417810f82b05
+Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
+Date:   Thu Feb 28 18:55:23 2008 -0300
+
+    Compile warning fix by using Cardinal instead of int.
+    
+    This also matches the function prototype.
+
+commit e2735131202e7801e72ce33def666b6a0a543e26
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Mon Jan 14 14:11:43 2008 -0800
+
+    Version bump: 1.0.4
+
+commit f11b5a161944dc694ee059f88acb20826bd6d90b
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Mon Jan 14 11:21:36 2008 -0800
+
+    Coverity #52: Dead code in get_os_name()
+
+commit 6f5ea6a2a0b56674f08f58d95085c0e9a8797fe2
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Sun Jan 13 01:58:12 2008 -0800
+
+    Clear sparse warnings: Using plain integer as NULL pointer
+
+commit 6f76ccc70a5f5ae834a3e63c9f4f35704837a4d1
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Fri Jan 11 20:43:26 2008 -0800
+
+    Add hooks for checking sources with tools like lint & sparse
+
+commit 43ec402bcd6a2333a4e213de3a82d7e3392b0fb0
+Author: James Cloos <cloos@jhcloos.com>
+Date:   Thu Dec 6 16:38:32 2007 -0500
+
+    Replace static ChangeLog with dist-hook to generate from git log
+
+commit 7e35135e9ad1ea2ef101402ea26bec62c3cbb69a
+Author: James Cloos <cloos@jhcloos.com>
+Date:   Mon Sep 3 05:53:43 2007 -0400
+
+    Add *~ to .gitignore to skip patch/emacs droppings
+
+commit a3e01af0f4b56b3b8891040cf0f7208265bbea2a
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Wed Nov 8 20:01:35 2006 +0200
+
+    bump to 1.0.3
+
+commit 7beb4c2909af805e61d073a6f2b93234eb91834d
+Author: Adam Jackson <ajax@benzedrine.nwnk.net>
+Date:   Fri Oct 13 16:22:06 2006 -0400
+
+    Bump to 1.0.2
+
+commit 339368b404a807d1c494b260314da16d044986ff
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Thu Jul 13 14:59:01 2006 -0700
+
+    renamed: .cvsignore -> .gitignore
+
+commit 60620a4b7eeb004e55ba57aef8df33f6adc930f0
+Author: Matthias Hopf <mhopf@suse.de>
+Date:   Mon Jul 3 19:33:05 2006 +0200
+
+    Added README missing from CVS conversion.
+
+commit 05a5c96fcef9822ff3c0312427d2c2672f73b551
+Author: Matthieu Herrb <matthieu.herrb@laas.fr>
+Date:   Sun Apr 30 14:22:53 2006 +0000
+
+    Define BITMAPDIR for the case where ${prefix} != /usr
+
+commit 0aa6a46099fb319c82da51b8a73566007ad5acbd
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Thu Apr 27 00:18:38 2006 +0000
+
+    Bump to 1.0.1
+
+commit 7bb6398aa024d782706125bebd93468f9cc8a0ec
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Mon Mar 20 19:57:04 2006 +0000
+
+    Bug #6276: Fix build on Cygwin. (Yaakov Selkowitz)
+
+commit 78ab364fec59fa84ac914d51628dfb8ac4a048a5
+Author: Kevin E Martin <kem@kem.org>
+Date:   Thu Dec 15 00:24:30 2005 +0000
+
+    Update package version number for final X11R7 release candidate.
+
+commit 1d93f5a9968e6e9af8f15c60107b1691009d1bd8
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Dec 3 05:49:44 2005 +0000
+
+    Update package version number for X11R7 RC3 release.
+
+commit 5a807bcce047a8072db2c0cef05a84aa6e6cd3ca
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Nov 19 07:15:42 2005 +0000
+
+    Update pkgconfig files to separate library build-time dependencies from
+        application build-time dependencies, and update package deps to work
+        with separate build roots.
+
+commit c50ca633b633d25ba672fb19ac182cea40242069
+Author: Kevin E Martin <kem@kem.org>
+Date:   Wed Oct 19 02:48:11 2005 +0000
+
+    Update package version number for RC1 release.
+
+commit 8c5b2278580193578cdd0da8c8e948e74f8a3f26
+Author: Kevin E Martin <kem@kem.org>
+Date:   Wed Oct 5 19:57:36 2005 +0000
+
+    Add missing file to EXTRA_DIST
+
+commit bf4087e453d8fd83630976cd6e7e31c63737a4a1
+Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
+Date:   Mon Oct 3 20:55:36 2005 +0000
+
+    Remvoe README file that is symlinked from monolith
+
+commit 82b5da0b34780df3fe91c4b617cb541ee767d794
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Sat Jul 30 19:15:16 2005 +0000
+
+    Add -D flags to clear various warnings (Stefan Dirsch)
+
+commit 43f43567e3c8c63f6b70d7e529827cd5f15e15d3
+Author: Kevin E Martin <kem@kem.org>
+Date:   Fri Jul 29 21:22:52 2005 +0000
+
+    Various changes preparing packages for RC0:
+    - Verify and update package version numbers as needed
+    - Implement versioning scheme
+    - Change bug address to point to bugzilla bug entry form
+    - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to
+        reenable it)
+    - Fix makedepend to use pkgconfig and pass distcheck
+    - Update build script to build macros first
+    - Update modular Xorg version
+
+commit e9ee49d99a20458e5f36bba48a7ea65bb5230a8d
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Sat Jul 16 07:16:27 2005 +0000
+
+    Set soversions to 6.2.0 and 1.0.0 with -version-number.
+
+commit 81f5815d0c42b7065eb8e5aeef8e115e7398128f
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sat Jul 9 06:43:26 2005 +0000
+
+    Add .cvsignore files
+
+commit 56ef5803a7def4f0d08ce8863e317b250c9c0ce4
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Sun Jul 3 07:00:57 2005 +0000
+
+    Add Xtrans definitions (FONT_t, TRANS_CLIENT) to clean up warnings.
+    Add XSERV_t, TRANS_SERVER, TRANS_REOPEN to quash warnings.
+    Add #include <dix-config.h> or <xorg-config.h>, as appropriate, to all
+        source files in the xserver/xorg tree, predicated on defines of
+        HAVE_{DIX,XORG}_CONFIG_H. Change all Xfont includes to
+        <X11/fonts/foo.h>.
+
+commit 5a64c1de0a1d620039afbb0805ae23f10470e815
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Sun May 22 19:06:20 2005 +0000
+
+    Add XTRANS_CONNECTION_FLAGS to get network transport #defines for
+        CvdStdSel.c
+    Add libXmuu_la_LIBADD
+
+commit 506a8f64c84b3db3ad64d03ee698c1de227247de
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Sun May 22 04:36:38 2005 +0000
+
+    Move #ifdef HAVE_CONFIG_H outside of #ifdef SYSVNET
+
+commit 9ca353477c403ab1341e994a5a42a998d29e9a58
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Thu May 19 00:22:32 2005 +0000
+
+    revert last change, didn't do right thing at all, sorry for the noise
+
+commit 0a662934f050cff90e82d463ec809c3758b260b1
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Thu May 19 00:10:08 2005 +0000
+
+    Require automake 1.7 in AM_INIT_AUTOMAKE
+
+commit 2e403190ff21b0bb277391a73741cfc6d5005ac3
+Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
+Date:   Wed May 18 19:38:36 2005 +0000
+
+    - Add Xmu build system
+
+commit 7cea083d37cfaaad321bddca0fb75b3308956938
+Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
+Date:   Wed May 18 19:30:41 2005 +0000
+
+    - Add Xmu to symlink.sh
+    - Conditionally include config.h in Xmu sources
+
+commit ab0973b4595cfe27c81202bfb4a148780b05bb02
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Wed Dec 22 08:28:16 2004 +0000
+
+    Bug #2123 <https://bugs.freedesktop.org/show_bug.cgi?id=2123> Attachment
+        #1587 <https://bugs.freedesktop.org/attachment.cgi?id=1587> Call to
+        uname should not check for return == 0, but for >= 0 instead
+
+commit ece6cefc8e0238071f89de520d4a969fede53bd6
+Author: Eric Anholt <anholt@freebsd.org>
+Date:   Tue May 18 04:45:29 2004 +0000
+
+    Remove Xaw header dependency from Xmu library build.
+    http://freedesktop.org/cgi-bin/bugzilla/attachment.cgi?bugid=634
+
+commit 51156051e17f4ec53cbfe34f3a79f38d5884b78d
+Author: Egbert Eich <eich@suse.de>
+Date:   Fri Apr 23 18:43:45 2004 +0000
+
+    Merging XORG-CURRENT into trunk
+
+commit 832c5a7d7b07b88f6468daabae56d9daeeee0db8
+Author: Egbert Eich <eich@suse.de>
+Date:   Sun Mar 14 08:32:24 2004 +0000
+
+    Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004
+
+commit 410cf462f4a8733c58303de686f07fbd98f2e30e
+Author: Egbert Eich <eich@suse.de>
+Date:   Wed Mar 3 12:11:29 2004 +0000
+
+    Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004
+
+commit b00bc81852e56578939fb4d63796f8e0cd187cbf
+Author: Egbert Eich <eich@suse.de>
+Date:   Thu Feb 26 13:35:33 2004 +0000
+
+    readding XFree86's cvs IDs
+
+commit aa59d04a1a50b5978e886c2e7248f77bea515ce0
+Author: Egbert Eich <eich@suse.de>
+Date:   Thu Feb 26 09:22:44 2004 +0000
+
+    Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004
+
+commit 0d10732a71487293bd70c2675ced6bffb6093c8d
+Author: Egbert Eich <eich@suse.de>
+Date:   Thu Jan 29 08:08:06 2004 +0000
+
+    Importing vendor version xf86-012804-2330 on Thu Jan 29 00:06:33 PST 2004
+
+commit 6b975651aef1797eb795bd876486c565c52f66fd
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Tue Nov 25 19:28:15 2003 +0000
+
+    XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks
+
+commit 865329b4e079334b4cb846347ab9a572ac946228
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Fri Nov 14 16:48:49 2003 +0000
+
+    XFree86 4.3.0.1
+
+commit 709dda59a506e0c4ad17b085aa381f35cd86176f
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Fri Nov 14 16:48:49 2003 +0000
+
+    Initial revision
+
+commit e3925d3087dc381a24b47c5602e086645e942fcf
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Fri Nov 14 15:54:39 2003 +0000
+
+    R6.6 is the Xorg base-line
diff --git a/INSTALL b/INSTALL
new file mode 100644 (file)
index 0000000..c9fd2c0
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,290 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006, 2007, 2008 Free Software Foundation, Inc.
+
+   This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+   Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package.  The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.
+
+     Running `configure' might take a while.  While running, it prints
+     some messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+  6. Often, you can also type `make uninstall' to remove the installed
+     files again.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you can use GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory.  After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+   On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor.  Like
+this:
+
+     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CPP="gcc -E" CXXCPP="g++ -E"
+
+   This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
+
+Installation Names
+==================
+
+   By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Particular systems
+==================
+
+   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+     ./configure CC="cc -Ae"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
+a workaround.  If GNU CC is not installed, it is therefore recommended
+to try
+
+     ./configure CC="cc"
+
+and if that doesn't work, try
+
+     ./configure CC="cc -nodtk"
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on.  Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+   Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug.  Until the bug is fixed you can use this workaround:
+
+     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+     Print a summary of all of the options to `configure', and exit.
+
+`--help=short'
+`--help=recursive'
+     Print a summary of the options unique to this package's
+     `configure', and exit.  The `short' variant lists options used
+     only in the top level, while the `recursive' variant lists options
+     also present in any nested packages.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--prefix=DIR'
+     Use DIR as the installation prefix.  *Note Installation Names::
+     for more details, including other options available for fine-tuning
+     the installation locations.
+
+`--no-create'
+`-n'
+     Run the configure checks, but stop before creating any output
+     files.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..9a875e3
--- /dev/null
@@ -0,0 +1,22 @@
+SUBDIRS = include src doc
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = xmu.pc xmuu.pc
+
+MAINTAINERCLEANFILES = ChangeLog INSTALL
+
+.PHONY: ChangeLog INSTALL
+
+INSTALL:
+       $(INSTALL_CMD)
+
+ChangeLog:
+       $(CHANGELOG_CMD)
+
+dist-hook: ChangeLog INSTALL
+
+if LINT
+# Check source code with tools like lint & sparse
+lint:
+       (cd src && $(MAKE) $(MFLAGS) lint)
+endif LINT
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..dbf260e
--- /dev/null
+++ b/README
@@ -0,0 +1,37 @@
+This library contains miscellaneous utilities and is not part of the Xlib
+standard.  It contains routines which only use public interfaces so that it
+may be layered on top of any proprietary implementation of Xlib or Xt.
+
+It is intended to support clients in the X.Org distribution; vendors
+may choose not to distribute this library if they wish.  Therefore,
+applications developers who depend on this library should be prepared to
+treat it as part of their software base when porting.
+
+API documentation for this library is provided in the docs directory in
+DocBook format.  If xmlto is installed, it will be converted to supported
+formats and installed in $(docdir) unless --disable-docs is passed to
+configure.
+
+All questions regarding this software should be directed at the
+Xorg mailing list:
+
+        http://lists.freedesktop.org/mailman/listinfo/xorg
+
+Please submit bug reports to the Xorg bugzilla:
+
+        https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
+
+The master development code repository can be found at:
+
+        git://anongit.freedesktop.org/git/xorg/lib/libXmu
+
+        http://cgit.freedesktop.org/xorg/lib/libXmu
+
+For patch submission instructions, see:
+
+       http://www.x.org/wiki/Development/Documentation/SubmittingPatches
+
+For more information on the git code manager, see:
+
+        http://wiki.x.org/wiki/GitPage
+
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..17fff03
--- /dev/null
@@ -0,0 +1,47 @@
+
+# Initialize Autoconf
+AC_PREREQ([2.60])
+AC_INIT([libXmu], [1.1.1],
+       [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXmu])
+AC_CONFIG_SRCDIR([Makefile.am])
+AC_CONFIG_HEADERS([config.h])
+
+# Initialize Automake
+AM_INIT_AUTOMAKE([foreign dist-bzip2])
+AM_MAINTAINER_MODE
+
+# Initialize libtool
+AC_PROG_LIBTOOL
+
+# Require xorg-macros minimum of 1.12 for DocBook external references
+m4_ifndef([XORG_MACROS_VERSION],
+          [m4_fatal([must install xorg-macros 1.12 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.12)
+XORG_DEFAULT_OPTIONS
+XORG_ENABLE_DOCS
+XORG_WITH_XMLTO(0.0.22)
+XORG_WITH_FOP
+XORG_WITH_XSLTPROC
+XORG_CHECK_SGML_DOCTOOLS(1.8)
+
+# Obtain compiler/linker options for depedencies
+PKG_CHECK_MODULES(XMU, xt xext x11 xextproto)
+PKG_CHECK_MODULES(XMUU, x11)
+
+# CvtStdSel.c needs to know which network transports to build hostname
+# conversion routines for
+XTRANS_CONNECTION_FLAGS
+
+# Allow checking code with lint, sparse, etc.
+XORG_WITH_LINT
+XORG_LINT_LIBRARY([Xmu])
+LINTLIBUU=`echo $LINTLIB | sed s/Xmu/Xmuu/`
+AC_SUBST(LINTLIBUU)
+
+AC_CONFIG_FILES([Makefile
+               doc/Makefile
+               include/Makefile
+               src/Makefile
+               xmu.pc
+               xmuu.pc])
+AC_OUTPUT
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644 (file)
index 0000000..11a2fe1
--- /dev/null
@@ -0,0 +1,16 @@
+
+if ENABLE_DOCS
+
+# Main DocBook/XML files (DOCTYPE book)
+docbook = Xmu.xml
+
+# Included chapters, appendix, images
+chapters = xlogo.svg
+
+# The location where the DocBook/XML files and their generated formats are installed
+shelfdir = $(docdir)
+
+# Generate DocBook/XML output formats with or without stylesheets
+include $(top_srcdir)/docbook.am
+
+endif ENABLE_DOCS
diff --git a/doc/Xmu.xml b/doc/Xmu.xml
new file mode 100644 (file)
index 0000000..2d363a9
--- /dev/null
@@ -0,0 +1,4728 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+[
+<!ENTITY % defs SYSTEM "defs.ent"> %defs;
+]>
+<!-- lifted from troff+ms+XMan by doclifter -->
+
+<article id='xmu'>
+  <articleinfo>
+    <title>Xmu and Xmuu Library API Reference</title>
+    <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
+    <copyright><year>1989</year><holder>X Consortium</holder>
+    </copyright>
+    <abstract><para>&ldquo;Don't ask.&rdquo;</para></abstract>
+
+    <legalnotice>
+
+      <para>
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the &ldquo;Software&rdquo;), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+      </para>
+      <para>
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+      </para>
+      <para>
+THE SOFTWARE IS PROVIDED &ldquo;AS IS&rdquo;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+      </para>
+      <para>
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+      </para>
+      <para>
+<trademark><emphasis>X Window System</emphasis></trademark>
+is a trademark of The Open Group.
+      </para>
+
+    </legalnotice>
+  </articleinfo>
+
+  <sect1 id='Introduction'>
+<title>Introduction</title>
+
+    <para>
+The Xmu Library is a collection of miscellaneous (some might say random)
+utility functions that have been useful in building various applications
+and widgets.  This library is required by the Athena Widgets.
+    </para>
+
+    <para>
+Starting in XFree86 4.1.0, and incorporated into X11R6.7 and later releases,
+a subset of the functions that do not rely on the Athena Widgets (libXaw)
+or X Toolkit Instrinsics (libXt) are provided in a second library, libXmuu.
+    </para>
+
+    <para>
+Programs using either of these libraries are encouraged to determine the
+correct compiler and linker options via the <userinput>xmu</userinput> or
+<userinput>xmuu</userinput> module names for <command>pkg-config</command>,
+<indexterm>
+<primary><command>pkg-config</command></primary>
+</indexterm>
+such as:
+
+      <screen>
+cc -c xapplication.c `pkg-config --cflags xmu`
+cc -o xapplication xapplication.o `pkg-config --libs xmu`
+      </screen>
+    </para>
+
+  </sect1>
+
+  <sect1 id='Atom_Functions'>
+<title>Atom Functions</title>
+
+    <para>
+To use the functions and macros defined in this section, you should include
+the header file
+&lt;<filename class='headerfile'>X11/Xmu/Atoms.h</filename>&gt;
+<indexterm>
+<primary><filename class='headerfile'>X11/Xmu/Atoms.h</filename></primary>
+</indexterm>
+and link against the libXmu library.
+    </para>
+
+    <funcsynopsis>
+      <funcprototype>
+       <funcdef><function>XA_ATOM_PAIR</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_CHARACTER_POSITION</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_CLASS</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_CLIENT_WINDOW</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_CLIPBOARD</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_COMPOUND_TEXT</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_DECNET_ADDRESS</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_DELETE</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_FILENAME</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_HOSTNAME</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_IP_ADDRESS</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_LENGTH</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_LIST_LENGTH</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_NAME</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_NET_ADDRESS</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_NULL</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_OWNER_OS</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_SPAN</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_TARGETS</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_TEXT</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_TIMESTAMP</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_USER</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+      <funcprototype>
+       <funcdef><function>XA_UTF8_STRING</function></funcdef>
+       <paramdef><parameter>d</parameter></paramdef>
+      </funcprototype>
+    </funcsynopsis>
+
+    <para>
+      <indexterm>
+       <primary><type>Atom</type></primary>
+      </indexterm>
+These macros take a display as argument and return an
+<type>Atom</type>.
+The name of the
+atom is obtained from the macro name by removing the leading characters
+&ldquo;<code>XA_</code>&rdquo;.  The
+<type>Atom</type>
+value is cached, such that subsequent requests do not cause
+another round-trip to the server.
+    </para>
+
+    <para>
+      <indexterm zone="XmuMakeAtom">
+       <primary><xref linkend='XmuMakeAtom' xrefstyle='select: title'/></primary>
+      </indexterm>
+      <funcsynopsis id='XmuMakeAtom'>
+       <funcprototype>
+         <funcdef>AtomPtr <function>XmuMakeAtom</function></funcdef>
+         <paramdef>const char *<parameter>name</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>name</parameter></term>
+         <listitem><para>
+specifies the atom name
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function creates and initializes an opaque object, an
+<type>AtomPtr</type>,
+for an
+<type>Atom</type>
+with the
+given name.
+<xref linkend='XmuInternAtom' xrefstyle='select: title'/>
+can be used to cache the Atom value for one or more displays.
+    </para>
+
+    <para>
+      <indexterm zone="XmuNameOfAtom">
+       <primary><xref linkend='XmuNameOfAtom' xrefstyle='select: title'/></primary>
+      </indexterm>
+      <funcsynopsis id='XmuNameOfAtom'>
+       <funcprototype>
+         <funcdef>char *<function>XmuNameOfAtom</function></funcdef>
+         <paramdef>AtomPtr <parameter>atom_ptr</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>atom_ptr</parameter></term>
+         <listitem><para>
+specifies the AtomPtr
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+The function returns the name of an AtomPtr.
+    </para>
+
+    <para>
+      <indexterm zone="XmuInternAtom">
+       <primary><xref linkend='XmuInternAtom' xrefstyle='select: title'/></primary>
+      </indexterm>
+      <funcsynopsis id='XmuInternAtom'>
+       <funcprototype>
+         <funcdef>Atom <function>XmuInternAtom</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>AtomPtr <parameter>atom_ptr</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the connection to the X server
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>atom_ptr</parameter></term>
+         <listitem><para>
+specifies the AtomPtr
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function returns the
+<type>Atom</type>
+for an
+<type>AtomPtr</type>.
+The
+<type>Atom</type>
+is cached,
+such that subsequent requests do not cause another round-trip to the server.
+    </para>
+
+    <para>
+      <indexterm zone="XmuGetAtomName">
+       <primary><xref linkend='XmuGetAtomName' xrefstyle='select: title'/></primary>
+      </indexterm>
+      <funcsynopsis id='XmuGetAtomName'>
+       <funcprototype>
+         <funcdef>char *<function>XmuGetAtomName</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>Atom <parameter>atom</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the connection to the X server
+          </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>atom</parameter></term>
+         <listitem><para>
+specifies the atom whose name is desired
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function returns the name of an
+<type>Atom</type>.
+The result is cached, such that subsequent
+requests do not cause another round-trip to the server.
+    </para>
+
+    <para>
+      <indexterm zone="XmuInternStrings">
+       <primary><xref linkend='XmuInternStrings' xrefstyle='select: title'/></primary>
+      </indexterm>
+      <funcsynopsis id='XmuInternStrings'>
+       <funcprototype>
+         <funcdef>void <function>XmuInternStrings</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>String *<parameter>names</parameter></paramdef>
+         <paramdef>Cardinal <parameter>count</parameter></paramdef>
+         <paramdef>Atom *<parameter>atoms</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the connection to the X server
+          </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>names</parameter></term>
+         <listitem><para>
+specifies the strings to intern
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>count</parameter></term>
+         <listitem><para>
+specifies the number of strings
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>atoms</parameter></term>
+         <listitem><para>
+returns the list of Atom values
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function converts a list of atom names into
+<type>Atom</type>
+values.  The results are cached, such
+that subsequent requests do not cause further round-trips to the server.
+The caller is responsible for preallocating the array pointed at by atoms.
+    </para>
+
+  </sect1>
+
+  <sect1 id='Error_Handler_Functions'>
+<title>Error Handler Functions</title>
+
+    <para>
+To use the functions defined in this section, you should include the header
+file
+&lt;<filename class='headerfile'>X11/Xmu/Error.h</filename>&gt;
+<indexterm>
+<primary><filename class='headerfile'>X11/Xmu/Error.h</filename></primary>
+</indexterm>
+and link against the libXmu or libXmuu library.
+    </para>
+
+    <para>
+      <indexterm zone="XmuPrintDefaultErrorMessage">
+       <primary><xref linkend='XmuPrintDefaultErrorMessage' xrefstyle='select: title'/></primary>
+      </indexterm>
+      <funcsynopsis id='XmuPrintDefaultErrorMessage'>
+       <funcprototype>
+         <funcdef>int <function>XmuPrintDefaultErrorMessage</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>XErrorEvent *<parameter>event</parameter></paramdef>
+         <paramdef>FILE *<parameter>fp</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the connection to the X server
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>event</parameter></term>
+         <listitem><para>
+specifies the error
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>fp</parameter></term>
+         <listitem><para>
+             specifies where to print the error message
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function prints an error message, equivalent to Xlib's default error
+message for protocol errors.  It returns a non-zero value
+if the caller should consider exiting, otherwise it returns 0.
+This function can be used when you need to
+write your own error handler, but need to print out an error from within
+that handler.
+    </para>
+
+    <para id="XmuSimpleErrorHandler">
+      <indexterm zone="XmuSimpleErrorHandler">
+       <primary><function>XmuSimpleErrorHandler</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>int <function>XmuSimpleErrorHandler</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>XErrorEvent *<parameter>errorp</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the connection to the X server
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>errorp</parameter></term>
+         <listitem><para>
+specifies the error
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function ignores errors for
+<errorname>BadWindow</errorname>
+errors for
+<olink targetdoc='libX11' targetptr='XQueryTree'><function>XQueryTree</function></olink>
+and
+<olink targetdoc='libX11' targetptr='XGetWindowAttributes'><function>XGetWindowAttributes</function></olink>,
+and ignores
+<errorname>BadDrawable</errorname>
+errors for
+<olink targetdoc='libX11' targetptr='XGetGeometry'><function>XGetGeometry</function></olink>;
+it returns 0 in those cases.  Otherwise, it prints the default error message,
+and returns a non-zero value if the caller should consider exiting,
+and 0 if the caller should not exit.
+    </para>
+  </sect1>
+
+  <sect1 id='System_Utility_Functions'>
+<title>System Utility Functions</title>
+
+    <para>
+To use the functions defined in this section, you should include the header
+file
+&lt;<filename class='headerfile'>X11/Xmu/SysUtil.h</filename>&gt;
+<indexterm>
+<primary><filename class='headerfile'>X11/Xmu/SysUtil.h</filename></primary>
+</indexterm>
+and link against the libXmu or libXmuu library.
+    </para>
+
+    <para id="XmuGetHostname">
+      <indexterm zone="XmuGetHostname">
+       <primary><function>XmuGetHostname</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>int <function>XmuGetHostname</function></funcdef>
+         <paramdef>char *<parameter>buf</parameter></paramdef>
+         <paramdef>int <parameter>maxlen</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+     <variablelist>
+       <varlistentry>
+         <term><parameter>buf</parameter></term>
+         <listitem><para>
+returns the host name
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>maxlen</parameter></term>
+         <listitem><para>
+specifies the length of <parameter>buf</parameter>
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function stores the null terminated name of the local host in
+<parameter>buf</parameter>, and
+returns length of the name.  This function hides operating system differences,
+such as whether to call <function>gethostname</function> or
+<function>uname</function>.
+    </para>
+
+    <para id="XmuSnprintf">
+      <indexterm zone="XmuSnprintf">
+       <primary><function>XmuSnprintf</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>int <function>XmuSnprintf</function></funcdef>
+         <paramdef>char *<parameter>str</parameter></paramdef>
+         <paramdef>int <parameter>size</parameter></paramdef>
+         <paramdef><parameter>...</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+     <variablelist>
+       <varlistentry>
+         <term><parameter>str</parameter></term>
+         <listitem><para>
+string to write output to
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>size</parameter></term>
+         <listitem><para>
+specifies the size of <parameter>str</parameter>
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function was provided as a portable implementation of
+<function>snprintf</function> before all platforms could be
+relied on to provide their own.   It is now deprecated in favor of
+calling <function>snprintf</function> directly and should only be used
+in software that needs to continue to support non-Unix98 compliant platforms.
+    </para>
+
+
+  </sect1>
+
+  <sect1 id='Window_Utility_Functions'>
+<title>Window Utility Functions</title>
+
+    <para>
+To use the functions defined in this section, you should include the header
+file
+&lt;<filename class='headerfile'>X11/Xmu/WinUtil.h</filename>&gt;
+<indexterm>
+<primary><filename class='headerfile'>X11/Xmu/WinUtil.h</filename></primary>
+</indexterm>.
+To use <function>XmuClientWindow</function>, you may link against either the
+libXmu or libXmuu libraries.   The other functions in this section require
+linking against the libXmu library.
+    </para>
+
+    <para id="XmuScreenOfWindow">
+      <indexterm zone="XmuScreenOfWindow">
+       <primary><function>XmuScreenOfWindow</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>Screen *<function>XmuScreenOfWindow</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>Window <parameter>w</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the connection to the X server
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>w</parameter></term>
+         <listitem><para>
+specifies the window
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function returns the
+<type>Screen</type>
+on which the specified window was created.
+    </para>
+
+    <para id="XmuClientWindow">
+      <indexterm zone="XmuClientWindow">
+       <primary><function>XmuClientWindow</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>Window <function>XmuClientWindow</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>Window <parameter>win</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the connection to the X server
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>win</parameter></term>
+         <listitem><para>
+specifies the window
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+      <indexterm zone="XmuClientWindow">
+       <primary><property>WM_STATE</property></primary>
+      </indexterm>
+This function finds a window, at or below the specified window, which has a
+<property>WM_STATE</property> property.  If such a window is found, it is
+returned, otherwise the
+argument window is returned.
+    </para>
+
+    <para id="XmuUpdateMapHints">
+      <indexterm zone="XmuUpdateMapHints">
+       <primary><function>XmuUpdateMapHints</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>Bool <function>XmuUpdateMapHints</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>Window <parameter>w</parameter></paramdef>
+         <paramdef>XSizeHints *<parameter>hints</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the connection to the X server
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>win</parameter></term>
+         <listitem><para>
+specifies the window
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>hints</parameter></term>
+         <listitem><para>
+specifies the new hints, or <symbol>NULL</symbol>
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function clears the
+<symbol>PPosition</symbol>
+and
+<symbol>PSize</symbol>
+flags and sets the
+<symbol>USPosition</symbol>
+and
+<symbol>USSize</symbol>
+flags in the hints structure, and then stores the hints for the
+window using
+      <indexterm zone="XmuUpdateMapHints">
+       <primary><olink targetdoc='libX11' targetptr='XSetWMNormalHints'><function>XSetWMNormalHints</function></olink></primary>
+      </indexterm>
+<olink targetdoc='libX11' targetptr='XSetWMNormalHints'><function>XSetWMNormalHints</function></olink>
+and returns
+<symbol>True</symbol>.
+If <symbol>NULL</symbol> is passed for the
+hints structure, then the current hints are read back from the window using
+      <indexterm zone="XmuUpdateMapHints">
+       <primary><olink targetdoc='libX11' targetptr='XGetWMNormalHints'><function>XGetWMNormalHints</function></olink></primary>
+      </indexterm>
+<olink targetdoc='libX11' targetptr='XGetWMNormalHints'><function>XGetWMNormalHints</function></olink>
+and are used instead, and
+<symbol>True</symbol>
+is returned; otherwise
+<symbol>False</symbol>
+is returned.
+    </para>
+
+  </sect1>
+
+  <sect1 id='Cursor_Utility_Functions'>
+<title>Cursor Utility Functions</title>
+
+    <para>
+To use the functions defined in this section, you should include the header
+file
+&lt;<filename class='headerfile'>X11/Xmu/CurUtil.h</filename>&gt;
+<indexterm>
+<primary><filename class='headerfile'>X11/Xmu/CurUtil.h</filename></primary>
+</indexterm>
+and link against the libXmu or libXmuu library.
+    </para>
+
+    <para id="XmuCursorNameToIndex">
+      <indexterm zone="XmuCursorNameToIndex">
+       <primary><function>XmuCursorNameToIndex</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>int <function>XmuCursorNameToIndex</function></funcdef>
+         <paramdef>const char *<parameter>name</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>name</parameter></term>
+         <listitem><para>
+specifies the name of the cursor
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function takes the name of a standard cursor and returns its index
+in the standard cursor font.  The cursor names are formed by removing the
+&ldquo;<code>XC_</code>&rdquo; prefix from the cursor defines listed in
+Appendix B of the Xlib
+manual.
+    </para>
+
+  </sect1>
+
+  <sect1 id='Graphics_Functions'>
+<title>Graphics Functions</title>
+
+    <para>
+To use the functions defined in this section, you should include the header
+file
+&lt;<filename class='headerfile'>X11/Xmu/Drawing.h</filename>&gt;
+<indexterm>
+<primary><filename class='headerfile'>X11/Xmu/Drawing.h</filename></primary>
+</indexterm>
+and link against the libXmu library.
+    </para>
+
+    <para id="XmuDrawRoundedRectangle">
+      <indexterm zone="XmuDrawRoundedRectangle">
+       <primary><function>XmuDrawRoundedRectangle</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XmuDrawRoundedRectangle</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>Drawable <parameter>draw</parameter></paramdef>
+         <paramdef>GC <parameter>gc</parameter></paramdef>
+         <paramdef>int <parameter>x</parameter></paramdef>
+         <paramdef>int <parameter>y</parameter></paramdef>
+         <paramdef>int <parameter>w</parameter></paramdef>
+         <paramdef>int <parameter>h</parameter></paramdef>
+         <paramdef>int <parameter>ew</parameter></paramdef>
+         <paramdef>int <parameter>eh</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the connection to the X server
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>draw</parameter></term>
+         <listitem><para>
+specifies the drawable
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>gc</parameter></term>
+         <listitem><para>
+specifies the GC
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>x</parameter></term>
+         <listitem><para>
+specifies the upper left x coordinate
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>y</parameter></term>
+         <listitem><para>
+specifies the upper left y coordinate
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>w</parameter></term>
+         <listitem><para>
+specifies the rectangle width
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>h</parameter></term>
+         <listitem><para>
+specifies the rectangle height
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>ew</parameter></term>
+         <listitem><para>
+specifies the corner width
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>eh</parameter></term>
+         <listitem><para>
+specifies the corner height
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function draws a rounded rectangle, where x, y, w, h are the dimensions
+of the overall rectangle, and ew and eh are the sizes of a bounding box that
+the corners are drawn inside of; ew should be no more than half of w, and eh
+should be no more than half of h.  The current GC line attributes control
+all attributes of the line.
+    </para>
+
+    <para id="XmuFillRoundedRectangle">
+      <indexterm zone="XmuFillRoundedRectangle">
+       <primary><function>XmuFillRoundedRectangle</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XmuFillRoundedRectangle</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>Drawable <parameter>draw</parameter></paramdef>
+         <paramdef>GC <parameter>gc</parameter></paramdef>
+         <paramdef>int <parameter>x</parameter></paramdef>
+         <paramdef>int <parameter>y</parameter></paramdef>
+         <paramdef>int <parameter>w</parameter></paramdef>
+         <paramdef>int <parameter>h</parameter></paramdef>
+         <paramdef>int <parameter>ew</parameter></paramdef>
+         <paramdef>int <parameter>eh</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the connection to the X server
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>draw</parameter></term>
+         <listitem><para>
+specifies the drawable
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>gc</parameter></term>
+         <listitem><para>
+specifies the GC
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>x</parameter></term>
+         <listitem><para>
+specifies the upper left x coordinate
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>y</parameter></term>
+         <listitem><para>
+specifies the upper left y coordinate
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>w</parameter></term>
+         <listitem><para>
+specifies the rectangle width
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>h</parameter></term>
+         <listitem><para>
+specifies the rectangle height
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>ew</parameter></term>
+         <listitem><para>
+specifies the corner width
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>eh</parameter></term>
+         <listitem><para>
+specifies the corner height
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function draws a filled rounded rectangle, where x, y, w, h are the
+dimensions of the overall rectangle, and ew and eh are the sizes of a
+bounding box that the corners are drawn inside of; ew should be no more than
+half of w, and eh should be no more than half of h.  The current GC fill
+settings control all attributes of the fill contents.
+      </para>
+
+    <para id="XmuDrawLogo">
+      <indexterm zone="XmuDrawLogo">
+       <primary><function>XmuDrawLogo</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef><function>XmuDrawLogo</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>Drawable <parameter>drawable</parameter></paramdef>
+         <paramdef>GC <parameter>gcFore</parameter></paramdef>
+         <paramdef>GC <parameter>gcBack</parameter></paramdef>
+         <paramdef>int <parameter>x</parameter></paramdef>
+         <paramdef>int <parameter>y</parameter></paramdef>
+         <paramdef>unsigned int <parameter>width</parameter></paramdef>
+         <paramdef>unsigned int <parameter>height</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the connection to the X server
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>drawable</parameter></term>
+         <listitem><para>
+specifies the drawable
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>gcFore</parameter></term>
+         <listitem><para>
+specifies the foreground GC
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>gcBack</parameter></term>
+         <listitem><para>
+specifies the background GC
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>x</parameter></term>
+         <listitem><para>
+specifies the upper left x coordinate
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>y</parameter></term>
+         <listitem><para>
+specifies the upper left y coordinate
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>width</parameter></term>
+         <listitem><para>
+specifies the logo width
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>height</parameter></term>
+         <listitem><para>
+specifies the logo height
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function draws the &ldquo;official&rdquo; X Window System logo
+(<xref linkend="xlogo"/>).  The bounding box
+of the logo in the drawable is given by x, y, width, and height.  The logo
+itself is filled using gcFore, and the rest of the rectangle is filled using
+gcBack.
+    </para>
+      <figure id="xlogo" pgwide="0">
+       <title>The X Logo</title>
+       <mediaobject>
+         <imageobject>
+           <imagedata id="xlogo-svg" format="SVG" fileref="xlogo.svg"/>
+         </imageobject>
+       </mediaobject>
+      </figure>
+    <para id="XmuCreateStippledPixmap">
+      <indexterm zone="XmuCreateStippledPixmap">
+       <primary><function>XmuCreateStippledPixmap</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>Pixmap <function>XmuCreateStippledPixmap</function></funcdef>
+         <paramdef>Screen *<parameter>screen</parameter></paramdef>
+         <paramdef>Pixel <parameter>fore</parameter></paramdef>
+         <paramdef>Pixel <parameter>back</parameter></paramdef>
+         <paramdef>unsigned int <parameter>depth</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>screen</parameter></term>
+         <listitem><para>
+specifies the screen the pixmap is created on
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>fore</parameter></term>
+         <listitem><para>
+specifies the foreground pixel value
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>back</parameter></term>
+         <listitem><para>
+specifies the background pixel value
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>depth</parameter></term>
+         <listitem><para>
+specifies the depth of the pixmap
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function creates a two pixel by one pixel stippled pixmap of specified
+depth on the specified screen.  The pixmap is cached so that multiple
+requests share the same pixmap.  The pixmap should be freed with
+<function>XmuReleaseStippledPixmap</function>
+to maintain correct reference counts.
+    </para>
+
+    <para id="XmuReleaseStippledPixmap">
+      <indexterm zone="XmuReleaseStippledPixmap">
+       <primary><function>XmuReleaseStippledPixmap</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XmuReleaseStippledPixmap</function></funcdef>
+         <paramdef>Screen *<parameter>screen</parameter></paramdef>
+         <paramdef>Pixmap <parameter>pixmap</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>screen</parameter></term>
+         <listitem><para>
+specifies the screen the pixmap was created on
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>pixmap</parameter></term>
+         <listitem><para>
+specifies the pixmap to free
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function frees a pixmap created with
+<function>XmuCreateStippledPixmap</function>.
+    </para>
+
+    <para id="XmuReadBitmapData">
+      <indexterm zone="XmuReadBitmapData">
+       <primary><function>XmuReadBitmapData</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>int <function>XmuReadBitmapData</function></funcdef>
+         <paramdef>FILE *<parameter>fstream</parameter></paramdef>
+         <paramdef>unsigned int *<parameter>width</parameter></paramdef>
+         <paramdef>unsigned int *<parameter>height</parameter></paramdef>
+         <paramdef>unsigned char **<parameter>datap</parameter></paramdef>
+         <paramdef>int *<parameter>x_hot</parameter></paramdef>
+         <paramdef>int *<parameter>y_hot</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>fstream</parameter></term>
+         <listitem><para>
+specifies the stream to read from
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>width</parameter></term>
+         <listitem><para>
+returns the width of the bitmap
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>height</parameter></term>
+         <listitem><para>
+returns the height of the bitmap
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>datap</parameter></term>
+         <listitem><para>
+returns the parsed bitmap data
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>x_hot</parameter></term>
+         <listitem><para>
+returns the x coordinate of the hotspot
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>y_hot</parameter></term>
+         <listitem><para>
+returns the y coordinate of the hotspot
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function reads a standard bitmap file description from the specified
+stream, and returns the parsed data in a format suitable for passing to
+<olink targetdoc='libX11' targetptr='XCreateBitmapFromData'><function>XCreateBitmapFromData</function></olink>.
+The return value of the function has the same
+interpretation as the return value for
+<olink targetdoc='libX11' targetptr='XReadBitmapFile'><function>XReadBitmapFile</function></olink>.
+    </para>
+
+    <para id="XmuReadBitmapDataFromFile">
+      <indexterm zone="XmuReadBitmapDataFromFile">
+       <primary><function>XmuReadBitmapDataFromFile</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>int <function>XmuReadBitmapDataFromFile</function></funcdef>
+         <paramdef>const char *<parameter>filename</parameter></paramdef>
+         <paramdef>unsigned int *<parameter>width</parameter></paramdef>
+         <paramdef>unsigned int *<parameter>height</parameter></paramdef>
+         <paramdef>unsigned char **<parameter>datap</parameter></paramdef>
+         <paramdef>int *<parameter>x_hot</parameter></paramdef>
+         <paramdef>int *<parameter>y_hot</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>fstream</parameter></term>
+         <listitem><para>
+specifies the file to read from
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>width</parameter></term>
+         <listitem><para>
+returns the width of the bitmap
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>height</parameter></term>
+         <listitem><para>
+returns the height of the bitmap
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>datap</parameter></term>
+         <listitem><para>
+returns the parsed bitmap data
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>x_hot</parameter></term>
+         <listitem><para>
+returns the x coordinate of the hotspot
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>y_hot</parameter></term>
+         <listitem><para>
+returns the y coordinate of the hotspot
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function reads a standard bitmap file description from the specified
+file, and returns the parsed data in a format suitable for passing to
+<olink targetdoc='libX11' targetptr='XCreateBitmapFromData'><function>XCreateBitmapFromData</function></olink>.
+The return value of the function has the same
+interpretation as the return value for
+<olink targetdoc='libX11' targetptr='XReadBitmapFile'><function>XReadBitmapFile</function></olink>.
+    </para>
+
+    <para id="XmuLocateBitmapFile">
+      <indexterm zone="XmuLocateBitmapFile">
+       <primary><function>XmuLocateBitmapFile</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>Pixmap <function>XmuLocateBitmapFile</function></funcdef>
+         <paramdef>Screen *<parameter>screen</parameter></paramdef>
+         <paramdef>const char *<parameter>name</parameter></paramdef>
+         <paramdef>char *<parameter>srcname</parameter></paramdef>
+         <paramdef>int <parameter>srcnamelen</parameter></paramdef>
+         <paramdef>int *<parameter>widthp</parameter></paramdef>
+         <paramdef>int *<parameter>heightp</parameter></paramdef>
+         <paramdef>int *<parameter>xhotp</parameter></paramdef>
+         <paramdef>int *<parameter>yhotp</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>screen</parameter></term>
+         <listitem><para>
+specifies the screen the pixmap is created on
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>name</parameter></term>
+         <listitem><para>
+specifies the file to read from
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>srcname</parameter></term>
+         <listitem><para>
+returns the full filename of the bitmap
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>srcnamelen</parameter></term>
+         <listitem><para>
+specifies the length of the srcname buffer
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>width</parameter></term>
+         <listitem><para>
+returns the width of the bitmap
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>height</parameter></term>
+         <listitem><para>
+returns the height of the bitmap
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>xhotp</parameter></term>
+         <listitem><para>
+returns the x coordinate of the hotspot
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>yhotp</parameter></term>
+         <listitem><para>
+returns the y coordinate of the hotspot
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function reads a file in standard bitmap file format, using
+<olink targetdoc='libX11' targetptr='XReadBitmapFile'><function>XReadBitmapFile</function></olink>,
+and returns the created bitmap.  The filename may be
+absolute, or relative to the global resource named
+      <indexterm zone="XmuLocateBitmapFile">
+       <primary><systemitem class="resource">bitmapFilePath</systemitem></primary>
+      </indexterm>
+<systemitem class="resource">bitmapFilePath</systemitem> with class
+BitmapFilePath.  If the resource is not defined, the default value is the
+build symbol BITMAPDIR, which is typically
+"<filename class="directory">/usr/include/X11/bitmaps</filename>".
+If <parameter>srcnamelen</parameter> is greater than zero and
+<parameter>srcname</parameter> is not <symbol>NULL</symbol>,
+the null terminated filename will be copied into
+<parameter>srcname</parameter>.  The size and hotspot of the bitmap are
+also returned.
+    </para>
+
+    <para id="XmuCreatePixmapFromBitmap">
+      <indexterm zone="XmuCreatePixmapFromBitmap">
+       <primary><function>XmuCreatePixmapFromBitmap</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>Pixmap <function>XmuCreatePixmapFromBitmap</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>Drawable <parameter>d</parameter></paramdef>
+         <paramdef>Pixmap <parameter>bitmap</parameter></paramdef>
+         <paramdef>unsigned int <parameter>width</parameter></paramdef>
+         <paramdef>unsigned int <parameter>height</parameter></paramdef>
+         <paramdef>unsigned int <parameter>depth</parameter></paramdef>
+         <paramdef>unsigned long <parameter>fore</parameter></paramdef>
+         <paramdef>unsigned long <parameter>back</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the connection to the X server
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>screen</parameter></term>
+         <listitem><para>
+specifies the screen the pixmap is created on
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>bitmap</parameter></term>
+         <listitem><para>
+specifies the bitmap source
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>width</parameter></term>
+         <listitem><para>
+specifies the width of the pixmap
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>height</parameter></term>
+         <listitem><para>
+specifies the height of the pixmap
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>depth</parameter></term>
+         <listitem><para>
+specifies the depth of the pixmap
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>fore</parameter></term>
+         <listitem><para>
+specifies the foreground pixel value
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>back</parameter></term>
+         <listitem><para>
+specifies the background pixel value
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function creates a pixmap of the specified width, height, and depth, on
+the same screen as the specified drawable, and then performs an
+<olink targetdoc='libX11' targetptr='XCopyPlane'><function>XCopyPlane</function></olink>
+from the specified bitmap to the pixmap,
+using the specified foreground and background pixel values.
+The created pixmap is returned.
+    </para>
+
+  </sect1>
+
+  <sect1 id='Selection_Functions'>
+<title>Selection Functions</title>
+
+    <para>
+To use the functions defined in this section, you should include the header
+file
+&lt;<filename class='headerfile'>X11/Xmu/StdSel.h</filename>&gt;
+<indexterm>
+<primary><filename class='headerfile'>X11/Xmu/StdSel.h</filename></primary>
+</indexterm>
+and link against the libXmu library.
+    </para>
+
+    <para id="XmuConvertStandardSelection">
+      <indexterm zone="XmuConvertStandardSelection">
+       <primary><function>XmuConvertStandardSelection</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>Boolean <function>XmuConvertStandardSelection</function></funcdef>
+         <paramdef>Widget <parameter>w</parameter></paramdef>
+         <paramdef>Time <parameter>time</parameter></paramdef>
+         <paramdef>Atom *<parameter>selection</parameter></paramdef>
+         <paramdef>Atom *<parameter>target</parameter></paramdef>
+         <paramdef>Atom *<parameter>type</parameter></paramdef>
+         <paramdef>XPointer <parameter>value</parameter></paramdef>
+         <paramdef>unsigned long *<parameter>length</parameter></paramdef>
+         <paramdef>int *<parameter>format</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>w</parameter></term>
+         <listitem><para>
+specifies the widget which currently owns the selection
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>time</parameter></term>
+         <listitem><para>
+specifies the time at which the selection was established
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>selection</parameter></term>
+         <listitem><para>
+this argument is ignored
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>target</parameter></term>
+         <listitem><para>
+specifies the target type of the selection
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>type</parameter></term>
+         <listitem><para>
+returns the property type of the converted value
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>value</parameter></term>
+         <listitem><para>
+returns the converted value
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>length</parameter></term>
+         <listitem><para>
+returns the number of elements in the converted value
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>format</parameter></term>
+         <listitem><para>
+returns the size in bits of the elements</para>
+         </listitem>
+       </varlistentry>
+      </variablelist>
+
+This function converts the following standard selections: CLASS,
+CLIENT_WINDOW, DECNET_ADDRESS, HOSTNAME, IP_ADDRESS, NAME, OWNER_OS,
+TARGETS, TIMESTAMP, and USER.  It returns
+<symbol>True</symbol>
+if the conversion was successful, else it returns
+<symbol>False</symbol>.
+    </para>
+  </sect1>
+
+  <sect1 id='Type_Converter_Functions'>
+<title>Type Converter Functions</title>
+
+    <para>
+To use the functions defined in this section, you should include the header
+file
+&lt;<filename class='headerfile'>X11/Xmu/Converters.h</filename>&gt;
+<indexterm>
+<primary><filename class='headerfile'>X11/Xmu/Converters.h</filename></primary>
+</indexterm>
+and link against the libXmu library.
+    </para>
+
+    <para id="XmuCvtFunctionToCallback">
+      <indexterm zone="XmuCvtFunctionToCallback">
+       <primary><function>XmuCvtFunctionToCallback</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XmuCvtFunctionToCallback</function></funcdef>
+         <paramdef>XrmValue *<parameter>args</parameter></paramdef>
+         <paramdef>Cardinal *<parameter>num_args</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>fromVal</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>toVal</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>args</parameter></term>
+         <listitem><para>
+this argument is ignored
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>num_args</parameter></term>
+         <listitem><para>
+this argument is ignored
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>fromVal</parameter></term>
+         <listitem><para>
+the function to convert
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>toVal</parameter></term>
+         <listitem><para>
+the place to store the converted value
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function converts a callback procedure to a callback list containing
+that procedure, with <symbol>NULL</symbol> closure data.  To use this converter, include the
+following in your widget's ClassInitialize procedure:
+
+      <programlisting>
+XtAddConverter(XtRCallProc, XtRCallback, XmuCvtFunctionToCallback, NULL, 0);
+      </programlisting>
+    </para>
+
+    <para id="XmuCvtStringToBackingStore">
+      <indexterm zone="XmuCvtStringToBackingStore">
+       <primary><function>XmuCvtStringToBackingStore</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XmuCvtStringToBackingStore</function></funcdef>
+         <paramdef>XrmValue *<parameter>args</parameter></paramdef>
+         <paramdef>Cardinal *<parameter>num_args</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>fromVal</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>toVal</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>args</parameter></term>
+         <listitem><para>
+this argument is ignored
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>num_args</parameter></term>
+         <listitem><para>
+this argument must be a pointer to a Cardinal containing the value 0
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>fromVal</parameter></term>
+         <listitem><para>
+specifies the string to convert
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>toVal</parameter></term>
+         <listitem><para>
+returns the converted value
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+      <indexterm zone="XmuCvtStringToBackingStore">
+       <primary>backing-store</primary>
+      </indexterm>
+This function converts a string to a backing-store integer as defined in
+&lt;<filename class='headerfile'>X11/X.h</filename>&gt;.
+The string "notUseful" converts to
+<symbol>NotUseful</symbol>,
+"whenMapped" converts to
+<symbol>WhenMapped</symbol>,
+and "always" converts to
+<symbol>Always</symbol>.
+The string "default" converts to the value
+<symbol>Always</symbol> +
+<symbol>WhenMapped</symbol> +
+<symbol>NotUseful</symbol>.
+The case of the string does not matter.
+To use this converter, include the following
+in your widget's ClassInitialize procedure:
+
+      <programlisting>
+XtAddConverter(XtRString, XtRBackingStore, XmuCvtStringToBackingStore, NULL, 0);
+      </programlisting>
+    </para>
+
+    <para id="XmuCvtStringToBitmap">
+      <indexterm zone="XmuCvtStringToBitmap">
+       <primary><function>XmuCvtStringToBitmap</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XmuCvtStringToBitmap</function></funcdef>
+         <paramdef>XrmValue *<parameter>args</parameter></paramdef>
+         <paramdef>Cardinal *<parameter>num_args</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>fromVal</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>toVal</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>args</parameter></term>
+         <listitem><para>
+the sole argument specifies the Screen on which to create the bitmap
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>num_args</parameter></term>
+         <listitem><para>
+must be the value 1
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>fromVal</parameter></term>
+         <listitem><para>
+specifies the string to convert
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>toVal</parameter></term>
+         <listitem><para>
+returns the converted value
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+      <indexterm zone="XmuCvtStringToBitmap">
+       <primary>window manager icons</primary>
+      </indexterm>
+This function creates a bitmap (a Pixmap of depth one) suitable for window
+manager icons.  The string argument is the name of a file in standard bitmap
+file format.  For the possible filename specifications, see
+<link linkend="XmuLocateBitmapFile"><function>XmuLocateBitmapFile</function></link>.
+To use this converter, include the following in your widget's
+ClassInitialize procedure:
+
+      <programlisting>
+static XtConvertArgRec screenConvertArg[] = {
+  {XtBaseOffset, (XtPointer)XtOffset(Widget, core.screen), sizeof(Screen *)}
+};
+
+XtAddConverter(XtRString, XtRBitmap, XmuCvtStringToBitmap,
+                screenConvertArg, XtNumber(screenConvertArg));
+      </programlisting>
+    </para>
+
+    <para id="XmuCvtStringToColorCursor">
+      <indexterm zone="XmuCvtStringToColorCursor">
+       <primary><function>XmuCvtStringToColorCursor</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>Boolean <function>XmuCvtStringToColorCursor</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>args</parameter></paramdef>
+         <paramdef>Cardinal *<parameter>num_args</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>fromVal</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>toVal</parameter></paramdef>
+         <paramdef>XtPointer *<parameter>data</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the display to use for conversion warnings
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>args</parameter></term>
+         <listitem><para>
+specifies the required conversion arguments
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>num_args</parameter></term>
+         <listitem><para>
+specifies the number of required conversion arguments, which is 4
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>fromVal</parameter></term>
+         <listitem><para>
+specifies the string to convert
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>toVal</parameter></term>
+         <listitem><para>
+returns the converted value
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>data</parameter></term>
+         <listitem><para>
+this argument is ignored
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+      <indexterm zone="XmuCvtStringToColorCursor">
+       <primary><type>Cursor</type></primary>
+      </indexterm>
+This function converts a string to a
+<type>Cursor</type>
+with the foreground and background pixels specified by the conversion
+arguments.  The string can either be a
+standard cursor name formed by removing the <code>&ldquo;XC_&rdquo;</code>
+prefix from any of the
+cursor defines listed in Appendix B of the Xlib Manual, a font name and
+glyph index in decimal of the form "FONT fontname index [[font] index]",
+or a bitmap filename acceptable to
+<link linkend="XmuLocateBitmapFile"><function>XmuLocateBitmapFile</function></link>.
+To use this converter, include
+the following in the widget ClassInitialize procedure:
+
+      <programlisting>
+static XtConvertArgRec colorCursorConvertArgs[] = {
+  {XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.screen),
+   sizeof(Screen *)},
+  {XtResourceString, (XtPointer) XtNpointerColor, sizeof(Pixel)},
+  {XtResourceString, (XtPointer) XtNpointerColorBackground, sizeof(Pixel)},
+  {XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.colormap),
+   sizeof(Colormap)}
+};
+
+
+XtSetTypeConverter(XtRString, XtRColorCursor, XmuCvtStringToColorCursor,
+                colorCursorConvertArgs, XtNumber(colorCursorConvertArgs),
+                 XtCacheByDisplay, NULL);
+      </programlisting>
+
+The widget must recognize XtNpointerColor and XtNpointerColorBackground as
+resources, or specify other appropriate foreground and background resources.
+The widget's Realize and SetValues methods must cause the converter to be
+invoked with the appropriate arguments when one of the foreground,
+background, or cursor resources has changed, or when the window is created,
+and must assign the cursor to the window of the widget.
+    </para>
+
+    <para id="XmuCvtStringToCursor">
+      <indexterm zone="XmuCvtStringToCursor">
+       <primary><function>XmuCvtStringToCursor</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XmuCvtStringToCursor</function></funcdef>
+         <paramdef>XrmValue *<parameter>args</parameter></paramdef>
+         <paramdef>Cardinal *<parameter>num_args</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>fromVal</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>toVal</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>args</parameter></term>
+         <listitem><para>
+specifies the required conversion argument, the screen
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>num_args</parameter></term>
+         <listitem><para>
+specifies the number of required conversion arguments, which is 1
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>fromVal</parameter></term>
+         <listitem><para>
+specifies the string to convert
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>toVal</parameter></term>
+         <listitem><para>
+returns the converted value
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+      <indexterm zone="XmuCvtStringToCursor">
+       <primary><type>Cursor</type></primary>
+      </indexterm>
+This function converts a string to a
+<type>Cursor</type>.
+The string can either be a
+standard cursor name formed by removing the <code>&ldquo;XC_&rdquo;</code>
+prefix from any of the
+cursor defines listed in Appendix B of the Xlib Manual, a font name and
+glyph index in decimal of the form "FONT fontname index [[font] index]", or
+a bitmap filename acceptable to
+<link linkend="XmuLocateBitmapFile"><function>XmuLocateBitmapFile</function></link>.
+To use this converter, include
+the following in your widget's ClassInitialize procedure:
+
+      <programlisting>
+static XtConvertArgRec screenConvertArg[] = {
+  {XtBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen), sizeof(Screen *)}
+};
+
+XtAddConverter(XtRString, XtRCursor, XmuCvtStringToCursor,
+                screenConvertArg, XtNumber(screenConvertArg));
+      </programlisting>
+    </para>
+
+    <para id="XmuCvtStringToGravity">
+      <indexterm zone="XmuCvtStringToGravity">
+       <primary><function>XmuCvtStringToGravity</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XmuCvtStringToGravity</function></funcdef>
+         <paramdef>XrmValue *<parameter>args</parameter></paramdef>
+         <paramdef>Cardinal *<parameter>num_args</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>fromVal</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>toVal</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>args</parameter></term>
+         <listitem><para>
+this argument is ignored
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>num_args</parameter></term>
+         <listitem><para>
+this argument must be a pointer to a Cardinal containing the value 0
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>fromVal</parameter></term>
+         <listitem><para>
+specifies the string to convert
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>toVal</parameter></term>
+         <listitem><para>
+returns the converted value
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+      <indexterm zone="XmuCvtStringToGravity">
+       <primary><type>XtGravity</type></primary>
+      </indexterm>
+This function converts a string to an
+<type>XtGravity</type>
+enumeration value.  The string "forget" and a <symbol>NULL</symbol> value convert to
+<symbol>ForgetGravity</symbol>,
+"NorthWestGravity" converts to
+<symbol>NorthWestGravity</symbol>,
+the strings "NorthGravity" and "top" convert to
+<symbol>NorthGravity</symbol>,
+"NorthEastGravity" converts to
+<symbol>NorthEastGravity</symbol>,
+the strings "West" and "left" convert to
+<symbol>WestGravity</symbol>,
+"CenterGravity" converts to
+<symbol>CenterGravity</symbol>,
+"EastGravity" and "right" convert to
+<symbol>EastGravity</symbol>,
+"SouthWestGravity" converts to
+<symbol>SouthWestGravity</symbol>,
+"SouthGravity" and "bottom" convert to
+<symbol>SouthGravity</symbol>,
+"SouthEastGravity" converts to
+<symbol>SouthEastGravity</symbol>,
+"StaticGravity" converts to
+<symbol>StaticGravity</symbol>,
+and "UnmapGravity" converts to
+<symbol>UnmapGravity</symbol>.
+The case of the string does not matter.  To use this converter, include
+the following in your widget's class initialize procedure:
+
+      <programlisting>
+XtAddConverter(XtRString, XtRGravity, XmuCvtStringToGravity, NULL, 0);
+      </programlisting>
+    </para>
+
+    <para id="XmuCvtStringToJustify">
+      <indexterm zone="XmuCvtStringToJustify">
+       <primary><function>XmuCvtStringToJustify</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XmuCvtStringToJustify</function></funcdef>
+         <paramdef>XrmValue *<parameter>args</parameter></paramdef>
+         <paramdef>Cardinal *<parameter>num_args</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>fromVal</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>toVal</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>args</parameter></term>
+         <listitem><para>
+this argument is ignored
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>num_args</parameter></term>
+         <listitem><para>
+this argument is ignored
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>fromVal</parameter></term>
+         <listitem><para>
+specifies the string to convert
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>toVal</parameter></term>
+         <listitem><para>
+returns the converted value
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+      <indexterm zone="XmuCvtStringToJustify">
+       <primary><type>XtJustify</type></primary>
+      </indexterm>
+This function converts a string to an
+<type>XtJustify</type>
+enumeration value.  The string "left" converts to
+<symbol>XtJustifyLeft</symbol>,
+"center" converts to
+<symbol>XtJustifyCenter</symbol>,
+and "right" converts to
+<symbol>XtJustifyRight</symbol>.
+The case of the string does not matter.  To use this converter,
+include the following in your widget's ClassInitialize procedure:
+
+      <programlisting>
+XtAddConverter(XtRString, XtRJustify, XmuCvtStringToJustify, NULL, 0);
+      </programlisting>
+    </para>
+
+    <para id="XmuCvtStringToLong">
+      <indexterm zone="XmuCvtStringToLong">
+       <primary><function>XmuCvtStringToLong</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XmuCvtStringToLong</function></funcdef>
+         <paramdef>XrmValue *<parameter>args</parameter></paramdef>
+         <paramdef>Cardinal *<parameter>num_args</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>fromVal</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>toVal</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>args</parameter></term>
+         <listitem><para>
+this argument is ignored
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>num_args</parameter></term>
+         <listitem><para>
+this argument must be a pointer to a Cardinal containing 0
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>fromVal</parameter></term>
+         <listitem><para>
+specifies the string to convert
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>toVal</parameter></term>
+         <listitem><para>
+returns the converted value
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function converts a string to an integer of type long.  It parses the
+string using
+<function>sscanf</function>
+with a format of "%ld".  To use this converter, include
+the following in your widget's ClassInitialize procedure:
+
+      <programlisting>
+XtAddConverter(XtRString, XtRLong, XmuCvtStringToLong, NULL, 0);
+      </programlisting>
+    </para>
+
+    <para id="XmuCvtStringToOrientation">
+      <indexterm zone="XmuCvtStringToOrientation">
+       <primary><function>XmuCvtStringToOrientation</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XmuCvtStringToOrientation</function></funcdef>
+         <paramdef>XrmValue *<parameter>args</parameter></paramdef>
+         <paramdef>Cardinal *<parameter>num_args</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>fromVal</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>toVal</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>args</parameter></term>
+         <listitem><para>
+this argument is ignored
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>num_args</parameter></term>
+         <listitem><para>
+this argument is ignored
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>fromVal</parameter></term>
+         <listitem><para>
+specifies the string to convert
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>toVal</parameter></term>
+         <listitem><para>
+returns the converted value
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+      <indexterm zone="XmuCvtStringToOrientation">
+       <primary><type>XtOrientation</type></primary>
+      </indexterm>
+This function converts a string to an
+<type>XtOrientation</type>
+enumeration value.  The string "horizontal" converts to
+<symbol>XtorientHorizontal</symbol>
+and "vertical" converts to
+<symbol>XtorientVertical</symbol>.
+The case of the string does not matter.  To use this converter,
+include the following in your widget's ClassInitialize procedure:
+
+      <programlisting>
+XtAddConverter(XtRString, XtROrientation, XmuCvtStringToOrientation, NULL, 0);
+      </programlisting>
+    </para>
+
+    <para id="XmuCvtStringToShapeStyle">
+      <indexterm zone="XmuCvtStringToShapeStyle">
+       <primary><function>XmuCvtStringToShapeStyle</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>Boolean <function>XmuCvtStringToShapeStyle</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>XrmValue *<parameter>args</parameter></paramdef>
+         <paramdef>Cardinal *<parameter>num_args</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>fromVal</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>toVal</parameter></paramdef>
+         <paramdef>XtPointer *<parameter>data</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+the display to use for conversion warnings
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>args</parameter></term>
+         <listitem><para>
+this argument is ignored
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>num_args</parameter></term>
+         <listitem><para>
+this argument is ignored
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>fromVal</parameter></term>
+         <listitem><para>
+the value to convert from
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>toVal</parameter></term>
+         <listitem><para>
+the place to store the converted value
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>data</parameter></term>
+         <listitem><para>
+this argument is ignored
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function converts a string to an integer shape style.  The string
+"rectangle" converts to
+<symbol>XmuShapeRectangle</symbol>,
+"oval" converts to
+<symbol>XmuShapeOval</symbol>,
+"ellipse" converts to
+<symbol>XmuShapeEllipse</symbol>,
+and "roundedRectangle" converts to
+<symbol>XmuShapeRoundedRectangle</symbol>.
+The case of the string does not matter.  To use this converter,
+include the following in your widget's ClassInitialize procedure:
+
+      <programlisting>
+XtSetTypeConverter(XtRString, XtRShapeStyle, XmuCvtStringToShapeStyle,
+                    NULL, 0, XtCacheNone, NULL);
+      </programlisting>
+    </para>
+
+    <para id="XmuReshapeWidget">
+      <indexterm zone="XmuReshapeWidget">
+       <primary><function>XmuReshapeWidget</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>Boolean <function>XmuReshapeWidget</function></funcdef>
+         <paramdef>Widget <parameter>w</parameter></paramdef>
+         <paramdef>int <parameter>shape_style</parameter></paramdef>
+         <paramdef>int <parameter>corner_width</parameter></paramdef>
+         <paramdef>int <parameter>corner_height</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>w</parameter></term>
+         <listitem><para>
+specifies the widget to reshape
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>shape_style</parameter></term>
+         <listitem><para>
+specifies the new shape
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>corner_width</parameter></term>
+         <listitem><para>
+specifies the width of the rounded rectangle corner
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>corner_height</parameter></term>
+         <listitem><para>
+specified the height of the rounded rectangle corner
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+      <indexterm zone="XmuReshapeWidget">
+       <primary>Shape extension</primary>
+      </indexterm>
+This function reshapes the specified widget, using the Shape extension, to a
+rectangle, oval, ellipse, or rounded rectangle, as specified by shape_style
+(
+<symbol>XmuShapeRectangle</symbol>,
+<symbol>XmuShapeOval</symbol>,
+<symbol>XmuShapeEllipse</symbol>,
+and
+<symbol>XmuShapeRoundedRectangle</symbol>,
+respectively).
+The shape is bounded by the outside edges of the rectangular extents of the
+widget.  If the shape is a rounded rectangle, corner_width and corner_height
+specify the size of the bounding box that the corners are drawn inside of
+(see
+<link linkend="XmuFillRoundedRectangle"><function>XmuFillRoundedRectangle</function></link>);
+otherwise, corner_width and corner_height are ignored.
+The origin of the widget within its parent remains unchanged.
+    </para>
+
+    <para id="XmuCvtStringToWidget">
+      <indexterm zone="XmuCvtStringToWidget">
+       <primary><function>XmuCvtStringToWidget</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XmuCvtStringToWidget</function></funcdef>
+         <paramdef>XrmValue *<parameter>args</parameter></paramdef>
+         <paramdef>Cardinal *<parameter>num_args</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>fromVal</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>toVal</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>args</parameter></term>
+         <listitem><para>
+the sole argument is the parent Widget
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>num_args</parameter></term>
+  <listitem><para>
+this argument must be 1
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>fromVal</parameter></term>
+  <listitem><para>
+specifies the string to convert
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>toVal</parameter></term>
+         <listitem><para>
+returns the converted value
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function converts a string to an immediate child widget of the parent
+widget passed as an argument.  Note that this converter only works for
+child widgets that have already been created; there is no lazy evaluation.
+The string is first compared against the
+names of the normal and popup children, and if a match is found the
+corresponding child is returned.  If no match is found, the string is
+compared against the classes of the normal and popup children, and if a
+match is found the corresponding child is returned.  The case of the string
+is significant.  To use this converter, include the following in your
+widget's ClassInitialize procedure:
+
+      <programlisting>
+static XtConvertArgRec parentCvtArg[] = {
+  {XtBaseOffset, (XtPointer)XtOffset(Widget, core.parent), sizeof(Widget)},
+};
+
+XtAddConverter(XtRString, XtRWidget, XmuCvtStringToWidget,
+                parentCvtArg, XtNumber(parentCvtArg));
+      </programlisting>
+    </para>
+
+    <para id="XmuNewCvtStringToWidget">
+      <indexterm zone="XmuNewCvtStringToWidget">
+       <primary><function>XmuNewCvtStringToWidget</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>Boolean <function>XmuNewCvtStringToWidget</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>args</parameter></paramdef>
+         <paramdef>Cardinal *<parameter>num_args</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>fromVal</parameter></paramdef>
+         <paramdef>XrmValuePtr <parameter>toVal</parameter></paramdef>
+         <paramdef>XtPointer *<parameter>data</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+the display to use for conversion warnings
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>args</parameter></term>
+         <listitem><para>
+the sole argument is the parent Widget
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>num_args</parameter></term>
+         <listitem><para>
+this argument must be a pointer to a Cardinal containing the value 1
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>fromVal</parameter></term>
+         <listitem><para>
+specifies the string to convert
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>toVal</parameter></term>
+         <listitem><para>
+returns the converted value
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>data</parameter></term>
+         <listitem><para>
+this argument is ignored
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This converter is identical in functionality to
+<link linkend="XmuCvtStringToWidget"><function>XmuCvtStringToWidget</function></link>, except
+that it is a new-style converter, allowing the specification of a cache type
+at the time of registration.
+Most widgets will not cache the conversion results, as the application may
+dynamically create and destroy widgets, which would cause cached values to
+become illegal.  To use this converter, include the following in the widget's
+class initialize procedure:
+
+    <programlisting>
+static XtConvertArgRec parentCvtArg[] = {
+  {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.parent),
+   sizeof(Widget)}
+};
+
+XtSetTypeConverter(XtRString, XtRWidget, XmuNewCvtStringToWidget,
+                  parentCvtArg, XtNumber(parentCvtArg), XtCacheNone, NULL);
+      </programlisting>
+
+    </para>
+
+  </sect1>
+
+  <sect1 id='Character_Set_Functions'>
+<title>Character Set Functions</title>
+
+<para>
+To use the functions defined in this section, you should include the header
+file
+&lt;<filename class='headerfile'>X11/Xmu/CharSet.h</filename>&gt;
+<indexterm>
+<primary><filename class='headerfile'>X11/Xmu/CharSet.h</filename></primary>
+</indexterm>
+and link against the libXmu or libXmuu library.
+</para>
+
+    <warning><para>
+The functions in this section are <emphasis remap='B'>deprecated</emphasis>
+because they don't work in most locales now supported by X11; most platforms
+provide alternatives in their system libraries.
+      </para></warning>
+
+    <para id="XmuCopyISOLatin1Lowered">
+      <indexterm zone="XmuCopyISOLatin1Lowered">
+       <primary><function>XmuCopyISOLatin1Lowered</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XmuCopyISOLatin1Lowered</function></funcdef>
+         <paramdef>char *<parameter>dst</parameter></paramdef>
+         <paramdef>const char *<parameter>src</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dst</parameter></term>
+         <listitem><para>
+returns the string copy
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>src</parameter></term>
+         <listitem><para>
+specifies the string to copy
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function copies a null terminated string from src to dst (including the
+null), changing all Latin-1 uppercase letters to lowercase.  The string is
+assumed to be encoded using ISO 8859-1.
+    </para>
+
+    <para>
+Note that like <function>strcpy</function> the caller is responsible for
+ensuring the size of <parameter>dst</parameter> is at least as large as the
+size of <parameter>src</parameter>.
+    </para>
+
+    <para id="XmuNCopyISOLatin1Lowered">
+      <indexterm zone="XmuNCopyISOLatin1Lowered">
+       <primary><function>XmuNCopyISOLatin1Lowered</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XmuNCopyISOLatin1Lowered</function></funcdef>
+         <paramdef>char *<parameter>dst</parameter></paramdef>
+         <paramdef>const char *<parameter>src</parameter></paramdef>
+         <paramdef>int <parameter>size</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dst</parameter></term>
+         <listitem><para>
+returns the string copy
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>src</parameter></term>
+         <listitem><para>
+specifies the string to copy
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>size</parameter></term>
+         <listitem><para>
+maximum number of characters (including the null terminator) to write to dst
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function copies up to <code><parameter>size</parameter> - 1</code>
+characters of a null terminated string from <parameter>src</parameter>
+to <parameter>dst</parameter>, and terminates it with a null,
+changing all Latin-1 uppercase letters to lowercase.  The string is
+assumed to be encoded using ISO 8859-1.
+    </para>
+
+    <para id="XmuCopyISOLatin1Uppered">
+      <indexterm zone="XmuCopyISOLatin1Uppered">
+       <primary><function>XmuCopyISOLatin1Uppered</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XmuCopyISOLatin1Uppered</function></funcdef>
+         <paramdef>char *<parameter>dst</parameter></paramdef>
+         <paramdef>const char *<parameter>src</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dst</parameter></term>
+         <listitem><para>
+returns the string copy
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>src</parameter></term>
+         <listitem><para>
+specifies the string to copy
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function copies a null terminated string from src to dst (including the
+null), changing all Latin-1 lowercase letters to uppercase.  The string is
+assumed to be encoded using ISO 8859-1.
+    </para>
+
+    <para>
+Note that like <function>strcpy</function> the caller is responsible for
+ensuring the size of <parameter>dst</parameter> is at least as large as the
+size of <parameter>src</parameter>.
+    </para>
+
+    <para id="XmuNCopyISOLatin1Uppered">
+      <indexterm zone="XmuNCopyISOLatin1Uppered">
+       <primary><function>XmuNCopyISOLatin1Uppered</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XmuNCopyISOLatin1Uppered</function></funcdef>
+         <paramdef>char *<parameter>dst</parameter></paramdef>
+         <paramdef>const char *<parameter>src</parameter></paramdef>
+         <paramdef>int <parameter>size</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dst</parameter></term>
+         <listitem><para>
+returns the string copy
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>src</parameter></term>
+         <listitem><para>
+specifies the string to copy
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>size</parameter></term>
+         <listitem><para>
+maximum number of characters (including the null terminator) to write to dst
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function copies up to <code><parameter>size</parameter> - 1</code>
+characters of a null terminated string from <parameter>src</parameter>
+to <parameter>dst</parameter>, and terminates it with a null,
+changing all Latin-1 lowercase letters to uppercase.  The string is
+assumed to be encoded using ISO 8859-1.
+    </para>
+
+    <para id="XmuCompareISOLatin1">
+      <indexterm zone="XmuCompareISOLatin1">
+       <primary><function>XmuCompareISOLatin1</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>int <function>XmuCompareISOLatin1</function></funcdef>
+         <paramdef>const char *<parameter>first</parameter></paramdef>
+         <paramdef>const char *<parameter>second</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>first</parameter></term>
+         <listitem><para>
+             specifies a string to compare
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>second</parameter></term>
+         <listitem><para>
+specifies a string to compare
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function compares two null terminated Latin-1 strings, ignoring case
+differences, and returns an integer greater than, equal to, or less than 0,
+according to whether first is lexicographically greater than, equal to, or
+less than second.  The two strings are assumed to be encoded using ISO
+8859-1.
+    </para>
+  </sect1>
+
+  <sect1 id='Keyboard_Event_Translation_Functions'>
+<title>Keyboard Event Translation Functions</title>
+
+    <para>
+To use the functions defined in this section, you should include the header
+file
+&lt;<filename class='headerfile'>X11/Xmu/Lookup.h</filename>&gt;
+<indexterm>
+<primary><filename class='headerfile'>X11/Xmu/Lookup.h</filename></primary>
+</indexterm>.
+and link against the libXmu library.
+    </para>
+
+    <warning><para>
+The functions in this section are <emphasis remap='B'>deprecated</emphasis> because they don't work
+in most locales now supported by X11; the function
+<olink targetdoc='libX11' targetptr='XmbLookupString'><function>XmbLookupString</function></olink>
+provides a better alternative.
+      </para></warning>
+
+    <para id="XmuLookupLatin1">
+      <indexterm zone="XmuLookupLatin1">
+       <primary><function>XmuLookupLatin1</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>int <function>XmuLookupLatin1</function></funcdef>
+         <paramdef>XKeyEvent *<parameter>event</parameter></paramdef>
+         <paramdef>unsigned char *<parameter>buffer</parameter></paramdef>
+         <paramdef>int <parameter>nbytes</parameter></paramdef>
+         <paramdef>KeySym *<parameter>keysym</parameter></paramdef>
+         <paramdef>XComposeStatus *<parameter>status</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>event</parameter></term>
+         <listitem><para>
+specifies the key event
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>buffer</parameter></term>
+         <listitem><para>
+returns the translated characters
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>nbytes</parameter></term>
+         <listitem><para>
+specifies the length of the buffer
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>keysym</parameter></term>
+         <listitem><para>
+returns the computed KeySym, or None
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>status</parameter></term>
+         <listitem><para>
+specifies or returns the compose state
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function is identical to
+<olink targetdoc='libX11' targetptr='XLookupString'><function>XLookupString</function></olink>,
+and exists only for naming symmetry with other functions.
+    </para>
+
+    <para id="XmuLookupLatin2">
+      <indexterm zone="XmuLookupLatin2">
+       <primary><function>XmuLookupLatin2</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>int <function>XmuLookupLatin2</function></funcdef>
+         <paramdef>XKeyEvent *<parameter>event</parameter></paramdef>
+         <paramdef>unsigned char *<parameter>buffer</parameter></paramdef>
+         <paramdef>int <parameter>nbytes</parameter></paramdef>
+         <paramdef>KeySym *<parameter>keysym</parameter></paramdef>
+         <paramdef>XComposeStatus *<parameter>status</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>event</parameter></term>
+         <listitem><para>
+specifies the key event
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>buffer</parameter></term>
+         <listitem><para>
+returns the translated characters
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>nbytes</parameter></term>
+         <listitem><para>
+specifies the length of the buffer
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>keysym</parameter></term>
+         <listitem><para>
+returns the computed KeySym, or None
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>status</parameter></term>
+         <listitem><para>
+specifies or returns the compose state
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function is similar to
+<olink targetdoc='libX11' targetptr='XLookupString'><function>XLookupString</function></olink>,
+except that it maps a key event
+to an Latin-2 (ISO 8859-2) string, or to an ASCII control string.
+    </para>
+
+    <para id="XmuLookupLatin3">
+      <indexterm zone="XmuLookupLatin3">
+       <primary><function>XmuLookupLatin3</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>int <function>XmuLookupLatin3</function></funcdef>
+         <paramdef>XKeyEvent *<parameter>event</parameter></paramdef>
+         <paramdef>unsigned char *<parameter>buffer</parameter></paramdef>
+         <paramdef>int <parameter>nbytes</parameter></paramdef>
+         <paramdef>KeySym *<parameter>keysym</parameter></paramdef>
+         <paramdef>XComposeStatus *<parameter>status</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>event</parameter></term>
+         <listitem><para>
+specifies the key event
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>buffer</parameter></term>
+         <listitem><para>
+returns the translated characters
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>nbytes</parameter></term>
+         <listitem><para>
+specifies the length of the buffer
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>keysym</parameter></term>
+         <listitem><para>
+returns the computed KeySym, or None
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>status</parameter></term>
+         <listitem><para>
+specifies or returns the compose state
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function is similar to
+<olink targetdoc='libX11' targetptr='XLookupString'><function>XLookupString</function></olink>,
+except that it maps a key event
+to an Latin-3 (ISO 8859-3) string, or to an ASCII control string.
+    </para>
+
+    <para id="XmuLookupLatin4">
+      <indexterm zone="XmuLookupLatin4">
+       <primary><function>XmuLookupLatin4</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>int <function>XmuLookupLatin4</function></funcdef>
+         <paramdef>XKeyEvent *<parameter>event</parameter></paramdef>
+         <paramdef>unsigned char *<parameter>buffer</parameter></paramdef>
+         <paramdef>int <parameter>nbytes</parameter></paramdef>
+         <paramdef>KeySym *<parameter>keysym</parameter></paramdef>
+         <paramdef>XComposeStatus *<parameter>status</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>event</parameter></term>
+         <listitem><para>
+specifies the key event
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>buffer</parameter></term>
+         <listitem><para>
+returns the translated characters
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>nbytes</parameter></term>
+         <listitem><para>
+specifies the length of the buffer
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>keysym</parameter></term>
+         <listitem><para>
+returns the computed KeySym, or None
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>status</parameter></term>
+         <listitem><para>
+specifies or returns the compose state
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function is similar to
+<olink targetdoc='libX11' targetptr='XLookupString'><function>XLookupString</function></olink>,
+except that it maps a key event
+to an Latin-4 (ISO 8859-4) string, or to an ASCII control string.
+    </para>
+
+    <para id="XmuLookupKana">
+      <indexterm zone="XmuLookupKana">
+       <primary><function>XmuLookupKana</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>int <function>XmuLookupKana</function></funcdef>
+         <paramdef>XKeyEvent *<parameter>event</parameter></paramdef>
+         <paramdef>unsigned char *<parameter>buffer</parameter></paramdef>
+         <paramdef>int <parameter>nbytes</parameter></paramdef>
+         <paramdef>KeySym *<parameter>keysym</parameter></paramdef>
+         <paramdef>XComposeStatus *<parameter>status</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>event</parameter></term>
+         <listitem><para>
+specifies the key event
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>buffer</parameter></term>
+         <listitem><para>
+returns the translated characters
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>nbytes</parameter></term>
+         <listitem><para>
+specifies the length of the buffer
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>keysym</parameter></term>
+         <listitem><para>
+returns the computed KeySym, or None
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>status</parameter></term>
+         <listitem><para>
+specifies or returns the compose state
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function is similar to
+<olink targetdoc='libX11' targetptr='XLookupString'><function>XLookupString</function></olink>,
+except that it maps a key event
+to a string in an encoding consisting of Latin-1 (ISO 8859-1) and ASCII
+control in the Graphics Left half (values 0 to 127), and Katakana in the
+Graphics Right half (values 128 to 255), using the values from JIS
+X201-1976.
+    </para>
+
+    <para id="XmuLookupJISX0201">
+      <indexterm zone="XmuLookupJISX0201">
+       <primary><function>XmuLookupJISX0201</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>int <function>XmuLookupJISX0201</function></funcdef>
+         <paramdef>XKeyEvent *<parameter>event</parameter></paramdef>
+         <paramdef>unsigned char *<parameter>buffer</parameter></paramdef>
+         <paramdef>int <parameter>nbytes</parameter></paramdef>
+         <paramdef>KeySym *<parameter>keysym</parameter></paramdef>
+         <paramdef>XComposeStatus *<parameter>status</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>event</parameter></term>
+         <listitem><para>
+specifies the key event
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>buffer</parameter></term>
+         <listitem><para>
+returns the translated characters
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>nbytes</parameter></term>
+         <listitem><para>
+specifies the length of the buffer
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>keysym</parameter></term>
+         <listitem><para>
+returns the computed KeySym, or None
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>status</parameter></term>
+         <listitem><para>
+specifies or returns the compose state
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function is similar to
+<olink targetdoc='libX11' targetptr='XLookupString'><function>XLookupString</function></olink>,
+except that it maps a key event
+to a string in the JIS X0201-1976 encoding, including ASCII control.
+    </para>
+
+    <para id="XmuLookupArabic">
+      <indexterm zone="XmuLookupArabic">
+       <primary><function>XmuLookupArabic</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>int <function>XmuLookupArabic</function></funcdef>
+         <paramdef>XKeyEvent *<parameter>event</parameter></paramdef>
+         <paramdef>unsigned char *<parameter>buffer</parameter></paramdef>
+         <paramdef>int <parameter>nbytes</parameter></paramdef>
+         <paramdef>KeySym *<parameter>keysym</parameter></paramdef>
+         <paramdef>XComposeStatus *<parameter>status</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>event</parameter></term>
+         <listitem><para>
+specifies the key event
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>buffer</parameter></term>
+         <listitem><para>
+returns the translated characters
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>nbytes</parameter></term>
+         <listitem><para>
+specifies the length of the buffer
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>keysym</parameter></term>
+         <listitem><para>
+returns the computed KeySym, or None
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>status</parameter></term>
+         <listitem><para>
+specifies or returns the compose state
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function is similar to
+<olink targetdoc='libX11' targetptr='XLookupString'><function>XLookupString</function></olink>,
+except that it maps a key event
+to a Latin/Arabic (ISO 8859-6) string, or to an ASCII control string.
+    </para>
+
+    <para id="XmuLookupCyrillic">
+      <indexterm zone="XmuLookupCyrillic">
+       <primary><function>XmuLookupCyrillic</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>int <function>XmuLookupCyrillic</function></funcdef>
+         <paramdef>XKeyEvent *<parameter>event</parameter></paramdef>
+         <paramdef>unsigned char *<parameter>buffer</parameter></paramdef>
+         <paramdef>int <parameter>nbytes</parameter></paramdef>
+         <paramdef>KeySym *<parameter>keysym</parameter></paramdef>
+         <paramdef>XComposeStatus *<parameter>status</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>event</parameter></term>
+         <listitem><para>
+specifies the key event
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>buffer</parameter></term>
+         <listitem><para>
+returns the translated characters
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>nbytes</parameter></term>
+         <listitem><para>
+specifies the length of the buffer
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>keysym</parameter></term>
+         <listitem><para>
+returns the computed KeySym, or None
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>status</parameter></term>
+         <listitem><para>
+specifies or returns the compose state
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function is similar to
+<olink targetdoc='libX11' targetptr='XLookupString'><function>XLookupString</function></olink>,
+except that it maps a key event
+to a Latin/Cyrillic (ISO 8859-5) string, or to an ASCII control string.
+    </para>
+
+    <para id="XmuLookupGreek">
+      <indexterm zone="XmuLookupGreek">
+       <primary><function>XmuLookupGreek</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>int <function>XmuLookupGreek</function></funcdef>
+         <paramdef>XKeyEvent *<parameter>event</parameter></paramdef>
+         <paramdef>unsigned char *<parameter>buffer</parameter></paramdef>
+         <paramdef>int <parameter>nbytes</parameter></paramdef>
+         <paramdef>KeySym *<parameter>keysym</parameter></paramdef>
+         <paramdef>XComposeStatus *<parameter>status</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>event</parameter></term>
+         <listitem><para>
+specifies the key event
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>buffer</parameter></term>
+         <listitem><para>
+returns the translated characters
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>nbytes</parameter></term>
+         <listitem><para>
+specifies the length of the buffer
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>keysym</parameter></term>
+         <listitem><para>
+returns the computed KeySym, or None
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>status</parameter></term>
+         <listitem><para>
+specifies or returns the compose state
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function is similar to
+<olink targetdoc='libX11' targetptr='XLookupString'><function>XLookupString</function></olink>,
+except that it maps a key event
+to a Latin/Greek (ISO 8859-7) string, or to an ASCII control string.
+    </para>
+
+    <para id="XmuLookupHebrew">
+      <indexterm zone="XmuLookupHebrew">
+       <primary><function>XmuLookupHebrew</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>int <function>XmuLookupHebrew</function></funcdef>
+         <paramdef>XKeyEvent *<parameter>event</parameter></paramdef>
+         <paramdef>unsigned char *<parameter>buffer</parameter></paramdef>
+         <paramdef>int <parameter>nbytes</parameter></paramdef>
+         <paramdef>KeySym *<parameter>keysym</parameter></paramdef>
+         <paramdef>XComposeStatus *<parameter>status</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>event</parameter></term>
+         <listitem><para>
+specifies the key event
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>buffer</parameter></term>
+         <listitem><para>
+returns the translated characters
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>nbytes</parameter></term>
+         <listitem><para>
+specifies the length of the buffer
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>keysym</parameter></term>
+         <listitem><para>
+returns the computed KeySym, or None
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>status</parameter></term>
+         <listitem><para>
+specifies or returns the compose state
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function is similar to
+<olink targetdoc='libX11' targetptr='XLookupString'><function>XLookupString</function></olink>,
+except that it maps a key event
+to a Latin/Hebrew (ISO 8859-8) string, or to an ASCII control string.
+    </para>
+
+    <para id="XmuLookupAPL">
+      <indexterm zone="XmuLookupAPL">
+       <primary><function>XmuLookupAPL</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>int <function>XmuLookupAPL</function></funcdef>
+         <paramdef>XKeyEvent *<parameter>event</parameter></paramdef>
+         <paramdef>unsigned char *<parameter>buffer</parameter></paramdef>
+         <paramdef>int <parameter>nbytes</parameter></paramdef>
+         <paramdef>KeySym *<parameter>keysym</parameter></paramdef>
+         <paramdef>XComposeStatus *<parameter>status</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>event</parameter></term>
+         <listitem><para>
+specifies the key event
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>buffer</parameter></term>
+         <listitem><para>
+returns the translated characters
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>nbytes</parameter></term>
+         <listitem><para>
+specifies the length of the buffer
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>keysym</parameter></term>
+         <listitem><para>
+returns the computed KeySym, or None
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>status</parameter></term>
+         <listitem><para>
+specifies or returns the compose state
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function is similar to
+<olink targetdoc='libX11' targetptr='XLookupString'><function>XLookupString</function></olink>,
+except that it maps a key event to an APL string.
+    </para>
+
+  </sect1>
+
+  <sect1 id='Compound_Text_Functions'>
+<title>Compound Text Functions</title>
+
+    <para>
+The functions defined in this section are for parsing Compound Text strings,
+decomposing them into individual segments. Definitions needed to use these
+routines are in the include file
+&lt;<filename class='headerfile'>X11/Xmu/Xct.h</filename>&gt;
+<indexterm>
+<primary><filename class='headerfile'>X11/Xmu/Xct.h</filename></primary>
+</indexterm>
+and link against the libXmu library.
+    </para>
+
+    <warning><para>
+The functions in this section are <emphasis remap='B'>deprecated</emphasis> because they shift the
+burden for recently introduced locale encodings to the application. The
+use of the
+<symbol>UTF8_STRING</symbol>
+text encoding provides a better alternative.
+      </para></warning>
+
+    <para>
+A Compound Text string is represented as the following type:
+
+      <synopsis>
+       typedef unsigned char *XctString;
+      </synopsis>
+    </para>
+
+    <para id="XctCreate">
+      <indexterm zone="XctCreate">
+       <primary><function>XctCreate</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>XctData <function>XctCreate</function></funcdef>
+         <paramdef>const XctString <parameter>string</parameter></paramdef>
+         <paramdef>int <parameter>length</parameter></paramdef>
+         <paramdef>XctFlags <parameter>flags</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>string</parameter></term>
+         <listitem><para>
+the Compound Text string
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>length</parameter></term>
+         <listitem><para>
+the number of bytes in string
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>flags</parameter></term>
+         <listitem><para>
+parsing control flags
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function creates an
+<type>XctData</type>
+structure for parsing a Compound Text
+string.  The string need not be null terminated.  The following flags are
+defined to control parsing of the string:
+
+    <variablelist>
+      <varlistentry>
+       <term><symbol>XctSingleSetSegments</symbol></term>
+       <listitem><para>
+This means that returned segments should contain
+characters from only one set (C0, C1, GL, GR).  When this is requested,
+<symbol>XctSegment</symbol>
+is never returned by
+<function>XctNextItem</function>,
+instead
+<symbol>XctC0Segment</symbol>,
+<symbol>XctC1Segment</symbol>,
+<symbol>XctGlSegment</symbol>,
+and
+<symbol>XctGRSegment</symbol>
+are returned.  C0 and C1
+segments are always returned as singleton characters.
+         </para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term><symbol>XctProvideExtensions</symbol></term>
+       <listitem><para>
+This means that if the Compound Text string is from a
+higher version than this code is implemented to, then syntactically correct
+but unknown control sequences should be returned as
+<symbol>XctExtension</symbol>
+items by
+<function>XctNextItem</function>.
+If this flag is not set, and the Compound Text string version
+indicates that extensions cannot be ignored, then each unknown control
+sequence will be reported as an
+<symbol>XctError</symbol>.
+         </para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term><symbol>XctAcceptC0Extensions</symbol></term>
+       <listitem><para>
+This means that if the Compound Text string is from
+a higher version than this code is implemented to, then unknown C0
+characters should be treated as if they were legal, and returned as C0
+characters (regardless of how
+<symbol>XctProvideExtensions</symbol>
+is set) by
+<function>XctNextItem</function>.
+If this flag is not set, then all unknown C0 characters are treated
+according to
+<symbol>XctProvideExtensions</symbol>.
+         </para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term><symbol>XctAcceptC1Extensions</symbol></term>
+       <listitem><para>
+This means that if the Compound Text string is from
+a higher version than this code is implemented to, then unknown C1
+characters should be treated as if they were legal, and returned as C1
+characters (regardless of how
+<symbol>XctProvideExtensions</symbol>
+is set) by
+<function>XctNextItem</function>.
+If this flag is not set, then all unknown C1 characters are treated
+according to
+<symbol>XctProvideExtensions</symbol>.
+         </para></listitem>
+      </varlistentry>
+      <varlistentry>
+       <term><symbol>XctHideDirection</symbol></term>
+       <listitem><para>
+This means that horizontal direction changes should be
+reported as
+<symbol>XctHorizontal</symbol>
+items by
+<function>XctNextItem</function>. If this flag is not set,
+then direction changes are not returned as items, but the current direction
+is still maintained and reported for other items.  The current direction is
+given as an enumeration, with the values
+<symbol>XctUnspecified</symbol>,
+<symbol>XctLeftToRight</symbol>,
+and
+<symbol>XctRightToLeft</symbol>.
+         </para></listitem>
+      </varlistentry>
+      <varlistentry>
+       <term><symbol>XctFreeString</symbol></term>
+       <listitem><para>
+This means that
+<function>XctFree</function>
+should free the Compound Text string that is passed to
+<function>XctCreate</function>.
+If this flag is not set, the string is not freed.
+         </para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term><symbol>XctShiftMultiGRToGL</symbol></term>
+       <listitem><para>
+This means that
+<function>XctNextItem</function>
+should translate GR
+segments on-the-fly into GL segments for the GR sets: GB2312.1980-1,
+JISX0208.1983-1, and KSC5601.1987-1.
+         </para></listitem>
+      </varlistentry>
+    </variablelist>
+  </para>
+
+    <para id="XctReset">
+      <indexterm zone="XctReset">
+       <primary><function>XctReset</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XctReset</function></funcdef>
+           <paramdef>XctData <parameter>data</parameter></paramdef>
+         </funcprototype>
+       </funcsynopsis>
+       <variablelist>
+         <varlistentry>
+           <term><parameter>data</parameter></term>
+           <listitem><para>
+specifies the Compound Text structure
+             </para></listitem>
+         </varlistentry>
+       </variablelist>
+
+This function resets the
+<type>XctData</type>
+structure to reparse the Compound Text string from the beginning.
+      </para>
+
+      <para id="XctNextItem">
+      <indexterm zone="XctNextItem">
+       <primary><function>XctNextItem</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>XctResult <function>XctNextItem</function></funcdef>
+           <paramdef>XctData <parameter>data</parameter></paramdef>
+         </funcprototype>
+       </funcsynopsis>
+       <variablelist>
+         <varlistentry>
+           <term><parameter>data</parameter></term>
+           <listitem><para>
+specifies the Compound Text structure
+             </para></listitem>
+         </varlistentry>
+       </variablelist>
+
+This function parses the next &ldquo;item&rdquo; from the Compound Text string.  The
+return value indicates what kind of item is returned.  The item itself, its
+length, and the current contextual state, are reported as components of the
+<type>XctData</type>
+structure.
+<type>XctResult</type>
+is an enumeration, with the following values:
+
+       <variablelist>
+         <varlistentry>
+           <term><symbol>XctSegment</symbol></term>
+           <listitem><para>
+the item contains some mixture of C0, GL, GR, and C1 characters.
+             </para></listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term><symbol>XctC0Segment</symbol></term>
+           <listitem><para>
+the item contains only C0 characters.
+             </para></listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term><symbol>XctGLSegment</symbol></term>
+           <listitem><para>
+the item contains only GL characters.
+             </para></listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term><symbol>XctC1Segment</symbol></term>
+           <listitem><para>
+the item contains only C1 characters.
+             </para></listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term><symbol>XctGRSegment</symbol></term>
+           <listitem><para>
+the item contains only GR characters.
+             </para></listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term><symbol>XctExtendedSegment</symbol></term>
+           <listitem><para>
+the item contains an extended segment.
+             </para></listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term><symbol>XctExtension</symbol></term>
+           <listitem><para>
+the item is an unknown extension control sequence.
+             </para></listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term><symbol>XctHorizontal</symbol></term>
+           <listitem><para>
+the item indicates a change in horizontal direction or
+depth.  The new direction and depth are recorded in the
+<type>XctData</type>
+structure.
+             </para></listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term><symbol>XctEndOfText</symbol></term>
+           <listitem><para>
+The end of the Compound Text string has been reached.
+             </para></listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term><symbol>XctError</symbol></term>
+           <listitem><para>
+the string contains a syntactic or semantic error; no further
+parsing should be performed.
+             </para></listitem>
+         </varlistentry>
+       </variablelist>
+    </para>
+
+    <para id="XctData">
+      <indexterm zone="XctData">
+       <primary><type>XctData</type></primary>
+      </indexterm>
+The following state values are stored in the
+<type>XctData</type>
+structure:
+       <synopsis>
+    XctString          item;           /* the action item */
+    unsigned           item_length;    /* length of item in bytes */
+    int                        char_size;      /* the number of bytes per character in
+                                        * item, with zero meaning variable */
+    char               *encoding;      /* the XLFD encoding name for item */
+    XctHDirection      horizontal;     /* the direction of item */
+    unsigned           horz_depth;     /* the current direction nesting depth */
+    char               *GL;            /* the "{I} F" string for the current GL */
+    char               *GL_encoding;   /* the XLFD encoding name for the current GL */
+    int                        GL_set_size;    /* 94 or 96 */
+    int                        GL_char_size;   /* the number of bytes per GL character */
+    char               *GR;            /* the "{I} F" string for the current GR */
+    char               *GR_encoding;   /* the XLFD encoding name for the current GR */
+    int                        GR_set_size;    /* 94 or 96 */
+    int                        GR_char_size;   /* number of bytes per GR character */
+    char               *GLGR_encoding; /* the XLFD encoding name for the current
+                                        *  GL+GR, if known */
+       </synopsis>
+      </para>
+      <para>
+       <funcsynopsis>
+         <funcprototype>
+           <funcdef>void <function>XctFree</function></funcdef>
+           <paramdef>XctData <parameter>data</parameter></paramdef>
+         </funcprototype>
+       </funcsynopsis>
+       <variablelist>
+         <varlistentry>
+           <term><parameter>data</parameter></term>
+           <listitem><para>
+specifies the Compound Text structure
+             </para></listitem>
+         </varlistentry>
+       </variablelist>
+
+This function frees all data associated with the
+<type>XctData</type>
+structure.
+      </para>
+
+  </sect1>
+
+  <sect1 id='CloseDisplay_Hook_Functions'>
+<title>CloseDisplay Hook Functions</title>
+
+    <para>
+To use the functions defined in this section, you should include the header
+file
+&lt;<filename class='headerfile'>X11/Xmu/CloseHook.h</filename>&gt;
+<indexterm>
+<primary><filename class='headerfile'>X11/Xmu/CloseHook.h</filename></primary>
+</indexterm>
+and link against the libXmu library.
+    </para>
+
+    <para id="XmuAddCloseDisplayHook">
+      <indexterm zone="XmuAddCloseDisplayHook">
+       <primary><function>XmuAddCloseDisplayHook</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>CloseHook <function>XmuAddCloseDisplayHook</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>int <parameter>( *func )</parameter>
+           <funcparams>Display *, XPointer</funcparams></paramdef>
+         <paramdef>XPointer <parameter>arg</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the connection to the X server
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>func</parameter></term>
+         <listitem><para>
+specifies the function to call at display close
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>arg</parameter></term>
+         <listitem><para>
+specifies arbitrary data to pass to <parameter>func</parameter>
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function adds a callback for the given display.  When the display is
+closed, the given function will be called with the given display and
+argument as:
+
+      <programlisting>
+       (*func)(dpy, arg)
+      </programlisting>
+    </para>
+
+    <para>
+The function is declared to return an int even though the value is ignored,
+because some compilers used to have problems with functions returning void.
+    </para>
+
+    <para>
+This routine returns <symbol>NULL</symbol> if it was unable to add the
+callback, otherwise it
+returns an opaque handle that can be used to remove or lookup the callback.
+    </para>
+
+    <para id="XmuRemoveCloseDisplayHook">
+      <indexterm zone="XmuRemoveCloseDisplayHook">
+       <primary><function>XmuRemoveCloseDisplayHook</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>Bool <function>XmuRemoveCloseDisplayHook</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>CloseHook <parameter>handle</parameter></paramdef>
+         <paramdef>int <parameter>( *func )</parameter>
+           <funcparams>Display *, XPointer</funcparams></paramdef>
+         <paramdef>XPointer <parameter>arg</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the connection to the X server
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>handle</parameter></term>
+         <listitem><para>
+specifies the callback by id, or <symbol>NULL</symbol>
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><function>func</function></term>
+         <listitem><para>
+specifies the callback by function
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>arg</parameter></term>
+               <listitem><para>
+specifies the function data to match
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function deletes a callback that has been added with
+<function>XmuAddCloseDisplayHook</function>.
+If handle is not <symbol>NULL</symbol>, it specifies the callback to
+remove, and the func and arg parameters are ignored.  If handle is <symbol>NULL</symbol>, the
+first callback found to match the specified func and arg will be removed.
+Returns
+<symbol>True</symbol>
+if a callback was removed, else returns
+<symbol>False</symbol>.
+    </para>
+
+    <para id="XmuLookupCloseDisplayHook">
+      <indexterm zone="XmuLookupCloseDisplayHook">
+       <primary><function>XmuLookupCloseDisplayHook</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>Bool <function>XmuLookupCloseDisplayHook</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>CloseHook <parameter>handle</parameter></paramdef>
+         <paramdef>int <parameter>( *func )</parameter>
+           <funcparams>Display *, XPointer</funcparams></paramdef>
+         <paramdef>XPointer <parameter>arg</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the connection to the X server
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>handle</parameter></term>
+         <listitem><para>
+specifies the callback by id, or <symbol>NULL</symbol>
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><function>func</function></term>
+         <listitem><para>
+specifies the callback by function
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>arg</parameter></term>
+         <listitem><para>
+specifies the function data to match
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function determines if a callback is installed.  If handle is not
+<symbol>NULL</symbol>,
+it specifies the callback to look for, and the func and arg parameters are
+ignored.  If handle is <symbol>NULL</symbol>, the function will look for
+any callback for the
+specified func and arg.  Returns
+<symbol>True</symbol>
+if a matching callback exists, else returns
+<symbol>False</symbol>.
+
+
+    </para>
+  </sect1>
+
+  <sect1 id='Display_Queue_Functions'>
+<title>Display Queue Functions</title>
+
+    <para>
+To use the functions and types defined in this section, you should include the
+header file
+&lt;<filename class='headerfile'>X11/Xmu/DisplayQue.h</filename>&gt;
+<indexterm>
+<primary><filename class='headerfile'>X11/Xmu/DisplayQue.h</filename></primary>
+</indexterm>
+and link against the libXmu library.
+<filename class='headerfile'>DisplayQue.h</filename> defines the following
+types:
+
+      <indexterm zone="XmuDisplayQueue">
+       <primary><type>XmuDisplayQueue</type></primary>
+      </indexterm>
+      <synopsis id="XmuDisplayQueue">
+typedef int (*XmuCloseDisplayQueueProc)(XmuDisplayQueue *queue,
+                                        XmuDisplayQueueEntry *entry);
+
+typedef int (*XmuFreeDisplayQueueProc)(XmuDisplayQueue *queue);
+
+typedef struct _XmuDisplayQueueEntry {
+       struct _XmuDisplayQueueEntry *prev, *next;
+       Display *display;
+       CloseHook closehook;
+       XPointer data;
+} XmuDisplayQueueEntry;
+
+typedef struct _XmuDisplayQueue {
+       int nentries;
+       XmuDisplayQueueEntry *head, *tail;
+       XmuCloseDisplayQueueProc closefunc;
+       XmuFreeDisplayQueueProc freefunc;
+       XPointer data;
+} XmuDisplayQueue;
+      </synopsis>
+    </para>
+
+    <para id="XmuDQCreate">
+      <indexterm zone="XmuDQCreate">
+       <primary><function>XmuDQCreate</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>XmuDisplayQueue *<function>XmuDQCreate</function></funcdef>
+         <paramdef>XmuCloseDisplayQueueProc <parameter>closefunc</parameter></paramdef>
+         <paramdef>XmuFreeDisplayQueueProc <parameter>freefunc</parameter></paramdef>
+         <paramdef>XPointer <parameter>data</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>closefunc</parameter></term>
+         <listitem><para>
+specifies the close function
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>freefunc</parameter></term>
+         <listitem><para>
+specifies the free function
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>data</parameter></term>
+         <listitem><para>
+specifies private data for the functions
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function creates and returns an empty
+<type>XmuDisplayQueue</type>
+(which is really just a set of displays, but is called a queue for
+historical reasons).  The queue is initially empty, but displays
+can be added using
+<function>XmuAddDisplay</function>.
+The data value is simply stored in the queue for use by the closefunc
+and freefunc callbacks.
+Whenever a display in the queue is closed using
+<function>XCloseDisplay</function>,
+the <parameter>closefunc</parameter> (if non-<symbol>NULL</symbol>) is called with the queue and the display's
+<function>XmuDisplayQueueEntry</function>
+as follows:
+      <programlisting>
+       (*closefunc)(queue, entry)
+      </programlisting>
+    </para>
+
+    <para>
+The <parameter>freefunc</parameter> (if non-<symbol>NULL</symbol>) is called whenever the last
+display in the
+queue is closed, as follows:
+
+      <programlisting>
+       (*freefunc)(queue)
+      </programlisting>
+    </para>
+
+    <para>
+The application is responsible for actually freeing the queue, by calling
+<function>XmuDQDestroy</function>.
+    </para>
+
+    <para id="XmuDQAddDisplay">
+      <indexterm zone="XmuDQAddDisplay">
+       <primary><function>XmuDQAddDisplay</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>XmuDisplayQueueEntry *<function>XmuDQAddDisplay</function></funcdef>
+         <paramdef>XmuDisplayQueue *<parameter>q</parameter></paramdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>XPointer <parameter>data</parameter></paramdef>
+       </funcprototype>
+     </funcsynopsis>
+
+      <variablelist>
+       <varlistentry>
+         <term><parameter>q</parameter></term>
+         <listitem><para>
+specifies the queue
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the display to add
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>data</parameter></term>
+         <listitem><para>
+specifies private data for the free function
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function adds the specified display to the queue.  If successful,
+the queue entry is returned, otherwise <symbol>NULL</symbol> is returned.
+The data value is simply stored in the queue entry for use by the
+queue's freefunc callback.  This function does not attempt to prevent
+duplicate entries in the queue; the caller should use
+<function>XmuDQLookupDisplay</function>
+to determine if a display has already been added to a queue.
+    </para>
+
+    <para id="XmuDQLookupDisplay">
+      <indexterm zone="XmuDQLookupDisplay">
+       <primary><function>XmuDQLookupDisplay</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>XmuDisplayQueueEntry *<function>XmuDQLookupDisplay</function></funcdef>
+         <paramdef>XmuDisplayQueue *<parameter>q</parameter></paramdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>q</parameter></term>
+         <listitem><para>
+specifies the queue
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the display to lookup
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function returns the queue entry for the specified display, or
+<symbol>NULL</symbol> if
+the display is not in the queue.
+    </para>
+
+    <para id="XmuDQNDisplays">
+      <indexterm zone="XmuDQNDisplays">
+       <primary><function>XmuDQNDisplays</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef><function>XmuDQNDisplays</function></funcdef>
+             <paramdef><parameter>q</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+This macro returns the number of displays in the specified queue.
+    </para>
+
+    <para id="XmuDQRemoveDisplay">
+      <indexterm zone="XmuDQRemoveDisplay">
+       <primary><function>XmuDQRemoveDisplay</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>Bool <function>XmuDQRemoveDisplay</function></funcdef>
+         <paramdef>XmuDisplayQueue *<parameter>q</parameter></paramdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>q</parameter></term>
+         <listitem><para>
+specifies the queue
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the display to remove
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function removes the specified display from the specified queue.
+No callbacks are performed.
+If the display is not found in the queue,
+<symbol>False</symbol>
+is returned, otherwise
+<symbol>True</symbol>
+is returned.
+    </para>
+
+    <para id="XmuDQDestroy">
+      <indexterm zone="XmuDQDestroy">
+       <primary><function>XmuDQDestroy</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>Bool <function>XmuDQDestroy</function></funcdef>
+         <paramdef>XmuDisplayQueue *<parameter>q</parameter></paramdef>
+         <paramdef>Bool <parameter>docallbacks</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>q</parameter></term>
+         <listitem><para>
+specifies the queue to destroy
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>docallbacks</parameter></term>
+         <listitem><para>
+specifies whether close functions should be called
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function releases all memory associated with the specified queue.
+If docallbacks is
+<symbol>True</symbol>,
+then the queue's closefunc callback (if non-<symbol>NULL</symbol>) is first called
+for each display in the queue, even though
+<function>XCloseDisplay</function>
+is not called on the display.
+    </para>
+
+  </sect1>
+
+  <sect1 id='Toolkit_Convenience_Functions'>
+<title>Toolkit Convenience Functions</title>
+
+    <para>
+To use the functions defined in this section, you should include the header
+file
+&lt;<filename class='headerfile'>X11/Xmu/Initer.h</filename>&gt;
+<indexterm>
+<primary><filename class='headerfile'>X11/Xmu/Initer.h</filename></primary>
+</indexterm>
+and link against the libXmu library.
+    </para>
+
+    <para id="XmuAddInitializer">
+      <indexterm zone="XmuAddInitializer">
+       <primary><function>XmuAddInitializer</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XmuAddInitializer</function></funcdef>
+         <paramdef>void <parameter>( *func )</parameter>
+           <funcparams>XtAppContext, XPointer</funcparams></paramdef>
+         <paramdef>XPointer <parameter>data</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>func</parameter></term>
+         <listitem><para>
+specifies the procedure to register
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>data</parameter></term>
+         <listitem><para>
+specifies private data for the procedure
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function registers a procedure, to be invoked the first time
+<function>XmuCallInitializers</function>
+is called on a given application context.  The procedure
+is called with the application context and the specified data:
+
+      <programlisting>
+       (*func)(app_con, data)
+      </programlisting>
+    </para>
+
+    <para id="XmuCallInitializers">
+      <indexterm zone="XmuCallInitializers">
+       <primary><function>XmuCallInitializers</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XmuCallInitializers</function></funcdef>
+         <paramdef>XtAppContext <parameter>app_con</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>app_con</parameter></term>
+         <listitem><para>
+specifies the application context to initialize
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function calls each of the procedures that have been registered with
+<function>XmuAddInitializer</function>,
+if this is the first time the application context has been passed to
+<function>XmuCallInitializers</function>.
+Otherwise, this function does nothing.
+    </para>
+
+  </sect1>
+
+  <sect1 id='Standard_Colormap_Functions'>
+<title>Standard Colormap Functions</title>
+
+    <para>
+To use the functions defined in this section, you should include the header
+file
+&lt;<filename class='headerfile'>X11/Xmu/StdCmap.h</filename>&gt;
+<indexterm>
+<primary><filename class='headerfile'>X11/Xmu/StdCmap.h</filename></primary>
+</indexterm>
+and link against the libXmu library.
+    </para>
+
+    <para id="XmuAllStandardColormaps">
+      <indexterm zone="XmuAllStandardColormaps">
+       <primary><function>XmuAllStandardColormaps</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>Status <function>XmuAllStandardColormaps</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the connection to the X server
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+      <indexterm>
+       <primary>colormaps</primary><secondary>standard</secondary>
+      </indexterm>
+To create all of the appropriate standard colormaps for every visual of
+every screen on a given display, use
+<function>XmuAllStandardColormaps</function>.
+    </para>
+
+    <para>
+This function defines and retains as permanent resources all standard
+colormaps which are meaningful for the visuals of each screen of the
+display.  It returns 0 on failure, non-zero on success.  If the property of
+any standard colormap is already defined, this function will redefine it.
+    </para>
+
+    <para>
+This function is intended to be used by window managers or a special client
+at the start of a session.
+    </para>
+
+    <para>
+The standard colormaps of a screen are defined by properties associated with
+the screen's root window.  The property names of standard colormaps are
+predefined, and each property name except
+<property>RGB_DEFAULT_MAP</property> may describe at
+most one colormap.
+    </para>
+
+    <para>
+The standard colormaps are: <property>RGB_BEST_MAP</property>,
+<property>RGB_RED_MAP</property>, <property>RGB_GREEN_MAP</property>,
+<property>RGB_BLUE_MAP</property>, <property>RGB_DEFAULT_MAP</property>,
+ and <property>RGB_GRAY_MAP</property>.  Therefore a screen may
+have at most 6 standard colormap properties defined.
+    </para>
+
+    <para>
+A standard colormap is associated with a particular visual of the screen.  A
+screen may have multiple visuals defined, including visuals of the same
+class at different depths.  Note that a visual id might be repeated for more
+than one depth, so the visual id and the depth of a visual identify the
+visual.  The characteristics of the visual will determine which standard
+colormaps are meaningful under that visual, and will determine how the
+standard colormap is defined.  Because a standard colormap is associated
+with a specific visual, there must be a method of determining which visuals
+take precedence in defining standard colormaps.
+    </para>
+
+    <para>
+The method used here is: for the visual of greatest depth, define all
+standard colormaps meaningful to that visual class, according to this order
+of (descending) precedence:
+<symbol>DirectColor</symbol>;
+<symbol>PseudoColor</symbol>;
+<symbol>TrueColor</symbol>
+and
+<symbol>GrayScale</symbol>;
+and finally
+<symbol>StaticColor</symbol>
+and
+<symbol>StaticGray</symbol>.
+    </para>
+
+<para>This function allows success, on a per screen basis.  For example, if a map
+on screen 1 fails, the maps on screen 0, created earlier, will remain.
+However, none on screen 1 will remain.  If a map on screen 0 fails, none
+will remain.
+    </para>
+
+    <para>
+See
+<link linkend="XmuVisualStandardColormaps"><function>XmuVisualStandardColormaps</function></link>
+for which standard colormaps are meaningful under these classes of visuals.
+    </para>
+
+    <para id="XmuVisualStandardColormaps">
+      <indexterm zone="XmuVisualStandardColormaps">
+       <primary><function>XmuVisualStandardColormaps</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>Status <function>XmuVisualStandardColormaps</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>int <parameter>screen</parameter></paramdef>
+         <paramdef>VisualID <parameter>visualid</parameter></paramdef>
+         <paramdef>unsigned int <parameter>depth</parameter></paramdef>
+         <paramdef>Bool <parameter>replace</parameter></paramdef>
+         <paramdef>Bool <parameter>retain</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the connection to the X server
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>screen</parameter></term>
+         <listitem><para>
+specifies the screen of the display
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>visualid</parameter></term>
+         <listitem><para>
+specifies the visual type
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>depth</parameter></term>
+         <listitem><para>
+specifies the visual depth
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>replace</parameter></term>
+         <listitem><para>
+specifies whether or not to replace
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>retain</parameter></term>
+         <listitem><para>
+specifies whether or not to retain
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+To create all of the appropriate standard colormaps for a given visual on a
+given screen, use
+<function>XmuVisualStandardColormaps</function>.
+    </para>
+
+    <para>
+This function defines all appropriate standard colormap properties for the
+given visual.  If replace is
+<symbol>True</symbol>,
+any previous definition will be removed.
+If retain is
+<symbol>True</symbol>,
+new properties will be retained for the duration of the
+server session.  This function returns 0 on failure, non-zero on success.
+On failure, no new properties will be defined, but old ones may have been
+removed if replace was <symbol>True</symbol>.
+    </para>
+
+    <para>
+Not all standard colormaps are meaningful to all visual classes.  This
+routine will check and define the following properties for the following
+classes, provided that the size of the colormap is not too small.  For
+<symbol>DirectColor</symbol>
+and
+<symbol>PseudoColor</symbol>:
+<property>RGB_DEFAULT_MAP</property>, <property>RGB_BEST_MAP</property>,
+<property>RGB_RED_MAP</property>, <property>RGB_GREEN_MAP</property>,
+<property>RGB_BLUE_MAP</property>, and <property>RGB_GRAY_MAP</property>.
+For
+<symbol>TrueColor</symbol>
+and
+<symbol>StaticColor</symbol>:
+<property>RGB_BEST_MAP</property>.  For
+<symbol>GrayScale</symbol>
+and
+<symbol>StaticGray</symbol>:
+<property>RGB_GRAY_MAP</property>.
+    </para>
+
+    <para id="XmuLookupStandardColormap">
+      <indexterm zone="XmuLookupStandardColormap">
+       <primary><function>XmuLookupStandardColormap</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>Status <function>XmuLookupStandardColormap</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>int <parameter>screen</parameter></paramdef>
+         <paramdef>VisualID <parameter>visualid</parameter></paramdef>
+         <paramdef>unsigned int <parameter>depth</parameter></paramdef>
+         <paramdef>Atom <parameter>property</parameter></paramdef>
+         <paramdef>Bool <parameter>replace</parameter></paramdef>
+         <paramdef>Bool <parameter>retain</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the connection to the X server
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>screen</parameter></term>
+         <listitem><para>
+specifies the screen of the display
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>visualid</parameter></term>
+         <listitem><para>
+specifies the visual type
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>depth</parameter></term>
+         <listitem><para>
+specifies the visual depth
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>property</parameter></term>
+         <listitem><para>
+specifies the standard colormap property
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>replace</parameter></term>
+         <listitem><para>
+specifies whether or not to replace
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>retain</parameter></term>
+         <listitem><para>
+specifies whether or not to retain
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+To create a standard colormap if one does not currently exist, or replace
+the currently existing standard colormap, use
+<function>XmuLookupStandardColormap</function>.
+    </para>
+
+    <para>
+Given a screen, a visual, and a property, this function will determine the
+best allocation for the property under the specified visual, and determine
+the whether to create a new colormap or to use the default colormap of the
+screen.
+    </para>
+
+    <para>
+If replace is True, any previous definition of the property will be
+replaced.  If retain is True, the property and the colormap will be made
+permanent for the duration of the server session.  However, pre-existing
+property definitions which are not replaced cannot be made permanent by a
+call to this function; a request to retain resources pertains to newly
+created resources.
+    </para>
+
+    <para>
+This function returns 0 on failure, non-zero on success.  A request to
+create a standard colormap upon a visual which cannot support such a map is
+considered a failure.  An example of this would be requesting any standard
+colormap property on a monochrome visual, or, requesting an
+<property>RGB_BEST_MAP</property> on
+a display whose colormap size is 16.
+    </para>
+
+    <para id="XmuGetColormapAllocation">
+      <indexterm zone="XmuGetColormapAllocation">
+       <primary><function>XmuGetColormapAllocation</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>Status <function>XmuGetColormapAllocation</function></funcdef>
+         <paramdef>XVisualInfo *<parameter>vinfo</parameter></paramdef>
+         <paramdef>Atom <parameter>property</parameter></paramdef>
+         <paramdef>unsigned long *<parameter>red_max</parameter></paramdef>
+         <paramdef>unsigned long *<parameter>green_max</parameter></paramdef>
+         <paramdef>unsigned long *<parameter>blue_max</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>vinfo</parameter></term>
+         <listitem><para>
+specifies visual information for a chosen visual
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>property</parameter></term>
+         <listitem><para>
+specifies one of the standard colormap property names
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>red_max</parameter></term>
+         <listitem><para>
+returns maximum red value</para>
+         </listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>green_max</parameter></term>
+         <listitem><para>
+returns maximum green value
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>blue_max</parameter></term>
+         <listitem><para>
+returns maximum blue value
+         </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+To determine the best allocation of reds, greens, and blues in a standard
+colormap, use
+<function>XmuGetColormapAllocation</function>.
+    </para>
+
+    <para>
+<function>XmuGetColormapAllocation</function>
+returns 0 on failure, non-zero on success.  It is
+assumed that the visual is appropriate for the colormap property.
+    </para>
+
+    <para id="XmuStandardColormap">
+      <indexterm zone="XmuStandardColormap">
+       <primary><function>XmuStandardColormap</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>XStandardColormap *<function>XmuStandardColormap</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>int <parameter>screen</parameter></paramdef>
+         <paramdef>VisualID <parameter>visualid</parameter></paramdef>
+         <paramdef>unsigned int <parameter>depth</parameter></paramdef>
+         <paramdef>Atom <parameter>property</parameter></paramdef>
+         <paramdef>Colormap <parameter>cmap</parameter></paramdef>
+         <paramdef>unsigned long <parameter>red_max</parameter></paramdef>
+         <paramdef>unsigned long <parameter>green_max</parameter></paramdef>
+         <paramdef>unsigned long <parameter>blue_max</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the connection to the X server
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>screen</parameter></term>
+         <listitem><para>
+specifies the screen of the display
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>visualid</parameter></term>
+         <listitem><para>
+specifies the visual type
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>depth</parameter></term>
+         <listitem><para>
+specifies the visual depth
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>property</parameter></term>
+         <listitem><para>
+specifies the standard colormap property
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>cmap</parameter></term>
+         <listitem><para>
+specifies the colormap ID, or None
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>red_max</parameter></term>
+         <listitem><para>
+specifies the red allocation
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>green_max</parameter></term>
+         <listitem><para>
+specifies the green allocation
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>blue_max</parameter></term>
+         <listitem><para>
+specifies the blue allocation
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+To create any one standard colormap, use
+<function>XmuStandardColormap</function>.
+    </para>
+
+    <para>
+This function creates a standard colormap for the given screen, visualid,
+and visual depth, with the given red, green, and blue maximum values, with
+the given standard property name.  Upon success, it returns a pointer to an
+<function>XStandardColormap</function>
+structure which describes the newly created colormap.
+Upon failure, it returns <symbol>NULL</symbol>.
+If cmap is the default colormap of the screen, the standard colormap
+will be defined on the default colormap; otherwise a new colormap is created.
+    </para>
+
+    <para>
+Resources created by this function are not made permanent; that is the
+caller's responsibility.
+    </para>
+
+    <para id="XmuCreateColormap">
+      <indexterm zone="XmuCreateColormap">
+       <primary><function>XmuCreateColormap</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>Status <function>XmuCreateColormap</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>XStandardColormap *<parameter>colormap</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the connection under which the map is created
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>colormap</parameter></term>
+         <listitem><para>
+specifies the map to be created</para></listitem>
+       </varlistentry>
+      </variablelist>
+
+To create any one colormap which is described by an
+<structname>XStandardColormap</structname>
+structure, use
+<function>XmuCreateColormap</function>.
+    </para>
+
+    <para>
+This function returns 0 on failure, and non-zero on success.  The base_pixel
+of the colormap is set on success.  Resources created by this function are
+not made permanent.  No argument error checking is provided; use at your own
+risk.
+    </para>
+
+    <para>
+All colormaps are created with read-only allocations, with the exception of
+read-only allocations of colors which fail
+to return the expected pixel value, and these are individually defined as
+read/write allocations.  This is done so that all the cells defined in the
+colormap are contiguous, for use in image processing.  This typically
+happens with White and Black in the default map.
+    </para>
+
+    <para>
+Colormaps of static visuals are considered to be successfully created if the
+map of the static visual matches the definition given in the standard
+colormap structure.
+    </para>
+
+    <para id="XmuDeleteStandardColormap">
+      <indexterm zone="XmuDeleteStandardColormap">
+       <primary><function>XmuDeleteStandardColormap</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XmuDeleteStandardColormap</function></funcdef>
+         <paramdef>Display *<parameter>dpy</parameter></paramdef>
+         <paramdef>Screen *<parameter>screen</parameter></paramdef>
+         <paramdef>Atom <parameter>property</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>dpy</parameter></term>
+         <listitem><para>
+specifies the connection to the X server
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>screen</parameter></term>
+         <listitem><para>
+specifies the screen of the display
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>property</parameter></term>
+         <listitem><para>
+specifies the standard colormap property
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+To remove any standard colormap property, use
+<function>XmuDeleteStandardColormap</function>.
+This function will remove the specified property from the specified screen,
+releasing any resources used by the colormap(s) of the property, if
+possible.
+    </para>
+
+  </sect1>
+
+  <sect1 id='Widget_Description_Functions'>
+<title>Widget Description Functions</title>
+
+    <para>
+The functions defined in this section are for building a description of
+the structure of and resources associated with a hierarchy of widget classes.
+This package is typically used by applications that wish to manipulate the
+widget set itself.
+    </para>
+
+    <para>
+The definitions needed to use these interfaces are in the header file
+&lt;<filename class='headerfile'>X11/Xmu/WidgetNode.h</filename>&gt;
+<indexterm>
+<primary><filename class='headerfile'>X11/Xmu/WidgetNode.h</filename></primary>
+</indexterm>.
+To call these functions, you need to link against the libXmu library.
+The following function must be called before any of the others described
+below:
+
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XmuWnInitializeNodes</function></funcdef>
+         <paramdef>XmuWidgetNode *<parameter>node_array</parameter></paramdef>
+         <paramdef>int <parameter>num_nodes</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>node_array</parameter></term>
+         <listitem><para>
+specifies a list of widget classes, in alphabetical order
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>num_nodes</parameter></term>
+         <listitem><para>
+specifies the number of widget classes in the node array
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+    </para>
+
+    <para>
+To determine the resources provided by a widget class or classes, use
+
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>void <function>XmuWnFetchResources</function></funcdef>
+         <paramdef>XmuWidgetNode *<parameter>node</parameter></paramdef>
+         <paramdef>Widget <parameter>toplevel</parameter></paramdef>
+         <paramdef>XmuWidgetNode *<parameter>top_node</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>node</parameter></term>
+         <listitem><para>
+specifies the widget class for which resources should be obtained.
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>toplevel</parameter></term>
+         <listitem><para>
+specifies the widget that should be used for creating an instance of
+<parameter>node</parameter>
+from which resources are extracted.  This is typically the value returned
+by <olink targetdoc='libXaw' targetptr='XtAppInitialize'><function>XtAppInitialize</function></olink>.
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>top_node</parameter></term>
+         <listitem><para>
+specifies the ancestor of <parameter>node</parameter> that should be
+treated as the root
+of the widget inheritance tree (used in determining which ancestor contributed
+which resources).
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+    </para>
+
+    <para>
+Each widget class inherits the resources of its parent.  To count the number
+of resources contributed by a particular widget class, use:
+
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>int <function>XmuWnCountOwnedResources</function></funcdef>
+         <paramdef>XmuWidgetNode *<parameter>node</parameter></paramdef>
+         <paramdef>XmuWidgetNode *<parameter>owner_node</parameter></paramdef>
+         <paramdef>Bool <parameter>constraints</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>node</parameter></term>
+         <listitem><para>
+specifies the widget class whose resources are being examined.
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>owner_node</parameter></term>
+         <listitem><para>
+specifies the widget class of the ancestor of <parameter>node</parameter>
+whose contributions
+are being counted.
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>constraints</parameter></term>
+         <listitem><para>
+specifies whether or not to count constraint resources or normal resources.
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This routine returns the number of resources contributed (or
+&ldquo;owned&rdquo;) by
+the specified widget class.
+           </para>
+
+    <para id="XmuWnNameToNode">
+      <indexterm zone="XmuWnNameToNode">
+       <primary><function>XmuWnNameToNode</function></primary>
+      </indexterm>
+      <funcsynopsis>
+       <funcprototype>
+         <funcdef>XmuWidgetNode *<function>XmuWnNameToNode</function></funcdef>
+         <paramdef>XmuWidgetNode *<parameter>node_list</parameter></paramdef>
+         <paramdef>int <parameter>num_nodes</parameter></paramdef>
+         <paramdef>char *<parameter>name</parameter></paramdef>
+       </funcprototype>
+      </funcsynopsis>
+      <variablelist>
+       <varlistentry>
+         <term><parameter>node_list</parameter></term>
+         <listitem><para>
+specifies a list of widget nodes
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>num_nodes</parameter></term>
+         <listitem><para>
+specifies the number of nodes in the list
+           </para></listitem>
+       </varlistentry>
+       <varlistentry>
+         <term><parameter>name</parameter></term>
+         <listitem><para>
+specifies the name of the widget class in the node list to search for
+           </para></listitem>
+       </varlistentry>
+      </variablelist>
+
+This function returns the WidgetNode in the list that matches the given
+widget name or widget class name.  If no match is found, it returns
+<symbol>NULL</symbol>.
+    </para>
+
+  </sect1>
+
+  <sect1 id='Participation_in_the_Editres_Protocol'>
+<title>Participation in the Editres Protocol</title>
+
+    <para>
+      <indexterm>
+       <primary>editres</primary>
+      </indexterm>
+To participate in the editres protocol, applications which are not based
+on the Athena widget set should include the header file
+&lt;<filename class='headerfile'>X11/Xmu/Editres.h</filename>&gt;
+<indexterm>
+<primary><filename class='headerfile'>X11/Xmu/Editres.h</filename></primary>
+</indexterm>
+and link against the libXmu library.
+    </para>
+
+    <para>
+To participate in the editres protocol, Xt applications which do not rely
+on the Athena widget set should register the editres protocol handler on
+each shell widget in the application, specifying an event mask of 0,
+nonmaskable events, and client data as <symbol>NULL</symbol>:
+
+    <programlisting>
+XtAddEventHandler(shell, (EventMask) 0, True, _XEditResCheckMessages, NULL);
+    </programlisting>
+    </para>
+  </sect1>
+
+  <index />
+</article>
diff --git a/doc/xlogo.svg b/doc/xlogo.svg
new file mode 100644 (file)
index 0000000..9c1168b
--- /dev/null
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   id="svg2"
+   sodipodi:version="0.32"
+   inkscape:version="0.46+devel"
+   width="55"
+   height="55"
+   xml:space="preserve"
+   sodipodi:docname="xlogo.svg"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
+   version="1.0">
+  <title>X Window System Logo</title>
+  <metadata><rdf:RDF><cc:Work rdf:about="">
+       <dc:format>image/svg+xml</dc:format>
+       <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+       <dc:title>X Window System Logo</dc:title>
+       <dc:contributor><cc:Agent><dc:title>Designed by Danny Cheng
+Converted to EPS by Stephen Gildea
+Converted from EPS to SVG by Inkscape</dc:title></cc:Agent></dc:contributor>
+       <cc:license rdf:resource="" />
+      </cc:Work></rdf:RDF></metadata>
+  <g transform="matrix(0.1,0,0,-0.1,0,50)">
+    <path
+      d="M 440,440 350,440 0,0 90,0"
+      style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+    <path
+      d="m 40,0 180,220 50,0 L 90,0 40,0 z m 360,440 -180,-220 -50,0 180,220"
+      style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+    <path
+      d="M 0,440 110,440 440,0 330,0"
+      style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+    <path
+      d="M 400,440 390,440 40,0 50,0"
+      style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+  </g>
+</svg>
diff --git a/docbook.am b/docbook.am
new file mode 100644 (file)
index 0000000..bba4d54
--- /dev/null
@@ -0,0 +1,105 @@
+#
+# Generate output formats for a single DocBook/XML with/without chapters
+#
+# Variables set by the calling Makefile:
+# shelfdir: the location where the docs/specs are installed. Typically $(docdir)
+# docbook:  the main DocBook/XML file, no chapters, appendix or image files
+# chapters: all files pulled in by an XInclude statement and images.
+#
+
+#
+# This makefile is intended for Users Documentation and Functional Specifications.
+# Do not use for Developer Documentation which is not installed and does not require olink.
+# Refer to http://www.x.org/releases/X11R7.6/doc/xorg-docs/ReleaseNotes.html#id2584393
+# for an explanation on documents classification.
+#
+
+# DocBook/XML generated output formats to be installed
+shelf_DATA =
+
+# DocBook/XML file with chapters, appendix and images it includes
+dist_shelf_DATA = $(docbook) $(chapters)
+
+if HAVE_XMLTO
+if HAVE_STYLESHEETS
+
+XMLTO_SEARCHPATH_FLAGS =                               \
+       --searchpath "$(XORG_SGML_PATH)/X11"            \
+       --searchpath "$(abs_top_builddir)"
+XMLTO_HTML_OLINK_FLAGS = \
+       --stringparam target.database.document=$(XORG_SGML_PATH)/X11/dbs/masterdb.html.xml \
+       --stringparam current.docid="$(<:.xml=)"
+XMLTO_HTML_STYLESHEET_FLAGS = -x $(STYLESHEET_SRCDIR)/xorg-xhtml.xsl
+XMLTO_HTML_FLAGS =                                     \
+       $(XMLTO_SEARCHPATH_FLAGS)                       \
+       $(XMLTO_HTML_STYLESHEET_FLAGS)                  \
+       $(XMLTO_HTML_OLINK_FLAGS)
+
+shelf_DATA += $(docbook:.xml=.html)
+%.html: %.xml $(chapters)
+       $(AM_V_GEN)$(XMLTO) $(XMLTO_HTML_FLAGS) xhtml-nochunks $<
+
+if HAVE_XMLTO_TEXT
+
+shelf_DATA += $(docbook:.xml=.txt)
+%.txt: %.xml $(chapters)
+       $(AM_V_GEN)$(XMLTO) $(XMLTO_HTML_FLAGS) txt $<
+endif HAVE_XMLTO_TEXT
+
+if HAVE_FOP
+XMLTO_FO_IMAGEPATH_FLAGS = --stringparam img.src.path=$(abs_builddir)/
+XMLTO_PDF_OLINK_FLAGS = \
+       --stringparam target.database.document=$(XORG_SGML_PATH)/X11/dbs/masterdb.pdf.xml \
+       --stringparam current.docid="$(<:.xml=)"
+XMLTO_FO_STYLESHEET_FLAGS = -x $(STYLESHEET_SRCDIR)/xorg-fo.xsl
+
+XMLTO_FO_FLAGS =                                       \
+       $(XMLTO_SEARCHPATH_FLAGS)                       \
+       $(XMLTO_FO_STYLESHEET_FLAGS)                    \
+       $(XMLTO_FO_IMAGEPATH_FLAGS)                     \
+       $(XMLTO_PDF_OLINK_FLAGS)
+
+shelf_DATA += $(docbook:.xml=.pdf)
+%.pdf: %.xml $(chapters)
+       $(AM_V_GEN)$(XMLTO) $(XMLTO_FO_FLAGS) --with-fop pdf $<
+
+shelf_DATA += $(docbook:.xml=.ps)
+%.ps: %.xml $(chapters)
+       $(AM_V_GEN)$(XMLTO) $(XMLTO_FO_FLAGS) --with-fop ps $<
+endif HAVE_FOP
+
+# Generate documents cross-reference target databases
+if HAVE_XSLTPROC
+
+XSLT_SEARCHPATH_FLAGS =                                \
+       --path "$(XORG_SGML_PATH)/X11"                  \
+       --path "$(abs_top_builddir)"
+XSLT_OLINK_FLAGS =                                     \
+       --stringparam targets.filename "$@"             \
+       --stringparam collect.xref.targets "only"       \
+       --stringparam olink.base.uri "$(@:.db=)"
+
+XSLT_HTML_FLAGS =                                      \
+       $(XSLT_SEARCHPATH_FLAGS)                        \
+       $(XSLT_OLINK_FLAGS)                             \
+       --nonet --xinclude                              \
+       $(STYLESHEET_SRCDIR)/xorg-xhtml.xsl
+XSLT_PDF_FLAGS =                                       \
+       $(XSLT_SEARCHPATH_FLAGS)                        \
+       $(XSLT_OLINK_FLAGS)                             \
+       --nonet --xinclude                              \
+       $(STYLESHEET_SRCDIR)/xorg-fo.xsl
+
+shelf_DATA += $(docbook:.xml=.html.db)
+%.html.db: %.xml  $(chapters)
+       $(AM_V_GEN)$(XSLTPROC) $(XSLT_HTML_FLAGS) $<
+
+shelf_DATA += $(docbook:.xml=.pdf.db)
+%.pdf.db: %.xml $(chapters)
+       $(AM_V_GEN)$(XSLTPROC) $(XSLT_PDF_FLAGS) $<
+
+endif HAVE_XSLTPROC
+endif HAVE_STYLESHEETS
+endif HAVE_XMLTO
+
+CLEANFILES = $(shelf_DATA)
diff --git a/include/Makefile.am b/include/Makefile.am
new file mode 100644 (file)
index 0000000..413dd5b
--- /dev/null
@@ -0,0 +1,25 @@
+xmuincludedir=${includedir}/X11/Xmu
+xmuinclude_HEADERS = \
+       X11/Xmu/Xmu.h \
+       X11/Xmu/Atoms.h \
+       X11/Xmu/CharSet.h \
+       X11/Xmu/CloseHook.h \
+       X11/Xmu/Converters.h \
+       X11/Xmu/CurUtil.h \
+       X11/Xmu/CvtCache.h \
+       X11/Xmu/DisplayQue.h \
+       X11/Xmu/Drawing.h \
+       X11/Xmu/Editres.h \
+       X11/Xmu/EditresP.h \
+       X11/Xmu/Error.h \
+       X11/Xmu/ExtAgent.h \
+       X11/Xmu/Initer.h \
+       X11/Xmu/Lookup.h \
+       X11/Xmu/Misc.h \
+       X11/Xmu/StdSel.h \
+       X11/Xmu/StdCmap.h \
+       X11/Xmu/SysUtil.h \
+       X11/Xmu/WidgetNode.h \
+       X11/Xmu/WinUtil.h \
+       X11/Xmu/Xct.h \
+       X11/Xmu/WhitePoint.h
diff --git a/include/X11/Xmu/Atoms.h b/include/X11/Xmu/Atoms.h
new file mode 100644 (file)
index 0000000..fc59b31
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_ATOMS_H_
+#define _XMU_ATOMS_H_
+
+#include <X11/Intrinsic.h>
+#include <X11/Xfuncproto.h>
+
+typedef struct _AtomRec *AtomPtr;
+
+extern AtomPtr
+    _XA_ATOM_PAIR,
+    _XA_CHARACTER_POSITION,
+    _XA_CLASS,
+    _XA_CLIENT_WINDOW,
+    _XA_CLIPBOARD,
+    _XA_COMPOUND_TEXT,
+    _XA_DECNET_ADDRESS,
+    _XA_DELETE,
+    _XA_FILENAME,
+    _XA_HOSTNAME,
+    _XA_IP_ADDRESS,
+    _XA_LENGTH,
+    _XA_LIST_LENGTH,
+    _XA_NAME,
+    _XA_NET_ADDRESS,
+    _XA_NULL,
+    _XA_OWNER_OS,
+    _XA_SPAN,
+    _XA_TARGETS,
+    _XA_TEXT,
+    _XA_TIMESTAMP,
+    _XA_USER,
+    _XA_UTF8_STRING;
+
+#define XA_ATOM_PAIR(d)                XmuInternAtom(d, _XA_ATOM_PAIR)
+#define XA_CHARACTER_POSITION(d) XmuInternAtom(d, _XA_CHARACTER_POSITION)
+#define XA_CLASS(d)            XmuInternAtom(d, _XA_CLASS)
+#define XA_CLIENT_WINDOW(d)    XmuInternAtom(d, _XA_CLIENT_WINDOW)
+#define XA_CLIPBOARD(d)                XmuInternAtom(d, _XA_CLIPBOARD)
+#define XA_COMPOUND_TEXT(d)    XmuInternAtom(d, _XA_COMPOUND_TEXT)
+#define XA_DECNET_ADDRESS(d)   XmuInternAtom(d, _XA_DECNET_ADDRESS)
+#define XA_DELETE(d)           XmuInternAtom(d, _XA_DELETE)
+#define XA_FILENAME(d)         XmuInternAtom(d, _XA_FILENAME)
+#define XA_HOSTNAME(d)         XmuInternAtom(d, _XA_HOSTNAME)
+#define XA_IP_ADDRESS(d)       XmuInternAtom(d, _XA_IP_ADDRESS)
+#define XA_LENGTH(d)           XmuInternAtom(d, _XA_LENGTH)
+#define XA_LIST_LENGTH(d)      XmuInternAtom(d, _XA_LIST_LENGTH)
+#define XA_NAME(d)             XmuInternAtom(d, _XA_NAME)
+#define XA_NET_ADDRESS(d)      XmuInternAtom(d, _XA_NET_ADDRESS)
+#define XA_NULL(d)             XmuInternAtom(d, _XA_NULL)
+#define XA_OWNER_OS(d)         XmuInternAtom(d, _XA_OWNER_OS)
+#define XA_SPAN(d)             XmuInternAtom(d, _XA_SPAN)
+#define XA_TARGETS(d)          XmuInternAtom(d, _XA_TARGETS)
+#define XA_TEXT(d)             XmuInternAtom(d, _XA_TEXT)
+#define XA_TIMESTAMP(d)                XmuInternAtom(d, _XA_TIMESTAMP)
+#define XA_USER(d)             XmuInternAtom(d, _XA_USER)
+#define XA_UTF8_STRING(d)      XmuInternAtom(d, _XA_UTF8_STRING)
+
+_XFUNCPROTOBEGIN
+
+char *XmuGetAtomName
+(
+ Display       *dpy,
+ Atom          atom
+ );
+
+Atom XmuInternAtom
+(
+ Display       *dpy,
+ AtomPtr       atom_ptr
+ );
+
+void XmuInternStrings
+(
+ Display       *dpy,
+ String                *names,
+ Cardinal      count,
+ Atom          *atoms_return
+);
+
+AtomPtr XmuMakeAtom
+(
+ _Xconst char  *name
+ );
+
+char *XmuNameOfAtom
+(
+ AtomPtr       atom_ptr
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_ATOMS_H_ */
diff --git a/include/X11/Xmu/CharSet.h b/include/X11/Xmu/CharSet.h
new file mode 100644 (file)
index 0000000..9d9e53a
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_CHARSET_H_
+#define _XMU_CHARSET_H_
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+void XmuCopyISOLatin1Lowered
+(
+ char          *dst_return,
+ _Xconst char  *src
+ );
+
+void XmuCopyISOLatin1Uppered
+(
+ char          *dst_return,
+ _Xconst char  *src
+ );
+
+int XmuCompareISOLatin1
+(
+ _Xconst char  *first,
+ _Xconst char  *second
+ );
+
+void XmuNCopyISOLatin1Lowered
+(
+ char          *dst_return,
+ _Xconst char  *src,
+ int            size
+ );
+
+void XmuNCopyISOLatin1Uppered
+(
+ char          *dst_return,
+ _Xconst char  *src,
+ int           size
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_CHARSET_H_ */
diff --git a/include/X11/Xmu/CloseHook.h b/include/X11/Xmu/CloseHook.h
new file mode 100644 (file)
index 0000000..1b895a9
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_CLOSEHOOK_H_
+#define _XMU_CLOSEHOOK_H_
+
+#include <X11/Xlib.h>
+#include <X11/Xfuncproto.h>
+#include <X11/Xlibint.h>
+
+typedef XPointer CloseHook;
+
+typedef int (*XmuCloseHookProc)(Display *dpy, XPointer data);
+
+_XFUNCPROTOBEGIN
+
+CloseHook XmuAddCloseDisplayHook
+(
+ Display               *dpy,
+ XmuCloseHookProc      proc,
+ XPointer              arg
+ );
+
+Bool XmuLookupCloseDisplayHook
+(
+ Display               *dpy,
+ CloseHook             handle,
+ XmuCloseHookProc      proc,
+ XPointer              arg
+ );
+
+Bool XmuRemoveCloseDisplayHook
+(
+ Display               *dpy,
+ CloseHook             handle,
+ XmuCloseHookProc      proc,
+ XPointer              arg
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_CLOSEHOOK_H_ */
diff --git a/include/X11/Xmu/Converters.h b/include/X11/Xmu/Converters.h
new file mode 100644 (file)
index 0000000..19ece56
--- /dev/null
@@ -0,0 +1,277 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_STRCONVERT_H_
+#define _XMU_STRCONVERT_H_
+
+#include <X11/Intrinsic.h>
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+void XmuCvtFunctionToCallback
+(
+ XrmValue              *args,
+ Cardinal              *num_args,
+ XrmValuePtr           fromVal,
+ XrmValuePtr           toVal
+ );
+
+#define XtNbackingStore "backingStore"
+#define XtCBackingStore "BackingStore"
+#define XtRBackingStore "BackingStore"
+#define XtEnotUseful "notUseful"
+#define XtEwhenMapped "whenMapped"
+#define XtEalways "always"
+#define XtEdefault "default"
+void XmuCvtStringToBackingStore
+(
+ XrmValue              *args,
+ Cardinal              *num_args,
+ XrmValuePtr           fromVal,
+ XrmValuePtr           toVal
+ );
+
+Boolean XmuCvtBackingStoreToString
+(
+ Display               *dpy,
+ XrmValue              *args,
+ Cardinal              *num_args,
+ XrmValuePtr           fromVal,
+ XrmValuePtr           toVal,
+ XtPointer             *converter_data
+ );
+
+void XmuCvtStringToCursor
+(
+ XrmValue              *args,
+ Cardinal              *num_args,
+ XrmValuePtr           fromVal,
+ XrmValuePtr           toVal
+ );
+
+#define XtRColorCursor "ColorCursor"
+#define XtNpointerColor "pointerColor"
+#define XtNpointerColorBackground "pointerColorBackground"
+Boolean XmuCvtStringToColorCursor
+(
+ Display               *dpy,
+ XrmValue              *args,
+ Cardinal              *num_args,
+ XrmValuePtr           fromVal,
+ XrmValuePtr           toVal,
+ XtPointer             *converter_data
+ );
+
+typedef int XtGravity;
+
+#ifndef XtRGravity
+#define XtRGravity "Gravity"
+#endif
+#define XtEForget "forget"
+#define XtENorthWest "northwest"
+#define XtENorth "north"
+#define XtENorthEast "northeast"
+#define XtEWest "west"
+#define XtECenter "center"
+#define XtEEast "east"
+#define XtESouthWest "southwest"
+#define XtESouth "south"
+#define XtESouthEast "southeast"
+#define XtEStatic "static"
+#define XtEUnmap "unmap"
+void XmuCvtStringToGravity
+(
+ XrmValue              *args,
+ Cardinal              *num_args,
+ XrmValuePtr           fromVal,
+ XrmValuePtr           toVal
+ );
+
+Boolean XmuCvtGravityToString
+(
+ Display               *dpy,
+ XrmValue              *args,
+ Cardinal              *num_args,
+ XrmValuePtr           fromVal,
+ XrmValuePtr           toVal,
+ XtPointer             *converter_data
+ );
+
+typedef enum {
+    XtJustifyLeft,       /* justify text to left side of button   */
+    XtJustifyCenter,     /* justify text in center of button      */
+    XtJustifyRight       /* justify text to right side of button  */
+} XtJustify;
+#ifndef XtRJustify
+#define XtRJustify "Justify"
+#endif
+#define XtEleft "left"
+#define XtEcenter "center"
+#define XtEright "right"
+#define XtEtop "top"
+#define XtEbottom "bottom"
+void XmuCvtStringToJustify
+(
+ XrmValue              *args,
+ Cardinal              *num_args,
+ XrmValuePtr           fromVal,
+ XrmValuePtr           toVal
+ );
+
+Boolean XmuCvtJustifyToString
+(
+ Display               *dpy,
+ XrmValue              *args,
+ Cardinal              *num_args,
+ XrmValuePtr           fromVal,
+ XrmValuePtr           toVal,
+ XtPointer             *converter_data
+ );
+
+#define XtRLong "Long"
+void XmuCvtStringToLong
+(
+ XrmValue              *args,
+ Cardinal              *num_args,
+ XrmValuePtr           fromVal,
+ XrmValuePtr           toVal
+ );
+Boolean XmuCvtLongToString
+(
+ Display               *dpy,
+ XrmValue              *args,
+ Cardinal              *num_args,
+ XrmValuePtr           fromVal,
+ XrmValuePtr           toVal,
+ XtPointer             *converter_data
+ );
+
+typedef enum {
+  XtorientHorizontal,
+  XtorientVertical
+} XtOrientation;
+void XmuCvtStringToOrientation
+(
+ XrmValue              *args,
+ Cardinal              *num_args,
+ XrmValuePtr           fromVal,
+ XrmValuePtr           toVal
+ );
+
+Boolean XmuCvtOrientationToString
+(
+ Display               *dpy,
+ XrmValue              *args,
+ Cardinal              *num_args,
+ XrmValuePtr           fromVal,
+ XrmValuePtr           toVal,
+ XtPointer             *converter_data
+ );
+
+void XmuCvtStringToBitmap
+(
+ XrmValue              *args,
+ Cardinal              *num_args,
+ XrmValuePtr           fromVal,
+ XrmValuePtr           toVal
+ );
+
+#define XtRShapeStyle "ShapeStyle"
+#define XtERectangle "Rectangle"
+#define XtEOval "Oval"
+#define XtEEllipse "Ellipse"
+#define XtERoundedRectangle "RoundedRectangle"
+
+#define XmuShapeRectangle 1
+#define XmuShapeOval 2
+#define XmuShapeEllipse 3
+#define XmuShapeRoundedRectangle 4
+
+Boolean XmuCvtStringToShapeStyle
+(
+ Display               *dpy,
+ XrmValue              *args,
+ Cardinal              *num_args,
+ XrmValuePtr           fromVal,
+ XrmValuePtr           toVal,
+ XtPointer             *converter_data
+ );
+
+Boolean XmuCvtShapeStyleToString
+(
+ Display               *dpy,
+ XrmValue              *args,
+ Cardinal              *num_args,
+ XrmValuePtr           fromVal,
+ XrmValuePtr           toVal,
+ XtPointer             *converter_data
+ );
+
+Boolean XmuReshapeWidget
+(
+ Widget                        w,
+ int                   shape_style,
+ int                   corner_width,
+ int                   corner_height
+ );
+
+void XmuCvtStringToWidget
+(
+ XrmValue              *args,
+ Cardinal              *num_args,
+ XrmValuePtr           fromVal,
+ XrmValuePtr           toVal
+ );
+
+Boolean XmuNewCvtStringToWidget
+(
+ Display               *display,
+ XrmValue              *args,
+ Cardinal              *num_args,
+ XrmValue              *fromVal,
+ XrmValue              *toVal,
+ XtPointer             *converter_data
+ );
+
+Boolean XmuCvtWidgetToString
+(
+ Display               *dpy,
+ XrmValue              *args,
+ Cardinal              *num_args,
+ XrmValue              *fromVal,
+ XrmValue              *toVal,
+ XtPointer             *converter_data
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_STRCONVERT_H_ */
diff --git a/include/X11/Xmu/CurUtil.h b/include/X11/Xmu/CurUtil.h
new file mode 100644 (file)
index 0000000..ab577a2
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_CURUTIL_H_
+#define _XMU_CURUTIL_H_
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+int XmuCursorNameToIndex
+(
+ _Xconst char  *name
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_CURUTIL_H_ */
diff --git a/include/X11/Xmu/CvtCache.h b/include/X11/Xmu/CvtCache.h
new file mode 100644 (file)
index 0000000..714a498
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ *                            Public Interfaces
+ *
+ * XmuCvtCache *XmuCvtCacheLookupDisplay (dpy)
+ *     Display *dpy;
+ */
+
+#ifndef _XMU_CVTCACHE_H_
+#define _XMU_CVTCACHE_H_
+
+#include <X11/Xmu/DisplayQue.h>
+#include <X11/Xfuncproto.h>
+
+typedef struct _XmuCvtCache {
+    struct {
+       char **bitmapFilePath;
+    } string_to_bitmap;
+    /* add other per-display data that needs to be cached */
+} XmuCvtCache;
+
+_XFUNCPROTOBEGIN
+
+XmuCvtCache *_XmuCCLookupDisplay
+(
+ Display       *dpy
+ );
+
+extern void _XmuStringToBitmapInitCache(XmuCvtCache *c);
+extern void _XmuStringToBitmapFreeCache(XmuCvtCache *c);
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_CVTCACHE_H_ */
diff --git a/include/X11/Xmu/DisplayQue.h b/include/X11/Xmu/DisplayQue.h
new file mode 100644 (file)
index 0000000..ffc82a2
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+
+Copyright 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _XMU_DISPLAYQUE_H_
+#define _XMU_DISPLAYQUE_H_
+
+#include <X11/Xmu/CloseHook.h>
+#include <X11/Xfuncproto.h>
+
+/*
+ *                           Public Entry Points
+ *
+ *
+ * XmuDisplayQueue *XmuDQCreate (closefunc, freefunc, data)
+ *     XmuCloseDisplayQueueProc closefunc;
+ *     XmuFreeDisplayQueueProc freefunc;
+ *     XPointer data;
+ *
+ *         Creates and returns a queue into which displays may be placed.  When
+ *         the display is closed, the closefunc (if non-NULL) is upcalled with
+ *         as follows:
+ *
+ *                 (*closefunc) (queue, entry)
+ *
+ *         The freeproc, if non-NULL, is called whenever the last display is
+ *         closed, notifying the creator that display queue may be released
+ *         using XmuDQDestroy.
+ *
+ *
+ * Bool XmuDQDestroy (q, docallbacks)
+ *     XmuDisplayQueue *q;
+ *     Bool docallbacks;
+ *
+ *         Releases all memory for the indicated display queue.  If docallbacks
+ *         is true, then the closefunc (if non-NULL) is called for each
+ *         display.
+ *
+ *
+ * XmuDisplayQueueEntry *XmuDQLookupDisplay (q, dpy)
+ *     XmuDisplayQueue *q;
+ *     Display *dpy;
+ *
+ *         Returns the queue entry for the specified display or NULL if the
+ *         display is not in the queue.
+ *
+ *
+ * XmuDisplayQueueEntry *XmuDQAddDisplay (q, dpy, data)
+ *     XmuDisplayQueue *q;
+ *     Display *dpy;
+ *     XPointer data;
+ *
+ *         Adds the indicated display to the end of the queue or NULL if it
+ *         is unable to allocate memory.  The data field may be used by the
+ *         caller to attach arbitrary data to this display in this queue.  The
+ *         caller should use XmuDQLookupDisplay to make sure that the display
+ *         hasn't already been added.
+ *
+ *
+ * Bool XmuDQRemoveDisplay (q, dpy)
+ *     XmuDisplayQueue *q;
+ *     Display *dpy;
+ *
+ *         Removes the specified display from the given queue.  If the
+ *         indicated display is not found on this queue, False is returned,
+ *         otherwise True is returned.
+ */
+
+typedef struct _XmuDisplayQueue XmuDisplayQueue;
+typedef struct _XmuDisplayQueueEntry XmuDisplayQueueEntry;
+
+typedef int (*XmuCloseDisplayQueueProc)(XmuDisplayQueue *queue,
+                                       XmuDisplayQueueEntry *entry);
+
+typedef int (*XmuFreeDisplayQueueProc)(XmuDisplayQueue *queue);
+
+struct _XmuDisplayQueueEntry {
+    struct _XmuDisplayQueueEntry *prev, *next;
+    Display *display;
+    CloseHook closehook;
+    XPointer data;
+};
+
+struct _XmuDisplayQueue {
+    int nentries;
+    XmuDisplayQueueEntry *head, *tail;
+    XmuCloseDisplayQueueProc closefunc;
+    XmuFreeDisplayQueueProc freefunc;
+    XPointer data;
+};
+
+_XFUNCPROTOBEGIN
+
+XmuDisplayQueue *XmuDQCreate
+(
+ XmuCloseDisplayQueueProc      closefunc,
+ XmuFreeDisplayQueueProc       freefunc,
+ XPointer                      data
+ );
+
+Bool XmuDQDestroy
+(
+ XmuDisplayQueue               *q,
+ Bool                          docallbacks
+ );
+
+XmuDisplayQueueEntry *XmuDQLookupDisplay
+(
+ XmuDisplayQueue               *q,
+ Display                       *dpy
+ );
+
+XmuDisplayQueueEntry *XmuDQAddDisplay
+(
+ XmuDisplayQueue               *q,
+ Display                       *dpy,
+ XPointer                      data
+ );
+
+Bool XmuDQRemoveDisplay
+(
+ XmuDisplayQueue               *q,
+ Display                       *dpy
+ );
+
+_XFUNCPROTOEND
+
+#define XmuDQNDisplays(q) ((q)->nentries)
+
+#endif /* _XMU_DISPLAYQUE_H_ */
diff --git a/include/X11/Xmu/Drawing.h b/include/X11/Xmu/Drawing.h
new file mode 100644 (file)
index 0000000..717292a
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_DRAWING_H_
+#define _XMU_DRAWING_H_
+
+#include <X11/Xlib.h>
+#include <X11/Xfuncproto.h>
+
+#include <stdio.h>
+#if ! defined(_XtIntrinsic_h) && ! defined(PIXEL_ALREADY_TYPEDEFED)
+typedef unsigned long Pixel;
+#endif
+
+_XFUNCPROTOBEGIN
+
+void XmuDrawRoundedRectangle
+(
+ Display               *dpy,
+ Drawable              draw,
+ GC                    gc,
+ int                   x,
+ int                   y,
+ int                   w,
+ int                   h,
+ int                   ew,
+ int                   eh
+ );
+
+void XmuFillRoundedRectangle
+(
+ Display               *dpy,
+ Drawable              draw,
+ GC                    gc,
+ int                   x,
+ int                   y,
+ int                   w,
+ int                   h,
+ int                   ew,
+ int                   eh
+ );
+
+void XmuDrawLogo
+(
+ Display               *dpy,
+ Drawable              drawable,
+ GC                    gcFore,
+ GC                    gcBack,
+ int                   x,
+ int                   y,
+ unsigned int          width,
+ unsigned int          height
+ );
+
+Pixmap XmuCreatePixmapFromBitmap
+(
+ Display               *dpy,
+ Drawable              d,
+ Pixmap                bitmap,
+ unsigned int          width,
+ unsigned int          height,
+ unsigned int          depth,
+ unsigned long         fore,
+ unsigned long         back
+);
+
+Pixmap XmuCreateStippledPixmap
+(
+ Screen                        *screen,
+ Pixel                 fore,
+ Pixel                 back,
+ unsigned int          depth
+ );
+
+void XmuReleaseStippledPixmap
+(
+ Screen                        *screen,
+ Pixmap                pixmap
+ );
+
+Pixmap XmuLocateBitmapFile
+(
+ Screen                        *screen,
+ _Xconst char          *name,
+ char                  *srcname_return,
+ int                   srcnamelen,
+ int                   *width_return,
+ int                   *height_return,
+ int                   *xhot_return,
+ int                   *yhot_return
+ );
+
+Pixmap XmuLocatePixmapFile
+(
+ Screen                        *screen,
+ _Xconst char          *name,
+ unsigned long         fore,
+ unsigned long         back,
+ unsigned int          depth,
+ char                  *srcname_return,
+ int                   srcnamelen,
+ int                   *width_return,
+ int                   *height_return,
+ int                   *xhot_return,
+ int                   *yhot_return
+ );
+
+int XmuReadBitmapData
+(
+ FILE                  *fstream,
+ unsigned int          *width_return,
+ unsigned int          *height_return,
+ unsigned char         **datap_return,
+ int                   *xhot_return,
+ int                   *yhot_return
+);
+
+int XmuReadBitmapDataFromFile
+(
+ _Xconst char          *filename,
+ unsigned int          *width_return,
+ unsigned int          *height_return,
+ unsigned char         **datap_return,
+ int                   *xhot_return,
+ int                   *yhot_return
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_DRAWING_H_ */
diff --git a/include/X11/Xmu/Editres.h b/include/X11/Xmu/Editres.h
new file mode 100644 (file)
index 0000000..0c1ffe0
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+
+Copyright 1991, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+void _XEditResCheckMessages
+(
+ Widget                        w,
+ XtPointer             data,
+ XEvent                        *event,
+ Boolean               *cont
+);
+
+_XFUNCPROTOEND
diff --git a/include/X11/Xmu/EditresP.h b/include/X11/Xmu/EditresP.h
new file mode 100644 (file)
index 0000000..ed9dd41
--- /dev/null
@@ -0,0 +1,406 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author:  Chris D. Peterson, MIT X Consortium
+ */
+
+/************************************************************
+
+               The Editres Protocol
+
+
+  The Client message sent to the application is:
+
+  ATOM = "ResEditor"           --- RES_EDITOR_NAME
+
+  FORMAT = 32                   --- RES_EDIT_SEND_EVENT_FORMAT
+
+  l[0] = timestamp
+  l[1] = command atom name
+  l[2] = ident of command
+  l[3] = protocol version number to use
+
+
+
+  The binary protocol has the following format:
+
+       Card8:          8-bit unsingned integer
+       Card16:         16-bit unsingned integer
+       Card32:         32-bit unsingned integer
+       Int16:          16-bit signed integer
+       Window:         32-bit value
+       Widget:         32-bit value
+       String8:        ListOfCard8
+
+       [a][b][c] represent an exclusive list of choices.
+
+       All widgets are passed as a list of widgets, containing the
+       full instance heirarch of this widget.  The hierarchy is ordered
+       from parent to child.  Thus the first element of each list is
+       the root of the widget tree (this makes verifying that the widget
+       still exists, MUCH faster).
+
+       ListOfFoo comprises a list of things in the following format:
+
+       number:                 Card16
+       <number> things:        ????
+
+  This is a synchronous protocol, every request MUST be followed by a
+  reply.
+
+  Request:
+
+       Serial Number:  Card8
+       Op Code:        Card8 - { SendWidgetTree = 0,
+                                 SetValues = 1,
+                                 GetResources = 2,
+                                 GetGeometry = 3,
+                                 FindChild = 4,
+                                 GetValues = 5 }
+       Length:         Card32
+       Data:
+
+   Reply:
+
+       Serial Number:  Card8
+       Type:           Card8 - { Formatted = 0,
+                                 Unformatted = 1,
+                                 ProtocolMismatch = 2
+                               }
+       Length:         Card32
+
+
+   Byte Order:
+
+       All Fields are MSB -> LSB
+
+    Data:
+
+       Formatted:
+
+               The data contains the reply information for the request as
+               specified below if the reply type is "Formatted".  The return
+               values for the other reply types are shown below.
+
+        Unformatted:
+
+               Message:        String8
+
+       ProtocolMismatch:
+
+               RequestedVersion:       Card8
+
+------------------------------------------------------------
+
+   SendWidgetTree:
+
+       --->
+
+       Number of Entries:      Card16
+       Entry:
+               widget:         ListOfWidgets
+               name:           String8
+               class:          String8
+               window:         Card32
+               toolkit:        String8
+
+       Send Widget Tree returns the toolkit type, and a fuly specified list
+        of widgets for each widget in the tree.  This is enough information
+        to completely reconstruct the entire widget heirarchy.
+
+       The window return value contains the Xid of the window currently
+       used by this widget.  If the widget is unrealized then 0 is returned,
+       and if widget is a non-windowed object a value of 2 is returned.
+
+   SetValues:
+
+       name:   String8
+       type:   String8
+       value:  String8
+       Number of Entries:      Card16
+       Entry:
+               widget:         ListOfWidgets
+
+       --->
+
+       Number of Entries:      Card16
+       Entry:
+               widget:         ListOfWidgets
+               message:        String8
+
+       SetValues will allow the same resource to be set on a number of
+       widgets.  This function will return an error message if the SetValues
+       request caused an Xt error.
+
+  GetValues:
+
+        names:                ListOfString8
+        widget:               Widget
+
+        --->
+       novalues:             ListOfCard16
+       values:               ListOfString8
+
+        GetValues will allow a number of resource values to be read
+        on a particular widget.  The request specifies the names of
+       the resources wanted and the widget id these resources are
+       from.  The reply returns a list of indices from the requests
+       name list of resources for which a value can not be returned.
+       It also returns a list of returned values, in the order of the
+        requests names list, skipping those indices present in novalues.
+
+   GetResources:
+
+       Number of Entries:      Card16
+       Entry
+               widget:         ListOfWidgets:
+
+       ---->
+
+       Number of Entries:      Card16
+       Entry
+               Widget:                 ListOfWidgets:
+               Error:                  Bool
+
+               [ Message:              String 8 ]
+               [ Number of Resources:  Card16
+               Resource:
+                       Kind:   {normal, constraint}
+                       Name:   String8
+                       Class:  String8
+                       Type:   String8 ]
+
+       GetResource retrieves the kind, name, class and type for every
+       widget passed to it.  If an error occured with the resource fetch
+       Error will be set to True for the given widget and a message
+       is returned rather than the resource info.
+
+  GetGeometry:
+
+       Number of Entries:      Card16
+       Entry
+               Widget:         ListOfWidgets:
+
+       ---->
+
+       Number of Entries:      Card16
+       Entry
+               Widget:                 ListOfWidgets:
+               Error:                  Bool
+
+               [ message:              String 8 ]
+               [ mapped:       Boolean
+                 X:            Int16
+                 Y:            Int16
+                 Width:        Card16
+                 Height:       Card16
+                 BorderWidth:  Card16 ]
+
+       GetGeometry retreives the mapping state, x, y, width, height
+       and border width for each widget specified.  If an error occured
+       with the geometry fetch "Error" will be set to True for the given
+       widget and a message is returned rather than the geometry info.
+       X an Y corrospond to the root coordinates of the upper left corner
+       of the widget (outside the window border).
+
+  FindChild:
+
+       Widget:         ListOfWidgets
+       X:              Int16
+       Y:              Int16
+
+       --->
+
+       Widget:         ListOfWidgets
+
+       Find Child returns a descendent of the widget specified that
+       is at the root coordinates specified.
+
+       NOTE:
+
+       The returned widget is undefined if the point is contained in
+       two or more mapped widgets, or in two overlapping Rect objs.
+
+  GetValues:
+
+        names:                ListOfString8
+        widget:               Widget
+
+        --->
+
+       values:               ListOfString8
+
+        GetValues will allow a number of resource values to be read
+        on a particular widget.  Currently only InterViews 3.0.1 Styles
+       and their attributes are supported.  In addition, the current
+       user interface  only supports the return of 1 resource.  The ability
+       to specify and return multiple resources is defined for future editres
+       interfaces where some or all of a widgets resource values are returned
+       and displayed at once.
+
+
+************************************************************/
+
+#include <X11/Intrinsic.h>
+#include <X11/Xfuncproto.h>
+
+#define XER_NBBY 8             /* number of bits in a byte */
+#define BYTE_MASK 255
+
+#define HEADER_SIZE 6
+
+#define EDITRES_IS_OBJECT 2
+#define EDITRES_IS_UNREALIZED 0
+
+/*
+ * Format for atoms
+ */
+#define EDITRES_FORMAT             8
+#define EDITRES_SEND_EVENT_FORMAT 32
+
+/*
+ * Atoms
+ */
+#define EDITRES_NAME         "Editres"
+#define EDITRES_COMMAND_ATOM "EditresCommand"
+#define EDITRES_COMM_ATOM    "EditresComm"
+#define EDITRES_CLIENT_VALUE "EditresClientVal"
+#define EDITRES_PROTOCOL_ATOM "EditresProtocol"
+
+typedef enum {
+  SendWidgetTree = 0,
+              SetValues      = 1,
+              GetResources   = 2,
+              GetGeometry    = 3,
+              FindChild      = 4,
+              GetValues      = 5
+} EditresCommand;
+
+typedef enum {
+  NormalResource     = 0,
+  ConstraintResource = 1
+} ResourceType;
+
+/*
+ * The type of a resource identifier
+ */
+typedef unsigned char ResIdent;
+
+typedef enum {
+  PartialSuccess   = 0,
+  Failure         = 1,
+  ProtocolMismatch = 2
+} EditResError;
+
+typedef struct _WidgetInfo {
+    unsigned short num_widgets;
+  unsigned long *ids;
+    Widget real_widget;
+} WidgetInfo;
+
+typedef struct _ProtocolStream {
+    unsigned long size, alloc;
+    unsigned char *real_top, *top, *current;
+} ProtocolStream;
+
+/************************************************************
+ * Function definitions for reading and writing protocol requests
+ ************************************************************/
+_XFUNCPROTOBEGIN
+
+void _XEditResPutString8
+(
+ ProtocolStream                *stream,
+ _Xconst char          *str
+ );
+
+void _XEditResPut8
+(
+ ProtocolStream                *stream,
+ unsigned int          value
+ );
+
+void _XEditResPut16
+(
+ ProtocolStream                *stream,
+ unsigned int          value
+ );
+
+void _XEditResPut32
+(
+ ProtocolStream                *stream,
+ unsigned long         value
+ );
+
+void _XEditResPutWidgetInfo
+(
+ ProtocolStream                *stream,
+ WidgetInfo            *info
+ );
+
+void _XEditResResetStream
+(
+ ProtocolStream                *stream
+ );
+
+Bool _XEditResGet8
+(
+ ProtocolStream                *stream,
+ unsigned char         *value
+ );
+
+Bool _XEditResGet16
+(
+ ProtocolStream                *stream,
+ unsigned short                *value
+ );
+
+Bool _XEditResGetSigned16
+(
+ ProtocolStream                *stream,
+ short                 *value
+ );
+
+Bool _XEditResGet32
+(
+ ProtocolStream                *stream,
+ unsigned long         *value
+ );
+
+Bool _XEditResGetString8
+(
+ ProtocolStream                *stream,
+ char                  **str
+ );
+
+Bool _XEditResGetWidgetInfo
+(
+ ProtocolStream                *stream,
+ WidgetInfo            *info
+ );
+
+_XFUNCPROTOEND
diff --git a/include/X11/Xmu/Error.h b/include/X11/Xmu/Error.h
new file mode 100644 (file)
index 0000000..e275fea
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_ERROR_H_
+#define _XMU_ERROR_H_
+
+#include <stdio.h>
+#include <X11/Xlib.h>
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+int XmuPrintDefaultErrorMessage
+(
+ Display               *dpy,
+ XErrorEvent           *event,
+ FILE                  *fp
+ );
+
+int XmuSimpleErrorHandler
+(
+ Display               *dpy,
+ XErrorEvent           *errorp
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_ERROR_H_ */
diff --git a/include/X11/Xmu/ExtAgent.h b/include/X11/Xmu/ExtAgent.h
new file mode 100644 (file)
index 0000000..b300140
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+
+Copyright 1994,1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#include <X11/Intrinsic.h>
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+extern void XmuRegisterExternalAgent
+(
+ Widget                w,
+ XtPointer     data,
+ XEvent                *event,
+ Boolean       *cont
+ );
+
+_XFUNCPROTOEND
+
diff --git a/include/X11/Xmu/Initer.h b/include/X11/Xmu/Initer.h
new file mode 100644 (file)
index 0000000..415885d
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_INITER_H_
+#define _XMU_INITER_H_
+
+#include <X11/Intrinsic.h>
+#include <X11/Xfuncproto.h>
+
+typedef void (*XmuInitializerProc)(XtAppContext app_context, XPointer data);
+
+_XFUNCPROTOBEGIN
+
+void XmuCallInitializers
+(
+ XtAppContext          app_context
+ );
+
+void XmuAddInitializer
+(
+ XmuInitializerProc    func,
+ XPointer              data
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_INITER_H_ */
diff --git a/include/X11/Xmu/Lookup.h b/include/X11/Xmu/Lookup.h
new file mode 100644 (file)
index 0000000..e99b8b1
--- /dev/null
@@ -0,0 +1,124 @@
+/************************************************************
+
+Copyright 1999 by Thomas E. Dickey <dickey@clark.net>
+
+                        All Rights Reserved
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name(s) of the above copyright
+holders shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization.
+
+********************************************************/
+
+#ifndef included_xmu_lookup_h
+#define included_xmu_lookup_h 1
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+extern int XmuLookupString(
+               XKeyEvent *event,
+               unsigned char *buffer,
+               int nbytes,
+               KeySym *keysym,
+               XComposeStatus *status,
+               unsigned long keysymSet);
+
+extern int XmuLookupLatin1(
+               XKeyEvent *event,
+               unsigned char *buffer,
+               int nbytes,
+               KeySym *keysym,
+               XComposeStatus *status);
+
+extern int XmuLookupLatin2(
+               XKeyEvent *event,
+               unsigned char *buffer,
+               int nbytes,
+               KeySym *keysym,
+               XComposeStatus *status);
+
+extern int XmuLookupLatin3(
+               XKeyEvent *event,
+               unsigned char *buffer,
+               int nbytes,
+               KeySym *keysym,
+               XComposeStatus *status);
+
+extern int XmuLookupLatin4(
+               XKeyEvent *event,
+               unsigned char *buffer,
+               int nbytes,
+               KeySym *keysym,
+               XComposeStatus *status);
+
+extern int XmuLookupKana(
+               XKeyEvent *event,
+               unsigned char *buffer,
+               int nbytes,
+               KeySym *keysym,
+               XComposeStatus *status);
+
+extern int XmuLookupJISX0201(
+               XKeyEvent *event,
+               unsigned char *buffer,
+               int nbytes,
+               KeySym *keysym,
+               XComposeStatus *status);
+
+extern int XmuLookupArabic(
+               XKeyEvent *event,
+               unsigned char *buffer,
+               int nbytes,
+               KeySym *keysym,
+               XComposeStatus *status);
+
+extern int XmuLookupCyrillic(
+               XKeyEvent *event,
+               unsigned char *buffer,
+               int nbytes,
+               KeySym *keysym,
+               XComposeStatus *status);
+
+extern int XmuLookupGreek(
+               XKeyEvent *event,
+               unsigned char *buffer,
+               int nbytes,
+               KeySym *keysym,
+               XComposeStatus *status);
+
+extern int XmuLookupAPL(
+               XKeyEvent *event,
+               unsigned char *buffer,
+               int nbytes,
+               KeySym *keysym,
+               XComposeStatus *status);
+
+extern int XmuLookupHebrew(
+               XKeyEvent *event,
+               unsigned char *buffer,
+               int nbytes,
+               KeySym *keysym,
+               XComposeStatus *status);
+
+#endif /* included_xmu_lookup_h */
diff --git a/include/X11/Xmu/Misc.h b/include/X11/Xmu/Misc.h
new file mode 100644 (file)
index 0000000..6ae6227
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/***********************************************************
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/* Various useful constant and macro definitions */
+
+#ifndef _Xmu_Misc_h
+#define _Xmu_Misc_h
+
+#define MAXDIMENSION   ((1 << 31)-1)
+
+#define Max(x, y)      (((x) > (y)) ? (x) : (y))
+#define Min(x, y)      (((x) < (y)) ? (x) : (y))
+#define AssignMax(x, y)        {if ((y) > (x)) x = (y);}
+#define AssignMin(x, y)        {if ((y) < (x)) x = (y);}
+
+#endif /*_Xmu_Misc_h*/
diff --git a/include/X11/Xmu/StdCmap.h b/include/X11/Xmu/StdCmap.h
new file mode 100644 (file)
index 0000000..3261673
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_STDCMAP_H_
+#define _XMU_STDCMAP_H_
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+Status XmuAllStandardColormaps
+(
+ Display               *dpy
+ );
+
+Status XmuCreateColormap
+(
+ Display               *dpy,
+ XStandardColormap     *colormap
+ );
+
+void XmuDeleteStandardColormap
+(
+ Display               *dpy,
+ int                   screen,
+ Atom                  property
+ );
+
+Status XmuGetColormapAllocation
+(
+ XVisualInfo           *vinfo,
+ Atom                  property,
+ unsigned long         *red_max_return,
+ unsigned long         *green_max_return,
+ unsigned long         *blue_max_return
+ );
+
+Status XmuLookupStandardColormap
+(
+ Display               *dpy,
+ int                   screen,
+ VisualID              visualid,
+ unsigned int          depth,
+ Atom                  property,
+ Bool                  replace,
+ Bool                  retain
+ );
+
+XStandardColormap *XmuStandardColormap
+(
+ Display               *dpy,
+ int                   screen,
+ VisualID              visualid,
+ unsigned int          depth,
+ Atom                  property,
+ Colormap              cmap,
+ unsigned long         red_max,
+ unsigned long         green_max,
+ unsigned long         blue_max
+ );
+
+Status XmuVisualStandardColormaps
+(
+ Display               *dpy,
+ int                   screen,
+ VisualID              visualid,
+ unsigned int          depth,
+ Bool                  replace,
+ Bool                  retain
+ );
+
+Bool XmuDistinguishableColors
+(
+ XColor                        *colors,
+ int                   count
+ );
+
+Bool XmuDistinguishablePixels
+(
+ Display               *dpy,
+ Colormap              cmap,
+ unsigned long         *pixels,
+ int                   count
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_STDCMAP_H_ */
diff --git a/include/X11/Xmu/StdSel.h b/include/X11/Xmu/StdSel.h
new file mode 100644 (file)
index 0000000..b780875
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_SELECTION_H_
+#define _XMU_SELECTION_H_
+
+#include <X11/Intrinsic.h>
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+Boolean XmuConvertStandardSelection
+(
+ Widget                        w,
+ Time                  timev,
+ Atom                  *selection,
+ Atom                  *target,
+ Atom                  *type_return,
+ XPointer              *value_return,
+ unsigned long         *length_return,
+ int                   *format_return
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_SELECTION_H_ */
diff --git a/include/X11/Xmu/SysUtil.h b/include/X11/Xmu/SysUtil.h
new file mode 100644 (file)
index 0000000..da5b189
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _SYSUTIL_H_
+#define _SYSUTIL_H_
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+int XmuGetHostname
+(
+    char               *buf_return,
+    int                        maxlen
+);
+
+#ifndef _XMU_H_
+int XmuSnprintf
+(
+ char                  *str,
+ int                   size,
+ _Xconst char          *fmt,
+    ...
+ )
+_X_ATTRIBUTE_PRINTF(3,4);
+#endif
+
+_XFUNCPROTOEND
+
+#endif /* _SYSUTIL_H_ */
diff --git a/include/X11/Xmu/WhitePoint.h b/include/X11/Xmu/WhitePoint.h
new file mode 100644 (file)
index 0000000..9f41c42
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+
+Copyright 1991, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+
+/*
+ *
+ *     DESCRIPTION
+ *             This file contains a series of standard white point values.
+ */
+#define CIE_A_u                0.2560
+#define CIE_A_v                0.5243
+#define CIE_A_Y                1.0000
+
+#define CIE_B_u                0.2137
+#define CIE_B_v                0.4852
+#define CIE_B_Y                1.0000
+
+#define CIE_C_u                0.2009
+#define CIE_C_v                0.4609
+#define CIE_C_Y                1.0000
+
+#define CIE_D55_u      0.2044
+#define CIE_D55_v      0.4808
+#define CIE_D55_Y      1.0000
+
+#define CIE_D65_u      0.1978
+#define CIE_D65_v      0.4684
+#define CIE_D65_Y      1.0000
+
+#define CIE_D75_u      0.1935
+#define CIE_D75_v      0.4586
+#define CIE_D75_Y      1.0000
+
+#define ASTM_D50_u     0.2092
+#define ASTM_D50_v     0.4881
+#define ASTM_D50_Y     1.0000
+
+#define WP_9300K_u     0.1884
+#define WP_9300K_v     0.4463
+#define WP_9300K_Y     1.0000
diff --git a/include/X11/Xmu/WidgetNode.h b/include/X11/Xmu/WidgetNode.h
new file mode 100644 (file)
index 0000000..f9d2cb5
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+
+Copyright 1990, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author:  Jim Fulton, MIT X Consortium
+ */
+
+#ifndef _XmuWidgetNode_h
+#define _XmuWidgetNode_h
+
+#include <X11/Intrinsic.h>
+#include <X11/Xfuncproto.h>
+
+/*
+ * This is usually initialized by setting the first two fields and letting
+ * rest be implicitly nulled (by genlist.sh, for example)
+ */
+typedef struct _XmuWidgetNode {
+    char *label;                       /* mixed case name */
+    WidgetClass *widget_class_ptr;     /* addr of widget class */
+    struct _XmuWidgetNode *superclass; /* superclass of widget_class */
+    struct _XmuWidgetNode *children, *siblings;        /* subclass links */
+    char *lowered_label;               /* lowercase version of label */
+    char *lowered_classname;           /* lowercase version of class_name */
+    Bool have_resources;               /* resources have been fetched */
+    XtResourceList resources;          /* extracted resource database */
+    struct _XmuWidgetNode **resourcewn;        /* where resources come from */
+    Cardinal nresources;               /* number of resources */
+    XtResourceList constraints;                /* extracted constraint resources */
+    struct _XmuWidgetNode **constraintwn;  /* where constraints come from */
+    Cardinal nconstraints;             /* number of constraint resources */
+    XtPointer data;                    /* extra data */
+} XmuWidgetNode;
+
+#define XmuWnClass(wn) ((wn)->widget_class_ptr[0])
+#define XmuWnClassname(wn) (XmuWnClass(wn)->core_class.class_name)
+#define XmuWnSuperclass(wn) ((XmuWnClass(wn))->core_class.superclass)
+
+                                       /* external interfaces */
+_XFUNCPROTOBEGIN
+
+void XmuWnInitializeNodes
+(
+ XmuWidgetNode         *nodearray,
+ int                   nnodes
+ );
+
+void XmuWnFetchResources
+(
+ XmuWidgetNode         *node,
+ Widget                        toplevel,
+ XmuWidgetNode         *topnode
+ );
+
+int XmuWnCountOwnedResources
+(
+ XmuWidgetNode         *node,
+ XmuWidgetNode         *ownernode,
+ Bool                  constraints
+ );
+
+XmuWidgetNode *XmuWnNameToNode
+(
+ XmuWidgetNode         *nodelist,
+ int                   nnodes,
+ _Xconst char          *name
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _XmuWidgetNode_h */
+
diff --git a/include/X11/Xmu/WinUtil.h b/include/X11/Xmu/WinUtil.h
new file mode 100644 (file)
index 0000000..3d187b9
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_WINDOWUTIL_H_
+#define _XMU_WINDOWUTIL_H_
+
+#include <X11/Xutil.h>
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+Window XmuClientWindow
+(
+ Display       *dpy,
+ Window        win
+ );
+
+Bool XmuUpdateMapHints
+(
+ Display       *dpy,
+ Window                win,
+ XSizeHints    *hints
+ );
+
+Screen *XmuScreenOfWindow
+(
+ Display       *dpy,
+ Window        w
+);
+
+_XFUNCPROTOEND
+
+#endif /* _XMU_WINDOWUTIL_H_ */
diff --git a/include/X11/Xmu/Xct.h b/include/X11/Xmu/Xct.h
new file mode 100644 (file)
index 0000000..514ad7f
--- /dev/null
@@ -0,0 +1,165 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _Xct_h
+#define _Xct_h
+
+#include <X11/Xfuncproto.h>
+
+#define XctVersion 1
+
+typedef unsigned char *XctString;
+
+typedef enum {
+    XctUnspecified,
+    XctLeftToRight,
+    XctRightToLeft
+} XctHDirection;
+
+typedef unsigned long XctFlags;
+
+/* These are bits in XctFlags. */
+
+#define XctSingleSetSegments   0x0001
+   /* This means that returned segments should contain characters from only
+    * one set (C0, C1, GL, GR).  When this is requested, XctSegment is never
+    * returned, instead XctC0Segment, XctC1Segment, XctGlSegment, and
+    * XctGRSegment are returned.  C0 and C1 segments are always returned as
+    * singleton characters.
+    */
+
+#define XctProvideExtensions   0x0002
+   /* This means that if the Compound Text string is from a higher version
+    * than this code is implemented to, then syntactically correct but unknown
+    * control sequences should be returned as XctExtension items.  If this
+    * flag is not set, and the Compound Text string version indicates that
+    * extensions cannot be ignored, then each unknown control sequence will be
+    * reported as an XctError.
+    */
+
+#define XctAcceptC0Extensions  0x0004
+   /* This means that if the Compound Text string is from a higher version
+    * than this code is implemented to, then unknown C0 characters should be
+    * treated as if they were legal, and returned as C0 characters (regardless
+    * of how XctProvideExtensions is set).  If this flag is not set, then all
+    * unknown C0 characters are treated according to XctProvideExtensions.
+    */
+
+#define XctAcceptC1Extensions  0x0008
+   /* This means that if the Compound Text string is from a higher version
+    * than this code is implemented to, then unknown C0 characters should be
+    * treated as if they were legal, and returned as C0 characters (regardless
+    * of how XctProvideExtensions is set).  If this flag is not set, then all
+    * unknown C0 characters are treated according to XctProvideExtensions.
+    */
+
+#define XctHideDirection       0x0010
+   /* This means that horizontal direction changes should be reported as
+    * XctHorizontal items.  If this flag is not set, then direction changes are
+    * not returned as items, but the current direction is still maintained and
+    * reported for other items.
+    */
+
+#define XctFreeString          0x0020
+   /* This means that XctFree should free the Compound Text string (that was
+    * passed to XctCreate.  If this flag is not set, the string is not freed.
+    */
+
+#define XctShiftMultiGRToGL    0x0040
+   /* Translate GR segments on-the-fly into GL segments for the GR sets:
+    * GB2312.1980-1, JISX0208.1983-1, and KSC5601.1987-1.
+    */
+
+/* This is the return type for XctNextItem. */
+typedef enum {
+    XctSegment,                /* used when XctSingleSetSegments is not requested */
+    XctC0Segment,      /* used when XctSingleSetSegments is requested */
+    XctGLSegment,      /* used when XctSingleSetSegments is requested */
+    XctC1Segment,      /* used when XctSingleSetSegments is requested */
+    XctGRSegment,      /* used when XctSingleSetSegments is requested */
+    XctExtendedSegment,        /* an extended segment */
+    XctExtension,      /* used when XctProvideExtensions is requested */
+    XctHorizontal,     /* horizontal direction or depth change */
+    XctEndOfText,      /* end of text string */
+    XctError           /* syntactic or semantic error */
+} XctResult;
+
+typedef struct _XctRec {
+    XctString          total_string;   /* as given to XctCreate */
+    int                        total_length;   /* as given to XctCreate */
+    XctFlags           flags;          /* as given to XctCreate */
+    int                        version;        /* indicates the version of the CT spec
+                                        * the string was produced from */
+    int                        can_ignore_exts;/* non-zero if ignoring extensions is
+                                        * acceptable, else zero */
+    XctString          item;           /* item returned from XctNextItem */
+    unsigned           item_length;    /* length of item in bytes */
+    int                        char_size;      /* number of bytes per character in
+                                        * item, with zero meaning variable */
+    char               *encoding;      /* Encoding name for item */
+    XctHDirection      horizontal;     /* direction of item */
+    unsigned           horz_depth;     /* current direction nesting depth */
+    char               *GL;            /* "{I} F" string for current GL */
+    char               *GL_encoding;   /* Encoding name for current GL */
+    int                        GL_set_size;    /* 94 or 96 */
+    int                        GL_char_size;   /* number of bytes per GL character */
+    char               *GR;            /* "{I} F" string for current GR */
+    char               *GR_encoding;   /* Encoding name for current GR */
+    int                        GR_set_size;    /* 94 or 96 */
+    int                        GR_char_size;   /* number of bytes per GR character */
+    char               *GLGR_encoding; /* Encoding name for current GL+GR,
+                                        * if known */
+    struct _XctPriv    *priv;          /* private to parser, don't peek */
+} *XctData;
+
+/* these are the external routines */
+_XFUNCPROTOBEGIN
+
+XctData XctCreate
+(
+ _Xconst unsigned char *string,
+ int                   length,
+ XctFlags              flags
+);
+
+XctResult XctNextItem
+(
+ XctData               data
+);
+
+void XctFree
+(
+ XctData               data
+ );
+
+void XctReset
+(
+ XctData               data
+ );
+
+_XFUNCPROTOEND
+
+#endif /* _Xct_h */
diff --git a/include/X11/Xmu/Xmu.h b/include/X11/Xmu/Xmu.h
new file mode 100644 (file)
index 0000000..e49ad6f
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The interfaces described by this header file are for miscellaneous utilities
+ * and are not part of the Xlib standard.
+ */
+
+#ifndef _XMU_H_
+#define _XMU_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/Intrinsic.h>
+#include <X11/Xmu/Atoms.h>             /* _XA_... */
+#include <X11/Xmu/CharSet.h>           /* CopyISOLatin1Lowered */
+#include <X11/Xmu/Converters.h>                /* CvtStringTo... */
+#include <X11/Xmu/Drawing.h>           /* DrawRoundedRect, DrawLogo */
+#include <X11/Xmu/Error.h>             /* PrintDefaultError */
+#include <X11/Xmu/StdSel.h>            /* ConvertStandardSelection */
+
+/*
+ * clip lists
+ */
+typedef struct _XmuSegment {
+  int x1, x2;
+  struct _XmuSegment *next;
+} XmuSegment;
+
+typedef struct _XmuScanline {
+  int y;
+  XmuSegment *segment;
+  struct _XmuScanline *next;
+} XmuScanline;
+
+typedef struct _XmuArea {
+  XmuScanline *scanline;
+} XmuArea;
+
+#define XmuCreateArea()                XmuNewArea(0, 0, 0, 0)
+#define XmuAreaOr(dst, src)    XmuAreaOrXor((dst), (src), True)
+#define XmuAreaXor(dst, src)   XmuAreaOrXor((dst), (src), False)
+
+#define XmuDestroyArea(a)                                      \
+                 do {                                          \
+                   XmuDestroyScanlineList((a)->scanline);      \
+                   XtFree((char *)(a));                        \
+                 } while (0)
+
+#define FreeArea(a)                                            \
+                 do {                                          \
+                   XmuDestroyScanlineList((a)->scanline);      \
+                   a->scanline = (Scanline *)0;                \
+                 } while (0)
+
+#define XmuValidSegment(s)     ((s)->x1 < (s)->x2)
+#define XmuSegmentEqu(s1, s2)  ((s1)->x1 == (s2)->x1 && (s1)->x2 == (s2)->x2)
+#define XmuDestroySegment(s)   XtFree((char *)(s))
+
+#define XmuDestroyScanline(s)                                  \
+                 do {                                          \
+                   XmuDestroySegmentList((s)->segment);        \
+                   XtFree((char*)(s));                         \
+                 } while (0)
+
+XmuArea *XmuNewArea(int, int, int, int);
+XmuArea *XmuAreaDup(XmuArea*);
+XmuArea *XmuAreaCopy(XmuArea*, XmuArea*);
+XmuArea *XmuAreaNot(XmuArea*, int, int, int, int);
+XmuArea *XmuAreaOrXor(XmuArea*, XmuArea*, Bool);
+XmuArea *XmuAreaAnd(XmuArea*, XmuArea*);
+Bool XmuValidArea(XmuArea*);
+Bool XmuValidScanline(XmuScanline*);
+Bool XmuScanlineEqu(XmuScanline*, XmuScanline*);
+XmuSegment *XmuNewSegment(int, int);
+void XmuDestroySegmentList(XmuSegment*);
+XmuScanline *XmuScanlineCopy(XmuScanline*, XmuScanline*);
+Bool XmuAppendSegment(XmuSegment*, XmuSegment*);
+XmuScanline *XmuOptimizeScanline(XmuScanline*);
+XmuScanline *XmuScanlineNot(XmuScanline *scanline, int, int);
+XmuScanline *XmuScanlineOr(XmuScanline*, XmuScanline*);
+XmuScanline *XmuScanlineAnd(XmuScanline*, XmuScanline*);
+XmuScanline *XmuScanlineXor(XmuScanline*, XmuScanline*);
+XmuScanline *XmuNewScanline(int, int, int);
+void XmuDestroyScanlineList(XmuScanline*);
+XmuArea *XmuOptimizeArea(XmuArea *area);
+
+#ifndef notdef
+XmuScanline *XmuScanlineOrSegment(XmuScanline*, XmuSegment*);
+XmuScanline *XmuScanlineAndSegment(XmuScanline*, XmuSegment*);
+XmuScanline *XmuScanlineXorSegment(XmuScanline*, XmuSegment*);
+#endif /* notdef */
+
+#ifndef _SYSUTIL_H_
+int XmuSnprintf(char *str, int size, _Xconst char *fmt, ...)
+    _X_ATTRIBUTE_PRINTF(3,4);
+#endif
+
+#endif /* _XMU_H_ */
+
diff --git a/packaging/libXmu.spec b/packaging/libXmu.spec
new file mode 100644 (file)
index 0000000..4437ddb
--- /dev/null
@@ -0,0 +1,97 @@
+# TODO: libXmuu split and/or elf filter emulation
+
+Summary: X.Org X11 libXmu/libXmuu runtime libraries
+Name: libXmu
+Version: 1.1.1
+Release: 1
+License: MIT
+Group: System Environment/Libraries
+URL: http://www.x.org
+
+Source0: %{name}-%{version}.tar.gz
+
+BuildRequires:  pkgconfig(xorg-macros)
+BuildRequires: xorg-x11-xutils-dev
+BuildRequires: libX11-devel
+BuildRequires: libXext-devel
+BuildRequires: libXt-devel
+
+%description
+X.Org X11 libXmu/libXmuu runtime libraries
+
+%package devel
+Summary: X.Org X11 libXmu development package
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+Provides: libxmu-devel
+
+%description devel
+X.Org X11 libXmu development package
+
+%prep
+%setup -q
+
+%build
+%reconfigure --disable-static \
+              LDFLAGS="${LDFLAGS} -Wl,--hash-style=both -Wl,--as-needed"
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+mkdir -p %{buildroot}/usr/share/license
+cp -af COPYING %{buildroot}/usr/share/license/%{name}
+make install DESTDIR=$RPM_BUILD_ROOT
+
+# We intentionally don't ship *.la files
+rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
+
+# fixup later
+rm -rf $RPM_BUILD_ROOT%{_docdir}
+
+%remove_docs
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(-,root,root,-)
+/usr/share/license/%{name}
+%doc COPYING README ChangeLog
+%{_libdir}/libXmu.so.6
+%{_libdir}/libXmu.so.6.2.0
+%{_libdir}/libXmuu.so.1
+%{_libdir}/libXmuu.so.1.0.0
+
+%files devel
+%defattr(-,root,root,-)
+%dir %{_includedir}/X11/Xmu
+%{_includedir}/X11/Xmu/Atoms.h
+%{_includedir}/X11/Xmu/CharSet.h
+%{_includedir}/X11/Xmu/CloseHook.h
+%{_includedir}/X11/Xmu/Converters.h
+%{_includedir}/X11/Xmu/CurUtil.h
+%{_includedir}/X11/Xmu/CvtCache.h
+%{_includedir}/X11/Xmu/DisplayQue.h
+%{_includedir}/X11/Xmu/Drawing.h
+%{_includedir}/X11/Xmu/Editres.h
+%{_includedir}/X11/Xmu/EditresP.h
+%{_includedir}/X11/Xmu/Error.h
+%{_includedir}/X11/Xmu/ExtAgent.h
+%{_includedir}/X11/Xmu/Initer.h
+%{_includedir}/X11/Xmu/Lookup.h
+%{_includedir}/X11/Xmu/Misc.h
+%{_includedir}/X11/Xmu/StdCmap.h
+%{_includedir}/X11/Xmu/StdSel.h
+%{_includedir}/X11/Xmu/SysUtil.h
+%{_includedir}/X11/Xmu/WhitePoint.h
+%{_includedir}/X11/Xmu/WidgetNode.h
+%{_includedir}/X11/Xmu/WinUtil.h
+%{_includedir}/X11/Xmu/Xct.h
+%{_includedir}/X11/Xmu/Xmu.h
+%{_libdir}/libXmu.so
+%{_libdir}/libXmuu.so
+%{_libdir}/pkgconfig/xmu.pc
+%{_libdir}/pkgconfig/xmuu.pc
diff --git a/src/AllCmap.c b/src/AllCmap.c
new file mode 100644 (file)
index 0000000..a974ce0
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <X11/Xutil.h>
+#include <X11/Xmu/StdCmap.h>
+
+static XVisualInfo *getDeepestVisual(int, XVisualInfo*, int);
+
+/*
+ * To create all of the appropriate standard colormaps for every visual of
+ * every screen on a given display, use XmuAllStandardColormaps.
+ *
+ * Define and retain as permanent resources all standard colormaps which are
+ * meaningful for the visuals of each screen of the display.  Return 0 on
+ * failure, non-zero on success.  If the property of any standard colormap
+ * is already defined, redefine it.
+ *
+ * This interface is intended to be used by window managers or a client
+ * upon start-up of a session.
+ *
+ * The standard colormaps of a screen are defined by properties associated
+ * with the screen's root window.  Each screen has exactly one root window.
+ * The property names of standard colormaps are predefined, and each property
+ * name may describe at most one colormap.
+ *
+ * The standard colormaps are
+ *             RGB_BEST_MAP
+ *             RGB_RED_MAP
+ *             RGB_GREEN_MAP
+ *             RGB_BLUE_MAP
+ *             RGB_DEFAULT_MAP
+ *             RGB_GRAY_MAP
+ *
+ * Therefore a screen may have at most 6 standard colormap properties defined.
+ *
+ * A standard colormap is associated with a particular visual of the screen.
+ * A screen may have multiple visuals defined, including visuals of the same
+ * class at different depths.  Note that a visual id might be repeated for
+ * more than one depth, so the visual id and the depth of a visual identify
+ * the visual.  The characteristics of the visual will determine which
+ * standard colormaps are meaningful under that visual, and will determine
+ * how the standard colormap is defined.  Because a standard colormap is
+ * associated with a specific visual, there must be a method of determining
+ * which visuals take precedence in defining standard colormaps.
+ *
+ * The method used here is: for the visual of greatest depth, define all
+ * standard colormaps meaningful to that visual class, according to this
+ * order of (descending) precedence:
+ *     1. DirectColor
+ *     2. PseudoColor
+ *     3. TrueColor and GrayScale
+ *     4. StaticColor and StaticGray
+ *
+ * Allows partial success by screenful.  For example, if a map on screen 1
+ * fails, the maps on screen 0, created earlier, will remain.  However,
+ * none on screen 1 will remain.  If a map on 0 fails, none will remain.
+ *
+ * See the comments under XmuVisualStandardColormaps() for notes on which
+ * standard colormaps are meaningful under these classes of visuals.
+ */
+
+Status
+XmuAllStandardColormaps(Display *dpy)
+{
+    int        nvisuals, scr;
+    Status     status;
+    long       vinfo_mask;
+    XVisualInfo        template, *vinfo, *v1, *v2;
+
+    status = 0;
+    /* for each screen, determine all visuals of this server */
+    for (scr=0; scr < ScreenCount(dpy); scr++)
+    {
+       template.screen = scr;
+       vinfo_mask = VisualScreenMask;
+       vinfo = XGetVisualInfo(dpy, vinfo_mask, &template, &nvisuals);
+       if (vinfo == NULL) /* unexpected: a screen with no visuals */
+           continue;
+
+       v1 = getDeepestVisual(DirectColor, vinfo, nvisuals);
+       v2 = getDeepestVisual(PseudoColor, vinfo, nvisuals);
+
+       if (v2 &&
+           (!v1 || (v2->colormap_size >=
+                    ((v1->red_mask | v1->green_mask | v1->blue_mask) + 1))))
+           status = XmuVisualStandardColormaps(dpy, scr, v2->visualid,
+                                               (unsigned) v2->depth, 1, 1);
+       else if (v1)
+           status = XmuVisualStandardColormaps(dpy, scr, v1->visualid,
+                                               (unsigned) v1->depth, 1, 1);
+
+       else {
+           if (((v1 = getDeepestVisual(TrueColor, vinfo, nvisuals)) != NULL)
+               || ((v1 = getDeepestVisual(StaticColor, vinfo, nvisuals)) !=
+               NULL))
+               status = XmuVisualStandardColormaps(dpy, scr, v1->visualid,
+                                                  (unsigned) v1->depth, 1, 1);
+           if (status &&
+              (((v1 = getDeepestVisual(GrayScale, vinfo, nvisuals)) != NULL)
+               || ((v1 = getDeepestVisual(StaticGray, vinfo, nvisuals)) !=
+                   NULL)))
+               status = XmuVisualStandardColormaps(dpy, scr, v1->visualid,
+                                                  (unsigned) v1->depth, 1, 1);
+       }
+       XFree ((char *) vinfo);
+       if (!status) break;
+    }
+    return status;
+}
+
+static XVisualInfo *
+getDeepestVisual(int visual_class, XVisualInfo *vinfo, int nvisuals)
+{
+    register int       i;
+    register int       maxdepth = 0;
+    XVisualInfo                *v = NULL;
+
+    for (i=0; i < nvisuals; i++, vinfo++)
+       if (vinfo->class == visual_class && vinfo->depth > maxdepth)
+       {
+           maxdepth = vinfo->depth;
+           v = vinfo;
+       }
+    return(v);
+}
+
diff --git a/src/Atoms.c b/src/Atoms.c
new file mode 100644 (file)
index 0000000..6f0ca64
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * This file contains routines to cache atoms, avoiding multiple
+ * server round-trips.  Not so useful now that Xlib caches them.
+ *
+ * Public entry points:
+ *
+ *     XmuMakeAtom             creates & initializes an opaque AtomRec
+ *     XmuInternAtom           fetches an Atom from cache or Display
+ *     XmuInternStrings        fetches multiple Atoms as strings
+ *     XmuGetAtomName          returns name of an Atom
+ *     XmuNameOfAtom           returns name from an AtomPtr
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Intrinsic.h>
+#include "Atoms.h"
+
+typedef struct _DisplayRec {
+    struct _DisplayRec* next;
+    Display *dpy;
+    Atom atom;
+} DisplayRec;
+
+struct _AtomRec {
+    _Xconst char *name;
+    DisplayRec* head;
+};
+
+#ifdef SUNSHLIB
+#define STATIC
+#else
+#define STATIC static
+#endif
+
+#define DeclareAtom(atom,text) \
+STATIC struct _AtomRec __##atom = { text, NULL }; \
+AtomPtr _##atom = &__##atom;
+
+DeclareAtom(XA_ATOM_PAIR,              "ATOM_PAIR"             )
+DeclareAtom(XA_CHARACTER_POSITION,     "CHARACTER_POSITION"    )
+DeclareAtom(XA_CLASS,                  "CLASS"                 )
+DeclareAtom(XA_CLIENT_WINDOW,          "CLIENT_WINDOW"         )
+DeclareAtom(XA_CLIPBOARD,              "CLIPBOARD"             )
+DeclareAtom(XA_COMPOUND_TEXT,          "COMPOUND_TEXT"         )
+DeclareAtom(XA_DECNET_ADDRESS,         "DECNET_ADDRESS"        )
+DeclareAtom(XA_DELETE,                 "DELETE"                )
+DeclareAtom(XA_FILENAME,               "FILENAME"              )
+DeclareAtom(XA_HOSTNAME,               "HOSTNAME"              )
+DeclareAtom(XA_IP_ADDRESS,             "IP_ADDRESS"            )
+DeclareAtom(XA_LENGTH,                 "LENGTH"                )
+DeclareAtom(XA_LIST_LENGTH,            "LIST_LENGTH"           )
+DeclareAtom(XA_NAME,                   "NAME"                  )
+DeclareAtom(XA_NET_ADDRESS,            "NET_ADDRESS"           )
+DeclareAtom(XA_NULL,                   "NULL"                  )
+DeclareAtom(XA_OWNER_OS,               "OWNER_OS"              )
+DeclareAtom(XA_SPAN,                   "SPAN"                  )
+DeclareAtom(XA_TARGETS,                        "TARGETS"               )
+DeclareAtom(XA_TEXT,                   "TEXT"                  )
+DeclareAtom(XA_TIMESTAMP,              "TIMESTAMP"             )
+DeclareAtom(XA_USER,                   "USER"                  )
+DeclareAtom(XA_UTF8_STRING,            "UTF8_STRING"           )
+
+/******************************************************************
+
+  Public procedures
+
+ ******************************************************************/
+
+
+AtomPtr
+XmuMakeAtom(_Xconst char *name)
+{
+    AtomPtr ptr = XtNew(struct _AtomRec);
+    ptr->name = name;
+    ptr->head = NULL;
+    return ptr;
+}
+
+char *
+XmuNameOfAtom(AtomPtr atom_ptr)
+{
+    return (char *) atom_ptr->name;
+}
+
+
+Atom
+XmuInternAtom(Display *d, AtomPtr atom_ptr)
+{
+    DisplayRec* display_rec;
+    for (display_rec = atom_ptr->head; display_rec != NULL;
+        display_rec = display_rec->next) {
+       if (display_rec->dpy == d)
+           return display_rec->atom;
+    }
+    display_rec = XtNew(DisplayRec);
+    display_rec->next = atom_ptr->head;
+    atom_ptr->head = display_rec;
+    display_rec->dpy = d;
+    display_rec->atom = XInternAtom(d, atom_ptr->name, False);
+    return display_rec->atom;
+}
+
+
+char *
+XmuGetAtomName(Display *d, Atom atom)
+{
+    if (atom == 0) return (NULL);
+    return XGetAtomName(d, atom);
+}
+
+/* convert (names, count) to a list of atoms. Caller allocates list */
+void
+XmuInternStrings(Display *d, register String *names,
+                register Cardinal count, register Atom *atoms)
+{
+    (void) XInternAtoms(d, (char**)names, (int)count, FALSE, atoms);
+}
diff --git a/src/ClientWin.c b/src/ClientWin.c
new file mode 100644 (file)
index 0000000..38ade28
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+
+#include <X11/Xmu/WinUtil.h>
+
+/*
+ * Prototypes
+ */
+static Window TryChildren(Display*, Window, Atom);
+
+/* Find a window with WM_STATE, else return win itself, as per ICCCM */
+
+Window
+XmuClientWindow(Display *dpy, Window win)
+{
+    Atom WM_STATE;
+    Atom type = None;
+    int format;
+    unsigned long nitems, after;
+    unsigned char *data = NULL;
+    Window inf;
+
+    WM_STATE = XInternAtom(dpy, "WM_STATE", True);
+    if (!WM_STATE)
+       return win;
+    XGetWindowProperty(dpy, win, WM_STATE, 0, 0, False, AnyPropertyType,
+                      &type, &format, &nitems, &after, &data);
+    if (data)
+       XFree(data);
+    if (type)
+       return win;
+    inf = TryChildren(dpy, win, WM_STATE);
+    if (!inf)
+       inf = win;
+    return inf;
+}
+
+static Window
+TryChildren(Display *dpy, Window win, Atom WM_STATE)
+{
+    Window root, parent;
+    Window *children;
+    unsigned int nchildren;
+    unsigned int i;
+    Atom type = None;
+    int format;
+    unsigned long nitems, after;
+    unsigned char *data;
+    Window inf = 0;
+
+    if (!XQueryTree(dpy, win, &root, &parent, &children, &nchildren))
+       return 0;
+    for (i = 0; !inf && (i < nchildren); i++) {
+       data = NULL;
+       XGetWindowProperty(dpy, children[i], WM_STATE, 0, 0, False,
+                          AnyPropertyType, &type, &format, &nitems,
+                          &after, &data);
+       if (data)
+           XFree(data);
+       if (type)
+           inf = children[i];
+    }
+    for (i = 0; !inf && (i < nchildren); i++)
+       inf = TryChildren(dpy, children[i], WM_STATE);
+    if (children)
+       XFree(children);
+    return inf;
+}
diff --git a/src/Clip.c b/src/Clip.c
new file mode 100644 (file)
index 0000000..232e4c5
--- /dev/null
@@ -0,0 +1,1616 @@
+/*
+ * Copyright (c) 1998 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdlib.h>
+
+#include <X11/IntrinsicP.h>
+#include <X11/Xmu/Xmu.h>
+
+#define XmuMax(a, b)   ((a) > (b) ? (a) : (b))
+#define XmuMin(a, b)   ((a) < (b) ? (a) : (b))
+
+/*
+ * Function:
+ *     XmuNewArea
+ *
+ * Parameters:
+ *     x1 - Coordinates of the rectangle
+ *     y1 - ""
+ *     x2 - ""
+ *     y2 - ""
+ *
+ * Description:
+ *     Creates a new rectangular clipping area
+ */
+XmuArea *
+XmuNewArea(int x1, int y1, int x2, int y2)
+{
+  XmuArea *area;
+
+  area = (XmuArea *)XtMalloc(sizeof(XmuArea));
+  if (x2 > x1 && y2 > y1)
+    {
+      area->scanline = XmuNewScanline(y1, x1, x2);
+      area->scanline->next = XmuNewScanline(y2, 0, 0);
+    }
+  else
+    area->scanline = (XmuScanline *)NULL;
+
+  return (area);
+}
+
+/*
+ * Function:
+ *     XmuAreaDup
+ *
+ * Parameters:
+ *     area - Area to copy
+ *
+ * Description:
+ *     Returns a copy of its argument
+ */
+XmuArea *
+XmuAreaDup(XmuArea *area)
+{
+  XmuArea *dst;
+
+  if (!area)
+    return ((XmuArea *)NULL);
+
+  dst = XmuCreateArea();
+  XmuAreaCopy(dst, area);
+  return (dst);
+}
+
+/*
+ * Function:
+ *     XmuAreaCopy
+ *
+ * Parameters:
+ *     dst - destination area
+ *     src - source area
+ *
+ * Description:
+ *     Minimizes memory alocation, trying to use already alocated memory
+ *     in dst, freeing what is not required anymore.
+ */
+XmuArea *
+XmuAreaCopy(XmuArea *dst, XmuArea *src)
+{
+  XmuScanline *z, *p, *Z;
+
+  if (!dst || !src || dst == src)
+    return (dst);
+
+  z = p = dst->scanline;
+  Z = src->scanline;
+
+  /*CONSTCOND*/
+  while (1)
+    {
+      if (!Z)
+       {
+         if (z == dst->scanline)
+           {
+             XmuDestroyScanlineList(dst->scanline);
+             dst->scanline = (XmuScanline *)NULL;
+           }
+         else
+           {
+             XmuDestroyScanlineList(p->next);
+             p->next = (XmuScanline *)NULL;
+           }
+         return (dst);
+       }
+      if (z)
+       {
+         XmuScanlineCopy(z, Z);
+         z->y = Z->y;
+       }
+      else
+       {
+         z = XmuNewScanline(Z->y, 0, 0);
+         XmuScanlineCopy(z, Z);
+         if (p == dst->scanline && !dst->scanline)
+           p = dst->scanline = z;
+         else
+           p->next = z;
+       }
+      p = z;
+      z = z->next;
+      Z = Z->next;
+    }
+
+  return (dst);
+}
+
+/*
+ * Function:
+ *   XmuAreaNot
+ *
+ * Parameters:
+ *     area - area to operate
+ *     x1   - retangle to clip the result against
+ *     y1   - ""
+ *     x2   - ""
+ *     y2   - ""
+ *
+ * Description:
+ * (Input)
+ * (x1, y1)                                                (x2, y1)
+ *                   +-------------+
+ *      +------------+             +----+
+ *      |                +--------------+
+ *      +----------------+
+ * (x1, y2)                                                (x2, y2)
+ *
+ * (Output)
+ * (x1, y1)                                                (x2, y1)
+ *    +--------------+             +--------------------------+
+ *    | +------------+             +----+                     |
+ *    | |                +--------------+                     |
+ *    +-+                +------------------------------------+
+ * (x1, y2)                                                (x2, y2)
+ */
+XmuArea *
+XmuAreaNot(XmuArea *area, int x1, int y1, int x2, int y2)
+{
+  XmuScanline *z;
+  XmuArea *and;
+
+  if (!area)
+    return (area);
+
+  if (x1 > x2)
+    {
+      x1 ^= x2; x2 ^= x1; x1 ^= x2;
+    }
+    if (y1 > y2)
+      {
+       y1 ^= y2; y2 ^= y1; y1 ^= y2;
+      }
+    if (!area->scanline)
+      {
+       if ((area->scanline = XmuNewScanline(y1, x1, x2)) != NULL)
+         area->scanline->next = XmuNewScanline(y2, 0, 0);
+       return (area);
+      }
+    and = XmuNewArea(x1, y1, x2, y2);
+    XmuAreaAnd(area, and);
+    XmuDestroyArea(and);
+    z = area->scanline;
+    if (z->y != y1)
+      {
+       XmuScanline *q = XmuNewScanline(y1, x1, x2);
+       q->next = z;
+       area->scanline = q;
+      }
+    else
+      {
+       area->scanline = area->scanline->next;
+       XmuDestroyScanline(z);
+       XmuOptimizeArea(area);
+       if((z = area->scanline) == (XmuScanline *)NULL)
+         return (area);
+      }
+
+    /* CONSTCOND */
+    while (1)
+      {
+       XmuScanlineNot(z, x1, x2);
+       if (!z->next)
+         {
+           z->next = XmuNewScanline(y2, 0, 0);
+           break;
+         }
+       if (z->next->y == y2)
+         {
+           XmuDestroyScanlineList(z->next);
+           z->next = XmuNewScanline(y2, 0, 0);
+           break;
+         }
+       z = z->next;
+      }
+
+    return (area);
+}
+
+/*
+ * Function:
+ *     XmuAreaOrXor
+ *
+ * Parameters:
+ *     dst - destination area
+ *     src - source area
+ *     or  - or operation if true, else xor operation
+ *
+ * Description:
+ *     Executes Or (Union) or Xor (Reverse intesection) of the areas
+ */
+XmuArea *
+XmuAreaOrXor(XmuArea *dst, XmuArea *src, Bool or)
+{
+  XmuScanline *z, *p, *Z, *P, *ins, *top;
+
+  if (!dst || !src)
+    return (dst);
+
+  if (dst == src)
+    {
+      if (or)
+       return (dst);
+      XmuDestroyScanlineList(dst->scanline);
+      dst->scanline = (XmuScanline *)NULL;
+      return (dst);
+    }
+  if (!XmuValidArea(src))
+    return (dst);
+  if (!XmuValidArea(dst))
+    {
+      XmuAreaCopy(dst, src);
+      return (dst);
+    }
+
+  p = z = dst->scanline;
+  P = Z = src->scanline;
+  ins = XmuNewScanline(dst->scanline->y, 0, 0);
+  top = XmuNewScanline(dst->scanline->y, 0, 0);
+  XmuScanlineCopy(ins, dst->scanline);
+  XmuScanlineCopy(top, dst->scanline);
+
+  /*CONSTCOND*/
+  while (1)
+    {
+      if (!Z)
+       break;
+      else if (Z->y < z->y)
+       {
+         XmuScanline  *q = XmuNewScanline(Z->y, 0, 0);
+         XmuScanlineCopy(q, Z);
+
+         if (z == dst->scanline)
+           {
+             dst->scanline = p = q;
+             q->next = z;
+            }
+         else
+           {
+             p->next = q;
+             q->next = z;
+             if (Z->y >= p->y)
+               {
+                 if (ins->y >= top->y
+                     && (p->y != P->y || !XmuScanlineEqu(p, P)
+                         || (ins->y <= P->y && !XmuScanlineEqu(ins, P))))
+                   {
+                     if (or)
+                       XmuScanlineOr(q, ins);
+                     else
+                       XmuScanlineXor(q, ins);
+                    }
+                 else if (Z->y >= top->y
+                          && (top->y == p->y || top->y > ins->y
+                              || !XmuValidScanline(Z)
+                              || (p->y == P->y && XmuValidScanline(p)
+                                  && XmuValidScanline(P))
+                              || XmuScanlineEqu(ins, top)))
+                   {
+                     if (or)
+                       XmuScanlineOr(q, top);
+                     else
+                       XmuScanlineXor(q, top);
+                   }
+                 if (ins->y != p->y && p->y != P->y)
+                   {
+                     XmuScanlineCopy(ins, p);
+                     ins->y = p->y;
+                   }
+               }
+             if (!XmuValidScanline(p) || Z->y <= p->y)
+               {
+                 XmuScanlineCopy(top, p);
+                 top->y = p->y;
+                }
+             p = q;
+           }
+         P = Z;
+         Z = Z->next;
+         continue;
+        }
+      else if (Z->y == z->y)
+       {
+         if (top->y != z->y)
+           {
+             XmuScanlineCopy(top, z);
+             top->y = z->y;
+           }
+         if (or)
+           XmuScanlineOr(z, Z);
+         else
+           XmuScanlineXor(z, Z);
+         P = Z;
+         Z = Z->next;
+       }
+      else if (P != Z)         /* && Z->y > z->y */
+       {
+         if (top->y == ins->y && top->y != z->y)
+           {
+             XmuScanlineCopy(top, z);
+             top->y = z->y;
+           }
+         if (ins->y != z->y)
+           {
+             XmuScanlineCopy(ins, z);
+             ins->y = z->y;
+           }
+         if (or)
+           XmuScanlineOr(z, P);
+         else
+           XmuScanlineXor(z, P);
+       }
+      else if (ins->y != z->y)
+       {
+         XmuScanlineCopy(ins, z);
+         ins->y = z->y;
+       }
+      p = z;
+      z = z->next;
+      if (!z)
+       {
+         while (Z)
+           {
+             p->next = XmuNewScanline(Z->y, 0, 0);
+             XmuScanlineCopy(p->next, Z);
+             p = p->next;
+             Z = Z->next;
+           }
+         break;
+       }
+      else if (ins->y > top->y && !XmuValidScanline(z)
+              && XmuValidScanline(ins))
+       {
+         XmuScanlineCopy(top, ins);
+         top->y = ins->y;
+       }
+    }
+  XmuOptimizeArea(dst);
+  XmuDestroyScanline(ins);
+  XmuDestroyScanline(top);
+
+  return (dst);
+}
+
+/*
+ * Function:
+ *     XmuAreaAnd(dst, src)
+ *
+ * Parameters:
+ *     dst - destination area
+ *     src - source area
+ *
+ * Description:
+ *     Executes And (intersection) of the areas
+ */
+XmuArea *
+XmuAreaAnd(XmuArea *dst, XmuArea *src)
+{
+  XmuScanline *z, *p, *Z, *P, *top;
+
+  if (!dst || !src || dst == src)
+    return (dst);
+  if (!XmuValidArea(dst) || !XmuValidArea(src))
+    {
+      XmuDestroyScanlineList(dst->scanline);
+      dst->scanline = (XmuScanline *)NULL;
+      return (dst);
+    }
+  z = p = dst->scanline;
+  Z = P = src->scanline;
+  top = XmuNewScanline(dst->scanline->y, 0, 0);
+  XmuScanlineCopy(top, dst->scanline);
+
+  while (z)
+    {
+      while (Z->next && Z->next->y < z->y)
+       {
+         P = Z;
+         Z = Z->next;
+         if (Z->y >= p->y)
+           {
+             XmuScanline *q = XmuNewScanline(Z->y, 0, 0);
+             XmuScanlineCopy(q, Z);
+
+             XmuScanlineAnd(q, top);
+             if (p->y != P->y)
+               {
+                 XmuScanlineAnd(p, P);
+                 p->y = XmuMax(p->y, P->y);
+               }
+             p->next = q;
+             q->next = z;
+             p = q;
+           }
+       }
+      if (!z->next)
+       {
+         z->y = XmuMax(z->y, Z->y);
+         break;
+        }
+      while (Z->y >= z->next->y)
+       {
+         if (z == dst->scanline)
+           {
+             p = dst->scanline = dst->scanline->next;
+             XmuDestroyScanline(z);
+             z = dst->scanline;
+           }
+         else
+           {
+             p->next = z->next;
+             XmuDestroyScanline(z);
+             z = p;
+           }
+         if (!z || !z->next)
+           {
+             XmuOptimizeArea(dst);
+             XmuDestroyScanline(top);
+
+             return (dst);
+           }
+       }
+      if (Z->y > p->y)
+       z->y = XmuMax(z->y, Z->y);
+      if (top->y != z->y)
+       {
+         XmuScanlineCopy(top, z);
+         top->y = z->y;
+       }
+      XmuScanlineAnd(z, Z);
+      p = z;
+      z = z->next;
+    }
+  XmuOptimizeArea(dst);
+  XmuDestroyScanline(top);
+
+  return (dst);
+}
+
+/*
+ * Function:
+ *   XmuValidArea(area)
+ *
+ * Parameters:
+ *     area - area to verify
+ *
+ * Description:
+ *     Verifies if the area is valid and/or useful
+ */
+Bool
+XmuValidArea(XmuArea *area)
+{
+  XmuScanline *at;
+
+  if (!area || !area->scanline)
+    return (False);
+
+  at = area->scanline;
+  while (at)
+    {
+      if (XmuValidScanline(at))
+       return (True);
+      at = at->next;
+    }
+
+  return (False);
+}
+
+/*
+ * Function:
+ *     XmuValidScanline
+ *
+ * Parameters:
+ *     scanline - scanline to verify
+ *
+ * Description:
+ *     Verifies if a scanline is useful
+ */
+Bool
+XmuValidScanline(XmuScanline *scanline)
+{
+  XmuSegment *z;
+
+  if (!scanline)
+    return (False);
+
+  z = scanline->segment;
+  while (z)
+    {
+      if (XmuValidSegment(z))
+       return (True);
+      z = z->next;
+    }
+
+  return (False);
+}
+
+/*
+ * Function:
+ *   XmuScanlineEqu
+ *
+ * Parameters:
+ *     s1 - scanline 1
+ *     s2 - scanline 2
+ *
+ * Description:
+ *     Checks if s1 and s2 are equal
+ */
+Bool
+XmuScanlineEqu(XmuScanline *s1, XmuScanline *s2)
+{
+  XmuSegment *z, *Z;
+
+  if ((!s1 && !s2) || s1 == s2)
+    return (True);
+  if (!s1 || !s2)
+    return (False);
+
+  z = s1->segment;
+  Z = s2->segment;
+
+  /*CONSTCOND*/
+  while (1)
+    {
+      if (!z && !Z)
+       return (True);
+      if (!z || !Z)
+       return (False);
+      if (!XmuSegmentEqu(z, Z))
+       return (False);
+      z = z->next;
+      Z = Z->next;
+    }
+  /*NOTREACHED*/
+}
+
+/*
+ * Function:
+ *     XmuNewSegment
+ *
+ * Parameters:
+ *     x1 - coordinates of the segment
+ *     x2 - ""
+ *
+ * Description:
+ *     Creates a new segments with the coordinates x1 and x2
+ *
+ * Returns:
+ *     New Segment of NULL
+ */
+XmuSegment *
+XmuNewSegment(int x1, int x2)
+{
+  XmuSegment *segment;
+
+  if ((segment = (XmuSegment *)XtMalloc(sizeof(XmuSegment))) == NULL)
+    return (segment);
+
+  segment->x1 = x1;
+  segment->x2 = x2;
+  segment->next = (XmuSegment *)NULL;
+
+  return (segment);
+}
+
+/*
+ * Function:
+ *     XmuDestroySegmentList
+ *
+ * Parameters:
+ *     segment - Segment to destroy
+ *
+ * Description:
+ *     Frees the memory used by the list headed by segment
+ */
+void
+XmuDestroySegmentList(XmuSegment *segment)
+{
+  XmuSegment *z;
+
+  if (!segment)
+    return;
+
+  while (segment)
+    {
+      z = segment;
+      segment = segment->next;
+      XmuDestroySegment(z);
+    }
+}
+
+/*
+ * Function:
+ *     XmuScanlineCopy
+ *
+ * Parameters:
+ *     dst - destination scanline
+ *     src - source scanline
+ *
+ * Description:
+ *     Makes dst contain the same data as src
+ */
+XmuScanline *
+XmuScanlineCopy(XmuScanline *dst, XmuScanline *src)
+{
+  XmuSegment *z, *p, *Z;
+
+  if (!dst || !src || dst == src)
+    return (dst);
+
+  z = p = dst->segment;
+  Z = src->segment;
+
+  /*CONSTCOND*/
+  while (1)
+    {
+      if (!Z)
+       {
+         if (z == dst->segment)
+           dst->segment = (XmuSegment *)NULL;
+         else
+           p->next = (XmuSegment *)NULL;
+         XmuDestroySegmentList(z);
+         return (dst);
+       }
+      if (z)
+       {
+         z->x1 = Z->x1;
+         z->x2 = Z->x2;
+       }
+      else
+       {
+         z = XmuNewSegment(Z->x1, Z->x2);
+         if (p == dst->segment && !dst->segment)
+           p = dst->segment = z;
+         else
+           p->next = z;
+       }
+      p = z;
+      z = z->next;
+      Z = Z->next;
+    }
+  /*NOTREACHED*/
+}
+
+/*
+ * Function:
+ *     XmuAppendSegment
+ *
+ * Parameters:
+ *     segment - destination segment
+ *     append  - segment to add
+ *
+ * Description:
+ *     Adds a copy of the append list at the end of the segment list
+ */
+Bool
+XmuAppendSegment(XmuSegment *segment, XmuSegment *append)
+{
+  if (!segment || !append)
+    return (False);
+
+  if (segment->next)
+    /* Should not happen! */
+    XmuDestroySegmentList(segment->next);
+
+  while (append)
+    {
+      if (XmuValidSegment(append))
+       {
+         if ((segment->next = XmuNewSegment(append->x1, append->x2)) == NULL)
+           return (False);
+         segment = segment->next;
+       }
+      append = append->next;
+    }
+
+  return (True);
+}
+
+/*
+ * Function:
+ *     XmuOptimizeScanline
+ *
+ * Parameters:
+ *     scanline - scanline to optimize
+ *
+ * Description:
+ *       Some functions, when transforming Segments of Scanlines, left these
+ *     with unnecessary data (that may cause error in these same functions).
+ *       This function corrects these incorrect segments.
+ */
+XmuScanline *
+XmuOptimizeScanline(XmuScanline *scanline)
+{
+  XmuSegment *z, *p;
+
+  while (scanline->segment && !XmuValidSegment(scanline->segment))
+    {
+      XmuSegment *s = scanline->segment;
+
+      scanline->segment = scanline->segment->next;
+      XmuDestroySegment(s);
+    }
+  for (z = p = scanline->segment; z; p = z, z = z->next)
+    {
+      if (!XmuValidSegment(z))
+       {
+         p->next = z->next;
+         XmuDestroySegment(z);
+         z = p;
+       }
+    }
+  return (scanline);
+}
+
+/*
+ * Name:
+ *     XmuScanlineNot(scanline, minx, maxx)
+ *
+ * Parameters:
+ *     scanline - scanlines operate
+ *     minx     - minimum x coordinate
+ *     maxx     - maximum x coordinate
+ *
+ * Description:
+ *         (minx)                                                        (maxx)
+ *           +                                                             +
+ * (input)         +---------+     +--------+        +--------+
+ * (output)  +-----+         +-----+        +--------+        +------------+
+ */
+XmuScanline *
+XmuScanlineNot(XmuScanline *scanline, int minx, int maxx)
+{
+  XmuSegment *z;
+  static XmuSegment x = { 0, 0, NULL };
+  static XmuScanline and = { 0, &x, NULL };
+
+  if (!scanline)
+    return (scanline);
+
+  XmuOptimizeScanline(scanline);
+  if (minx > maxx)
+    {
+      minx ^= maxx; maxx ^= minx; minx ^= maxx;
+    }
+  and.segment->x1 = minx;
+  and.segment->x2 = maxx;
+  XmuScanlineAnd(scanline, &and);
+  if (!scanline->segment)
+    {
+      scanline->segment = XmuNewSegment(minx, maxx);
+      return (scanline);
+    }
+  z = scanline->segment;
+  if (z->x1 != minx)
+    {
+      XmuSegment *q = XmuNewSegment(minx, z->x1);
+
+      q->next = z;
+      scanline->segment = q;
+    }
+
+  /*CONSTCOND*/
+  while (1)
+    {
+      z->x1 = z->x2;
+      if (!z->next)
+       {
+         z->x2 = maxx;
+         break;
+       }
+      z->x2 = z->next->x1;
+      if (z->next->x2 == maxx)
+       {
+         XmuDestroySegment(z->next);
+         z->next = (XmuSegment *)NULL;
+         break;
+       }
+      z = z->next;
+    }
+
+  return (scanline);
+}
+
+
+#ifndef notdef
+/*
+ * Function:
+ *     XmuScanlineOrSegment
+ *
+ * Parameters:
+ *     dst - destionation scanline
+ *     src - source segment
+ *
+ * Description:
+ * (input)      +-----------+  +--------+    +---------+
+ * (src)              +-------------------+
+ * (output)     +-------------------------+  +---------+
+ */
+XmuScanline *
+XmuScanlineOrSegment(XmuScanline *dst, XmuSegment *src)
+{
+  XmuSegment *z, *p, ins;
+
+  if (!src || !dst || !XmuValidSegment(src))
+    return (dst);
+
+  if (!dst->segment)
+    {
+      dst->segment = XmuNewSegment(src->x1, src->x2);
+      return (dst);
+    }
+
+  z = p = dst->segment;
+  ins.x1 = src->x1;
+  ins.x2 = src->x2;
+
+  /*CONSTCOND*/
+  while (1)
+    {
+      if (!z)
+       {
+            XmuSegment *q = XmuNewSegment(ins.x1, ins.x2);
+
+           if (p == dst->segment && z == p)
+             dst->segment = q;
+           else
+             p->next = q;
+           break;
+       }
+      else if (ins.x2 < z->x1)
+       {
+         XmuSegment *q = XmuNewSegment(ins.x1, ins.x2);
+
+         if (p == dst->segment && z == p)
+           {
+             q->next = dst->segment;
+             dst->segment = q;
+           }
+         else
+           {
+             p->next = q;
+             q->next = z;
+           }
+         break;
+        }
+      else if (ins.x2 <= z->x2)
+       {
+         z->x1 = XmuMin(z->x1, ins.x1);
+         break;
+       }
+      else if (ins.x1 <= z->x2)
+       {
+         ins.x1 = XmuMin(z->x1, ins.x1);
+         if (!z->next)
+           {
+             z->x1 = ins.x1;
+             z->x2 = ins.x2;
+             break;
+           }
+         else
+           {
+             if (z == dst->segment)
+               {
+                 p = dst->segment = dst->segment->next;
+                 XmuDestroySegment(z);
+                 z = dst->segment;
+                 continue;
+               }
+             else
+               {
+                 p->next = z->next;
+                 XmuDestroySegment(z);
+                 z = p;
+               }
+           }
+       }
+      p = z;
+      z = z->next;
+    }
+
+  return (dst);
+}
+
+/*
+ * Function:
+ *     XmuScanlineAndSegment
+ *
+ * Parameters:
+ *     dst - destination scanline
+ *     src - source segment
+ *
+ * Description:
+ * (input)      +------------+   +------+     +----------+
+ * (src)             +---------------------+
+ * (output)          +-------+   +------+
+ */
+XmuScanline *
+XmuScanlineAndSegment(XmuScanline *dst, XmuSegment *src)
+{
+  XmuSegment *z, *p;
+
+  if (!dst || !src)
+    return (dst);
+
+  if (!XmuValidSegment(src))
+    {
+      XmuDestroySegmentList(dst->segment);
+      dst->segment = (XmuSegment *)NULL;
+      return (dst);
+    }
+  if (!dst->segment)
+    return (dst);
+
+  z = p = dst->segment;
+  while (z)
+    {
+      if (src->x2 <= z->x1 || src->x1 >= z->x2)
+       {
+         if (z == dst->segment)
+           {
+             p = dst->segment = dst->segment->next;
+             XmuDestroySegment(z);
+             z = dst->segment;
+             continue;
+           }
+         else
+           {
+             p->next = z->next;
+             XmuDestroySegment(z);
+             z = p;
+           }
+       }
+      else
+       {
+         z->x1 = XmuMax(z->x1, src->x1);
+         z->x2 = XmuMin(z->x2, src->x2);
+       }
+      p = z;
+      z = z->next;
+    }
+
+  return (dst);
+}
+
+/*
+ * Function:
+ *     XmuScanlineXorSegment
+ *
+ * Parameters:
+ *     dst - destionation scanline
+ *     src - source segment
+ *
+ * Descriptipn:
+ * (input)     +------------+  +----------+    +-----------+
+ * (src)           +------------------------+
+ * (output)    +---+        +--+          +-+  +-----------+
+ */
+XmuScanline *
+XmuScanlineXorSegment(XmuScanline *dst, XmuSegment *src)
+{
+  XmuSegment *p, *z, ins;
+  int tmp1, tmp2;
+
+  if (!dst || !src || !XmuValidSegment(src))
+    return (dst);
+  if (!dst->segment)
+    {
+      dst->segment = XmuNewSegment(src->x1, src->x2);
+      return (dst);
+    }
+
+  p = z = dst->segment;
+  ins.x1 = src->x1;
+  ins.x2 = src->x2;
+
+  /*CONSTCOND*/
+  while (1)
+    {
+      if (!XmuValidSegment((&ins)))
+       break;
+      if (!z || ins.x2 < z->x1)
+       {
+         XmuSegment *q = XmuNewSegment(ins.x1, ins.x2);
+
+         q->next = z;
+         if (z == dst->segment)
+           dst->segment = q;
+         else
+           p->next = q;
+         break;
+       }
+      else if (ins.x2 == z->x1)
+       {
+         z->x1 = ins.x1;
+         break;
+       }
+      else if (ins.x1 < z->x2)
+       {
+         if (ins.x1 < z->x1)
+           {
+             tmp1 = ins.x2;
+             tmp2 = z->x2;
+             ins.x2 = XmuMax(ins.x2, z->x2);
+             z->x2 = z->x1;
+             z->x1 = ins.x1;
+             ins.x1 = XmuMin(tmp1, tmp2);
+           }
+         else if (ins.x1 > z->x1)
+           {
+             tmp1 = ins.x1;
+             ins.x1 = XmuMin(ins.x2, z->x2);
+             ins.x2 = XmuMax(z->x2, ins.x2);
+             z->x2 = tmp1;
+           }
+         else  /* ins.x1 == z->x1 */
+           {
+             if (ins.x2 < z->x2)
+               {
+                 z->x1 = ins.x2;
+                 break;
+               }
+             else
+               {
+                 ins.x1 = z->x2;
+                 if (z == dst->segment)
+                   p = dst->segment = dst->segment->next;
+                 else
+                   p->next = z->next;
+                 XmuDestroySegment(z);
+                 z = p;
+                 continue;
+               }
+           }
+       }
+      else if (ins.x1 == z->x2)
+       {
+         ins.x1 = z->x1;
+         if (z == dst->segment)
+           p = dst->segment = dst->segment->next;
+         else
+           p->next = z->next;
+         XmuDestroySegment(z);
+         z = p;
+         continue;
+       }
+      p = z;
+      z = z->next;
+    }
+
+  return (dst);
+}
+#endif /* notdef */
+
+/*
+ * Function:
+ *     ScanlineOr
+ *
+ * Parameters:
+ *     dst - destionation scanline
+ *     src - source scanline
+ *
+ * Description:
+ * (input)    +--------------+  +-----+    +----------+
+ * (src)          +---------------------+       +-----------+
+ * (output)   +-------------------------+  +----------------+
+ */
+XmuScanline *
+XmuScanlineOr(XmuScanline *dst, XmuScanline *src)
+{
+  XmuSegment *z, *p, *Z, ins;
+
+  if (!src || !src->segment || !dst || dst == src)
+    return (dst);
+  if (!dst->segment)
+    {
+      XmuScanlineCopy(dst, src);
+      return (dst);
+    }
+
+  z = p = dst->segment;
+  Z = src->segment;
+  ins.x1 = Z->x1;
+  ins.x2 = Z->x2;
+
+  /*CONSTCOND*/
+  while (1)
+    {
+      while (!XmuValidSegment((&ins)))
+       {
+         if ((Z = Z->next) == (XmuSegment *)NULL)
+           return (dst);
+         ins.x1 = Z->x1;
+         ins.x2 = Z->x2;
+       }
+        if (!z)
+         {
+            XmuSegment *q = XmuNewSegment(ins.x1, ins.x2);
+
+            if (p == dst->segment && z == p)
+             dst->segment = p = q;
+            else
+             {
+               p->next = q;
+               p = q;
+             }
+           Z = Z->next;
+           XmuAppendSegment(p, Z);
+           break;
+         }
+        else if (ins.x2 < z->x1)
+         {
+           XmuSegment *r = XmuNewSegment(ins.x1, ins.x2);
+
+           if (p == dst->segment && z == p)
+             {
+               r->next = dst->segment;
+               dst->segment = p = r;
+             }
+           else
+             {
+               p->next = r;
+               r->next = z;
+               p = r;
+             }
+           Z = Z->next;
+            if (!Z)
+             break;
+            else
+             {
+               ins.x1 = Z->x1;
+               ins.x2 = Z->x2;
+               continue;
+             }
+         }
+       else if (ins.x2 <= z->x2)
+         {
+           z->x1 = XmuMin(z->x1, ins.x1);
+           Z = Z->next;
+           if (!Z)
+             break;
+            else
+             {
+               ins.x1 = Z->x1;
+               ins.x2 = Z->x2;
+               continue;
+             }
+         }
+       else if (ins.x1 <= z->x2)
+         {
+           ins.x1 = XmuMin(z->x1, ins.x1);
+           if (!z->next)
+             {
+               z->x1 = ins.x1;
+               z->x2 = ins.x2;
+               p = z;
+               Z = Z->next;
+               XmuAppendSegment(p, Z);
+               break;
+             }
+            else
+             {
+               if (z == dst->segment)
+                 {
+                   p = dst->segment = dst->segment->next;
+                   XmuDestroySegment(z);
+                   z = p;
+                   continue;
+                 }
+                else
+                 {
+                   p->next = z->next;
+                   XmuDestroySegment(z);
+                   z = p;
+                 }
+             }
+         }
+       p = z;
+       z = z->next;
+    }
+
+  return (dst);
+}
+
+/*
+ * Function:
+ *     XmuScanlineAnd
+ *
+ * Parameters:
+ *     dst - destination scanline
+ *     src - source scanline
+ *
+ * Description:
+ * (input)    +--------------+  +-----+    +----------+
+ * (src)          +---------------------+       +-----------+
+ * (output)       +----------+  +-----+         +-----+
+ */
+XmuScanline *
+XmuScanlineAnd(XmuScanline *dst, XmuScanline *src)
+{
+  XmuSegment  *z, *p, *Z;
+
+  if (!dst || !src || dst == src || !dst->segment) {
+        return (dst);
+  }
+  if (!src->segment)
+    {
+      XmuDestroySegmentList(dst->segment);
+      dst->segment = (XmuSegment *)NULL;
+      return (dst);
+    }
+  z = p = dst->segment;
+  Z = src->segment;
+
+  while (z)
+    {
+      while (!XmuValidSegment(Z) || Z->x2 <= z->x1)
+       {
+         Z = Z->next;
+         if (!Z)
+           {
+             if (z == dst->segment)
+               dst->segment = (XmuSegment *)NULL;
+             else
+               p->next = (XmuSegment *)0;
+             XmuDestroySegmentList(z);
+             return (dst);
+           }
+       }
+      if (Z->x1 >= z->x2)
+       {
+         if (z == dst->segment)
+           {
+             p = dst->segment = dst->segment->next;
+             XmuDestroySegment(z);
+             z = dst->segment;
+           }
+         else
+           {
+             p->next = z->next;
+             XmuDestroySegment(z);
+             z = p->next;
+           }
+         if (!z)
+           return (dst);
+         else
+           continue;
+       }
+        z->x1 = XmuMax(z->x1, Z->x1);
+       if (z->x2 > Z->x2)
+         {
+            if (Z->next)
+             {
+                XmuSegment *q = XmuNewSegment(Z->x2, z->x2);
+
+               q->next = z->next;
+               z->next = q;
+             }
+           z->x2 = Z->x2;
+         }
+       p = z;
+       z = z->next;
+    }
+
+  return (dst);
+}
+
+/*
+ * Function:
+ *     ScanlineXor
+ *
+ * Parameters:
+ *     dst - destination scanline
+ *     src - source scanline
+ *
+ * Description:
+ * (input)    +--------------+  +-----+    +----------+
+ * (src)          +---------------------+       +-----------+
+ * (output)   +---+          +--+     +-+  +----+     +-----+
+ */
+XmuScanline *
+XmuScanlineXor(XmuScanline *dst, XmuScanline *src)
+{
+  XmuSegment *z, *p, *Z, ins;
+  int tmp1, tmp2;
+
+  if (!src || !dst || !src->segment)
+    return (dst);
+  if (src == dst)
+    {
+      XmuDestroySegmentList(dst->segment);
+      dst->segment = (XmuSegment *)NULL;
+      return (dst);
+    }
+  if (!dst->segment)
+    {
+      XmuScanlineCopy(dst, src);
+      return (dst);
+    }
+
+  z = p = dst->segment;
+  Z = src->segment;
+  ins.x1 = Z->x1;
+  ins.x2 = Z->x2;
+
+  /*CONSTCOND*/
+  while (1)
+    {
+      while (!XmuValidSegment((&ins)))
+       {
+         if ((Z = Z->next) == (XmuSegment *)NULL)
+           return (dst);
+         ins.x1 = Z->x1;
+         ins.x2 = Z->x2;
+       }
+      if (!z)
+       {
+         XmuSegment *q = XmuNewSegment(ins.x1, ins.x2);
+
+            if (!dst->segment)
+             dst->segment = q;
+            else
+             p->next = q;
+           p = q;
+           Z = Z->next;
+           XmuAppendSegment(p, Z);
+           break;
+       }
+      else if (ins.x2 < z->x1)
+       {
+         XmuSegment *q = XmuNewSegment(ins.x1, ins.x2);
+
+         q->next = z;
+         if (z == dst->segment)
+           dst->segment = q;
+         else
+           p->next = q;
+         if ((Z = Z->next) == (XmuSegment *)NULL)
+           return (dst);
+
+         p = q;
+         ins.x1 = Z->x1;
+         ins.x2 = Z->x2;
+         continue;
+       }
+      else if (ins.x2 == z->x1)
+       {
+         z->x1 = ins.x1;
+         if ((Z = Z->next) == (XmuSegment *)NULL)
+           break;
+         ins.x1 = Z->x1;
+         ins.x2 = Z->x2;
+         continue;
+       }
+      else if (ins.x1 < z->x2)
+       {
+         if (ins.x1 == z->x1)
+           {
+             if (ins.x2 < z->x2)
+               {
+                 z->x1 = ins.x2;
+                 if ((Z = Z->next) == (XmuSegment *)NULL)
+                   break;
+                 ins.x1 = Z->x1;
+                 ins.x2 = Z->x2;
+                 continue;
+               }
+             else
+               {
+                 ins.x1 = z->x2;
+                 if (z == dst->segment)
+                   p = dst->segment = dst->segment->next;
+                 else
+                   p->next = z->next;
+                 XmuDestroySegment(z);
+                 z = p;
+                 continue;
+               }
+           }
+         else
+           {
+             if (Z->x2 < z->x2)
+               {
+                 XmuSegment  *q = XmuNewSegment(XmuMin(ins.x1, z->x1),
+                                                XmuMax(z->x1, ins.x1));
+
+                 q->next = z;
+                 if (z == dst->segment)
+                   dst->segment = q;
+                 else
+                   p->next = q;
+                 ins.x1 = z->x2;
+                 z->x1 = ins.x2;
+                 p = q;
+                 continue;
+               }
+             else
+               {
+                 tmp1 = ins.x2;
+                 tmp2 = z->x2;
+                 ins.x2 = XmuMax(ins.x2, z->x2);
+                 z->x2 = XmuMax(z->x1, ins.x1);
+                 z->x1 = XmuMin(ins.x1, z->x1);
+                 ins.x1 = XmuMin(tmp1, tmp2);
+               }
+           }
+       }
+      else if (ins.x1 == z->x2)
+       {
+         ins.x1 = z->x1;
+         if (z == dst->segment)
+           p = dst->segment = dst->segment->next;
+         else
+           p->next = z->next;
+         XmuDestroySegment(z);
+         z = p;
+         continue;
+       }
+      p = z;
+      z = z->next;
+    }
+
+  return (dst);
+}
+
+/*
+ * Function:
+ *     XmuNewScanline
+ *
+ * Parameters:
+ *     y  - y coordinate
+ *     x1 - left coordinate
+ *     x2 - right coordinate
+ *
+ * Description:
+ *     Creates a new Scanline
+ */
+XmuScanline *
+XmuNewScanline(int y, int x1, int x2)
+{
+  XmuScanline *scanline;
+
+  scanline = (XmuScanline *)XtMalloc(sizeof(XmuScanline));
+  scanline->y = y;
+  if (x1 < x2)
+    scanline->segment = XmuNewSegment(x1, x2);
+  else
+    scanline->segment = (XmuSegment *)NULL;
+
+  scanline->next = (XmuScanline *)NULL;
+
+  return (scanline);
+}
+
+/*
+ * Function:
+ *     XmuDestroyScanlineList
+ *
+ * Parameters:
+ *     scanline - scanline list to destroy
+ *
+ * Description:
+ *     Destroy a scanline list
+ *
+ * Observation:
+ *     Use as follow:
+ *     XmuDestroyScanlineList(area->scanline);
+ *     area->scanline = (XmuScanline *)NULL;
+ */
+void
+XmuDestroyScanlineList(XmuScanline *scanline)
+{
+  XmuScanline *z;
+
+  if (!scanline)
+    return;
+
+  while (scanline)
+    {
+      z = scanline;
+      scanline = scanline->next;
+      XmuDestroyScanline(z);
+    }
+}
+
+/*
+ * Function:
+ *     XmuOptimizeArea
+ *
+ * Parameters:
+ *     area - area to optimize
+ *
+ * Description:
+ *       Optimizes an area. This function is called when finishing a
+ *     operation between areas, since they can end with redundant data,
+ *     and the algorithms for area combination waits a area with
+ *     correct data (but can left unnecessary data in the area, to avoid
+ *     to much paranoia tests).
+ */
+XmuArea *XmuOptimizeArea(XmuArea *area)
+{
+  XmuScanline *pr, *at;
+
+  if (!area || !area->scanline)
+    return (area);
+
+  if (!area->scanline->next)
+    {
+      XmuDestroyScanlineList(area->scanline);
+      area->scanline = (XmuScanline *)0;
+      return (area);
+    }
+
+  pr = area->scanline;
+  at = area->scanline->next;
+  while (area->scanline && (!XmuValidScanline(area->scanline)
+                           || (area->scanline->next && area->scanline->y
+                               >= area->scanline->next->y)))
+    {
+      area->scanline = area->scanline->next;
+      XmuDestroyScanline(pr);
+      pr = area->scanline;
+      if (pr)
+       at = pr->next;
+    }
+
+  for (; at; pr = at, at = at->next)
+    {
+      if (XmuScanlineEqu(at, pr)
+         || (!XmuValidScanline(at) && !XmuValidScanline(pr))
+         || (at->next && at->y >= at->next->y))
+       {
+         pr->next = at->next;
+         XmuDestroyScanline(at);
+         at = pr;
+       }
+    }
+  if (pr && XmuValidScanline(pr))
+    {
+      XmuDestroySegmentList(pr->segment);
+      pr->segment = (XmuSegment *)NULL;
+    }
+  if (area->scanline && !area->scanline->next)
+    {
+      XmuDestroyScanlineList(area->scanline);
+      area->scanline = (XmuScanline *)NULL;
+    }
+
+  return (area);
+}
diff --git a/src/CloseHook.c b/src/CloseHook.c
new file mode 100644 (file)
index 0000000..01a1beb
--- /dev/null
@@ -0,0 +1,294 @@
+/*
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * CloseDisplayHook package - provide callback on XCloseDisplay
+ *
+ * *
+ * Author:  Jim Fulton, MIT X Consortium
+ *
+ *
+ *                           Public Entry Points
+ *
+ * CloseHook XmuAddCloseDisplayHook (dpy, func, arg)
+ *     Display *dpy;
+ *     XmuCloseHookProc func;
+ *     XPointer arg;
+ *
+ * Bool XmuRemoveCloseDisplayHook (dpy, hook, func, arg)
+ *     Display *dpy;
+ *     CloseHook hook;
+ *     XmuCloseHookProc func;
+ *     XPointer arg;
+ *
+ * Bool XmuLookupCloseDisplayHook (dpy, hook, func, arg)
+ *     Display *dpy;
+ *     CloseHook hook;
+ *     XmuCloseHookProc func;
+ *     XPointer arg;
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>                                     /* for NULL */
+#include <X11/Xos.h>
+#include <X11/Xlib.h>
+#include <X11/Xmu/CloseHook.h>
+#include <stdlib.h>
+
+/*
+ *                              Private data
+ *
+ * This is a list of display entries, each of which contains a list of callback
+ * records.
+ */
+
+typedef struct _CallbackRec {
+    struct _CallbackRec *next;         /* next link in chain */
+    XmuCloseHookProc func;             /* function to call */
+    XPointer arg;                      /* argument to pass with function */
+} CallbackRec;
+
+
+typedef struct _DisplayEntry {
+    struct _DisplayEntry *next;                /* next link in chain */
+    Display *dpy;                      /* the display this represents */
+    int extension;                     /* from XAddExtension */
+    struct _CallbackRec *start, *end;  /* linked list of callbacks */
+    struct _CallbackRec *calling;      /* currently being called back */
+} DisplayEntry;
+
+/*
+ * Prototypes
+ */
+static DisplayEntry *_FindDisplayEntry(Display*, DisplayEntry**);
+static Bool _MakeExtension(Display*, int*);
+
+static DisplayEntry *elist = NULL;
+
+
+/*
+ *****************************************************************************
+ *                           Public Entry Points                            *
+ *****************************************************************************
+ */
+
+/*
+ * Add - add a callback for the given display.  When the display is closed,
+ * the given function will be called as:
+ *
+ *         (*func) (dpy, arg)
+ *
+ * This function is declared to return an int even though the value is ignored
+ * because some compilers have problems with functions returning void.
+ *
+ * This routine returns NULL if it was unable to add the callback, otherwise
+ * it returns an untyped pointer that can be used with Remove or Lookup, but
+ * not dereferenced.
+ */
+CloseHook
+XmuAddCloseDisplayHook(Display *dpy, XmuCloseHookProc func, XPointer arg)
+{
+    DisplayEntry *de;
+    CallbackRec *cb;
+
+    /* allocate ahead of time so that we can fail atomically */
+    cb = (CallbackRec *) malloc (sizeof (CallbackRec));
+    if (!cb) return ((XPointer) NULL);
+
+    de = _FindDisplayEntry (dpy, NULL);
+    if (!de) {
+       if ((de = (DisplayEntry *) malloc (sizeof (DisplayEntry))) == NULL ||
+           !_MakeExtension (dpy, &de->extension)) {
+           free ((char *) cb);
+           if (de) free ((char *) de);
+           return ((CloseHook) NULL);
+       }
+       de->dpy = dpy;
+       de->start = de->end = NULL;
+       de->calling = NULL;
+       de->next = elist;
+       elist = de;
+    }
+
+    /* add to end of list of callback recordss */
+    cb->func = func;
+    cb->arg = arg;
+    cb->next = NULL;
+    if (de->end) {
+       de->end->next = cb;
+    } else {
+       de->start = cb;
+    }
+    de->end = cb;
+
+    return ((CloseHook) cb);
+}
+
+
+/*
+ * Remove - get rid of a callback.  If handle is non-null, use that to compare
+ * entries.  Otherwise, remove first instance of the function/argument pair.
+ */
+Bool
+XmuRemoveCloseDisplayHook(Display *dpy, CloseHook handle,
+                         XmuCloseHookProc func, XPointer arg)
+{
+    DisplayEntry *de = _FindDisplayEntry (dpy, NULL);
+    register CallbackRec *h, *prev;
+
+    if (!de) return False;
+
+    /* look for handle or function/argument pair */
+    for (h = de->start, prev = NULL; h; h = h->next) {
+       if (handle) {
+           if (h == (CallbackRec *) handle) break;
+       } else {
+           if (h->func == func && h->arg == arg) break;
+       }
+       prev = h;
+    }
+    if (!h) return False;
+
+
+    /* remove from list, watch head and tail */
+    if (de->start == h) {
+       de->start = h->next;
+    } else {
+       prev->next = h->next;
+    }
+    if (de->end == h) de->end = prev;
+    if (de->calling != h) free ((char *) h);
+    return True;
+}
+
+
+/*
+ * Lookup - see whether or not a handle has been installed.  If handle is
+ * non-NULL, look for an entry that matches it; otherwise look for an entry
+ * with the same function/argument pair.
+ */
+Bool
+XmuLookupCloseDisplayHook(Display *dpy, CloseHook handle,
+                         XmuCloseHookProc func, XPointer arg)
+{
+    DisplayEntry *de = _FindDisplayEntry (dpy, NULL);
+    register CallbackRec *h;
+
+    if (!de) return False;
+
+    for (h = de->start; h; h = h->next) {
+       if (handle) {
+           if (h == (CallbackRec *) handle) break;
+       } else {
+           if (h->func == func && h->arg == arg) break;
+       }
+    }
+    return (h ? True : False);
+}
+
+
+/*
+ *****************************************************************************
+ *                            internal routines                             *
+ *****************************************************************************
+ */
+
+
+/*
+ * Find the specified display on the linked list of displays.  Also return
+ * the preceeding link so that the display can be unlinked without having
+ * back pointers.
+ */
+static DisplayEntry *
+_FindDisplayEntry(register Display *dpy, DisplayEntry **prevp)
+{
+    register DisplayEntry *d, *prev;
+
+    for (d = elist, prev = NULL; d; d = d->next) {
+       if (d->dpy == dpy) {
+           if (prevp) *prevp = prev;
+           return d;
+       }
+       prev = d;
+    }
+    return NULL;
+}
+
+
+
+/*
+ * _DoCallbacks - process all of the callbacks for this display and free
+ * the associated callback data (callback records and display entries).
+ */
+/* ARGSUSED */
+static int
+_DoCallbacks(Display *dpy, XExtCodes *codes)
+{
+    register CallbackRec *h;
+    DisplayEntry *prev;
+    DisplayEntry *de = _FindDisplayEntry (dpy, &prev);
+
+    if (!de) return 0;
+
+    /* walk the list doing the callbacks and freeing callback record */
+    for (h = de->start; h;) {
+       register CallbackRec *nexth = h->next;
+       de->calling = h;                /* let remove know we'll free it */
+       (*(h->func)) (dpy, h->arg);
+       de->calling = NULL;
+       free ((char *) h);
+       h = nexth;
+    }
+
+    /* unlink this display from chain */
+    if (elist == de) {
+       elist = de->next;
+    } else {
+       prev->next = de->next;
+    }
+    free ((char *) de);
+    return 1;
+}
+
+
+/*
+ * _MakeExtension - create an extension for this display; done once per display
+ */
+static Bool
+_MakeExtension(Display *dpy, int *extensionp)
+{
+    XExtCodes *codes;
+
+    codes = XAddExtension (dpy);
+    if (!codes) return False;
+
+    (void) XESetCloseDisplay (dpy, codes->extension, _DoCallbacks);
+
+    *extensionp = codes->extension;
+    return True;
+}
diff --git a/src/CmapAlloc.c b/src/CmapAlloc.c
new file mode 100644 (file)
index 0000000..31cc153
--- /dev/null
@@ -0,0 +1,343 @@
+/*
+
+Copyright 1989, 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author:  Donna Converse, MIT X Consortium
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <X11/Xutil.h>
+#include <X11/Xmu/StdCmap.h>
+#include <stdio.h>
+
+#define lowbit(x) ((x) & (~(x) + 1))
+
+/*
+ * Prototypes
+ */
+static void best_allocation(XVisualInfo*, unsigned long*, unsigned long*,
+                           unsigned long*);
+static int default_allocation(XVisualInfo*, unsigned long*,
+                             unsigned long*, unsigned long*);
+static void gray_allocation(int, unsigned long*, unsigned long*,
+                           unsigned long*);
+static int icbrt(int);
+static int icbrt_with_bits(int, int);
+static int icbrt_with_guess(int, int);
+
+/* To determine the best allocation of reds, greens, and blues in a
+ * standard colormap, use XmuGetColormapAllocation.
+ *     vinfo           specifies visual information for a chosen visual
+ *     property        specifies one of the standard colormap property names
+ *     red_max         returns maximum red value
+ *      green_max      returns maximum green value
+ *     blue_max        returns maximum blue value
+ *
+ * XmuGetColormapAllocation returns 0 on failure, non-zero on success.
+ * It is assumed that the visual is appropriate for the colormap property.
+ */
+
+Status
+XmuGetColormapAllocation(XVisualInfo *vinfo, Atom property,
+                        unsigned long *red_max,
+                        unsigned long *green_max,
+                        unsigned long *blue_max)
+{
+    Status     status = 1;
+
+    if (vinfo->colormap_size <= 2)
+       return 0;
+
+    switch (property)
+    {
+      case XA_RGB_DEFAULT_MAP:
+       status = default_allocation(vinfo, red_max, green_max, blue_max);
+       break;
+      case XA_RGB_BEST_MAP:
+       best_allocation(vinfo, red_max, green_max, blue_max);
+       break;
+      case XA_RGB_GRAY_MAP:
+       gray_allocation(vinfo->colormap_size, red_max, green_max, blue_max);
+       break;
+      case XA_RGB_RED_MAP:
+       *red_max = vinfo->colormap_size - 1;
+       *green_max = *blue_max = 0;
+       break;
+      case XA_RGB_GREEN_MAP:
+       *green_max = vinfo->colormap_size - 1;
+       *red_max = *blue_max = 0;
+       break;
+      case XA_RGB_BLUE_MAP:
+       *blue_max = vinfo->colormap_size - 1;
+       *red_max = *green_max = 0;
+       break;
+      default:
+       status = 0;
+    }
+    return status;
+}
+
+/****************************************************************************/
+/* Determine the appropriate color allocations of a gray scale.
+ *
+ * Keith Packard, MIT X Consortium
+ */
+
+static void
+gray_allocation(int n, unsigned long *red_max, unsigned long *green_max,
+               unsigned long *blue_max)
+{
+    *red_max = (n * 30) / 100;
+    *green_max = (n * 59) / 100;
+    *blue_max = (n * 11) / 100;
+    *green_max += ((n - 1) - (*red_max + *green_max + *blue_max));
+}
+
+/****************************************************************************/
+/* Determine an appropriate color allocation for the RGB_DEFAULT_MAP.
+ * If a map has less than a minimum number of definable entries, we do not
+ * produce an allocation for an RGB_DEFAULT_MAP.
+ *
+ * For 16 planes, the default colormap will have 27 each RGB; for 12 planes,
+ * 12 each.  For 8 planes, let n = the number of colormap entries, which may
+ * be 256 or 254.  Then, maximum red value = floor(cube_root(n - 125)) - 1.
+ * Maximum green and maximum blue values are identical to maximum red.
+ * This leaves at least 125 cells which clients can allocate.
+ *
+ * Return 0 if an allocation has been determined, non-zero otherwise.
+ */
+
+static int
+default_allocation(XVisualInfo *vinfo, unsigned long *red,
+                  unsigned long *green, unsigned long *blue)
+{
+    int                        ngrays;         /* number of gray cells */
+
+    switch (vinfo->class) {
+      case PseudoColor:
+
+       if (vinfo->colormap_size > 65000)
+           /* intended for displays with 16 planes */
+           *red = *green = *blue = (unsigned long) 27;
+       else if (vinfo->colormap_size > 4000)
+           /* intended for displays with 12 planes */
+           *red = *green = *blue = (unsigned long) 12;
+       else if (vinfo->colormap_size < 250)
+           return 0;
+       else
+           /* intended for displays with 8 planes */
+           *red = *green = *blue = (unsigned long)
+               (icbrt(vinfo->colormap_size - 125) - 1);
+       break;
+
+      case DirectColor:
+
+       if (vinfo->colormap_size < 10)
+           return 0;
+       *red = *green = *blue = vinfo->colormap_size / 2 - 1;
+       break;
+
+      case TrueColor:
+
+       *red = vinfo->red_mask / lowbit(vinfo->red_mask);
+       *green = vinfo->green_mask / lowbit(vinfo->green_mask);
+       *blue = vinfo->blue_mask / lowbit(vinfo->blue_mask);
+       break;
+
+      case GrayScale:
+
+       if (vinfo->colormap_size > 65000)
+           ngrays = 4096;
+       else if (vinfo->colormap_size > 4000)
+           ngrays = 512;
+       else if (vinfo->colormap_size < 250)
+           return 0;
+       else
+           ngrays = 12;
+       gray_allocation(ngrays, red, green, blue);
+       break;
+
+      default:
+       return 0;
+    }
+    return 1;
+}
+
+/****************************************************************************/
+/* Determine an appropriate color allocation for the RGB_BEST_MAP.
+ *
+ * For a DirectColor or TrueColor visual, the allocation is determined
+ * by the red_mask, green_mask, and blue_mask members of the visual info.
+ *
+ * Otherwise, if the colormap size is an integral power of 2, determine
+ * the allocation according to the number of bits given to each color,
+ * with green getting more than red, and red more than blue, if there
+ * are to be inequities in the distribution.  If the colormap size is
+ * not an integral power of 2, let n = the number of colormap entries.
+ * Then maximum red value = floor(cube_root(n)) - 1;
+ *     maximum blue value = floor(cube_root(n)) - 1;
+ *     maximum green value = n / ((# red values) * (# blue values)) - 1;
+ * Which, on a GPX, allows for 252 entries in the best map, out of 254
+ * defineable colormap entries.
+ */
+
+static void
+best_allocation(XVisualInfo *vinfo, unsigned long *red, unsigned long *green,
+               unsigned long *blue)
+{
+
+    if (vinfo->class == DirectColor || vinfo->class == TrueColor)
+    {
+       *red = vinfo->red_mask;
+       while ((*red & 01) == 0)
+           *red >>= 1;
+       *green = vinfo->green_mask;
+       while ((*green & 01) == 0)
+           *green >>=1;
+       *blue = vinfo->blue_mask;
+       while ((*blue & 01) == 0)
+           *blue >>= 1;
+    }
+    else
+    {
+       register int bits, n;
+
+       /* Determine n such that n is the least integral power of 2 which is
+        * greater than or equal to the number of entries in the colormap.
+         */
+       n = 1;
+       bits = 0;
+       while (vinfo->colormap_size > n)
+       {
+           n = n << 1;
+           bits++;
+       }
+
+       /* If the number of entries in the colormap is a power of 2, determine
+        * the allocation by "dealing" the bits, first to green, then red, then
+        * blue.  If not, find the maximum integral red, green, and blue values
+        * which, when multiplied together, do not exceed the number of
+
+        * colormap entries.
+        */
+       if (n == vinfo->colormap_size)
+       {
+           register int r, g, b;
+           b = bits / 3;
+           g = b + ((bits % 3) ? 1 : 0);
+           r = b + (((bits % 3) == 2) ? 1 : 0);
+           *red = 1 << r;
+           *green = 1 << g;
+           *blue = 1 << b;
+       }
+       else
+       {
+           *red = icbrt_with_bits(vinfo->colormap_size, bits);
+           *blue = *red;
+           *green = (vinfo->colormap_size / ((*red) * (*blue)));
+       }
+       (*red)--;
+       (*green)--;
+       (*blue)--;
+    }
+    return;
+}
+
+/*
+ * integer cube roots by Newton's method
+ *
+ * Stephen Gildea, MIT X Consortium, July 1991
+ */
+
+static int
+icbrt(int a)
+{
+    register int bits = 0;
+    register unsigned n = a;
+
+    while (n)
+    {
+       bits++;
+       n >>= 1;
+    }
+    return icbrt_with_bits(a, bits);
+}
+
+
+static int
+icbrt_with_bits(int a, int bits)
+     /* bits - log 2 of a */
+{
+    return icbrt_with_guess(a, a>>2*bits/3);
+}
+
+#ifdef _X_ROOT_STATS
+int icbrt_loopcount;
+#endif
+
+/* Newton's Method:  x_n+1 = x_n - ( f(x_n) / f'(x_n) ) */
+
+/* for cube roots, x^3 - a = 0,  x_new = x - 1/3 (x - a/x^2) */
+
+/*
+ * Quick and dirty cube roots.  Nothing fancy here, just Newton's method.
+ * Only works for positive integers (since that's all we need).
+ * We actually return floor(cbrt(a)) because that's what we need here, too.
+ */
+
+static int
+icbrt_with_guess(int a, int guess)
+{
+    register int delta;
+
+#ifdef _X_ROOT_STATS
+    icbrt_loopcount = 0;
+#endif
+    if (a <= 0)
+       return 0;
+    if (guess < 1)
+       guess = 1;
+
+    do {
+#ifdef _X_ROOT_STATS
+       icbrt_loopcount++;
+#endif
+       delta = (guess - a/(guess*guess))/3;
+#if defined(DEBUG) && defined(_X_ROOT_STATS)
+       printf("pass %d: guess=%d, delta=%d\n", icbrt_loopcount, guess, delta);
+#endif
+       guess -= delta;
+    } while (delta != 0);
+
+    if (guess*guess*guess > a)
+       guess--;
+
+    return guess;
+}
diff --git a/src/CrCmap.c b/src/CrCmap.c
new file mode 100644 (file)
index 0000000..9cb5c81
--- /dev/null
@@ -0,0 +1,534 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author:  Donna Converse, MIT X Consortium
+ */
+
+/*
+ * CreateCmap.c - given a standard colormap description, make the map.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xmu/StdCmap.h>
+
+/*
+ * Prototypes
+ */
+/* allocate entire map Read Only */
+static int ROmap(Display*, Colormap, unsigned long[], int, int);
+
+/* allocate a cell, prefer Read Only */
+static Status ROorRWcell(Display*, Colormap, unsigned long[], int,
+                        XColor*, unsigned long);
+
+/* allocate a cell Read Write */
+static Status RWcell(Display*, Colormap, XColor*, XColor*, unsigned long*);
+
+/* for quicksort */
+static int compare(_Xconst void*, _Xconst void*);
+
+/* find contiguous sequence of cells */
+static Status contiguous(unsigned long[], int, int, unsigned long, int*, int*);
+
+/* frees resources before quitting */
+static void free_cells(Display*, Colormap, unsigned long[], int, int);
+
+/* create a map in a RO visual type */
+static Status readonly_map(Display*, XVisualInfo*, XStandardColormap*);
+
+/* create a map in a RW visual type */
+static Status readwrite_map(Display*, XVisualInfo*, XStandardColormap*);
+
+#define lowbit(x) ((x) & (~(x) + 1))
+#define TRUEMATCH(mult,max,mask) \
+    (colormap->max * colormap->mult <= vinfo->mask && \
+     lowbit(vinfo->mask) == colormap->mult)
+
+/*
+ * To create any one colormap which is described by an XStandardColormap
+ * structure, use XmuCreateColormap().
+ *
+ * Return 0 on failure, non-zero on success.
+ * Resources created by this function are not made permanent.
+ * No argument error checking is provided.  Use at your own risk.
+ *
+ * All colormaps are created with read only allocations, with the exception
+ * of read only allocations of colors in the default map or otherwise
+ * which fail to return the expected pixel value, and these are individually
+ * defined as read/write allocations.  This is done so that all the cells
+ * defined in the default map are contiguous, for use in image processing.
+ * This typically happens with White and Black in the default map.
+ *
+ * Colormaps of static visuals are considered to be successfully created if
+ * the map of the static visual matches the definition given in the
+ * standard colormap structure.
+ */
+
+Status
+XmuCreateColormap(Display *dpy, XStandardColormap *colormap)
+     /* dpy     - specifies the connection under which the map is created
+      * colormap - specifies the map to be created, and returns, particularly
+      *                   if the map is created as a subset of the default colormap
+      *                   of the screen, the base_pixel of the map.
+                                        */
+{
+    XVisualInfo                vinfo_template; /* template visual information */
+    XVisualInfo                *vinfo;         /* matching visual information */
+    XVisualInfo                *vpointer;      /* for freeing the entire list */
+    long               vinfo_mask;     /* specifies the visual mask value */
+    int                n;              /* number of matching visuals */
+    int                        status;
+
+    vinfo_template.visualid = colormap->visualid;
+    vinfo_mask = VisualIDMask;
+    if ((vinfo = XGetVisualInfo(dpy, vinfo_mask, &vinfo_template, &n)) == NULL)
+       return 0;
+
+    /* A visual id may be valid on multiple screens.  Also, there may
+     * be multiple visuals with identical visual ids at different depths.
+     * If the colormap is the Default Colormap, use the Default Visual.
+     * Otherwise, arbitrarily, use the deepest visual.
+     */
+    vpointer = vinfo;
+    if (n > 1)
+    {
+       register int    i;
+       register int    screen_number;
+       Bool            def_cmap;
+
+       def_cmap = False;
+       for (screen_number = ScreenCount(dpy); --screen_number >= 0; )
+           if (colormap->colormap == DefaultColormap(dpy, screen_number)) {
+               def_cmap = True;
+               break;
+           }
+
+       if (def_cmap) {
+           for (i=0; i < n; i++, vinfo++) {
+               if (vinfo->visual == DefaultVisual(dpy, screen_number))
+                       break;
+           }
+       } else {
+           int                 maxdepth = 0;
+           XVisualInfo         *v = NULL;
+
+           for (i=0; i < n; i++, vinfo++)
+               if (vinfo->depth > maxdepth) {
+                   maxdepth = vinfo->depth;
+                   v = vinfo;
+               }
+           vinfo = v;
+       }
+    }
+
+    if (vinfo->class == PseudoColor || vinfo->class == DirectColor ||
+       vinfo->class == GrayScale)
+       status = readwrite_map(dpy, vinfo, colormap);
+    else if (vinfo->class == TrueColor)
+       status = TRUEMATCH(red_mult, red_max, red_mask) &&
+                TRUEMATCH(green_mult, green_max, green_mask) &&
+                TRUEMATCH(blue_mult, blue_max, blue_mask);
+    else
+       status = readonly_map(dpy, vinfo, colormap);
+
+    XFree((char *) vpointer);
+    return status;
+}
+
+/****************************************************************************/
+static Status
+readwrite_map(Display *dpy, XVisualInfo *vinfo, XStandardColormap *colormap)
+{
+    register unsigned long i, n;       /* index counters */
+    unsigned long      ncolors;        /* number of colors to be defined */
+    int                        npixels;        /* number of pixels allocated R/W */
+    int                        first_index;    /* first index of pixels to use */
+    int                        remainder;      /* first index of remainder */
+    XColor             color;          /* the definition of a color */
+    unsigned long      *pixels;        /* array of colormap pixels */
+    unsigned long      delta;
+
+
+    /* Determine ncolors, the number of colors to be defined.
+     * Insure that 1 < ncolors <= the colormap size.
+     */
+    if (vinfo->class == DirectColor) {
+       ncolors = colormap->red_max;
+       if (colormap->green_max > ncolors)
+           ncolors = colormap->green_max;
+       if (colormap->blue_max > ncolors)
+           ncolors = colormap->blue_max;
+       ncolors++;
+       delta = lowbit(vinfo->red_mask) +
+               lowbit(vinfo->green_mask) +
+               lowbit(vinfo->blue_mask);
+    } else {
+       ncolors = colormap->red_max * colormap->red_mult +
+                 colormap->green_max * colormap->green_mult +
+                 colormap->blue_max * colormap->blue_mult + 1;
+       delta = 1;
+    }
+    if (ncolors <= 1 || (int) ncolors > vinfo->colormap_size)  return 0;
+
+    /* Allocate Read/Write as much of the colormap as we can possibly get.
+     * Then insure that the pixels we were allocated are given in
+     * monotonically increasing order, using a quicksort.  Next, insure
+     * that our allocation includes a subset of contiguous pixels at least
+     * as long as the number of colors to be defined.  Now we know that
+     * these conditions are met:
+     * 1) There are no free cells in the colormap.
+     *  2) We have a contiguous sequence of pixels, monotonically
+     *     increasing, of length >= the number of colors requested.
+     *
+     * One cell at a time, we will free, compute the next color value,
+     * then allocate read only.  This takes a long time.
+     * This is done to insure that cells are allocated read only in the
+     * contiguous order which we prefer.  If the server has a choice of
+     * cells to grant to an allocation request, the server may give us any
+     * cell, so that is why we do these slow gymnastics.
+     */
+
+    if ((pixels = (unsigned long *) calloc((unsigned) vinfo->colormap_size,
+                                     sizeof(unsigned long))) == NULL)
+       return 0;
+
+    if ((npixels = ROmap(dpy, colormap->colormap, pixels,
+                          vinfo->colormap_size, ncolors)) == 0) {
+       free((char *) pixels);
+       return 0;
+    }
+
+    qsort((char *) pixels, npixels, sizeof(unsigned long), compare);
+
+    if (!contiguous(pixels, npixels, ncolors, delta, &first_index, &remainder))
+    {
+       /* can't find enough contiguous cells, give up */
+       XFreeColors(dpy, colormap->colormap, pixels, npixels,
+                   (unsigned long) 0);
+       free((char *) pixels);
+       return 0;
+    }
+    colormap->base_pixel = pixels[first_index];
+
+    /* construct a gray map */
+    if (colormap->red_mult == 1 && colormap->green_mult == 1 &&
+       colormap->blue_mult == 1)
+       for (n=colormap->base_pixel, i=0; i < ncolors; i++, n += delta)
+       {
+           color.pixel = n;
+           color.blue = color.green = color.red =
+               (unsigned short) ((i * 65535) / (colormap->red_max +
+                                                colormap->green_max +
+                                                colormap->blue_max));
+
+           if (! ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
+                            first_index + i))
+               return 0;
+       }
+
+    /* construct a red ramp map */
+    else if (colormap->green_max == 0 && colormap->blue_max == 0)
+       for (n=colormap->base_pixel, i=0; i < ncolors; i++, n += delta)
+       {
+           color.pixel = n;
+           color.red = (unsigned short) ((i * 65535) / colormap->red_max);
+           color.green = color.blue = 0;
+
+           if (! ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
+                            first_index + i))
+               return 0;
+       }
+
+    /* construct a green ramp map */
+    else if (colormap->red_max == 0 && colormap->blue_max == 0)
+       for (n=colormap->base_pixel, i=0; i < ncolors; i++, n += delta)
+       {
+           color.pixel = n;
+           color.green = (unsigned short) ((i * 65535) / colormap->green_max);
+           color.red = color.blue = 0;
+
+           if (! ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
+                            first_index + i))
+               return 0;
+       }
+
+    /* construct a blue ramp map */
+    else if (colormap->red_max == 0 && colormap->green_max == 0)
+       for (n=colormap->base_pixel, i=0; i < ncolors; i++, n += delta)
+       {
+           color.pixel = n;
+           color.blue = (unsigned short) ((i * 65535) / colormap->blue_max);
+           color.red = color.green = 0;
+
+           if (! ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
+                            first_index + i))
+               return 0;
+       }
+
+    /* construct a standard red green blue cube map */
+    else
+    {
+#define calc(max,mult) (((n / colormap->mult) % \
+                        (colormap->max + 1)) * 65535) / colormap->max
+
+       for (n=0, i=0; i < ncolors; i++, n += delta)
+       {
+           color.pixel = n + colormap->base_pixel;
+           color.red = calc(red_max, red_mult);
+           color.green = calc(green_max, green_mult);
+           color.blue = calc(blue_max, blue_mult);
+           if (! ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
+                            first_index + i))
+               return 0;
+       }
+#undef calc
+    }
+    /* We have a read-only map defined.  Now free unused cells,
+     * first those occuring before the contiguous sequence begins,
+     * then any following the contiguous sequence.
+     */
+
+    if (first_index)
+       XFreeColors(dpy, colormap->colormap, pixels, first_index,
+                   (unsigned long) 0);
+    if (remainder)
+       XFreeColors(dpy, colormap->colormap,
+                   &(pixels[first_index + ncolors]), remainder,
+                   (unsigned long) 0);
+
+    free((char *) pixels);
+    return 1;
+}
+
+
+/****************************************************************************/
+static int
+ROmap(Display *dpy, Colormap cmap, unsigned long pixels[], int m, int n)
+     /*
+      * dpy    - the X server connection
+      * cmap   - specifies colormap ID
+      * pixels - returns pixel allocations
+      * m      - specifies colormap size
+      * n      - specifies number of colors
+      */
+{
+    register int       p;
+
+    /* first try to allocate the entire colormap */
+    if (XAllocColorCells(dpy, cmap, 1, (unsigned long *) NULL,
+                        (unsigned) 0, pixels, (unsigned) m))
+       return m;
+
+    /* Allocate all available cells in the colormap, using a binary
+     * algorithm to discover how many cells we can allocate in the colormap.
+     */
+    m--;
+    while (n <= m) {
+       p = n + ((m - n + 1) / 2);
+       if (XAllocColorCells(dpy, cmap, 1, (unsigned long *) NULL,
+                            (unsigned) 0, pixels, (unsigned) p)) {
+           if (p == m)
+               return p;
+           else {
+               XFreeColors(dpy, cmap, pixels, p, (unsigned long) 0);
+               n = p;
+           }
+       }
+       else
+           m = p - 1;
+    }
+    return 0;
+}
+
+
+/****************************************************************************/
+static Status
+contiguous(unsigned long pixels[], int npixels, int ncolors,
+          unsigned long delta, int *first, int *rem)
+     /* pixels - specifies allocated pixels
+      * npixels        - specifies count of alloc'd pixels
+      * ncolors - specifies needed sequence length
+      * delta  - between pixels
+      * first  - returns first index of sequence
+      * rem    - returns first index after sequence, or 0, if none follow
+      */
+{
+    register int i = 1;                /* walking index into the pixel array */
+    register int count = 1;    /* length of sequence discovered so far */
+
+    *first = 0;
+    if (npixels == ncolors) {
+       *rem = 0;
+       return 1;
+    }
+    *rem = npixels - 1;
+    while (count < ncolors && ncolors - count <= *rem)
+    {
+       if (pixels[i-1] + delta == pixels[i])
+           count++;
+       else {
+           count = 1;
+           *first = i;
+       }
+       i++;
+       (*rem)--;
+    }
+    if (count != ncolors)
+       return 0;
+    return 1;
+}
+
+
+/****************************************************************************/
+static Status
+ROorRWcell(Display *dpy, Colormap cmap, unsigned long pixels[],
+          int npixels, XColor *color, unsigned long p)
+{
+    unsigned long      pixel;
+    XColor             request;
+
+    /* Free the read/write allocation of one cell in the colormap.
+     * Request a read only allocation of one cell in the colormap.
+     * If the read only allocation cannot be granted, give up, because
+     * there must be no free cells in the colormap.
+     * If the read only allocation is granted, but gives us a cell which
+     * is not the one that we just freed, it is probably the case that
+     * we are trying allocate White or Black or some other color which
+     * already has a read-only allocation in the map.  So we try to
+     * allocate the previously freed cell with a read/write allocation,
+     * because we want contiguous cells for image processing algorithms.
+     */
+
+    pixel = color->pixel;
+    request.red = color->red;
+    request.green = color->green;
+    request.blue = color->blue;
+
+    XFreeColors(dpy, cmap, &pixel, 1, (unsigned long) 0);
+    if (! XAllocColor(dpy, cmap, color)
+       || (color->pixel != pixel &&
+           (!RWcell(dpy, cmap, color, &request, &pixel))))
+    {
+       free_cells(dpy, cmap, pixels, npixels, (int)p);
+       return 0;
+    }
+    return 1;
+}
+
+
+/****************************************************************************/
+static void
+free_cells(Display *dpy, Colormap cmap, unsigned long pixels[],
+          int npixels, int p)
+     /*
+      * pixels - to be freed
+      *        npixels - original number allocated
+      */
+{
+    /* One of the npixels allocated has already been freed.
+     * p is the index of the freed pixel.
+     * First free the pixels preceeding p, and there are p of them;
+     * then free the pixels following p, there are npixels - p - 1 of them.
+     */
+    XFreeColors(dpy, cmap, pixels, p, (unsigned long) 0);
+    XFreeColors(dpy, cmap, &(pixels[p+1]), npixels - p - 1, (unsigned long) 0);
+    free((char *) pixels);
+}
+
+
+/****************************************************************************/
+static Status
+RWcell(Display *dpy, Colormap cmap, XColor *color, XColor *request,
+       unsigned long *pixel)
+{
+    unsigned long      n = *pixel;
+
+    XFreeColors(dpy, cmap, &(color->pixel), 1, (unsigned long)0);
+    if (! XAllocColorCells(dpy, cmap, (Bool) 0, (unsigned long *) NULL,
+                          (unsigned) 0, pixel, (unsigned) 1))
+       return 0;
+    if (*pixel != n)
+    {
+       XFreeColors(dpy, cmap, pixel, 1, (unsigned long) 0);
+       return 0;
+    }
+    color->pixel = *pixel;
+    color->flags = DoRed | DoGreen | DoBlue;
+    color->red = request->red;
+    color->green = request->green;
+    color->blue = request->blue;
+    XStoreColors(dpy, cmap, color, 1);
+    return 1;
+}
+
+
+/****************************************************************************/
+static int
+compare(_Xconst void *e1, _Xconst void *e2)
+{
+  return ((int)(*(long *)e1 - *(long *)e2));
+}
+
+
+/****************************************************************************/
+static Status
+readonly_map(Display *dpy, XVisualInfo *vinfo, XStandardColormap *colormap)
+{
+    int                        i, last_pixel;
+    XColor             color;
+
+    last_pixel = (colormap->red_max + 1) * (colormap->green_max + 1) *
+       (colormap->blue_max + 1) + colormap->base_pixel - 1;
+
+    for(i=colormap->base_pixel; i <= last_pixel; i++) {
+
+       color.pixel = (unsigned long) i;
+       color.red = (unsigned short)
+           (((i/colormap->red_mult) * 65535) / colormap->red_max);
+
+       if (vinfo->class == StaticColor) {
+           color.green = (unsigned short)
+               ((((i/colormap->green_mult) % (colormap->green_max + 1)) *
+                 65535) / colormap->green_max);
+           color.blue = (unsigned short)
+               (((i%colormap->green_mult) * 65535) / colormap->blue_max);
+       }
+       else    /* vinfo->class == GrayScale, old style allocation XXX */
+           color.green = color.blue = color.red;
+
+       XAllocColor(dpy, colormap->colormap, &color);
+       if (color.pixel != (unsigned long) i)
+           return 0;
+    }
+    return 1;
+}
diff --git a/src/CrPixFBit.c b/src/CrPixFBit.c
new file mode 100644 (file)
index 0000000..9489a19
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * This file contains miscellaneous utility routines and is not part of the
+ * Xlib standard.
+ */
+
+/*
+ * Public entry points:
+ *
+ *     XmuCreatePixmapFromBitmap       make a pixmap from a bitmap
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xos.h>
+#include <X11/Xlib.h>
+#include <X11/Xmu/Drawing.h>
+
+Pixmap
+XmuCreatePixmapFromBitmap(Display *dpy, Drawable d, Pixmap bitmap,
+                         unsigned int width, unsigned int height,
+                         unsigned int depth,
+                         unsigned long fore, unsigned long back)
+     /*
+      * dpy            -       connection to X server
+      * d              -       drawable indicating screen
+      * bitmap         -       single plane pixmap
+      * width, height  -       dimensions of bitmap and pixmap
+      * depth          -       depth of pixmap to create
+      * fore, back     -       colors to use
+      */
+{
+    Pixmap pixmap;
+
+    pixmap = XCreatePixmap (dpy, d, width, height, depth);
+    if (pixmap != None) {
+       GC gc;
+       XGCValues xgcv;
+
+       xgcv.foreground = fore;
+       xgcv.background = back;
+       xgcv.graphics_exposures = False;
+
+       gc = XCreateGC (dpy, d,
+                       (GCForeground | GCBackground | GCGraphicsExposures),
+                       &xgcv);
+       if (gc) {
+           XCopyPlane (dpy, bitmap, pixmap, gc, 0, 0, width, height, 0, 0, 1);
+           XFreeGC (dpy, gc);
+       } else {
+           XFreePixmap (dpy, pixmap);
+           pixmap = None;
+       }
+    }
+    return pixmap;
+}
diff --git a/src/CursorName.c b/src/CursorName.c
new file mode 100644 (file)
index 0000000..635ae51
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xmu/CharSet.h>
+#include <X11/Xmu/CurUtil.h>
+#include <X11/cursorfont.h>
+#include <string.h>
+
+int
+XmuCursorNameToIndex(_Xconst char *name)
+{
+    static _Xconst struct _CursorName {
+       _Xconst char    *name;
+       unsigned int    shape;
+    } cursor_names[] = {
+                       {"x_cursor",            XC_X_cursor},
+                       {"arrow",               XC_arrow},
+                       {"based_arrow_down",    XC_based_arrow_down},
+                       {"based_arrow_up",      XC_based_arrow_up},
+                       {"boat",                XC_boat},
+                       {"bogosity",            XC_bogosity},
+                       {"bottom_left_corner",  XC_bottom_left_corner},
+                       {"bottom_right_corner", XC_bottom_right_corner},
+                       {"bottom_side",         XC_bottom_side},
+                       {"bottom_tee",          XC_bottom_tee},
+                       {"box_spiral",          XC_box_spiral},
+                       {"center_ptr",          XC_center_ptr},
+                       {"circle",              XC_circle},
+                       {"clock",               XC_clock},
+                       {"coffee_mug",          XC_coffee_mug},
+                       {"cross",               XC_cross},
+                       {"cross_reverse",       XC_cross_reverse},
+                       {"crosshair",           XC_crosshair},
+                       {"diamond_cross",       XC_diamond_cross},
+                       {"dot",                 XC_dot},
+                       {"dotbox",              XC_dotbox},
+                       {"double_arrow",        XC_double_arrow},
+                       {"draft_large",         XC_draft_large},
+                       {"draft_small",         XC_draft_small},
+                       {"draped_box",          XC_draped_box},
+                       {"exchange",            XC_exchange},
+                       {"fleur",               XC_fleur},
+                       {"gobbler",             XC_gobbler},
+                       {"gumby",               XC_gumby},
+                       {"hand1",               XC_hand1},
+                       {"hand2",               XC_hand2},
+                       {"heart",               XC_heart},
+                       {"icon",                XC_icon},
+                       {"iron_cross",          XC_iron_cross},
+                       {"left_ptr",            XC_left_ptr},
+                       {"left_side",           XC_left_side},
+                       {"left_tee",            XC_left_tee},
+                       {"leftbutton",          XC_leftbutton},
+                       {"ll_angle",            XC_ll_angle},
+                       {"lr_angle",            XC_lr_angle},
+                       {"man",                 XC_man},
+                       {"middlebutton",        XC_middlebutton},
+                       {"mouse",               XC_mouse},
+                       {"pencil",              XC_pencil},
+                       {"pirate",              XC_pirate},
+                       {"plus",                XC_plus},
+                       {"question_arrow",      XC_question_arrow},
+                       {"right_ptr",           XC_right_ptr},
+                       {"right_side",          XC_right_side},
+                       {"right_tee",           XC_right_tee},
+                       {"rightbutton",         XC_rightbutton},
+                       {"rtl_logo",            XC_rtl_logo},
+                       {"sailboat",            XC_sailboat},
+                       {"sb_down_arrow",       XC_sb_down_arrow},
+                       {"sb_h_double_arrow",   XC_sb_h_double_arrow},
+                       {"sb_left_arrow",       XC_sb_left_arrow},
+                       {"sb_right_arrow",      XC_sb_right_arrow},
+                       {"sb_up_arrow",         XC_sb_up_arrow},
+                       {"sb_v_double_arrow",   XC_sb_v_double_arrow},
+                       {"shuttle",             XC_shuttle},
+                       {"sizing",              XC_sizing},
+                       {"spider",              XC_spider},
+                       {"spraycan",            XC_spraycan},
+                       {"star",                XC_star},
+                       {"target",              XC_target},
+                       {"tcross",              XC_tcross},
+                       {"top_left_arrow",      XC_top_left_arrow},
+                       {"top_left_corner",     XC_top_left_corner},
+                       {"top_right_corner",    XC_top_right_corner},
+                       {"top_side",            XC_top_side},
+                       {"top_tee",             XC_top_tee},
+                       {"trek",                XC_trek},
+                       {"ul_angle",            XC_ul_angle},
+                       {"umbrella",            XC_umbrella},
+                       {"ur_angle",            XC_ur_angle},
+                       {"watch",               XC_watch},
+                       {"xterm",               XC_xterm},
+    };
+#define NUM_CURSOR_NAMES    (sizeof (cursor_names) / sizeof (cursor_names[0]))
+    register _Xconst struct _CursorName *table;
+    register int i;
+    char tmp[40];
+
+    if (strlen (name) >= sizeof tmp) return -1;
+    XmuCopyISOLatin1Lowered (tmp, name);
+
+    for (i=0, table=cursor_names; i < NUM_CURSOR_NAMES; i++, table++ ) {
+       if (strcmp(tmp, table->name) == 0) return table->shape;
+    }
+
+    return -1;
+}
+
+
+
+
+
diff --git a/src/CvtCache.c b/src/CvtCache.c
new file mode 100644 (file)
index 0000000..921b51a
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author:  Jim Fulton, MIT X Consortium
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Xlib.h>
+#include <X11/Xos.h>
+#include <X11/Xmu/CvtCache.h>
+#include <stdlib.h>
+
+/*
+ * Prototypes
+ */
+static int _CloseDisplay(XmuDisplayQueue*, XmuDisplayQueueEntry*);
+static int _FreeCCDQ(XmuDisplayQueue*);
+static void _InitializeCvtCache(XmuCvtCache*);
+
+/*
+ * Initialization
+ */
+static XmuDisplayQueue *dq = NULL;
+
+
+/*
+ * internal utility callbacks
+ */
+
+static int
+_FreeCCDQ(XmuDisplayQueue *q)
+{
+    XmuDQDestroy (dq, False);
+    dq = NULL;
+    return (0);
+}
+
+
+static int
+_CloseDisplay(XmuDisplayQueue *q, XmuDisplayQueueEntry *e)
+{
+    XmuCvtCache *c;
+
+    if (e && (c = (XmuCvtCache *)(e->data))) {
+       _XmuStringToBitmapFreeCache (c);
+       /* insert calls to free any cached memory */
+
+    }
+    return 0;
+}
+
+static void
+_InitializeCvtCache(register XmuCvtCache *c)
+{
+    _XmuStringToBitmapInitCache (c);
+    /* insert calls to init any cached memory */
+}
+
+
+/*
+ * XmuCCLookupDisplay - return the cache entry for the indicated display;
+ * initialize the cache if necessary
+ */
+XmuCvtCache *
+_XmuCCLookupDisplay(Display *dpy)
+{
+    XmuDisplayQueueEntry *e;
+
+    /*
+     * If no displays have been added before this, create the display queue.
+     */
+    if (!dq) {
+       dq = XmuDQCreate (_CloseDisplay, _FreeCCDQ, NULL);
+       if (!dq) return NULL;
+    }
+
+    /*
+     * See if the display is already there
+     */
+    e = XmuDQLookupDisplay (dq, dpy);  /* see if it's there */
+    if (!e) {                          /* else create it */
+       XmuCvtCache *c = (XmuCvtCache *) malloc (sizeof (XmuCvtCache));
+       if (!c) return NULL;
+
+       /*
+        * Add the display to the queue
+        */
+       e = XmuDQAddDisplay (dq, dpy, (XPointer) c);
+       if (!e) {
+           free ((char *) c);
+           return NULL;
+       }
+
+       /*
+        * initialize fields in cache
+        */
+       _InitializeCvtCache (c);
+    }
+
+    /*
+     * got it
+     */
+    return (XmuCvtCache *)(e->data);
+}
+
+
diff --git a/src/CvtStdSel.c b/src/CvtStdSel.c
new file mode 100644 (file)
index 0000000..141dfe8
--- /dev/null
@@ -0,0 +1,347 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * This file contains routines to handle common selection targets.
+ *
+ * Public entry points:
+ *
+ *     XmuConvertStandardSelection()   return a known selection
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef SYSVNET
+#include <interlan/il_types.h>
+#define __TYPES__              /* prevent #include <sys/types.h> in Xlib.h */
+#include <interlan/netdb.h>
+#include <interlan/socket.h>
+#endif /* SYSVNET */
+
+#include <X11/IntrinsicP.h>
+#include <X11/Xatom.h>
+#include <X11/ShellP.h>
+#ifdef XTHREADS
+#include <X11/Xthreads.h>
+#endif
+#include <stdio.h>
+
+#ifndef SYSVNET
+#ifdef WIN32
+#include <X11/Xwinsock.h>
+#define XOS_USE_MTSAFE_NETDBAPI
+#else
+#ifndef Lynx
+#include <sys/socket.h>
+#else
+#include <sys/types.h>
+#include <socket.h>
+#endif
+#define XOS_USE_XT_LOCKING
+#endif
+#define X_INCLUDE_NETDB_H
+#include <X11/Xos_r.h>
+#endif
+
+#include <X11/Xos.h>
+#include <stdlib.h>
+#include "Atoms.h"
+#include "StdSel.h"
+#include "SysUtil.h"
+#include <X11/Xfuncs.h>
+
+#ifndef OS_NAME
+#ifndef X_OS_FILE
+#ifdef SYSV                    /* keep separate until makedepend fixed */
+#define USE_UNAME
+#endif
+#ifdef SVR4
+#define USE_UNAME
+#endif
+#ifdef ultrix
+#define USE_UNAME
+#endif
+#ifdef CSRG_BASED
+#define USE_UNAME
+#endif
+#endif /*X_OS_FILE*/
+#ifdef USE_UNAME
+#include <sys/utsname.h>
+#endif
+#endif
+
+/*
+ * Prototypes
+ */
+static char *get_os_name(void);
+static Bool isApplicationShell(Widget);
+
+/*
+ * Implementation
+ */
+static char *
+get_os_name(void)
+{
+#ifdef OS_NAME
+       return XtNewString(OS_NAME);
+#else
+#if defined(X_OS_FILE) || defined(MOTD_FILE)
+       FILE *f = NULL;
+#endif
+
+#ifdef USE_UNAME
+       struct utsname utss;
+
+       if (uname (&utss) >= 0) {
+           char *os_name;
+           int len = strlen(utss.sysname) + 1;
+#ifndef hpux                           /* because of hostname length crock */
+           len += 2 + strlen(utss.release);
+#endif
+           os_name = XtMalloc (len);
+           strcpy (os_name, utss.sysname);
+#ifndef hpux
+           strcat (os_name, " ");
+           strcat (os_name, utss.release);
+#endif
+           return os_name;
+       }
+#endif
+
+#ifdef X_OS_FILE
+       f = fopen(X_OS_FILE, "r");
+       if (!f)
+#endif
+#ifdef MOTD_FILE
+              f = fopen(MOTD_FILE, "r");
+#endif
+#if defined(X_OS_FILE) || defined(MOTD_FILE)
+       if (f) {
+           char motd[512];
+           motd[0] = '\0';
+           (void) fgets(motd, 511, f);
+           fclose(f);
+           motd[511] = '\0';
+           if (motd[0] != '\0') {
+               int len = strlen(motd);
+               if (motd[len - 1] == '\n')
+                   motd[len - 1] = '\0';
+               return XtNewString(motd);
+           }
+       }
+#endif
+
+#ifdef sun
+       return XtNewString("SunOS");
+#else
+# if !defined(SYSV) && (defined(CSRG_BASED) || defined(unix))
+       return XtNewString("BSD");
+# else
+       return NULL;
+# endif
+#endif
+
+#endif /*OS_NAME*/
+}
+
+/* This is a trick/kludge.  To make shared libraries happier (linking
+ * against Xmu but not linking against Xt, and apparently even work
+ * as we desire on SVR4, we need to avoid an explicit data reference
+ * to applicationShellWidgetClass.  XtIsTopLevelShell is known
+ * (implementation dependent assumption!) to use a bit flag.  So we
+ * go that far.  Then, we test whether it is an applicationShellWidget
+ * class by looking for an explicit class name.  Seems pretty safe.
+ */
+static Bool
+isApplicationShell(Widget w)
+{
+    register WidgetClass c;
+
+    if (!XtIsTopLevelShell(w))
+       return False;
+    for (c = XtClass(w); c; c = c->core_class.superclass) {
+       if (!strcmp(c->core_class.class_name, "ApplicationShell"))
+           return True;
+    }
+    return False;
+}
+
+Boolean
+XmuConvertStandardSelection(Widget w, Time time, Atom *selection, Atom *target,
+                           Atom *type, XPointer *value,
+                           unsigned long *length, int *format)
+{
+    Display *d = XtDisplay(w);
+    if (*target == XA_TIMESTAMP(d)) {
+       *value = XtMalloc(4);
+       if (sizeof(long) == 4)
+           *(long*)*value = time;
+       else {
+           long temp = time;
+           (void) memmove((char*)*value, ((char*)&temp)+sizeof(long)-4, 4);
+       }
+       *type = XA_INTEGER;
+       *length = 1;
+       *format = 32;
+       return True;
+    }
+    if (*target == XA_HOSTNAME(d)) {
+       char hostname[1024];
+       hostname[0] = '\0';
+       *length = XmuGetHostname (hostname, sizeof hostname);
+       *value = XtNewString(hostname);
+       *type = XA_STRING;
+       *format = 8;
+       return True;
+    }
+#if defined(TCPCONN)
+    if (*target == XA_IP_ADDRESS(d)) {
+       char hostname[1024];
+#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
+       _Xgethostbynameparams hparams;
+#endif
+       struct hostent *hostp;
+
+       hostname[0] = '\0';
+       (void) XmuGetHostname (hostname, sizeof hostname);
+
+       if ((hostp = _XGethostbyname (hostname,hparams)) == NULL)
+           return False;
+
+       if (hostp->h_addrtype != AF_INET) return False;
+       *length = hostp->h_length;
+       *value = XtMalloc(*length);
+       (void) memmove (*value, hostp->h_addr, *length);
+       *type = XA_NET_ADDRESS(d);
+       *format = 8;
+       return True;
+    }
+#endif
+#ifdef DNETCONN
+    if (*target == XA_DECNET_ADDRESS(d)) {
+       return False;           /* XXX niy */
+    }
+#endif
+    if (*target == XA_USER(d)) {
+       char *name = (char*)getenv("USER");
+       if (name == NULL) return False;
+       *value = XtNewString(name);
+       *type = XA_STRING;
+       *length = strlen(name);
+       *format = 8;
+       return True;
+    }
+    if (*target == XA_CLASS(d)) {
+       Widget parent = XtParent(w);
+       char *class;
+       int len;
+       while (parent != NULL && !isApplicationShell(w)) {
+           w = parent;
+           parent = XtParent(w);
+       }
+       if (isApplicationShell(w))
+           class = ((ApplicationShellWidget) w)->application.class;
+       else
+           class = XtClass(w)->core_class.class_name;
+       *length = (len=strlen(w->core.name)) + strlen(class) + 2;
+       *value = XtMalloc(*length);
+       strcpy( (char*)*value, w->core.name );
+       strcpy( (char*)*value+len+1, class );
+       *type = XA_STRING;
+       *format = 8;
+       return True;
+    }
+    if (*target == XA_NAME(d)) {
+       Widget parent = XtParent(w);
+
+       while (parent != NULL && !XtIsWMShell(w)) {
+           w = parent;
+           parent = XtParent(w);
+       }
+       if (!XtIsWMShell(w)) return False;
+       *value = XtNewString( ((WMShellWidget) w)->wm.title );
+       *length = strlen(*value);
+       *type = XA_STRING;
+       *format = 8;
+       return True;
+    }
+    if (*target == XA_CLIENT_WINDOW(d)) {
+       Widget parent = XtParent(w);
+       while (parent != NULL) {
+           w = parent;
+           parent = XtParent(w);
+       }
+       *value = XtMalloc(sizeof(Window));
+       *(Window*)*value = w->core.window;
+       *type = XA_WINDOW;
+       *length = 1;
+       *format = 32;
+       return True;
+    }
+    if (*target == XA_OWNER_OS(d)) {
+       *value = get_os_name();
+       if (*value == NULL) return False;
+       *type = XA_STRING;
+       *length = strlen(*value);
+       *format = 8;
+       return True;
+    }
+    if (*target == XA_TARGETS(d)) {
+#if defined(unix) && defined(DNETCONN)
+#  define NUM_TARGETS 9
+#else
+#  if defined(unix) || defined(DNETCONN)
+#    define NUM_TARGETS 8
+#  else
+#    define NUM_TARGETS 7
+#  endif
+#endif
+       Atom* std_targets = (Atom*)XtMalloc(NUM_TARGETS*sizeof(Atom));
+       int i = 0;
+       std_targets[i++] = XA_TIMESTAMP(d);
+       std_targets[i++] = XA_HOSTNAME(d);
+       std_targets[i++] = XA_IP_ADDRESS(d);
+       std_targets[i++] = XA_USER(d);
+       std_targets[i++] = XA_CLASS(d);
+       std_targets[i++] = XA_NAME(d);
+       std_targets[i++] = XA_CLIENT_WINDOW(d);
+#ifdef unix
+       std_targets[i++] = XA_OWNER_OS(d);
+#endif
+#ifdef DNETCONN
+       std_targets[i++] = XA_DECNET_ADDRESS(d);
+#endif
+       *value = (XPointer)std_targets;
+       *type = XA_ATOM;
+       *length = NUM_TARGETS;
+       *format = 32;
+       return True;
+    }
+    /* else */
+    return False;
+}
diff --git a/src/DefErrMsg.c b/src/DefErrMsg.c
new file mode 100644 (file)
index 0000000..3cb914a
--- /dev/null
@@ -0,0 +1,169 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Xlibint.h>
+#include <X11/Xproto.h>
+#include <X11/Xmu/Error.h>
+#include <X11/Xmu/SysUtil.h>
+
+/*
+ * XmuPrintDefaultErrorMessage - print a nice error that looks like the usual
+ * message.  Returns 1 if the caller should consider exitting else 0.
+ */
+int
+XmuPrintDefaultErrorMessage(Display *dpy, XErrorEvent *event, FILE *fp)
+{
+    char buffer[BUFSIZ];
+    char mesg[BUFSIZ];
+    char number[32];
+    _Xconst char *mtype = "XlibMessage";
+    register _XExtension *ext = (_XExtension *)NULL;
+    _XExtension *bext = (_XExtension *)NULL;
+    XGetErrorText(dpy, event->error_code, buffer, BUFSIZ);
+    XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ);
+    (void) fprintf(fp, "%s:  %s\n  ", mesg, buffer);
+    XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d",
+       mesg, BUFSIZ);
+    (void) fprintf(fp, mesg, event->request_code);
+    if (event->request_code < 128) {
+       XmuSnprintf(number, sizeof(number), "%d", event->request_code);
+       XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ);
+    } else {
+       /* XXX this is non-portable */
+       for (ext = dpy->ext_procs;
+            ext && (ext->codes.major_opcode != event->request_code);
+            ext = ext->next)
+         ;
+       if (ext)
+         XmuSnprintf(buffer, sizeof(buffer), "%s", ext->name);
+       else
+           buffer[0] = '\0';
+    }
+    (void) fprintf(fp, " (%s)", buffer);
+    fputs("\n  ", fp);
+    if (event->request_code >= 128) {
+       XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d",
+                             mesg, BUFSIZ);
+       (void) fprintf(fp, mesg, event->minor_code);
+       if (ext) {
+           XmuSnprintf(mesg, sizeof(mesg),
+                       "%s.%d", ext->name, event->minor_code);
+           XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ);
+           (void) fprintf(fp, " (%s)", buffer);
+       }
+       fputs("\n  ", fp);
+    }
+    if (event->error_code >= 128) {
+       /* kludge, try to find the extension that caused it */
+       buffer[0] = '\0';
+       for (ext = dpy->ext_procs; ext; ext = ext->next) {
+           if (ext->error_string)
+               (*ext->error_string)(dpy, event->error_code, &ext->codes,
+                                    buffer, BUFSIZ);
+           if (buffer[0]) {
+               bext = ext;
+               break;
+           }
+           if (ext->codes.first_error &&
+               ext->codes.first_error < event->error_code &&
+               (!bext || ext->codes.first_error > bext->codes.first_error))
+               bext = ext;
+       }
+       if (bext)
+           XmuSnprintf(buffer, sizeof(buffer), "%s.%d", bext->name,
+                       event->error_code - bext->codes.first_error);
+       else
+           strcpy(buffer, "Value");
+       XGetErrorDatabaseText(dpy, mtype, buffer, "", mesg, BUFSIZ);
+       if (mesg[0]) {
+           fputs("  ", fp);
+           (void) fprintf(fp, mesg, event->resourceid);
+           fputs("\n", fp);
+       }
+       /* let extensions try to print the values */
+       for (ext = dpy->ext_procs; ext; ext = ext->next) {
+           if (ext->error_values)
+               (*ext->error_values)(dpy, event, fp);
+       }
+    } else if ((event->error_code == BadWindow) ||
+              (event->error_code == BadPixmap) ||
+              (event->error_code == BadCursor) ||
+              (event->error_code == BadFont) ||
+              (event->error_code == BadDrawable) ||
+              (event->error_code == BadColor) ||
+              (event->error_code == BadGC) ||
+              (event->error_code == BadIDChoice) ||
+              (event->error_code == BadValue) ||
+              (event->error_code == BadAtom)) {
+       if (event->error_code == BadValue)
+           XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x",
+                                 mesg, BUFSIZ);
+       else if (event->error_code == BadAtom)
+           XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x",
+                                 mesg, BUFSIZ);
+       else
+           XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x",
+                                 mesg, BUFSIZ);
+       (void) fprintf(fp, mesg, event->resourceid);
+       fputs("\n  ", fp);
+    }
+    XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d",
+       mesg, BUFSIZ);
+    (void) fprintf(fp, mesg, event->serial);
+    fputs("\n  ", fp);
+    XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d",
+       mesg, BUFSIZ);
+    (void) fprintf(fp, mesg, NextRequest(dpy)-1);
+    fputs("\n", fp);
+    if (event->error_code == BadImplementation) return 0;
+    return 1;
+}
+
+
+/*
+ * XmuSimpleErrorHandler - ignore errors for XQueryTree, XGetWindowAttributes,
+ * and XGetGeometry; print a message for everything else.  In all case, do
+ * not exit.
+ */
+int
+XmuSimpleErrorHandler(Display *dpy, XErrorEvent *errorp)
+{
+    switch (errorp->request_code) {
+      case X_QueryTree:
+      case X_GetWindowAttributes:
+        if (errorp->error_code == BadWindow) return 0;
+       break;
+      case X_GetGeometry:
+       if (errorp->error_code == BadDrawable) return 0;
+       break;
+    }
+    /* got a "real" X error */
+    return XmuPrintDefaultErrorMessage (dpy, errorp, stderr);
+}
diff --git a/src/DelCmap.c b/src/DelCmap.c
new file mode 100644 (file)
index 0000000..462c812
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author:  Donna Converse, MIT X Consortium
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xmu/StdCmap.h>
+
+/* To remove any standard colormap property, use XmuDeleteStandardColormap().
+ * XmuDeleteStandardColormap() will remove the specified property from the
+ * specified screen, releasing any resources used by the colormap(s) of the
+ * property if possible.
+ */
+
+void
+XmuDeleteStandardColormap(Display *dpy, int screen, Atom property)
+     /* dpy;           - specifies the X server to connect to
+      * screen         - specifies the screen of the display
+      * property       - specifies the standard colormap property
+      */
+{
+    XStandardColormap  *stdcmaps, *s;
+    int                        count = 0;
+
+    if (XGetRGBColormaps(dpy, RootWindow(dpy, screen), &stdcmaps, &count,
+                        property))
+    {
+       for (s=stdcmaps; count > 0; count--, s++) {
+           if ((s->killid == ReleaseByFreeingColormap) &&
+               (s->colormap != None) &&
+               (s->colormap != DefaultColormap(dpy, screen)))
+               XFreeColormap(dpy, s->colormap);
+           else if (s->killid != None)
+               XKillClient(dpy, s->killid);
+       }
+       XDeleteProperty(dpy, RootWindow(dpy, screen), property);
+       XFree((char *) stdcmaps);
+       XSync(dpy, False);
+    }
+}
+
diff --git a/src/DisplayQue.c b/src/DisplayQue.c
new file mode 100644 (file)
index 0000000..7eea9f2
--- /dev/null
@@ -0,0 +1,191 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author:  Jim Fulton, MIT X Consortium
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Xlib.h>
+#include <stdlib.h>
+#include <X11/Xmu/DisplayQue.h>
+
+/*
+ * Prototypes
+ */
+static int _DQCloseDisplay(Display*, XPointer);
+
+#define CallCloseCallback(q,e) (void) (*((q)->closefunc)) ((q), (e))
+#define CallFreeCallback(q) (void) (*((q)->freefunc)) ((q))
+
+/*
+ * XmuDQCreate - create a display queue
+ */
+XmuDisplayQueue *
+XmuDQCreate(XmuCloseDisplayQueueProc closefunc,
+           XmuFreeDisplayQueueProc freefunc,
+           XPointer data)
+{
+    XmuDisplayQueue *q = (XmuDisplayQueue *) malloc (sizeof (XmuDisplayQueue));
+    if (q) {
+       q->nentries = 0;
+       q->head = q->tail = NULL;
+       q->closefunc = closefunc;
+       q->freefunc = freefunc;
+       q->data = data;
+    }
+    return q;
+}
+
+
+/*
+ * XmuDQDestroy - free all storage associated with this display queue,
+ * optionally invoking the close callbacks.
+ */
+
+Bool
+XmuDQDestroy(XmuDisplayQueue *q, Bool docallbacks)
+{
+    XmuDisplayQueueEntry *e = q->head;
+
+    while (e) {
+       XmuDisplayQueueEntry *nexte = e->next;
+       if (docallbacks && q->closefunc) CallCloseCallback (q, e);
+       free ((char *) e);
+       e = nexte;
+    }
+    free ((char *) q);
+    return True;
+}
+
+
+/*
+ * XmuDQLookupDisplay - finds the indicated display on the given queue
+ */
+XmuDisplayQueueEntry *
+XmuDQLookupDisplay(XmuDisplayQueue *q, Display *dpy)
+{
+    XmuDisplayQueueEntry *e;
+
+    for (e = q->head; e; e = e->next) {
+       if (e->display == dpy) return e;
+    }
+    return NULL;
+}
+
+
+/*
+ * XmuDQAddDisplay - add the specified display to the queue; set data as a
+ * convenience.  Does not ensure that dpy hasn't already been added.
+ */
+XmuDisplayQueueEntry *
+XmuDQAddDisplay(XmuDisplayQueue *q, Display *dpy, XPointer data)
+{
+    XmuDisplayQueueEntry *e;
+
+    if (!(e = (XmuDisplayQueueEntry *) malloc (sizeof (XmuDisplayQueueEntry)))) {
+       return NULL;
+    }
+    if (!(e->closehook = XmuAddCloseDisplayHook (dpy, _DQCloseDisplay,
+                                                (XPointer) q))) {
+       free ((char *) e);
+       return NULL;
+    }
+
+    e->display = dpy;
+    e->next = NULL;
+    e->data = data;
+
+    if (q->tail) {
+       q->tail->next = e;
+       e->prev = q->tail;
+    } else {
+       q->head = e;
+       e->prev = NULL;
+    }
+    q->tail = e;
+    q->nentries++;
+    return e;
+}
+
+
+/*
+ * XmuDQRemoveDisplay - remove the specified display from the queue
+ */
+Bool
+XmuDQRemoveDisplay(XmuDisplayQueue *q, Display *dpy)
+{
+    XmuDisplayQueueEntry *e;
+
+    for (e = q->head; e; e = e->next) {
+       if (e->display == dpy) {
+           if (q->head == e)
+             q->head = e->next;        /* if at head, then bump head */
+           else
+             e->prev->next = e->next;  /* else splice out */
+           if (q->tail == e)
+             q->tail = e->prev;        /* if at tail, then bump tail */
+           else
+             e->next->prev = e->prev;  /* else splice out */
+           (void) XmuRemoveCloseDisplayHook (dpy, e->closehook,
+                                             _DQCloseDisplay, (XPointer) q);
+           free ((char *) e);
+           q->nentries--;
+           return True;
+       }
+    }
+    return False;
+}
+
+
+/*****************************************************************************
+ *                            private functions                             *
+ *****************************************************************************/
+
+/*
+ * _DQCloseDisplay - upcalled from CloseHook to notify this queue; remove the
+ * display when finished
+ */
+static int
+_DQCloseDisplay(Display *dpy, XPointer arg)
+{
+    XmuDisplayQueue *q = (XmuDisplayQueue *) arg;
+    XmuDisplayQueueEntry *e;
+
+    for (e = q->head; e; e = e->next) {
+       if (e->display == dpy) {
+           if (q->closefunc) CallCloseCallback (q, e);
+           (void) XmuDQRemoveDisplay (q, dpy);
+           if (q->nentries == 0 && q->freefunc) CallFreeCallback (q);
+           return 1;
+       }
+    }
+
+    return 0;
+}
diff --git a/src/Distinct.c b/src/Distinct.c
new file mode 100644 (file)
index 0000000..9d31494
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+
+Copyright 1990, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author:  Keith Packard, MIT X Consortium
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xlib.h>
+#include <stdlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xmu/StdCmap.h>
+
+/*
+ * Distinguishable colors routine.  Determines if two colors are
+ * distinguishable or not.  Somewhat arbitrary meaning.
+ */
+
+#define MIN_DISTINGUISH        10000.0
+
+Bool
+XmuDistinguishableColors(XColor        *colors, int count)
+{
+    double         deltaRed, deltaGreen, deltaBlue;
+    double         dist;
+    int                    i, j;
+
+    for (i = 0; i < count - 1; i++)
+       for (j = i + 1; j < count; j++)
+       {
+           deltaRed = (double)colors[i].red - (double)colors[j].red;
+           deltaGreen = (double)colors[i].green - (double)colors[j].green;
+           deltaBlue = (double)colors[i].blue - (double)colors[j].blue;
+           dist = deltaRed * deltaRed +
+                  deltaGreen * deltaGreen +
+                  deltaBlue * deltaBlue;
+           if (dist <= MIN_DISTINGUISH * MIN_DISTINGUISH)
+               return False;
+       }
+    return True;
+}
+
+Bool
+XmuDistinguishablePixels(Display *dpy, Colormap cmap,
+                        unsigned long *pixels, int  count)
+{
+    XColor  *defs;
+    int            i, j;
+    Bool    ret;
+
+    for (i = 0; i < count - 1; i++)
+       for (j = i + 1; j < count; j++)
+           if (pixels[i] == pixels[j])
+               return False;
+    defs = (XColor *) malloc (count * sizeof (XColor));
+    if (!defs)
+       return False;
+    for (i = 0; i < count; i++)
+       defs[i].pixel = pixels[i];
+    XQueryColors (dpy, cmap, defs, count);
+    ret = XmuDistinguishableColors (defs, count);
+    free ((char *) defs);
+    return ret;
+}
diff --git a/src/DrRndRect.c b/src/DrRndRect.c
new file mode 100644 (file)
index 0000000..1373de0
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * XmuDrawRoundedRectangle, XmuFillRoundedRectangle
+ *
+ * Draw/Fill a rounded rectangle, where x, y, w, h are the dimensions of
+ * the overall rectangle, and ew and eh are the sizes of a bounding box
+ * that the corners are drawn inside of.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xlib.h>
+#include <X11/Xmu/Drawing.h>
+
+void
+XmuDrawRoundedRectangle(Display *dpy, Drawable draw, GC gc,
+                       int x, int y, int w, int h, int ew, int eh)
+{
+       XArc    arcs[8];
+  int ew2, eh2;
+
+  if ((ew2 = (ew << 1)) > w)
+    ew2 = ew = 0;
+  if ((eh2 = (eh << 1)) > h)
+    eh2 = eh = 0;
+
+       arcs[0].x = x;
+       arcs[0].y = y;
+  arcs[0].width = ew2;
+  arcs[0].height = eh2;
+  arcs[0].angle1 = 180 * 64;
+  arcs[0].angle2 = -90 * 64;
+
+       arcs[1].x = x + ew;
+       arcs[1].y = y;
+  arcs[1].width = w - ew2;
+       arcs[1].height = 0;
+  arcs[1].angle1 = 180 * 64;
+  arcs[1].angle2 = -180 * 64;
+
+  arcs[2].x = x + w - ew2;
+       arcs[2].y = y;
+  arcs[2].width = ew2;
+  arcs[2].height = eh2;
+  arcs[2].angle1 = 90 * 64;
+  arcs[2].angle2 = -90 * 64;
+
+       arcs[3].x = x + w;
+       arcs[3].y = y + eh;
+       arcs[3].width = 0;
+  arcs[3].height = h - eh2;
+       arcs[3].angle1 = 90 * 64;
+  arcs[3].angle2 = -180 * 64;
+
+  arcs[4].x = x + w - ew2;
+  arcs[4].y = y + h - eh2;
+  arcs[4].width = ew2;
+  arcs[4].height = eh2;
+       arcs[4].angle1 = 0;
+  arcs[4].angle2 = -90 * 64;
+
+       arcs[5].x = x + ew;
+       arcs[5].y = y + h;
+  arcs[5].width = w - ew2;
+       arcs[5].height = 0;
+       arcs[5].angle1 = 0;
+  arcs[5].angle2 = -180 * 64;
+
+       arcs[6].x = x;
+  arcs[6].y = y + h - eh2;
+  arcs[6].width = ew2;
+  arcs[6].height = eh2;
+  arcs[6].angle1 = 270 * 64;
+  arcs[6].angle2 = -90 * 64;
+
+       arcs[7].x = x;
+       arcs[7].y = y + eh;
+       arcs[7].width = 0;
+  arcs[7].height = h - eh2;
+  arcs[7].angle1 = 270 * 64;
+  arcs[7].angle2 = -180 * 64;
+
+  XDrawArcs(dpy, draw, gc, arcs, 8);
+}
+
+void
+XmuFillRoundedRectangle(Display *dpy, Drawable draw, GC gc,
+                       int x, int y, int w, int h, int ew, int eh)
+{
+       XArc    arcs[4];
+       XRectangle rects[3];
+       XGCValues vals;
+  int ew2, eh2;
+
+       XGetGCValues(dpy, gc, GCArcMode, &vals);
+       if (vals.arc_mode != ArcPieSlice)
+           XSetArcMode(dpy, gc, ArcPieSlice);
+
+  if ((ew2 = (ew << 1)) > w)
+    ew2 = ew = 0;
+  if ((eh2 = (eh << 1)) > h)
+    eh2 = eh = 0;
+
+       arcs[0].x = x;
+       arcs[0].y = y;
+  arcs[0].width = ew2;
+  arcs[0].height = eh2;
+  arcs[0].angle1 = 180 * 64;
+  arcs[0].angle2 = -90 * 64;
+
+  arcs[1].x = x + w - ew2 - 1;
+       arcs[1].y = y;
+  arcs[1].width = ew2;
+  arcs[1].height = eh2;
+  arcs[1].angle1 = 90 * 64;
+  arcs[1].angle2 = -90 * 64;
+
+  arcs[2].x = x + w - ew2 - 1;
+  arcs[2].y = y + h - eh2 - 1;
+  arcs[2].width = ew2;
+  arcs[2].height = eh2;
+       arcs[2].angle1 = 0;
+  arcs[2].angle2 = -90 * 64;
+
+       arcs[3].x = x;
+  arcs[3].y = y + h - eh2 - 1;
+  arcs[3].width = ew2;
+  arcs[3].height = eh2;
+  arcs[3].angle1 = 270 * 64;
+  arcs[3].angle2 = -90 * 64;
+
+  XFillArcs(dpy, draw, gc, arcs, 4);
+
+       rects[0].x = x + ew;
+       rects[0].y = y;
+  rects[0].width = w - ew2;
+       rects[0].height = h;
+
+       rects[1].x = x;
+       rects[1].y = y + eh;
+       rects[1].width = ew;
+  rects[1].height = h - eh2;
+
+       rects[2].x = x + w - ew;
+       rects[2].y = y + eh;
+       rects[2].width = ew;
+  rects[2].height = h - eh2;
+
+  XFillRectangles(dpy, draw, gc, rects, 3);
+
+       if (vals.arc_mode != ArcPieSlice)
+           XSetArcMode(dpy, gc, vals.arc_mode);
+}
diff --git a/src/DrawLogo.c b/src/DrawLogo.c
new file mode 100644 (file)
index 0000000..21dbe38
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xlib.h>
+#include <X11/Xmu/Drawing.h>
+
+/*
+ *  Draw the "official" X Window System Logo, designed by Danny Chong
+ *
+ *  Written by Ollie Jones, Apollo Computer
+ *
+ *  Does some fancy stuff to make the logo look acceptable even
+ *  if it is tiny.  Also makes the various linear elements of
+ *  the logo line up as well as possible considering rasterization.
+ */
+void
+XmuDrawLogo(Display *dpy, Drawable drawable, GC gcFore, GC gcBack,
+           int x, int y, unsigned int width, unsigned int height)
+{
+    unsigned int size;
+    int thin, gap, d31;
+    XPoint poly[4];
+
+    XFillRectangle(dpy, drawable, gcBack, x, y, width, height);
+
+    /* for now, do a centered even-sized square, at least for now */
+    size = width;
+    if (height < width)
+        size = height;
+    size &= ~1;
+    x += (width - size) >> 1;
+    y += (height - size) >> 1;
+
+/*
+ * Draw what will be the thin strokes.
+ *
+ *           -----
+ *          /    /
+ *         /    /
+ *        /    /
+ *       /    /
+ *      /____/
+ *           d
+ *
+ * Point d is 9/44 (~1/5) of the way across.
+ */
+
+    thin = (size / 11);
+    if (thin < 1) thin = 1;
+    gap = (thin+3) / 4;
+    d31 = thin + thin + gap;
+    poly[0].x = x + size;              poly[0].y = y;
+    poly[1].x = x + size-d31;          poly[1].y = y;
+    poly[2].x = x + 0;                 poly[2].y = y + size;
+    poly[3].x = x + d31;               poly[3].y = y + size;
+    XFillPolygon(dpy, drawable, gcFore, poly, 4, Convex, CoordModeOrigin);
+
+/*
+ * Erase area not needed for lower thin stroke.
+ *
+ *           ------
+ *          /     /
+ *         /  __ /
+ *        /  /  /
+ *       /  /  /
+ *      /__/__/
+ */
+
+    poly[0].x = x + d31/2;                       poly[0].y = y + size;
+    poly[1].x = x + size / 2;                    poly[1].y = y + size/2;
+    poly[2].x = x + (size/2)+(d31-(d31/2));      poly[2].y = y + size/2;
+    poly[3].x = x + d31;                         poly[3].y = y + size;
+    XFillPolygon(dpy, drawable, gcBack, poly, 4, Convex, CoordModeOrigin);
+
+/*
+ * Erase area not needed for upper thin stroke.
+ *
+ *           ------
+ *          /  /  /
+ *         /--/  /
+ *        /     /
+ *       /     /
+ *      /_____/
+ */
+
+    poly[0].x = x + size - d31/2;                poly[0].y = y;
+    poly[1].x = x + size / 2;                    poly[1].y = y + size/2;
+    poly[2].x = x + (size/2)-(d31-(d31/2));      poly[2].y = y + size/2;
+    poly[3].x = x + size - d31;                  poly[3].y = y;
+    XFillPolygon(dpy, drawable, gcBack, poly, 4, Convex, CoordModeOrigin);
+
+/*
+ * Draw thick stroke.
+ * Point b is 1/4 of the way across.
+ *
+ *      b
+ * -----
+ * \    \
+ *  \    \
+ *   \    \
+ *    \    \
+ *     \____\
+ */
+
+    poly[0].x = x;                     poly[0].y = y;
+    poly[1].x = x + size/4;            poly[1].y = y;
+    poly[2].x = x + size;              poly[2].y = y + size;
+    poly[3].x = x + size - size/4;     poly[3].y = y + size;
+    XFillPolygon(dpy, drawable, gcFore, poly, 4, Convex, CoordModeOrigin);
+
+/*
+ * Erase to create gap.
+ *
+ *          /
+ *         /
+ *        /
+ *       /
+ *      /
+ */
+
+    poly[0].x = x + size- thin;        poly[0].y = y;
+    poly[1].x = x + size-( thin+gap);  poly[1].y = y;
+    poly[2].x = x + thin;              poly[2].y = y + size;
+    poly[3].x = x + thin + gap;        poly[3].y = y + size;
+    XFillPolygon(dpy, drawable, gcBack, poly, 4, Convex, CoordModeOrigin);
+}
diff --git a/src/EditresCom.c b/src/EditresCom.c
new file mode 100644 (file)
index 0000000..716a2b3
--- /dev/null
@@ -0,0 +1,2213 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author:  Chris D. Peterson, Dave Sternlicht, MIT X Consortium
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/IntrinsicP.h>    /* To get into the composite and core widget
+                                  structures. */
+#include <X11/ObjectP.h>       /* For XtIs<Classname> macros. */
+#include <X11/StringDefs.h>    /* for XtRString. */
+#include <X11/ShellP.h>                /* for Application Shell Widget class. */
+
+#include <X11/Xatom.h>
+#include <X11/Xos.h>           /* for strcpy declaration */
+#include <X11/Xfuncs.h>
+#include <X11/Xmu/EditresP.h>
+#include <X11/Xmd.h>
+#include <X11/Xmu/CharSet.h>
+#include <X11/Xmu/SysUtil.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define _XEditResPutBool _XEditResPut8
+#define _XEditResPutResourceType _XEditResPut8
+
+/*
+ * Types
+ */
+typedef enum {
+    BlockNone,
+    BlockSetValues,
+    BlockAll
+} EditresBlock;
+
+typedef struct _SetValuesEvent {
+    EditresCommand type;               /* first field must be type */
+    WidgetInfo *widgets;
+    unsigned short num_entries;                /* number of set values requests */
+    char *name;
+    char *res_type;
+    XtPointer value;
+    unsigned short value_len;
+} SetValuesEvent;
+
+typedef struct _SVErrorInfo {
+    SetValuesEvent *event;
+    ProtocolStream *stream;
+    unsigned short *count;
+    WidgetInfo *entry;
+} SVErrorInfo;
+
+typedef struct _GetValuesEvent {
+    EditresCommand type;               /* first field must be type */
+    WidgetInfo *widgets;
+    unsigned short num_entries;                /* number of get values requests */
+    char *name;
+} GetValuesEvent;
+
+typedef struct _FindChildEvent {
+    EditresCommand type;               /* first field must be type */
+    WidgetInfo *widgets;
+    short x, y;
+} FindChildEvent;
+
+typedef struct _GenericGetEvent {
+    EditresCommand type;               /* first field must be type */
+    WidgetInfo *widgets;
+    unsigned short num_entries;                /* number of set values requests */
+} GenericGetEvent, GetResEvent, GetGeomEvent;
+
+/*
+ * Common to all events
+ */
+typedef struct _AnyEvent {
+    EditresCommand type;               /* first field must be type */
+    WidgetInfo *widgets;
+} AnyEvent;
+
+/*
+ * The event union
+ */
+typedef union _EditresEvent {
+    AnyEvent any_event;
+    SetValuesEvent set_values_event;
+    GetResEvent get_resources_event;
+    GetGeomEvent get_geometry_event;
+    FindChildEvent find_child_event;
+} EditresEvent;
+
+typedef struct _Globals {
+    EditresBlock block;
+    SVErrorInfo error_info;
+    ProtocolStream stream;
+    ProtocolStream *command_stream;    /* command stream */
+#if defined(LONG64) || defined(WORD64)
+    unsigned long base_address;
+#endif
+} Globals;
+
+#define CURRENT_PROTOCOL_VERSION 5L
+
+#define streq(a,b) (strcmp((a), (b)) == 0)
+
+/*
+ * Prototypes
+ */
+static Widget _FindChild(Widget, int, int);
+static void _XEditresGetStringValues(Widget, Arg*, int);
+static XtPointer BuildReturnPacket(ResIdent, EditResError, ProtocolStream*);
+static void CommandDone(Widget, Atom*, Atom*);
+static Boolean ConvertReturnCommand(Widget, Atom*, Atom*, Atom*, XtPointer*,
+                                   unsigned long*, int*);
+static Boolean CvtStringToBlock(Display*, XrmValue*, Cardinal*,
+                               XrmValue*, XrmValue*, XtPointer*);
+static EditresEvent *BuildEvent(Widget, Atom, XtPointer, ResIdent,
+                               unsigned long);
+static _Xconst char *DoFindChild(Widget, EditresEvent*, ProtocolStream*);
+static _Xconst char *DoGetGeometry(Widget, EditresEvent*, ProtocolStream*);
+static _Xconst char *DoGetResources(Widget, EditresEvent*, ProtocolStream*);
+static _Xconst char *DoSetValues(Widget, EditresEvent*, ProtocolStream*);
+static void DumpChildren(Widget, ProtocolStream*, unsigned short*);
+static _Xconst char *DumpValues(Widget, EditresEvent*, ProtocolStream*);
+static _Xconst char *DumpWidgets(Widget, EditresEvent*, ProtocolStream*);
+static void ExecuteCommand(Widget, Atom, ResIdent, EditresEvent*);
+static void ExecuteGetGeometry(Widget, ProtocolStream*);
+static void ExecuteGetResources(Widget w, ProtocolStream *stream);
+static void ExecuteSetValues(Widget, SetValuesEvent*, WidgetInfo*,
+                            ProtocolStream*, unsigned short*);
+static void FreeEvent(EditresEvent*);
+static void GetCommand(Widget w, XtPointer, Atom*, Atom*, XtPointer,
+                      unsigned long*, int*);
+static void HandleToolkitErrors(String, String, String, String,
+                               String*, Cardinal*);
+static void InsertWidget(ProtocolStream*, Widget);
+static Bool IsChild(Widget, Widget, Widget);
+static Bool isApplicationShell(Widget);
+static void LoadResources(Widget);
+static Bool PositionInChild(Widget, int, int);
+static int qcmp_widget_list(register _Xconst void*, register _Xconst void*);
+static void SendCommand(Widget, Atom, ResIdent, EditResError,
+                       ProtocolStream*);
+static void SendFailure(Widget, Atom, ResIdent, _Xconst char*);
+static _Xconst char *VerifyWidget(Widget, WidgetInfo*);
+
+/*
+ * External
+ */
+void _XEditResCheckMessages(Widget, XtPointer, XEvent*, Boolean*);
+
+/*
+ * Initialization
+ */
+static Atom res_editor_command, res_editor_protocol, client_value;
+static Globals globals;
+
+/************************************************************
+ * Resource Editor Communication Code
+ ************************************************************/
+/*
+ * Function:
+ *     _XEditResCheckMessages
+ *
+ * Parameters:
+ *     data  - unused
+ *     event - The X Event that triggered this handler
+ *     cont  - unused
+ *
+ * Description:
+ *       This callback routine is set on all shell widgets, and checks to
+ *     see if a client message event has come from the resource editor.
+ */
+/*ARGSUSED*/
+void
+_XEditResCheckMessages(Widget w, XtPointer data, XEvent *event, Boolean *cont)
+{
+    Time time;
+    ResIdent ident;
+    static Boolean first_time = False;
+    static Atom res_editor, res_comm;
+    Display *dpy;
+
+    if (event->type == ClientMessage)
+    {
+       XClientMessageEvent * c_event = (XClientMessageEvent *)event;
+       dpy = XtDisplay(w);
+
+       if (!first_time)
+       {
+           Atom atoms[4];
+           static _Xconst char *names[] = {
+               EDITRES_NAME, EDITRES_COMMAND_ATOM,
+               EDITRES_PROTOCOL_ATOM, EDITRES_CLIENT_VALUE
+           };
+
+           first_time = True;
+           XInternAtoms(dpy, (char **) names, 4, False, atoms);
+           res_editor = atoms[0];
+           res_editor_command = atoms[1];
+           res_editor_protocol = atoms[2];
+         /* Used in later procedures */
+           client_value = atoms[3];
+           LoadResources(w);
+       }
+
+       if ((c_event->message_type != res_editor)
+           || (c_event->format != EDITRES_SEND_EVENT_FORMAT))
+           return;
+
+       time = c_event->data.l[0];
+       res_comm = c_event->data.l[1];
+       ident = (ResIdent) c_event->data.l[2];
+       if (c_event->data.l[3] != CURRENT_PROTOCOL_VERSION)
+       {
+           _XEditResResetStream(&globals.stream);
+           _XEditResPut8(&globals.stream,
+                         (unsigned int) CURRENT_PROTOCOL_VERSION);
+           SendCommand(w, res_comm, ident, ProtocolMismatch, &globals.stream);
+           return;
+       }
+
+       XtGetSelectionValue(w, res_comm, res_editor_command,
+                           GetCommand, (XtPointer)(long)ident, time);
+    }
+}
+
+/*
+ * Function:
+ *     BuildEvent
+ *
+ * Parameters:
+ *     w      - widget to own selection, in case of error
+ *     sel    - selection to send error message beck in
+ *     data   - the data for the request
+ *     ident  - the id number we are looking for
+ *     length - length of request
+ *
+ * Description:
+ *       Takes the info out the protocol stream an constructs
+ *                   the proper event structure.
+ *
+ * Returns:
+ *     the event, or NULL
+ */
+#if defined(ERROR_MESSAGE)
+#undef ERROR_MESSAGE
+#endif
+#define ERROR_MESSAGE "Client: Improperly formatted protocol request"
+static EditresEvent *
+BuildEvent(Widget w, Atom sel, XtPointer data, ResIdent ident,
+          unsigned long length)
+{
+    EditresEvent *event;
+    ProtocolStream alloc_stream, *stream;
+    unsigned char temp;
+    register unsigned int i;
+
+    stream = &alloc_stream;
+    stream->current = stream->top = (unsigned char *)data;
+    stream->size = HEADER_SIZE;                /* size of header */
+
+    /*
+     * Retrieve the Header
+     */
+    if (length < HEADER_SIZE)
+    {
+       SendFailure(w, sel, ident, ERROR_MESSAGE);
+       return (NULL);
+    }
+
+    (void)_XEditResGet8(stream, &temp);
+    if (temp != ident)                 /* Id's don't match, ignore request */
+       return (NULL);
+
+    event = (EditresEvent *)XtCalloc(sizeof(EditresEvent), 1);
+
+    (void)_XEditResGet8(stream, &temp);
+    event->any_event.type = (EditresCommand)temp;
+    (void)_XEditResGet32(stream, &stream->size);
+    stream->top = stream->current;     /* reset stream to top of value */
+
+    /*
+     * Now retrieve the data segment
+     */
+    switch(event->any_event.type)
+    {
+    case SendWidgetTree:
+       break;                  /* no additional info */
+    case SetValues:
+        {
+           SetValuesEvent *sv_event = (SetValuesEvent *)event;
+
+           if (!(_XEditResGetString8(stream, &sv_event->name)
+                 && _XEditResGetString8(stream, &sv_event->res_type)))
+               goto done;
+
+           /*
+            * Since we need the value length, we have to pull the
+            * value out by hand
+            */
+           if (!_XEditResGet16(stream, &sv_event->value_len))
+               goto done;
+
+           sv_event->value = XtMalloc(sizeof(char) * (sv_event->value_len + 1));
+
+           for (i = 0; i < sv_event->value_len; i++)
+               if (!_XEditResGet8(stream, (unsigned char *)sv_event->value + i))
+                   goto done;
+
+           ((char*)sv_event->value)[i] = '\0';
+
+           if (!_XEditResGet16(stream, &sv_event->num_entries))
+               goto done;
+
+           sv_event->widgets = (WidgetInfo *)
+               XtCalloc(sizeof(WidgetInfo), sv_event->num_entries);
+
+           for (i = 0; i < sv_event->num_entries; i++)
+               if (!_XEditResGetWidgetInfo(stream, sv_event->widgets + i))
+                   goto done;
+       }
+       break;
+    case FindChild:
+       {
+           FindChildEvent *find_event = (FindChildEvent *)event;
+
+           find_event->widgets = (WidgetInfo *)XtCalloc(sizeof(WidgetInfo), 1);
+
+           if (!(_XEditResGetWidgetInfo(stream, find_event->widgets)
+                 && _XEditResGetSigned16(stream, &find_event->x)
+                 && _XEditResGetSigned16(stream, &find_event->y)))
+               goto done;
+       }
+       break;
+    case GetGeometry:
+    case GetResources:
+       {
+           GenericGetEvent *get_event = (GenericGetEvent *)event;
+
+           if (!_XEditResGet16(stream, &get_event->num_entries))
+               goto done;
+
+           get_event->widgets = (WidgetInfo *)
+               XtCalloc(sizeof(WidgetInfo), get_event->num_entries);
+
+           for (i = 0; i < get_event->num_entries; i++)
+               if (!_XEditResGetWidgetInfo(stream, get_event->widgets + i))
+                   goto done;
+       }
+       break;
+    case GetValues:
+       {
+           GetValuesEvent *gv_event = (GetValuesEvent *)event;
+
+           _XEditResGetString8(stream, &gv_event->name);
+           _XEditResGet16(stream, &gv_event->num_entries);
+           gv_event->widgets = (WidgetInfo *)
+               XtCalloc(sizeof(WidgetInfo), gv_event->num_entries);
+           _XEditResGetWidgetInfo(stream, gv_event->widgets);
+       }
+        break;
+    default:
+       {
+           char buf[BUFSIZ];
+
+           XmuSnprintf(buf, sizeof(buf),
+                       "Unknown Protocol request %d.", event->any_event.type);
+           SendFailure(w, sel, ident, buf);
+           FreeEvent(event);
+           return (NULL);
+       }
+    }
+
+    return (event);
+
+  done:
+    SendFailure(w, sel, ident, ERROR_MESSAGE);
+    FreeEvent(event);
+    return (NULL);
+}
+
+/*
+ * Function:
+ *     FreeEvent
+ *
+ * Parameters:
+ *     event - event to free
+ *
+ * Description:
+ *     Frees the event structure and any other pieces in it that need freeing.
+ */
+static void
+FreeEvent(EditresEvent *event)
+{
+    if (event->any_event.widgets != NULL)
+    {
+       XtFree((char *)event->any_event.widgets->ids);
+       XtFree((char *)event->any_event.widgets);
+    }
+
+    if (event->any_event.type == SetValues)
+    {
+       XtFree(event->set_values_event.name);
+       XtFree(event->set_values_event.res_type);
+    }
+
+    XtFree((char *)event);
+}
+
+/*
+ * Function:
+ *     GetCommand
+ *
+ * Parameters:
+ *     (See Xt XtConvertSelectionProc)
+ *     data - contains the ident number for the command
+ *
+ * Description:
+ *     Gets the Command out of the selection asserted by the resource manager.
+ */
+/*ARGSUSED*/
+static void
+GetCommand(Widget w, XtPointer data, Atom *selection, Atom *type,
+          XtPointer value, unsigned long *length, int *format)
+{
+    ResIdent ident = (ResIdent)(long)data;
+    EditresEvent *event;
+
+    if (*type != res_editor_protocol || *format != EDITRES_FORMAT)
+       return;
+
+    if ((event = BuildEvent(w, *selection, value, ident, *length)) != NULL)
+    {
+       ExecuteCommand(w, *selection, ident, event);
+       FreeEvent(event);
+    }
+}
+
+/*
+ * Function:
+ *     ExecuteCommand
+ *
+ * Parameters:
+ *     w       - widget
+ *     command - the command to execute
+ *     value   - the associated with the command
+ *
+ * Description:
+ *     Executes a command string received from the resource editor.
+ */
+/*ARGSUSED*/
+static void
+ExecuteCommand(Widget w, Atom sel, ResIdent ident, EditresEvent *event)
+{
+    _Xconst char *(*func)(Widget, EditresEvent*, ProtocolStream*);
+    _Xconst char *str;
+
+    if (globals.block == BlockAll)
+    {
+       SendFailure(w, sel, ident,
+                   "This client has blocked all Editres commands.");
+       return;
+    }
+    else if (globals.block == BlockSetValues
+            && event->any_event.type == SetValues)
+    {
+       SendFailure(w, sel, ident,
+                   "This client has blocked all SetValues requests.");
+       return;
+    }
+
+    switch(event->any_event.type)
+    {
+    case SendWidgetTree:
+#if defined(LONG64) || defined(WORD64)
+       globals.base_address = (unsigned long)w & 0xFFFFFFFF00000000;
+#endif
+       func = DumpWidgets;
+       break;
+    case SetValues:
+       func = DoSetValues;
+       break;
+    case FindChild:
+       func = DoFindChild;
+       break;
+    case GetGeometry:
+       func = DoGetGeometry;
+       break;
+    case GetResources:
+       func = DoGetResources;
+       break;
+    case GetValues:
+        func = DumpValues;
+    break;
+    default:
+        {
+           char buf[BUFSIZ];
+
+           XmuSnprintf(buf, sizeof(buf),
+                       "Unknown Protocol request %d.",event->any_event.type);
+           SendFailure(w, sel, ident, buf);
+           return;
+       }
+    }
+
+    _XEditResResetStream(&globals.stream);
+    if ((str = (*func)(w, event, &globals.stream)) == NULL)
+       SendCommand(w, sel, ident, PartialSuccess, &globals.stream);
+    else
+       SendFailure(w, sel, ident, str);
+}
+
+/*
+ * Function:
+ *     ConvertReturnCommand
+ *
+ * Parameters:
+ *     w          - the widget that owns the selection
+ *     selection  - selection to convert
+ *     target     - target type for this selection
+ *     type_ret   - type of the selection
+ *     value_ret  - selection value
+ *     length_ret - lenght of this selection
+ *     format_ret - the format the selection is in
+ *
+ * Description:
+ *     Converts a selection
+ *
+ * Returns:
+ *     True if conversion was sucessful
+ */
+/*ARGSUSED*/
+static Boolean
+ConvertReturnCommand(Widget w, Atom *selection, Atom *target, Atom *type_ret,
+                    XtPointer *value_ret, unsigned long *length_ret,
+                    int *format_ret)
+{
+    /*
+     * I assume the intrinsics give me the correct selection back
+     */
+    if ((*target != client_value))
+       return (False);
+
+    *type_ret = res_editor_protocol;
+    *value_ret = (XtPointer)globals.command_stream->real_top;
+    *length_ret = globals.command_stream->size + HEADER_SIZE;
+    *format_ret = EDITRES_FORMAT;
+
+  return (True);
+}
+
+/*
+ * Function:
+ *     CommandDone
+ *
+ * Parameters:
+ *     widget    - unused
+ *     selection - unused
+ *     target    - unused
+ *
+ * Description:
+ *     done with the selection
+ */
+/*ARGSUSED*/
+static void
+CommandDone(Widget widget, Atom *selection, Atom *target)
+{
+    /* Keep the toolkit from automaticaly freeing the selection value */
+}
+
+/*
+ * Function:
+ *     SendFailure
+ *
+ * Paramters:
+ *     w     - widget to own the selection
+ *     sel   - selection to assert
+ *     ident - identifier
+ *     str   - error message
+ *
+ * Description:
+ *     Sends a failure message
+ */
+static void
+SendFailure(Widget w, Atom sel, ResIdent ident, _Xconst char *str)
+{
+    _XEditResResetStream(&globals.stream);
+    _XEditResPutString8(&globals.stream, str);
+    SendCommand(w, sel, ident, Failure, &globals.stream);
+}
+
+/*
+ * Function:
+ *     BuildReturnPacket
+ *
+ * Parameters:
+ *     ident   - identifier
+ *     command - command code
+ *     stream  - protocol stream
+ * Description:
+ *     Builds a return packet, given the data to send
+ *
+ * Returns:
+ *     packet to send
+ */
+static XtPointer
+BuildReturnPacket(ResIdent ident, EditResError error, ProtocolStream *stream)
+{
+    long old_alloc, old_size;
+    unsigned char *old_current;
+
+    /*
+     * We have cleverly keep enough space at the top of the header
+     * for the return protocol stream, so all we have to do is
+     * fill in the space
+     */
+    /*
+     * Fool the insert routines into putting the header in the right
+     * place while being damn sure not to realloc (that would be very bad.)
+     */
+    old_current = stream->current;
+    old_alloc = stream->alloc;
+    old_size = stream->size;
+
+    stream->current = stream->real_top;
+    stream->alloc = stream->size + (2 * HEADER_SIZE);
+
+    _XEditResPut8(stream, ident);
+    _XEditResPut8(stream, (unsigned char)error);
+    _XEditResPut32(stream, old_size);
+
+    stream->alloc = old_alloc;
+    stream->current = old_current;
+    stream->size = old_size;
+
+    return ((XtPointer)stream->real_top);
+}
+
+/*
+ * Function:
+ *     SendCommand
+ * Parameters:
+ *     w       - widget to own the selection
+ *     sel     - selection to assert
+ *     ident   - identifier
+ *     command - command code
+ *     stream  - protocol stream
+ *
+ * Description:
+ *     Builds a return command line
+ */
+static void
+SendCommand(Widget w, Atom sel, ResIdent ident, EditResError error,
+           ProtocolStream *stream)
+{
+    BuildReturnPacket(ident, error, stream);
+    globals.command_stream = stream;
+
+    /*
+     * I REALLY want to own the selection.  Since this was not triggered
+     * by a user action, and I am the only one using this atom it is safe to
+     * use CurrentTime
+     */
+    XtOwnSelection(w, sel, CurrentTime, ConvertReturnCommand, NULL, CommandDone);
+}
+
+/************************************************************
+ * Generic Utility Functions
+ ************************************************************/
+static int
+qcmp_widget_list(register _Xconst void *left, register _Xconst void *right)
+{
+    return (char *)*(Widget **)left - (char *)*(Widget **)right;
+}
+
+/*
+ * Function:
+ *     FindChildren
+ *
+ * Parameters:
+ *     parent   - parent widget
+ *     children - list of children
+ *     normal   - return normal children
+ *     popup    - return popup children
+ *     extra    - return extra children
+ *
+ * Description:
+ *     Retuns all children (popup, normal and otherwise) of this widget
+ *
+ * Returns:
+ *     number of children
+ */
+static int
+FindChildren(Widget parent, Widget **children, Bool normal, Bool popup,
+            Bool extra)
+{
+    CompositeWidget cw = (CompositeWidget)parent;
+    Cardinal i, num_children, current = 0;
+    Widget *extra_widgets = NULL;
+    Cardinal num_extra = 0;
+
+    num_children = 0;
+
+    if (XtIsWidget(parent) && popup)
+       num_children += parent->core.num_popups;
+
+    if (XtIsComposite(parent) && normal)
+       num_children += cw->composite.num_children;
+
+    if (XtIsWidget(parent) && extra)
+    {
+       XtResourceList norm_list, cons_list;
+       Cardinal num_norm, num_cons;
+       Arg args[1];
+       Widget widget;
+
+       XtGetResourceList(XtClass(parent), &norm_list, &num_norm);
+
+       if (XtParent(parent) != NULL)
+           XtGetConstraintResourceList(XtClass(XtParent(parent)),
+                                       &cons_list, &num_cons);
+       else
+           num_cons = 0;
+
+       extra_widgets = (Widget *)XtMalloc(sizeof(Widget));
+       for (i = 0; i < num_norm; i++)
+           if (strcmp(norm_list[i].resource_type, XtRWidget) == 0)
+           {
+               widget = NULL;
+               XtSetArg(args[0], norm_list[i].resource_name, &widget);
+               XtGetValues(parent, args, 1);
+               if (widget && XtParent(widget) == parent)
+               {
+                   ++num_extra;
+                   extra_widgets = (Widget *) XtRealloc(
+                       (char *)extra_widgets, num_extra * sizeof(Widget));
+                   extra_widgets[num_extra - 1] = widget;
+               }
+           }
+       for (i = 0; i < num_cons; i++)
+           if (strcmp(cons_list[i].resource_type, XtRWidget) == 0)
+           {
+               widget = NULL;
+               XtSetArg(args[0], cons_list[i].resource_name, &widget);
+               XtGetValues(parent, args, 1);
+               if (widget && XtParent(widget) == parent)
+               {
+                   ++num_extra;
+                   extra_widgets = (Widget *) XtRealloc(
+                       (char *)extra_widgets, num_extra * sizeof(Widget));
+                   extra_widgets[num_extra - 1] = widget;
+               }
+           }
+       if (num_norm)
+           XtFree((char *)norm_list);
+       if (num_cons)
+           XtFree((char *)cons_list);
+    }
+
+    if ((num_children + num_extra) == 0)
+    {
+       *children = NULL;
+       return (0);
+    }
+
+    *children = (Widget *)XtMalloc(sizeof(Widget) * (num_children + num_extra));
+
+    if (XtIsComposite(parent) && normal)
+       for (i = 0; i < cw->composite.num_children; i++, current++)
+           (*children)[current] = cw->composite.children[i];
+
+    if (XtIsWidget(parent) && popup)
+       for (i = 0; i < parent->core.num_popups; i++, current++)
+           (*children)[current] = parent->core.popup_list[i];
+
+    if (num_extra)
+    /* Check for dups */
+    {
+       Cardinal j, old_num_extra = num_extra;
+
+       qsort(extra_widgets, num_extra, sizeof(Widget), qcmp_widget_list);
+       for (i = 0; i < num_extra - 1; i++)
+           while (i < num_extra - 1 &&
+                  extra_widgets[i] == extra_widgets[i + 1])
+           {
+               memmove(&extra_widgets[i], &extra_widgets[i + 1],
+                       (num_extra - i) * sizeof(Widget));
+               --num_extra;
+           }
+
+       for (i = 0; i < num_children; i++)
+           for (j = 0; j < num_extra; j++)
+               if ((*children)[i] == extra_widgets[j])
+               {
+                   if ((j + 1) < num_extra)
+                       memmove(&extra_widgets[j], &extra_widgets[j + 1],
+                               (num_extra - j) * sizeof(Widget));
+                   --num_extra;
+               }
+
+       if (old_num_extra != num_extra)
+           *children = (Widget *)XtRealloc((char *)*children, sizeof(Widget)
+                                           * (num_children + num_extra));
+
+       if (num_extra)
+           memcpy(&(*children)[num_children], extra_widgets,
+                  sizeof(Widget) * num_extra);
+    }
+    if (extra_widgets)
+       XtFree((char *)extra_widgets);
+    if (num_children + num_extra == 0)
+    {
+       XtFree((char *)*children);
+       *children = NULL;
+    }
+
+    return (num_children + num_extra);
+}
+
+/*
+ * Function:
+ *     IsChild
+ *
+ * parameters:
+ *     top    - top of the tree
+ *     parent - parent widget
+ *     child  - child widget
+ *
+ * Description:
+ *     Check to see of child is a child of parent
+ */
+static Bool
+IsChild(Widget top, Widget parent, Widget child)
+{
+    int i, num_children;
+    Widget *children;
+
+    if (parent == NULL)
+       return (top == child);
+
+    num_children = FindChildren(parent, &children, True, True, True);
+
+    for (i = 0; i < num_children; i++)
+       if (children[i] == child)
+       {
+           XtFree((char *)children);
+           return (True);
+       }
+
+    XtFree((char *)children);
+    return (False);
+}
+
+/*
+ * Function:
+ *     VerifyWidget
+ *
+ * Parameters:
+ *     w    - any widget in the tree
+ *     info - info about the widget to verify
+ *
+ * Description:
+ *     Makes sure all the widgets still exist
+ */
+static _Xconst char *
+VerifyWidget(Widget w, WidgetInfo *info)
+{
+    Widget top;
+    register int count;
+    register Widget parent;
+    register unsigned long *child;
+
+    for (top = w; XtParent(top) != NULL; top = XtParent(top))
+       ;
+
+    parent = NULL;
+    child = info->ids;
+    count = 0;
+
+    while (True)
+    {
+       if (!IsChild(top, parent, (Widget) *child))
+           return ("This widget no longer exists in the client.");
+
+       if (++count == info->num_widgets)
+           break;
+
+       parent = (Widget)*child++;
+    }
+
+    info->real_widget = (Widget)*child;
+
+    return (NULL);
+}
+
+/************************************************************
+ * Code to Perform SetValues operations
+ ************************************************************/
+/*
+ * Function:
+ *     DoSetValues
+ *
+ * Parameters:
+ *     w      - a widget in the tree
+ *     event  - event that caused this action
+ *     stream - protocol stream to add
+ *
+ * Description:
+ *     Performs the setvalues requested
+ *
+ * Returns:
+ *     NULL
+ */
+static _Xconst char *
+DoSetValues(Widget w, EditresEvent *event, ProtocolStream *stream)
+{
+    _Xconst char *str;
+    register unsigned i;
+    unsigned short count = 0;
+    SetValuesEvent *sv_event = (SetValuesEvent *)event;
+
+    _XEditResPut16(stream, count);  /* insert 0, will be overwritten later */
+
+    for (i = 0; i < sv_event->num_entries; i++)
+    {
+       if ((str = VerifyWidget(w, &sv_event->widgets[i])) != NULL)
+       {
+           _XEditResPutWidgetInfo(stream, &sv_event->widgets[i]);
+           _XEditResPutString8(stream, str);
+           count++;
+       }
+       else
+           ExecuteSetValues(sv_event->widgets[i].real_widget,
+                            sv_event, sv_event->widgets + i, stream, &count);
+    }
+
+    /*
+     * Overwrite the first 2 bytes with the real count.
+     */
+    *(stream->top) = count >> XER_NBBY;
+    *(stream->top + 1) = count;
+
+    return (NULL);
+}
+
+/*
+ * Function:
+ *     HandleToolkitErrors
+ *
+ * Parameters:
+ *     name       - name of the error
+ *     type       - type of the error
+ *     class      - class of the error
+ *     msg        - the default message
+ *     params     - the extra parameters for this message
+ *     num_params - ""
+ *
+ *     Description: Handles X Toolkit Errors.
+ */
+/* ARGSUSED */
+static void
+HandleToolkitErrors(String name, String type, String class, String msg,
+                   String *params, Cardinal *num_params)
+{
+    SVErrorInfo *info = &globals.error_info;
+    char buf[BUFSIZ];
+
+    if (streq(name, "unknownType"))
+       XmuSnprintf(buf, sizeof(buf),
+                   "The `%s' resource is not used by this widget.",
+                   info->event->name);
+    else if (streq(name, "noColormap"))
+       XmuSnprintf(buf, sizeof(buf), msg, params[0]);
+    else if (streq(name, "conversionFailed") || streq(name, "conversionError"))
+    {
+       if (streq((String)info->event->value, XtRString))
+           XmuSnprintf(buf, sizeof(buf),
+                       "Could not convert the string '%s' for the `%s' "
+                       "resource.", (String)info->event->value,
+                       info->event->name);
+       else
+           XmuSnprintf(buf, sizeof(buf),
+                       "Could not convert the `%s' resource.",
+                       info->event->name);
+    }
+    else
+       XmuSnprintf(buf, sizeof(buf),
+                   "Name: %s, Type: %s, Class: %s, Msg: %s",
+                   name, type, class, msg);
+
+    /*
+     * Insert this info into the protocol stream, and update the count
+     */
+    (*(info->count))++;
+    _XEditResPutWidgetInfo(info->stream, info->entry);
+    _XEditResPutString8(info->stream, buf);
+}
+
+/*
+ * Function:
+ *     ExecuteSetValues
+ *
+ * Parameters:
+ *     w        - widget to perform the set_values on
+ *     sv_event - set values event
+ *     sv_info  - set_value info
+ *.
+ * Description:
+ *     Performs a setvalues for a given command
+ */
+static void
+ExecuteSetValues(Widget w, SetValuesEvent *sv_event, WidgetInfo *entry,
+                ProtocolStream *stream, unsigned short *count)
+{
+    XtErrorMsgHandler old;
+    SVErrorInfo *info = &globals.error_info;
+
+    info->event = sv_event;    /* No data can be passed to */
+    info->stream = stream;     /* an error handler, so we */
+    info->count = count;       /* have to use a global */
+    info->entry = entry;
+
+    old = XtAppSetWarningMsgHandler(XtWidgetToApplicationContext(w),
+                                   HandleToolkitErrors);
+
+    XtVaSetValues(w, XtVaTypedArg,
+                 sv_event->name, sv_event->res_type,
+                 sv_event->value, sv_event->value_len,
+                 NULL);
+
+    (void)XtAppSetWarningMsgHandler(XtWidgetToApplicationContext(w), old);
+}
+
+/************************************************************
+ * Code for Creating and dumping widget tree.
+ ************************************************************/
+/* Function:
+ *     DumpWidgets
+ *
+ * Parameters:
+ *     w      - a widget in the tree
+ *     event  - event that caused this action
+ *     stream - protocol stream to add
+ *
+ * Description:
+ *       Given a widget it builds a protocol packet containing the entire
+ *     widget heirarchy.
+ *
+ * Returns:
+ *     NULL
+ */
+#define TOOLKIT_TYPE ("Xt")
+/*ARGSUSED*/
+static _Xconst char *
+DumpWidgets(Widget w, EditresEvent *event, ProtocolStream *stream)
+{
+    unsigned short count = 0;
+
+    /* Find Tree's root */
+    for (; XtParent(w) != NULL; w = XtParent(w))
+       ;
+
+    /*
+     * hold space for count, overwritten later
+     */
+    _XEditResPut16(stream, (unsigned int)0);
+
+    DumpChildren(w, stream, &count);
+
+    /*
+     * write out toolkit type
+     */
+    _XEditResPutString8(stream, TOOLKIT_TYPE);
+
+    /*
+     * Overwrite the first 2 bytes with the real count
+     */
+    *(stream->top) = count >> XER_NBBY;
+    *(stream->top + 1) = count;
+
+    return (NULL);
+}
+
+/*
+ * Function:
+ *      DumpChildren
+ *
+ * Parameters:
+ *     w      - widget to dump
+ *     stream - stream to dump to
+ *     count  - number of dumps we have performed
+ *
+ * Description:
+ *     Adds a child's name to the list.
+ */
+/* This is a trick/kludge.  To make shared libraries happier (linking
+ * against Xmu but not linking against Xt, and apparently even work
+ * as we desire on SVR4, we need to avoid an explicit data reference
+ * to applicationShellWidgetClass.  XtIsTopLevelShell is known
+ * (implementation dependent assumption!) to use a bit flag.  So we
+ * go that far.  Then, we test whether it is an applicationShellWidget
+ * class by looking for an explicit class name.  Seems pretty safe.
+ */
+static Bool
+isApplicationShell(Widget w)
+{
+    register WidgetClass c;
+
+    if (!XtIsTopLevelShell(w))
+       return (False);
+    for (c = XtClass(w); c; c = c->core_class.superclass)
+      if (strcmp(c->core_class.class_name, "ApplicationShell") == 0)
+         return (True);
+
+    return (False);
+}
+
+static void
+DumpChildren(Widget w, ProtocolStream *stream, unsigned short *count)
+{
+    int i, num_children;
+    Widget *children;
+    unsigned long window;
+    char *c_class;
+
+    (*count)++;
+
+    InsertWidget(stream, w);           /* Insert the widget into the stream */
+
+    _XEditResPutString8(stream, XtName(w)); /* Insert name */
+
+    if (isApplicationShell(w))
+       c_class = ((ApplicationShellWidget)w)->application.class;
+    else
+       c_class = XtClass(w)->core_class.class_name;
+
+    _XEditResPutString8(stream, c_class);      /* Insert class */
+
+    if (XtIsWidget(w))
+       if (XtIsRealized(w))
+           window = XtWindow(w);
+       else
+           window = EDITRES_IS_UNREALIZED;
+    else
+       window = EDITRES_IS_OBJECT;
+
+    _XEditResPut32(stream, window);            /* Insert window id */
+
+    /*
+     * Find children and recurse
+     */
+    num_children = FindChildren(w, &children, True, True, True);
+    for (i = 0; i < num_children; i++)
+       DumpChildren(children[i], stream, count);
+
+    XtFree((char *)children);
+}
+
+/************************************************************
+ * Code for getting the geometry of widgets
+ ************************************************************/
+/*
+ * Function:
+ *     DoGetGeometry
+ *
+ * Parameters:
+ *     w      - widget in the tree
+ *     event  - event that caused this action
+ *     stream - protocol stream to add
+ *
+ * Description:
+ *     Retrieves the Geometry of each specified widget.
+ *
+ * Returns:
+ *     NULL
+ */
+static _Xconst char *
+DoGetGeometry(Widget w, EditresEvent *event, ProtocolStream *stream)
+{
+    unsigned i;
+    _Xconst char *str;
+    GetGeomEvent *geom_event = (GetGeomEvent *)event;
+
+    _XEditResPut16(stream, geom_event->num_entries);
+
+    for (i = 0; i < geom_event->num_entries; i++)
+    {
+       /*
+        * Send out the widget id
+        */
+       _XEditResPutWidgetInfo(stream, &geom_event->widgets[i]);
+
+       if ((str = VerifyWidget(w, &geom_event->widgets[i])) != NULL)
+       {
+           _XEditResPutBool(stream, True);     /* an error occured */
+           _XEditResPutString8(stream, str);   /* set message */
+       }
+       else
+           ExecuteGetGeometry(geom_event->widgets[i].real_widget, stream);
+    }
+
+    return (NULL);
+}
+
+/*
+ * Function:
+ *     ExecuteGetGeometry
+ *
+ * Parameters:
+ *     w      - widget to get geometry
+ *     stream - stream to append to
+ *
+ * Description:
+ *     Gets the geometry for each widget specified.
+ *
+ * Returns:
+ *     True if no error occured.
+ */
+static void
+ExecuteGetGeometry(Widget w, ProtocolStream *stream)
+{
+    int i;
+    Boolean mapped_when_man;
+    Dimension width, height, border_width;
+    Arg args[8];
+    Cardinal num_args = 0;
+    Position x, y;
+
+    if (!XtIsRectObj(w) || (XtIsWidget(w) && !XtIsRealized(w)))
+    {
+       _XEditResPutBool(stream, False);        /* no error */
+       _XEditResPutBool(stream, False);        /* not visable */
+       for (i = 0; i < 5; i++)         /* fill in extra space with 0's */
+           _XEditResPut16(stream, 0);
+       return;
+    }
+
+    XtSetArg(args[num_args], XtNwidth, &width); num_args++;
+    XtSetArg(args[num_args], XtNheight, &height); num_args++;
+    XtSetArg(args[num_args], XtNborderWidth, &border_width); num_args++;
+    XtSetArg(args[num_args], XtNmappedWhenManaged, &mapped_when_man);
+    num_args++;
+    XtGetValues(w, args, num_args);
+
+    if (!(XtIsManaged(w) && mapped_when_man) && XtIsWidget(w))
+    {
+       XWindowAttributes attrs;
+
+       /*
+        * The toolkit does not maintain mapping state, we have
+        * to go to the server
+        */
+       if (XGetWindowAttributes(XtDisplay(w), XtWindow(w), &attrs) != 0)
+       {
+           if (attrs.map_state != IsViewable)
+           {
+               _XEditResPutBool(stream, False);        /* no error */
+               _XEditResPutBool(stream, False);        /* not visable */
+               for (i = 0; i < 5; i++) /* fill in extra space with 0's */
+                   _XEditResPut16(stream, 0);
+               return;
+           }
+       }
+       else
+       {
+           _XEditResPut8(stream, True); /* Error occured. */
+           _XEditResPutString8(stream, "XGetWindowAttributes failed.");
+           return;
+       }
+    }
+
+    XtTranslateCoords(w, -((int) border_width), -((int) border_width), &x, &y);
+
+    _XEditResPutBool(stream, False);   /* no error */
+    _XEditResPutBool(stream, True);    /* Visable */
+    _XEditResPut16(stream, x);
+    _XEditResPut16(stream, y);
+    _XEditResPut16(stream, width);
+    _XEditResPut16(stream, height);
+    _XEditResPut16(stream, border_width);
+}
+
+/************************************************************
+ * Code for executing FindChild
+ ************************************************************/
+/*
+ * Function:
+ *     PositionInChild
+ *
+ * Parameters:
+ *     child - child widget to check
+ *     x     - location of point to check in the parent's coord space
+ *     y     - ""
+ *
+ * Description:
+ *     Returns true if this location is in the child.
+ */
+static Bool
+PositionInChild(Widget child, int x, int y)
+{
+    Arg args[6];
+    Cardinal num;
+    Dimension width, height, border_width;
+    Position child_x, child_y;
+    Boolean mapped_when_managed;
+
+    if (!XtIsRectObj(child))   /* we must at least be a rect obj */
+       return (False);
+
+    num = 0;
+    XtSetArg(args[num], XtNmappedWhenManaged, &mapped_when_managed); num++;
+    XtSetArg(args[num], XtNwidth, &width); num++;
+    XtSetArg(args[num], XtNheight, &height); num++;
+    XtSetArg(args[num], XtNx, &child_x); num++;
+    XtSetArg(args[num], XtNy, &child_y); num++;
+    XtSetArg(args[num], XtNborderWidth, &border_width); num++;
+    XtGetValues(child, args, num);
+
+    /*
+     * The only way we will know of the widget is mapped is to see if
+     * mapped when managed is True and this is a managed child.  Otherwise
+     * we will have to ask the server if this window is mapped
+     */
+    if (XtIsWidget(child) && !(mapped_when_managed && XtIsManaged(child)))
+    {
+       XWindowAttributes attrs;
+
+       if (XGetWindowAttributes(XtDisplay(child), XtWindow(child), &attrs)
+           &&  attrs.map_state != IsViewable)
+       return (False);
+    }
+
+    return ((x >= child_x)
+           && (x <= (child_x + (Position)width + 2 * (Position)border_width))
+           && (y >= child_y)
+           && (y <= (child_y + (Position)height + 2 * (Position)border_width)));
+}
+
+/*
+ * Function:
+ *     _FindChild
+ *
+ * Parameters:
+ *     parent - widget that is known to contain the point specified
+ *     x      - point in coordinates relative to the widget specified
+ *     y      - ""
+ *
+ * Description:
+ *     Finds the child that actually contains the point shown.
+ */
+static Widget
+_FindChild(Widget parent, int x, int y)
+{
+    Widget *children;
+    int i = FindChildren(parent, &children, True, False, True);
+
+    while (i > 0)
+    {
+       i--;
+
+       if (PositionInChild(children[i], x, y))
+       {
+           Widget child = children[i];
+
+           XtFree((char *)children);
+           return (_FindChild(child, x - child->core.x, y - child->core.y));
+       }
+    }
+
+    XtFree((char *)children);
+
+    return (parent);
+}
+
+/*
+ * Function:
+ *     DoFindChild
+ *
+ * Parameters:
+ *     w      - widget in the tree
+ *     event  - event that caused this action
+ *     stream - protocol stream to add
+ * Description:
+ *     Finds the child that contains the location specified.
+ *
+ * Returns:
+ *       An allocated error message if something went horribly wrong and
+ *     no set values were performed, else NULL.
+ */
+static _Xconst char *
+DoFindChild(Widget w, EditresEvent *event, ProtocolStream *stream)
+{
+    _Xconst char *str;
+    Widget parent, child;
+    Position parent_x, parent_y;
+    FindChildEvent *find_event = (FindChildEvent *)event;
+
+    if ((str = VerifyWidget(w, find_event->widgets)) != NULL)
+       return (str);
+
+    parent = find_event->widgets->real_widget;
+
+    XtTranslateCoords(parent, (Position) 0, (Position) 0,
+                     &parent_x, &parent_y);
+
+    child = _FindChild(parent, find_event->x - (int) parent_x,
+                      find_event->y - (int) parent_y);
+
+    InsertWidget(stream, child);
+
+    return (NULL);
+}
+
+/************************************************************
+ * Procedures for performing GetResources
+ ************************************************************/
+/*
+ * Function:
+ *     DoGetResources
+ *
+ * Parameters:
+ *     w      - widget in the tree
+ *     event  - event that caused this action
+ *     stream - protocol stream to add
+ *
+ * Description:
+ *     Gets the Resources associated with the widgets passed.
+ *
+ * Returns:
+ *     NULL
+ */
+static _Xconst char *
+DoGetResources(Widget w, EditresEvent *event, ProtocolStream *stream)
+{
+    unsigned int i;
+    _Xconst char *str;
+    GetResEvent *res_event = (GetResEvent *)event;
+
+    _XEditResPut16(stream, res_event->num_entries); /* number of replys */
+
+    for (i = 0; i < res_event->num_entries; i++)
+    {
+       /*
+        * Send out the widget id
+        */
+       _XEditResPutWidgetInfo(stream, &res_event->widgets[i]);
+       if ((str = VerifyWidget(w, &res_event->widgets[i])) != NULL)
+       {
+           _XEditResPutBool(stream, True);     /* an error occured */
+           _XEditResPutString8(stream, str);   /* set message */
+       }
+       else
+       {
+           _XEditResPutBool(stream, False);    /* no error occured */
+           ExecuteGetResources(res_event->widgets[i].real_widget, stream);
+       }
+    }
+
+    return (NULL);
+}
+
+/* Function:
+ *     ExecuteGetResources
+ *
+ * Parameters:
+ *     w      - widget to get resources on
+ *     stream - protocol stream
+ *
+ * Description:
+ *     Gets the resources for any individual widget
+ */
+static void
+ExecuteGetResources(Widget w, ProtocolStream *stream)
+{
+    XtResourceList norm_list, cons_list;
+    Cardinal num_norm, num_cons;
+    register Cardinal i;
+
+    /*
+     * Get Normal Resources
+     */
+    XtGetResourceList(XtClass(w), &norm_list, &num_norm);
+
+    if (XtParent(w) != NULL)
+       XtGetConstraintResourceList(XtClass(XtParent(w)), &cons_list,&num_cons);
+    else
+       num_cons = 0;
+
+    _XEditResPut16(stream, num_norm + num_cons);       /* how many resources */
+
+    /*
+     * Insert all the normal resources
+     */
+    for (i = 0; i < num_norm; i++)
+    {
+       _XEditResPutResourceType(stream, NormalResource);
+       _XEditResPutString8(stream, norm_list[i].resource_name);
+       _XEditResPutString8(stream, norm_list[i].resource_class);
+       _XEditResPutString8(stream, norm_list[i].resource_type);
+    }
+    XtFree((char *)norm_list);
+
+    /*
+     * Insert all the constraint resources
+     */
+    if (num_cons > 0)
+    {
+       for (i = 0; i < num_cons; i++)
+       {
+           _XEditResPutResourceType(stream, ConstraintResource);
+           _XEditResPutString8(stream, cons_list[i].resource_name);
+           _XEditResPutString8(stream, cons_list[i].resource_class);
+           _XEditResPutString8(stream, cons_list[i].resource_type);
+       }
+       XtFree((char *)cons_list);
+    }
+}
+
+/*
+ * Function:
+ *     DumpValues
+ *
+ * Parameters:
+ *     event  - event that caused this action
+ *     stream - protocol stream to add
+ *
+ * Description:
+ *     Returns resource values to the resource editor.
+ *
+ * Returns:
+ *     NULL
+ */
+/*ARGSUSED*/
+static _Xconst char *
+DumpValues(Widget w, EditresEvent* event, ProtocolStream* stream)
+{
+    _Xconst char *str;
+    Arg warg[1];
+    _Xconst _XtString res_value = NULL;
+    GetValuesEvent *gv_event = (GetValuesEvent *)event;
+
+    /* put the count in the stream */
+    _XEditResPut16(stream, (unsigned int)1);
+
+    /*
+     * Get the resource of the widget asked for by the
+     * resource editor and insert it into the stream
+     */
+    XtSetArg(warg[0], gv_event->name, &res_value);
+
+    if ((str = VerifyWidget(w, &gv_event->widgets[0])) != NULL)
+       _XEditResPutString8(stream, str);
+    else
+    {
+       _XEditresGetStringValues(gv_event->widgets[0].real_widget, warg, 1);
+       if (!res_value)
+           res_value = "NoValue";
+       _XEditResPutString8(stream, res_value);
+    }
+
+    return (NULL);
+}
+
+/************************************************************
+ * Code for inserting values into the protocol stream
+ ************************************************************/
+/*
+ * Function:
+ *     InsertWidget
+ *
+ * Parameters:
+ *     stream - protocol stream
+ *     w      - widget to insert
+ *
+ * Description:
+ *       Inserts the full parent hierarchy of this widget into the protocol
+ *     stream as a widget list.
+ */
+static void
+InsertWidget(ProtocolStream *stream, Widget w)
+{
+    Widget temp;
+    unsigned long *widget_list;
+    register int i, num_widgets;
+
+    for (temp = w, i = 0; temp != NULL; temp = XtParent(temp), i++)
+       ;
+
+    num_widgets = i;
+    widget_list = (unsigned long *)XtMalloc(sizeof(unsigned long) * num_widgets);
+
+    /*
+     * Put the widgets into the list
+     * make sure that they are inserted in the list from parent -> child
+     */
+    for (i--, temp = w; temp != NULL; temp = XtParent(temp), i--)
+    widget_list[i] = (unsigned long)temp;
+
+    _XEditResPut16(stream, num_widgets);       /* insert number of widgets */
+    for (i = 0; i < num_widgets; i++)          /* insert Widgets themselves */
+       _XEditResPut32(stream, widget_list[i]);
+
+    XtFree((char *)widget_list);
+}
+
+/************************************************************
+ * All of the following routines are public
+ ************************************************************/
+/*
+ * Function:
+ *     _XEditResPutString8
+ *
+ * Parameters:
+ *     stream - stream to insert string into
+ *     str    - string to insert
+ *
+ * Description:
+ *     Inserts a string into the protocol stream.
+ */
+void
+_XEditResPutString8(ProtocolStream *stream, _Xconst char *str)
+{
+    int i, len = strlen(str);
+
+    _XEditResPut16(stream, len);
+    for (i = 0; i < len; i++, str++)
+       _XEditResPut8(stream, *str);
+}
+
+/*
+ * Function:
+ *     _XEditResPut8
+ *
+ * Parameters:
+ *     stream - stream to insert string into
+ *     value  - value to insert
+ *
+ * Description:
+ *     Inserts an 8 bit integer into the protocol stream.
+ */
+void
+_XEditResPut8(ProtocolStream *stream, unsigned int value)
+{
+    unsigned char temp;
+
+    if (stream->size >= stream->alloc)
+    {
+       stream->alloc += 100;
+       stream->real_top = (unsigned char *)
+           XtRealloc((char *)stream->real_top, stream->alloc + HEADER_SIZE);
+       stream->top = stream->real_top + HEADER_SIZE;
+       stream->current = stream->top + stream->size;
+    }
+
+    temp = (unsigned char) (value & BYTE_MASK);
+    *((stream->current)++) = temp;
+    (stream->size)++;
+}
+
+/*
+ * Function:
+ *     _XEditResPut16
+ *
+ * Arguments:
+ *     stream - stream to insert string into
+ *     value  - value to insert
+ *
+ * Description:
+ *     Inserts a 16 bit integer into the protocol stream.
+ */
+void
+_XEditResPut16(ProtocolStream *stream, unsigned int value)
+{
+    _XEditResPut8(stream, (value >> XER_NBBY) & BYTE_MASK);
+    _XEditResPut8(stream, value & BYTE_MASK);
+}
+
+/*
+ * Function:
+ *     _XEditResPut32
+ *
+ * Arguments:
+ *     stream - stream to insert string into
+ *     value  - value to insert
+ *
+ * Description:
+ *     Inserts a 32 bit integer into the protocol stream.
+ */
+void
+_XEditResPut32(ProtocolStream *stream, unsigned long value)
+{
+    int i;
+
+    for (i = 3; i >= 0; i--)
+       _XEditResPut8(stream, (value >> (XER_NBBY * i)) & BYTE_MASK);
+}
+
+/*
+ * Function:
+ *     _XEditResPutWidgetInfo
+ *
+ * Parameters:
+ *     stream - stream to insert widget info into
+ *     info   - info to insert
+ *
+ * Description:
+ *     Inserts the widget info into the protocol stream.
+ */
+void
+_XEditResPutWidgetInfo(ProtocolStream *stream, WidgetInfo *info)
+{
+    unsigned int i;
+
+    _XEditResPut16(stream, info->num_widgets);
+    for (i = 0; i < info->num_widgets; i++)
+       _XEditResPut32(stream, info->ids[i]);
+}
+
+/************************************************************
+ * Code for retrieving values from the protocol stream
+ ************************************************************/
+/*
+ * Function:
+ *     _XEditResResetStream
+ *
+ * Parameters:
+ *     stream - stream to reset
+ *
+ * Description:
+ *     Resets the protocol stream.
+ */
+void
+_XEditResResetStream(ProtocolStream *stream)
+{
+    stream->current = stream->top;
+    stream->size = 0;
+    if (stream->real_top == NULL)
+    {
+       stream->real_top = (unsigned char *)
+           XtRealloc((char *)stream->real_top, stream->alloc + HEADER_SIZE);
+       stream->top = stream->real_top + HEADER_SIZE;
+       stream->current = stream->top + stream->size;
+    }
+}
+
+/*
+ * NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
+ *
+ * The only modified field if the "current" field
+ *
+ * The only fields that must be set correctly are the "current", "top"
+ * and "size" fields.
+ */
+/*
+ * Function:
+ *     _XEditResGetg8
+ *
+ * Parameters:
+ *     stream - protocol stream
+ *     value  - a pointer to value to return
+ *
+ * Description:
+ *     Retrieves an unsigned 8 bit value from the protocol stream.
+ *
+ * Returns:
+ *     True if sucessful
+ */
+Bool
+_XEditResGet8(ProtocolStream *stream, unsigned char *value)
+{
+    if (stream->size < (unsigned long)(stream->current - stream->top))
+       return (False);
+
+    *value = *((stream->current)++);
+    return (True);
+}
+
+/*
+ * Function:
+ *     _XEditResGet16
+ *
+ * Parameters:
+ *     stream - protocol stream
+ *     value  - pointer to return value
+ *
+ * Description:
+ *     Retrieves an unsigned 16 bit value from the protocol stream.
+ *
+ * Returns:
+ *     True if sucessful
+ */
+Bool
+_XEditResGet16(ProtocolStream *stream, unsigned short *value)
+{
+    unsigned char temp1, temp2;
+
+    if (!(_XEditResGet8(stream, &temp1) && _XEditResGet8(stream, &temp2)))
+       return (False);
+
+    *value = ((unsigned short)temp1 << XER_NBBY) + (unsigned short)temp2;
+    return (True);
+}
+
+/*
+ * Function:
+ *     _XEditResGetSigned16
+ *
+ * Parameters:
+ *     stream - protocol stream
+ *     value  - pointer to return value
+ *
+ * Description:
+ *     Retrieves an signed 16 bit value from the protocol stream.
+ *
+ * Returns:
+ *     True if sucessful
+ */
+Bool
+_XEditResGetSigned16(ProtocolStream *stream, short *value)
+{
+    unsigned char temp1, temp2;
+
+    if (!(_XEditResGet8(stream, &temp1) && _XEditResGet8(stream, &temp2)))
+       return (False);
+
+    if (temp1 & (1 << (XER_NBBY - 1))) /* If the sign bit is active */
+    {
+      *value = -1;                     /* store all 1's */
+      *value &= (temp1 << XER_NBBY);   /* Now and in the MSB */
+      *value &= temp2;                 /* and LSB */
+    }
+    else
+       *value = ((unsigned short)temp1 << XER_NBBY) + (unsigned short)temp2;
+
+    return (True);
+}
+
+/*
+ * Function:
+ *     _XEditResGet32
+ *
+ * Parameters:
+ *     stream - protocol stream
+ *     value  - pointer to return value
+ *
+ * Description:
+ *     Retrieves an unsigned 32 bit value from the protocol stream.
+ *
+ * Returns:
+ *     True if sucessful
+ */
+Bool
+_XEditResGet32(ProtocolStream *stream, unsigned long *value)
+{
+    unsigned short temp1, temp2;
+
+    if (!(_XEditResGet16(stream, &temp1) && _XEditResGet16(stream, &temp2)))
+       return (False);
+
+    *value = ((unsigned short)temp1 << (XER_NBBY * 2)) + (unsigned short)temp2;
+    return (True);
+}
+
+/* Function:
+ *     _XEditResGetString8
+ *
+ * Parameters:
+ *     stream - protocol stream
+ *     str    - string to retrieve
+ *
+ * Description:
+ *     Retrieves an 8 bit string value from the protocol stream.
+ *
+ * Returns:
+ *     True if retrieval was successful
+ */
+Bool
+_XEditResGetString8(ProtocolStream *stream, char **str)
+{
+    unsigned short len;
+    register unsigned i;
+
+    if (!_XEditResGet16(stream, &len))
+       return (False);
+
+    *str = XtMalloc(sizeof(char) * (len + 1));
+
+    for (i = 0; i < len; i++)
+    {
+       if (!_XEditResGet8(stream, (unsigned char *)*str + i))
+       {
+           XtFree(*str);
+           *str = NULL;
+           return (False);
+       }
+    }
+    (*str)[i] = '\0';
+
+    return (True);
+}
+
+/*
+ * Function:
+ *     _XEditResGetWidgetInfo
+ *
+ * Parameters:
+ *     stream - protocol stream
+ *     info   - widget info struct to store into
+ *
+ * Description:
+ *       Retrieves the list of widgets that follow and stores them in the
+ *     widget info structure provided.
+ *
+ * Returns:
+ *     True if retrieval was successful
+ */
+Bool
+_XEditResGetWidgetInfo(ProtocolStream *stream, WidgetInfo *info)
+{
+    unsigned int i;
+
+    if (!_XEditResGet16(stream, &info->num_widgets))
+       return (False);
+
+    info->ids = (unsigned long *)XtMalloc(sizeof(long) * info->num_widgets);
+
+    for (i = 0; i < info->num_widgets; i++)
+    {
+       if (!_XEditResGet32(stream, info->ids + i))
+       {
+           XtFree((char *)info->ids);
+           info->ids = NULL;
+           return (False);
+       }
+#if defined(LONG64) || defined(WORD64)
+       info->ids[i] |= globals.base_address;
+#endif
+    }
+    return (True);
+}
+
+/************************************************************
+ * Code for Loading the EditresBlock resource
+ ************************************************************/
+/*
+ * Function:
+ *     CvStringToBlock
+ *
+ * Parameters:
+ *     dpy            - display
+ *     args           - unused
+ *     num_args       - unused
+ *     from_val       - value to convert
+ *     to_val         - where to store
+ *     converter_data - unused
+ *
+ * Description:
+ *     Converts a string to an editres block value.
+ *
+ * Returns:
+ *     True if conversion was sucessful
+ */
+/*ARGSUSED*/
+static Boolean
+CvtStringToBlock(Display *dpy, XrmValue *args, Cardinal *num_args,
+                XrmValue *from_val, XrmValue *to_val,
+                XtPointer *converter_data)
+{
+    char ptr[16];
+    static EditresBlock block;
+
+    XmuNCopyISOLatin1Lowered(ptr, from_val->addr, sizeof(ptr));
+
+    if (streq(ptr, "none"))
+       block = BlockNone;
+    else if (streq(ptr, "setvalues"))
+       block = BlockSetValues;
+    else if (streq(ptr, "all"))
+       block = BlockAll;
+    else
+    {
+       Cardinal num_params = 1;
+       String params[1];
+
+       params[0] = from_val->addr;
+       XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
+                       "CvtStringToBlock", "unknownValue", "EditresError",
+                       "Could not convert string \"%s\" to EditresBlock.",
+                       params, &num_params);
+       return FALSE;
+    }
+
+    if (to_val->addr != NULL)
+    {
+       if (to_val->size < sizeof(EditresBlock))
+       {
+           to_val->size = sizeof(EditresBlock);
+           return FALSE;
+       }
+       *(EditresBlock *)(to_val->addr) = block;
+    }
+    else
+       to_val->addr = (XtPointer)block;
+
+    to_val->size = sizeof(EditresBlock);
+    return TRUE;
+}
+
+#define XtREditresBlock                "EditresBlock"
+/*
+ * Function:
+ *     LoadResources
+ *
+ * Parameters:
+ *     w - any widget in the tree
+ *
+ * Description:
+ *       Loads a global resource the determines of this application should
+ *     allow Editres requests.
+ */
+static void
+LoadResources(Widget w)
+{
+    static XtResource resources[] = {
+        {"editresBlock", "EditresBlock", XtREditresBlock, sizeof(EditresBlock),
+        XtOffsetOf(Globals, block), XtRImmediate, (XtPointer)BlockNone}
+    };
+
+    for (; XtParent(w) != NULL; w = XtParent(w))
+       ;
+
+    XtAppSetTypeConverter(XtWidgetToApplicationContext(w),
+                         XtRString, XtREditresBlock, CvtStringToBlock,
+                         NULL, 0, XtCacheAll, NULL);
+
+    XtGetApplicationResources(w, (XtPointer)&globals, resources,
+                             XtNumber(resources), NULL, 0);
+}
+
+/*
+ * Function:
+ *     _XEditresGetStringValues
+ *
+ * Parameters:
+ *     w       - widget
+ *     warg    - where to store result
+ *     numargs - unused
+ */
+/*ARGSUSED*/
+static void
+_XEditresGetStringValues(Widget w, Arg *warg, int numargs)
+{
+    static char buffer[32];
+    XtResourceList res_list;
+    Cardinal num_res;
+    XtResource *res = NULL;
+    long value;
+    Cardinal i;
+    char *string = "";
+    Arg args[1];
+    XrmValue to, from;
+
+    /*
+     * Look for the resource
+     */
+    XtGetResourceList(XtClass(w), &res_list, &num_res);
+    for (i = 0; i < num_res; i++)
+       if (strcmp(res_list[i].resource_name, warg->name) == 0)
+       {
+           res = &res_list[i];
+           break;
+       }
+
+    if (res == NULL && XtParent(w) != NULL)
+    {
+       XtFree((char *)res_list);
+       XtGetConstraintResourceList(XtClass(XtParent(w)), &res_list, &num_res);
+       for (i = 0; i < num_res; i++)
+           if (strcmp(res_list[i].resource_name, warg->name) == 0)
+           {
+               res = &res_list[i];
+               break;
+           }
+    }
+
+    if (res == NULL)
+    {
+       /* Couldn't find resource */
+
+       XtFree((char *)res_list);
+       *(XtPointer *)warg->value = NULL;
+       return;
+    }
+
+    /* try to get the value in the proper size */
+    switch (res->resource_size)
+    {
+#ifdef LONG64
+       long v8;
+#endif
+       int v4;
+       short v2;
+       char v1;
+
+    case 1:
+       XtSetArg(args[0], res->resource_name, &v1);
+       XtGetValues(w, args, 1);
+       value = (int)v1;
+       break;
+    case 2:
+       XtSetArg(args[0], res->resource_name, &v2);
+       XtGetValues(w, args, 1);
+       value = (int)v2;
+       break;
+    case 4:
+       XtSetArg(args[0], res->resource_name, &v4);
+       XtGetValues(w, args, 1);
+       value = (int)v4;
+       break;
+#ifdef LONG64
+    case 8:
+       XtSetArg(args[0], res->resource_name, &v8);
+       XtGetValues(w, args, 1);
+       value = (long)v8;
+       break;
+#endif
+    default:
+       fprintf(stderr, "_XEditresGetStringValues: bad size %d\n",
+               res->resource_size);
+       string = "bad size";
+       *(char **)(warg->value) = string;
+       XtFree((char *)res_list);
+       return;
+    }
+
+    /*
+     * If the resource is already String, no conversion needed
+     */
+    if (strcmp(XtRString, res->resource_type) == 0)
+    {
+       if (value == 0)
+           string = "(null)";
+       else
+           string = (char *)value;
+    }
+    else
+    {
+       from.size = res->resource_size;
+       from.addr = (XPointer)&value;
+       to.addr = NULL;
+       to.size = 0;
+
+       if (XtConvertAndStore(w,res->resource_type, &from, XtRString, &to))
+           string = to.addr;
+       else
+       {
+           string = buffer;
+           /*
+            * Conversion failed, fall back to representing it as integer
+            */
+           switch (res->resource_size)
+           {
+           case sizeof(char):
+               XmuSnprintf(buffer, sizeof(buffer), "%d", (int)(value & 0xff));
+               break;
+           case sizeof(short):
+               XmuSnprintf(buffer, sizeof(buffer), "%d", (int)(value & 0xffff));
+               break;
+           case sizeof(int):
+               XmuSnprintf(buffer, sizeof(buffer), "0x%08x", (int)value);
+               break;
+#ifdef LONG64
+           case sizeof(long):
+               XmuSnprintf(buffer, sizeof(buffer), "0x%016lx", value);
+               break;
+#endif
+           }
+       }
+    }
+
+    if (string == NULL)
+       string = "";
+
+    *(char **)(warg->value) = string;
+    XtFree((char *)res_list);
+}
diff --git a/src/ExtAgent.c b/src/ExtAgent.c
new file mode 100644 (file)
index 0000000..16a709b
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+
+Copyright 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Intrinsic.h>
+#include <X11/Xmu/ExtAgent.h>
+
+/* ARGSUSED */
+void
+XmuRegisterExternalAgent(Widget w, XtPointer data,
+                        XEvent *event, Boolean *cont)
+{
+/*
+* This is a stub.  Writers of protocol libraries
+* that want to add protocol to Xaw, such as RAP, will reimplement this
+* procedure in their own libraries.
+*/
+}
diff --git a/src/FToCback.c b/src/FToCback.c
new file mode 100644 (file)
index 0000000..07c00fe
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+
+Copyright 1988,1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include       <X11/Intrinsic.h>
+#include <X11/Xmu/Converters.h>
+
+/* ARGSUSED */
+void
+XmuCvtFunctionToCallback(XrmValue *args, Cardinal *num_args,
+                        XrmValuePtr fromVal, XrmValuePtr toVal)
+{
+    static XtCallbackRec callback[2]; /* K&R: initialized to NULL */
+    static XtCallbackList callback_list = callback;
+
+    callback[0].callback = *(XtCallbackProc *)fromVal->addr;
+
+    toVal->size = sizeof(XtCallbackList);
+    toVal->addr = (XPointer)&callback_list;
+}
diff --git a/src/GetHost.c b/src/GetHost.c
new file mode 100644 (file)
index 0000000..2f0bccd
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author:  Jim Fulton, MIT X Consortium
+ *
+ * _XGetHostname - similar to gethostname but allows special processing.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xosdefs.h>
+#include <string.h>
+#include <unistd.h>
+
+#ifdef WIN32
+#include <X11/Xlibint.h>
+#include <X11/Xwinsock.h>
+#endif
+
+#ifdef USG
+#define NEED_UTSNAME
+#endif
+
+#ifdef NEED_UTSNAME
+#include <sys/utsname.h>
+#endif
+
+#include <X11/Xmu/SysUtil.h>
+
+int
+XmuGetHostname(char *buf, int maxlen)
+{
+    int len;
+#ifdef WIN32
+    static WSADATA wsadata;
+
+    if (!wsadata.wVersion && WSAStartup(MAKEWORD(2,2), &wsadata))
+       return -1;
+#endif
+
+#ifdef NEED_UTSNAME
+    /*
+     * same host name crock as in server and xinit.
+     */
+    struct utsname name;
+
+    uname (&name);
+    len = strlen (name.nodename);
+    if (len >= maxlen) len = maxlen - 1;
+    strncpy (buf, name.nodename, len);
+    buf[len] = '\0';
+#else
+    buf[0] = '\0';
+    (void) gethostname (buf, maxlen);
+    buf [maxlen - 1] = '\0';
+    len = strlen(buf);
+#endif /* hpux */
+    return len;
+}
diff --git a/src/GrayPixmap.c b/src/GrayPixmap.c
new file mode 100644 (file)
index 0000000..8005c3a
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/***********************************************************
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Intrinsic.h>
+#include <X11/Xmu/Drawing.h>
+
+typedef struct _PixmapCache {
+    Screen *screen;
+    Pixmap pixmap;
+    Pixel foreground, background;
+    unsigned int depth;
+    int ref_count;
+    struct _PixmapCache *next;
+  } CacheEntry;
+
+static CacheEntry *pixmapCache = NULL;
+
+
+
+Pixmap
+XmuCreateStippledPixmap(Screen *screen, Pixel fore, Pixel back,
+                       unsigned int depth)
+/*
+ *     Creates a stippled pixmap of specified depth
+ *     caches these so that multiple requests share the pixmap
+ */
+{
+    register Display *display = DisplayOfScreen(screen);
+    CacheEntry *cachePtr;
+    Pixmap stippled_pixmap;
+    static unsigned char pixmap_bits[] = {
+       0x02, 0x01,
+    };
+
+/*
+ *     Creates a stippled pixmap of depth DefaultDepth(screen)
+ *     caches these so that multiple requests share the pixmap
+ */
+
+#define pixmap_width 2
+#define pixmap_height 2
+
+    /* see if we already have a pixmap suitable for this screen */
+    for (cachePtr = pixmapCache; cachePtr; cachePtr = cachePtr->next) {
+       if (cachePtr->screen == screen && cachePtr->foreground == fore &&
+           cachePtr->background == back && cachePtr->depth == depth)
+           return( cachePtr->ref_count++, cachePtr->pixmap );
+    }
+
+    stippled_pixmap = XCreatePixmapFromBitmapData (display,
+                       RootWindowOfScreen(screen), (char *)pixmap_bits,
+                       pixmap_width, pixmap_height, fore, back, depth);
+
+    /* and insert it at the head of the cache */
+    cachePtr = XtNew(CacheEntry);
+    cachePtr->screen = screen;
+    cachePtr->foreground = fore;
+    cachePtr->background = back;
+    cachePtr->depth = depth;
+    cachePtr->pixmap = stippled_pixmap;
+    cachePtr->ref_count = 1;
+    cachePtr->next = pixmapCache;
+    pixmapCache = cachePtr;
+
+    return( stippled_pixmap );
+}
+
+void
+XmuReleaseStippledPixmap(Screen *screen, Pixmap pixmap)
+{
+    register Display *display = DisplayOfScreen(screen);
+    CacheEntry *cachePtr, **prevP;
+    for (prevP = &pixmapCache, cachePtr = pixmapCache; cachePtr;) {
+       if (cachePtr->screen == screen && cachePtr->pixmap == pixmap) {
+           if (--cachePtr->ref_count == 0) {
+               XFreePixmap( display, pixmap );
+               *prevP = cachePtr->next;
+               XtFree( (char*)cachePtr );
+               break;
+           }
+       }
+       prevP = &cachePtr->next;
+       cachePtr = *prevP;
+    }
+}
diff --git a/src/Initer.c b/src/Initer.c
new file mode 100644 (file)
index 0000000..bf05942
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+
+Copyright 1988, 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/* Created By:  Chris D. Peterson
+ *              MIT X Consortium
+ * Date:        May 8, 1989
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Intrinsic.h>
+#include <X11/Xmu/Initer.h>
+
+struct InitializerList {
+  XmuInitializerProc function; /* function to call */
+  XPointer data;               /* Data to pass the function. */
+  XtAppContext * app_con_list; /* a null terminated list of app_contexts. */
+};
+
+/*
+ * Prototypes
+ */
+static Bool AddToAppconList(XtAppContext**, XtAppContext);
+
+static struct InitializerList * init_list = NULL;
+static Cardinal init_list_length = 0;
+
+void
+XmuAddInitializer(XmuInitializerProc func, XPointer data)
+{
+  init_list_length++;
+  init_list = (struct InitializerList *) XtRealloc( (char *) init_list,
+                                           (sizeof(struct InitializerList) *
+                                            init_list_length) );
+
+  init_list[init_list_length - 1].function = func;
+  init_list[init_list_length - 1].data = data;
+  init_list[init_list_length - 1].app_con_list = NULL;
+}
+
+void
+XmuCallInitializers(XtAppContext app_con)
+{
+  unsigned i;
+
+  for (i = 0 ; i < init_list_length ; i++) {
+    if (AddToAppconList(&(init_list[i].app_con_list), app_con))
+      (init_list[i].function) (app_con, init_list[i].data);
+  }
+}
+
+/*
+ * Function:
+ *     AddToAppconList
+ *
+ * Parameters:
+ *     app_list - NULL terminated list of application contexts
+ *     app_con  - application context to test
+ *
+ * Description:
+ *       Adds an action to the application context list and
+ *     returns True, if this app_con is already on the list then
+ *     it is NOT added and False is returned.
+ *
+ * Returns:
+ *     True if not found, False if found
+ */
+static Bool
+AddToAppconList(XtAppContext **app_list, XtAppContext app_con)
+{
+  int i;
+  XtAppContext *local_list;
+
+  i = 0;
+  local_list = *app_list;
+  if (*app_list != NULL) {
+    for ( ; *local_list != NULL ; i++, local_list++) {
+      if (*local_list == app_con)
+       return (False);
+    }
+  }
+
+  *app_list = (XtAppContext *)  XtRealloc((char *)(*app_list),
+                                         sizeof(XtAppContext *) * (i + 2) );
+  (*app_list)[i++] = app_con;
+  (*app_list)[i] = NULL;
+
+  return (True);
+}
diff --git a/src/LocBitmap.c b/src/LocBitmap.c
new file mode 100644 (file)
index 0000000..b587de7
--- /dev/null
@@ -0,0 +1,269 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author:  Jim Fulton, MIT X Consortium
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xlib.h>
+#include <stdlib.h>
+#include <string.h>
+#include <X11/Xresource.h>
+#include <X11/Xutil.h>
+#include <X11/Xmu/CvtCache.h>
+#include <X11/Xmu/Drawing.h>
+#include <X11/Xmu/SysUtil.h>
+
+#ifndef X_NOT_POSIX
+#ifdef _POSIX_SOURCE
+#include <limits.h>
+#else
+#define _POSIX_SOURCE
+#include <limits.h>
+#undef _POSIX_SOURCE
+#endif
+#endif /* X_NOT_POSIX */
+#ifndef PATH_MAX
+#ifdef WIN32
+#define PATH_MAX 512
+#else
+#include <sys/param.h>
+#endif
+#ifndef PATH_MAX
+#ifdef MAXPATHLEN
+#define PATH_MAX MAXPATHLEN
+#else
+#define PATH_MAX 1024
+#endif
+#endif
+#endif /* PATH_MAX */
+
+/*
+ * Prototypes
+ */
+static char **split_path_string(char*);
+
+/*
+ * XmuLocateBitmapFile - read a bitmap file using the normal defaults
+ */
+
+Pixmap
+XmuLocateBitmapFile(Screen *screen, _Xconst char *name, char *srcname,
+                           int srcnamelen, int *widthp, int *heightp,
+                           int *xhotp, int *yhotp)
+{
+    return XmuLocatePixmapFile (screen, name,
+                               (unsigned long) 1, (unsigned long) 0,
+                               (unsigned int) 1, srcname, srcnamelen,
+                               widthp, heightp, xhotp, yhotp);
+}
+
+
+/*
+ * version that reads pixmap data as well as bitmap data
+ */
+Pixmap
+XmuLocatePixmapFile(Screen *screen, _Xconst char *name,
+                           unsigned long fore, unsigned long back,
+                           unsigned int depth,
+                           char *srcname, int srcnamelen,
+                           int *widthp, int *heightp, int *xhotp, int *yhotp)
+{
+
+#ifndef BITMAPDIR
+#define BITMAPDIR "/usr/include/X11/bitmaps"
+#endif
+
+    Display *dpy = DisplayOfScreen (screen);
+    Window root = RootWindowOfScreen (screen);
+    Bool try_plain_name = True;
+    XmuCvtCache *cache = _XmuCCLookupDisplay (dpy);
+    char **file_paths = (char **) NULL;
+    char filename[PATH_MAX];
+#if 0
+    char* bitmapdir = BITMAPDIR;
+#endif
+    unsigned int width, height;
+    int xhot, yhot;
+    int i;
+
+    /*
+     * look in cache for bitmap path
+     */
+    if (cache) {
+       if (!cache->string_to_bitmap.bitmapFilePath) {
+           XrmName xrm_name[2];
+           XrmClass xrm_class[2];
+           XrmRepresentation rep_type;
+           XrmValue value;
+
+           xrm_name[0] = XrmPermStringToQuark ("bitmapFilePath");
+           xrm_name[1] = NULLQUARK;
+           xrm_class[0] = XrmPermStringToQuark ("BitmapFilePath");
+           xrm_class[1] = NULLQUARK;
+           if (!XrmGetDatabase(dpy)) {
+               /* what a hack; need to initialize it */
+               (void) XGetDefault (dpy, "", "");
+           }
+           if (XrmQGetResource (XrmGetDatabase(dpy), xrm_name, xrm_class,
+                                &rep_type, &value) &&
+               rep_type == XrmPermStringToQuark("String")) {
+               cache->string_to_bitmap.bitmapFilePath =
+                 split_path_string (value.addr);
+           }
+       }
+       file_paths = cache->string_to_bitmap.bitmapFilePath;
+    }
+
+    /*
+     * Search order:
+     *    1.  name if it begins with / or ./
+     *    2.  "each prefix in file_paths"/name
+     *    3.  BITMAPDIR/name
+     *    4.  name if didn't begin with / or .
+     */
+
+    for (i = 1; i <= 4; i++) {
+       char *fn = filename;
+       Pixmap pixmap;
+       unsigned char *data;
+
+       switch (i) {
+         case 1:
+#ifndef __UNIXOS2__
+           if (!(name[0] == '/' || ((name[0] == '.') && name[1] == '/')))
+#else
+           if (!(name[0] == '/' || (name[0] == '.' && name[1] == '/') ||
+                 (isalpha(name[0]) && name[1] == ':')))
+#endif
+             continue;
+           fn = (char *) name;
+           try_plain_name = False;
+           break;
+         case 2:
+           if (file_paths && *file_paths) {
+               XmuSnprintf(filename, sizeof(filename),
+                           "%s/%s", *file_paths, name);
+               file_paths++;
+               i--;
+               break;
+           }
+           continue;
+         case 3:
+           XmuSnprintf(filename, sizeof(filename), "%s/%s", BITMAPDIR, name);
+           break;
+         case 4:
+           if (!try_plain_name) continue;
+           fn = (char *) name;
+           break;
+       }
+
+       data = NULL;
+       pixmap = None;
+#ifdef __UNIXOS2__
+       fn = (char*)__XOS2RedirRoot(fn);
+#endif
+       if (XmuReadBitmapDataFromFile (fn, &width, &height, &data,
+                                      &xhot, &yhot) == BitmapSuccess) {
+           pixmap = XCreatePixmapFromBitmapData (dpy, root, (char *) data,
+                                                 width, height,
+                                                 fore, back, depth);
+           XFree ((char *)data);
+       }
+
+       if (pixmap) {
+           if (widthp) *widthp = (int)width;
+           if (heightp) *heightp = (int)height;
+           if (xhotp) *xhotp = xhot;
+           if (yhotp) *yhotp = yhot;
+           if (srcname && srcnamelen > 0) {
+               strncpy (srcname, fn, srcnamelen - 1);
+               srcname[srcnamelen - 1] = '\0';
+           }
+           return pixmap;
+       }
+    }
+
+    return None;
+}
+
+
+/*
+ * split_path_string - split a colon-separated list into its constituent
+ * parts; to release, free list[0] and list.
+ */
+static char **
+split_path_string(register char *src)
+{
+    int nelems = 1;
+    register char *dst;
+    char **elemlist, **elem;
+
+    /* count the number of elements */
+    for (dst = src; *dst; dst++) if (*dst == ':') nelems++;
+
+    /* get memory for everything */
+    dst = (char *) malloc (dst - src + 1);
+    if (!dst) return NULL;
+    elemlist = (char **) calloc ((nelems + 1), sizeof (char *));
+    if (!elemlist) {
+       free (dst);
+       return NULL;
+    }
+
+    /* copy to new list and walk up nulling colons and setting list pointers */
+    strcpy (dst, src);
+    for (elem = elemlist, src = dst; *src; src++) {
+       if (*src == ':') {
+           *elem++ = dst;
+           *src = '\0';
+           dst = src + 1;
+       }
+    }
+    *elem = dst;
+
+    return elemlist;
+}
+
+
+void
+_XmuStringToBitmapInitCache(register XmuCvtCache *c)
+{
+    c->string_to_bitmap.bitmapFilePath = NULL;
+}
+
+void
+_XmuStringToBitmapFreeCache(register XmuCvtCache *c)
+{
+    if (c->string_to_bitmap.bitmapFilePath) {
+       if (c->string_to_bitmap.bitmapFilePath[0])
+         free (c->string_to_bitmap.bitmapFilePath[0]);
+       free ((char *) (c->string_to_bitmap.bitmapFilePath));
+    }
+}
diff --git a/src/Lookup.c b/src/Lookup.c
new file mode 100644 (file)
index 0000000..023b33e
--- /dev/null
@@ -0,0 +1,276 @@
+/*
+
+Copyright 1988, 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xmu/Lookup.h>
+
+#define XK_LATIN1
+#define XK_PUBLISHING
+#include <X11/keysymdef.h>
+
+/* bit (1<<i) means character is in codeset i */
+static unsigned short _Xconst latin1[128] =
+  {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x10ee, 0x0000, 0x1000, 0x1084, 0x102e, 0x1000, 0x1080, 0x108e, /* 10 */
+   0x108e, 0x1080, 0x0000, 0x1080, 0x1080, 0x10ee, 0x1000, 0x1008,
+   0x108e, 0x1080, 0x1084, 0x1084, 0x108e, 0x1004, 0x1000, 0x1084, /* 11 */
+   0x100e, 0x1000, 0x0000, 0x1080, 0x1000, 0x1084, 0x1000, 0x0000,
+   0x0004, 0x000e, 0x000e, 0x0008, 0x000e, 0x0008, 0x0008, 0x0006, /* 12 */
+   0x0004, 0x000e, 0x0004, 0x000e, 0x0004, 0x000e, 0x000e, 0x0004,
+   0x0000, 0x0004, 0x0004, 0x0006, 0x000e, 0x0008, 0x000e, 0x000e, /* 13 */
+   0x0008, 0x0004, 0x000e, 0x000c, 0x000e, 0x0002, 0x0000, 0x000e,
+   0x0004, 0x000e, 0x000e, 0x0008, 0x000e, 0x0008, 0x0008, 0x0006, /* 14 */
+   0x0004, 0x000e, 0x0004, 0x000e, 0x0004, 0x000e, 0x000e, 0x0004,
+   0x0000, 0x0004, 0x0004, 0x0006, 0x000e, 0x0008, 0x000e, 0x000e, /* 15 */
+   0x0008, 0x0004, 0x000e, 0x000c, 0x000e, 0x0002, 0x0000, 0x0000};
+
+/* bit (1<<i) means character is in codeset i */
+static unsigned short _Xconst latin2[128] =
+  {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0008, 0x0004, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 10 */
+   0x0000, 0x0008, 0x0004, 0x0000, 0x0000, 0x0000, 0x0008, 0x0004,
+   0x0000, 0x0008, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0008, /* 11 */
+   0x0000, 0x0008, 0x0004, 0x0000, 0x0000, 0x0000, 0x0008, 0x0004,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 12 */
+   0x0008, 0x0000, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 13 */
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 14 */
+   0x0008, 0x0000, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 15 */
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x000c};
+
+/* maps Cyrillic keysyms to 8859-5 */
+static unsigned char _Xconst cyrillic[128] =
+   {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0xf2, 0xf3, 0xf1, 0xf4, 0xf5, 0xf6, 0xf7, /* 10 */
+    0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0xfe, 0xff,
+    0xf0, 0xa2, 0xa3, 0xa1, 0xa4, 0xa5, 0xa6, 0xa7, /* 11 */
+    0xa8, 0xa9, 0xaa, 0xab, 0xac, 0x00, 0xae, 0xaf,
+    0xee, 0xd0, 0xd1, 0xe6, 0xd4, 0xd5, 0xe4, 0xd3, /* 12 */
+    0xe5, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde,
+    0xdf, 0xef, 0xe0, 0xe1, 0xe2, 0xe3, 0xd6, 0xd2, /* 13 */
+    0xec, 0xeb, 0xd7, 0xe8, 0xed, 0xe9, 0xe7, 0xea,
+    0xce, 0xb0, 0xb1, 0xc6, 0xb4, 0xb5, 0xc4, 0xb3, /* 14 */
+    0xc5, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe,
+    0xbf, 0xcf, 0xc0, 0xc1, 0xc2, 0xc3, 0xb6, 0xb2, /* 15 */
+    0xcc, 0xcb, 0xb7, 0xc8, 0xcd, 0xc9, 0xc7, 0xca};
+
+/* maps Greek keysyms to 8859-7 */
+static unsigned char _Xconst greek[128] =
+   {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0xb6, 0xb8, 0xb9, 0xba, 0xda, 0x00, 0xbc, /* 10 */
+    0xbe, 0xdb, 0x00, 0xbf, 0x00, 0x00, 0xb5, 0xaf,
+    0x00, 0xdc, 0xdd, 0xde, 0xdf, 0xfa, 0xc0, 0xfc, /* 11 */
+    0xfd, 0xfb, 0xe0, 0xfe, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 12 */
+    0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+    0xd0, 0xd1, 0xd3, 0x00, 0xd4, 0xd5, 0xd6, 0xd7, /* 13 */
+    0xd8, 0xd9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 14 */
+    0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
+    0xf0, 0xf1, 0xf3, 0xf2, 0xf4, 0xf5, 0xf6, 0xf7, /* 15 */
+    0xf8, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+#define sLatin1                (unsigned long)0
+#define sLatin2                (unsigned long)1
+#define sLatin3                (unsigned long)2
+#define sLatin4                (unsigned long)3
+#define sKana          (unsigned long)4
+#define sX0201         (unsigned long)0x01000004
+#define sArabic                (unsigned long)5
+#define sCyrillic      (unsigned long)6
+#define sGreek         (unsigned long)7
+#define sAPL           (unsigned long)11
+#define sHebrew                (unsigned long)12
+
+int
+XmuLookupString(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+               KeySym *keysym, XComposeStatus *status,
+               unsigned long keysymSet)
+{
+    int count;
+    KeySym symbol;
+    unsigned long kset;
+
+    kset = keysymSet & 0xffffff;
+    count = XLookupString(event, (char *)buffer, nbytes, &symbol, status);
+    if (keysym) *keysym = symbol;
+    if ((nbytes == 0) || (symbol == NoSymbol)) {
+       /* nothing */
+    } else if ((count == 0) && ((symbol >> 8) == kset)) {
+       count = 1;
+       switch (keysymSet) {
+       case sKana:
+           buffer[0] = (symbol & 0xff);
+           if (buffer[0] == 0x7e)
+               count = 0;
+           break;
+       case sCyrillic:
+           buffer[0] = cyrillic[symbol & 0x7f];
+           break;
+       case sGreek:
+           buffer[0] = greek[symbol & 0x7f];
+           if (!buffer[0])
+               count = 0;
+           break;
+       default:
+           buffer[0] = (symbol & 0xff);
+           break;
+       }
+    } else if ((keysymSet != 0) && (count == 1) &&
+              (((unsigned char *)buffer)[0] == symbol) &&
+              (symbol & 0x80) &&
+              !(latin1[symbol & 0x7f] & (1 << kset))) {
+       if ((keysymSet == sHebrew) && (symbol == XK_multiply))
+           buffer[0] = 0xaa;
+       else if ((keysymSet == sHebrew) && (symbol == XK_division))
+           buffer[0] = 0xba;
+       else if ((keysymSet == sCyrillic) && (symbol == XK_section))
+           buffer[0] = 0xfd;
+       else if ((keysymSet == sX0201) && (symbol == XK_yen))
+           buffer[0] = 0x5c;
+       else
+           count = 0;
+    } else if (count != 0) {
+       if ((keysymSet == sX0201) &&
+           ((symbol == XK_backslash) || (symbol == XK_asciitilde)))
+           count = 0;
+    } else if (((symbol >> 8) == sLatin2) &&
+              (symbol & 0x80) && (latin2[symbol & 0x7f] & (1 << kset))) {
+       buffer[0] = (symbol & 0xff);
+       count = 1;
+    } else if ((keysymSet == sGreek) &&
+              ((symbol == XK_leftsinglequotemark) ||
+               (symbol == XK_rightsinglequotemark))) {
+       buffer[0] = symbol - (XK_leftsinglequotemark - 0xa1);
+       count = 1;
+    }
+    return count;
+}
+
+/* produces ISO 8859-1 encoding plus ASCII control */
+int
+XmuLookupLatin1(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+               KeySym *keysym, XComposeStatus *status)
+{
+    return XLookupString(event, (char *)buffer, nbytes, keysym, status);
+}
+
+/* produces ISO 8859-2 encoding plus ASCII control */
+int
+XmuLookupLatin2(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+               KeySym *keysym, XComposeStatus *status)
+{
+    return XmuLookupString(event, buffer, nbytes, keysym, status, sLatin2);
+}
+
+/* produces ISO 8859-3 encoding plus ASCII control */
+int
+XmuLookupLatin3(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+               KeySym *keysym, XComposeStatus *status)
+{
+    return XmuLookupString(event, buffer, nbytes, keysym, status, sLatin3);
+}
+
+/* produces ISO 8859-4 encoding plus ASCII control */
+int
+XmuLookupLatin4(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+               KeySym *keysym, XComposeStatus *status)
+{
+    return XmuLookupString(event, buffer, nbytes, keysym, status, sLatin4);
+}
+
+/* produces ISO 8859-1 GL plus Katakana plus ASCII control */
+int
+XmuLookupKana(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+             KeySym *keysym, XComposeStatus *status)
+{
+    return XmuLookupString(event, buffer, nbytes, keysym, status, sKana);
+}
+
+/* produces JIS X0201-1976 (8-bit) */
+int
+XmuLookupJISX0201(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+                 KeySym *keysym, XComposeStatus *status)
+{
+    return XmuLookupString(event, buffer, nbytes, keysym, status, sX0201);
+}
+
+/* produces ISO 8859-6 encoding plus ASCII control */
+int
+XmuLookupArabic(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+               KeySym *keysym, XComposeStatus *status)
+{
+    return XmuLookupString(event, buffer, nbytes, keysym, status, sArabic);
+}
+
+/* produces ISO/IEC 8859-5 encoding plus ASCII control */
+int
+XmuLookupCyrillic(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+                 KeySym *keysym, XComposeStatus *status)
+{
+    return XmuLookupString(event, buffer, nbytes, keysym, status, sCyrillic);
+}
+
+/* produces ISO 8859-7 encoding plus ASCII control */
+int
+XmuLookupGreek(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+              KeySym *keysym, XComposeStatus *status)
+{
+    return XmuLookupString(event, buffer, nbytes, keysym, status, sGreek);
+}
+
+/* XXX this character set needs work */
+
+int
+XmuLookupAPL(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+            KeySym *keysym, XComposeStatus *status)
+{
+    return XmuLookupString(event, buffer, nbytes, keysym, status, sAPL);
+}
+
+/* produces ISO 8859-8 encoding plus ASCII control */
+int
+XmuLookupHebrew(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+               KeySym *keysym, XComposeStatus *status)
+{
+    return XmuLookupString(event, buffer, nbytes, keysym, status, sHebrew);
+}
diff --git a/src/LookupCmap.c b/src/LookupCmap.c
new file mode 100644 (file)
index 0000000..4a52290
--- /dev/null
@@ -0,0 +1,322 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author:  Donna Converse, MIT X Consortium
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <X11/Xutil.h>
+#include <X11/Xmu/StdCmap.h>
+#include <stdlib.h>
+
+/*
+ * Prototypes
+ */
+static Status lookup(Display*, int, VisualID, Atom, XStandardColormap*, Bool);
+
+/*
+ * To create a standard colormap if one does not currently exist, or
+ * replace the currently existing standard colormap, use
+ * XmuLookupStandardColormap().
+ *
+ * Given a screen, a visual, and a property, XmuLookupStandardColormap()
+ * will determine the best allocation for the property under the specified
+ * visual, and determine the whether to create a new colormap or to use
+ * the default colormap of the screen.  It will call XmuStandardColormap()
+ * to create the standard colormap.
+ *
+ * If replace is true, any previous definition of the property will be
+ * replaced.  If retain is true, the property and the colormap will be
+ * made permanent for the duration of the server session.  However,
+ * pre-existing property definitions which are not replaced cannot be made
+ * permanent by a call to XmuLookupStandardColormap(); a request to retain
+ * resources pertains to newly created resources.
+ *
+ * Returns 0 on failure, non-zero on success.  A request to create a
+ * standard colormap upon a visual which cannot support such a map is
+ * considered a failure.  An example of this would be requesting any
+ * standard colormap property on a monochrome visual, or, requesting an
+ * RGB_BEST_MAP on a display whose colormap size is 16.
+ */
+
+Status
+XmuLookupStandardColormap(Display *dpy, int screen, VisualID visualid,
+                         unsigned int depth, Atom property,
+                         Bool replace, Bool retain)
+     /*
+      * dpy            - specifies X server connection
+      * screen                 - specifies screen of display
+      * visualid       - specifies the visual type
+      * depth          - specifies  the visual type
+      * property       - a standard colormap property
+      * replace                - specifies whether to replace
+      * retain         - specifies whether to retain
+      */
+{
+    Display            *odpy;          /* original display connection */
+    XStandardColormap  *colormap;
+    XVisualInfo                vinfo_template, *vinfo; /* visual */
+    long               vinfo_mask;
+    unsigned long      r_max, g_max, b_max;    /* allocation */
+    int                        count;
+    Colormap           cmap;                   /* colormap ID */
+    Status             status = 0;
+
+
+    /* Match the requested visual */
+
+    vinfo_template.visualid = visualid;
+    vinfo_template.screen = screen;
+    vinfo_template.depth = depth;
+    vinfo_mask = VisualIDMask | VisualScreenMask | VisualDepthMask;
+    if ((vinfo = XGetVisualInfo(dpy, vinfo_mask, &vinfo_template, &count)) ==
+       NULL)
+       return 0;
+
+    /* Monochrome visuals have no standard maps */
+
+    if (vinfo->colormap_size <= 2) {
+       XFree((char *) vinfo);
+       return 0;
+    }
+
+    /* If the requested property already exists on this screen, and,
+     * if the replace flag has not been set to true, return success.
+     * lookup() will remove a pre-existing map if replace is true.
+     */
+
+    if (lookup(dpy, screen, visualid, property, (XStandardColormap *) NULL,
+              replace) && !replace) {
+       XFree((char *) vinfo);
+       return 1;
+    }
+
+    /* Determine the best allocation for this property under the requested
+     * visualid and depth, and determine whether or not to use the default
+     * colormap of the screen.
+     */
+
+    if (!XmuGetColormapAllocation(vinfo, property, &r_max, &g_max, &b_max)) {
+       XFree((char *) vinfo);
+       return 0;
+    }
+
+    cmap = (property == XA_RGB_DEFAULT_MAP &&
+           visualid == XVisualIDFromVisual(DefaultVisual(dpy, screen)))
+       ? DefaultColormap(dpy, screen) : None;
+
+    /* If retaining resources, open a new connection to the same server */
+
+    if (retain) {
+       odpy = dpy;
+       if ((dpy = XOpenDisplay(XDisplayString(odpy))) == NULL) {
+           XFree((char *) vinfo);
+           return 0;
+       }
+    }
+
+    /* Create the standard colormap */
+
+    colormap = XmuStandardColormap(dpy, screen, visualid, depth, property,
+                                  cmap, r_max, g_max, b_max);
+
+    /* Set the standard colormap property */
+
+    if (colormap) {
+       XGrabServer(dpy);
+
+       if (lookup(dpy, screen, visualid, property, colormap, replace) &&
+           !replace) {
+           /* Someone has defined the property since we last looked.
+            * Since we will not replace it, release our own resources.
+            * If this is the default map, our allocations will be freed
+            * when this connection closes.
+            */
+           if (colormap->killid == ReleaseByFreeingColormap)
+               XFreeColormap(dpy, colormap->colormap);
+       }
+       else if (retain) {
+               XSetCloseDownMode(dpy, RetainPermanent);
+       }
+       XUngrabServer(dpy);
+       XFree((char *) colormap);
+       status = 1;
+    }
+
+    if (retain)
+       XCloseDisplay(dpy);
+    XFree((char *) vinfo);
+    return status;
+}
+
+/***************************************************************************/
+
+/* Lookup a standard colormap property.  If the property is RGB_DEFAULT_MAP,
+ * the visualid is used to determine whether the indicated standard colormap
+ * exists.  If the map exists and replace is true, delete the resources used
+ * by the map and remove the property.  Return true if the map exists,
+ * or did exist and was deleted; return false if the map was not found.
+ *
+ * Note that this is not the way that a Status return is normally used.
+ *
+ * If new is not NULL, new points to an XStandardColormap structure which
+ * describes a standard colormap of the specified property.  It will be made
+ * a standard colormap of the screen if none already exists, or if replace
+ * is true.
+ */
+
+static Status
+lookup(Display *dpy, int screen, VisualID visualid, Atom property,
+       XStandardColormap *cnew, Bool replace)
+     /*
+      * dpy            - specifies display connection
+      * screen         - specifies screen number
+      * visualid       - specifies visualid for std map
+      * property       - specifies colormap property name
+      * cnew           - specifies a standard colormap
+      * replace                - specifies whether to replace
+      */
+{
+    register int       i;
+    int                        count;
+    XStandardColormap  *stdcmaps, *s;
+    Window             win = RootWindow(dpy, screen);
+
+    /* The property does not already exist */
+
+    if (! XGetRGBColormaps(dpy, win, &stdcmaps, &count, property)) {
+       if (cnew)
+           XSetRGBColormaps(dpy, win, cnew, 1, property);
+       return 0;
+    }
+
+    /* The property exists and is not describing the RGB_DEFAULT_MAP */
+
+    if (property != XA_RGB_DEFAULT_MAP) {
+       if (replace) {
+           XmuDeleteStandardColormap(dpy, screen, property);
+           if (cnew)
+               XSetRGBColormaps(dpy, win, cnew, 1, property);
+       }
+       XFree((char *)stdcmaps);
+       return 1;
+    }
+
+    /* The property exists and is RGB_DEFAULT_MAP */
+
+    for (i=0, s=stdcmaps; (i < count) && (s->visualid != visualid); i++, s++)
+       ;
+
+    /* No RGB_DEFAULT_MAP property matches the given visualid */
+
+    if (i == count) {
+       if (cnew) {
+           XStandardColormap   *m, *maps;
+
+           s = (XStandardColormap *) malloc((unsigned) ((count+1) * sizeof
+                                             (XStandardColormap)));
+
+           for (i = 0, m = s, maps = stdcmaps; i < count; i++, m++, maps++) {
+               m->colormap   = maps->colormap;
+               m->red_max    = maps->red_max;
+               m->red_mult   = maps->red_mult;
+               m->green_max  = maps->green_max;
+               m->green_mult = maps->green_mult;
+               m->blue_max   = maps->blue_max;
+               m->blue_mult  = maps->blue_mult;
+               m->base_pixel = maps->base_pixel;
+               m->visualid   = maps->visualid;
+               m->killid     = maps->killid;
+           }
+           m->colormap   = cnew->colormap;
+           m->red_max    = cnew->red_max;
+           m->red_mult   = cnew->red_mult;
+           m->green_max  = cnew->green_max;
+           m->green_mult = cnew->green_mult;
+           m->blue_max   = cnew->blue_max;
+           m->blue_mult  = cnew->blue_mult;
+           m->base_pixel = cnew->base_pixel;
+           m->visualid   = cnew->visualid;
+           m->killid     = cnew->killid;
+
+           XSetRGBColormaps(dpy, win, s, ++count, property);
+           free((char *) s);
+       }
+       XFree((char *) stdcmaps);
+       return 0;
+    }
+
+    /* Found an RGB_DEFAULT_MAP property with a matching visualid */
+
+    if (replace) {
+       /* Free old resources first - we may need them, particularly in
+        * the default colormap of the screen.  However, because of this,
+        * it is possible that we will destroy the old resource and fail
+        * to create a new one if XmuStandardColormap() fails.
+        */
+
+       if (count == 1) {
+           XmuDeleteStandardColormap(dpy, screen, property);
+           if (cnew)
+               XSetRGBColormaps(dpy, win, cnew, 1, property);
+       }
+       else {
+           XStandardColormap   *map;
+
+           /* s still points to the matching standard colormap */
+
+           if (s->killid == ReleaseByFreeingColormap) {
+               if ((s->colormap != None) &&
+                   (s->colormap != DefaultColormap(dpy, screen)))
+                   XFreeColormap(dpy, s->colormap);
+           }
+           else if (s->killid != None)
+               XKillClient(dpy, s->killid);
+
+           map = (cnew) ? cnew : stdcmaps + --count;
+
+           s->colormap   = map->colormap;
+           s->red_max    = map->red_max;
+           s->red_mult   = map->red_mult;
+           s->green_max  = map->green_max;
+           s->green_mult = map->green_mult;
+           s->blue_max   = map->blue_max;
+           s->blue_mult  = map->blue_mult;
+           s->visualid   = map->visualid;
+           s->killid     = map->killid;
+
+           XSetRGBColormaps(dpy, win, stdcmaps, count, property);
+       }
+    }
+    XFree((char *) stdcmaps);
+    return 1;
+}
diff --git a/src/Lower.c b/src/Lower.c
new file mode 100644 (file)
index 0000000..d3aaaf3
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#define  XK_LATIN1
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/keysymdef.h>
+#include <X11/Xmu/CharSet.h>
+#include <X11/Xmu/SysUtil.h>
+
+#include <stdio.h>
+#include <stdarg.h>
+
+/*
+ * ISO Latin-1 case conversion routine
+ */
+#define XmuTolower(c)                                                   \
+((c) >= XK_a && (c) <= XK_z ?                                           \
+ (c) : (c) >= XK_A && (c) <= XK_Z ?                                     \
+ (c) + (XK_a - XK_A) : (c) >= XK_Agrave && (c) <= XK_Odiaeresis ?       \
+ (c) + (XK_agrave - XK_Agrave) : (c) >= XK_Ooblique && (c) <= XK_Thorn ? \
+ (c) + (XK_oslash - XK_Ooblique) :                                      \
+ (c))
+
+#define XmuToupper(c)                                                   \
+((c) >= XK_A && (c) <= XK_Z ?                                           \
+ (c) : (c) >= XK_a && (c) <= XK_z ?                                     \
+ (c) - (XK_a - XK_A) : (c) >= XK_agrave && (c) <= XK_odiaeresis ?       \
+ (c) - (XK_agrave - XK_Agrave) : (c) >= XK_oslash && (c) <= XK_thorn ?  \
+ (c) - (XK_oslash - XK_Ooblique) :                                      \
+ (c))
+
+/*
+ * Implementation
+ */
+void
+XmuCopyISOLatin1Lowered(char *dst, _Xconst char *src)
+{
+  register unsigned char *dest, *source;
+
+  for (dest = (unsigned char *)dst, source = (unsigned char *)src;
+       *source;
+       source++, dest++)
+    *dest = XmuTolower(*source);
+  *dest = '\0';
+}
+
+void
+XmuCopyISOLatin1Uppered(char *dst, _Xconst char *src)
+{
+  register unsigned char *dest, *source;
+
+  for (dest = (unsigned char *)dst, source = (unsigned char *)src;
+       *source;
+       source++, dest++)
+    *dest = XmuToupper(*source);
+  *dest = '\0';
+}
+
+int
+XmuCompareISOLatin1(_Xconst char *first, _Xconst char *second)
+{
+  register unsigned char *ap, *bp;
+
+  for (ap = (unsigned char *)first, bp = (unsigned char *)second;
+       *ap && *bp && XmuTolower(*ap) == XmuTolower(*bp);
+       ap++, bp++)
+    ;
+
+  return ((int)XmuTolower(*ap) - (int)XmuTolower(*bp));
+}
+
+void
+XmuNCopyISOLatin1Lowered(char *dst, _Xconst char *src, register int size)
+{
+  register unsigned char *dest, *source;
+
+  if (size > 0)
+    {
+      for (dest = (unsigned char *)dst, source = (unsigned char *)src;
+          *source && size > 1;
+          source++, dest++, size--)
+       *dest = XmuTolower(*source);
+      *dest = '\0';
+    }
+}
+
+void
+XmuNCopyISOLatin1Uppered(char *dst, _Xconst char *src, register int size)
+{
+  register unsigned char *dest, *source;
+
+  if (size > 0)
+    {
+      for (dest = (unsigned char *)dst, source = (unsigned char *)src;
+          *source && size > 1;
+          source++, dest++, size--)
+       *dest = XmuToupper(*source);
+      *dest = '\0';
+    }
+}
+
+int
+XmuSnprintf(char *str, int size, _Xconst char *fmt, ...)
+{
+  va_list ap;
+  int retval;
+
+  if (size <= 0)
+    return (size);
+
+  va_start(ap, fmt);
+
+#if 0
+  retval = vsprintf(str, fmt, ap);
+  if (retval >= size)
+    {
+      fprintf(stderr, "WARNING: buffer overflow detected!\n");
+      fflush(stderr);
+      abort();
+    }
+#else
+  retval = vsnprintf(str, size, fmt, ap);
+#endif
+
+  va_end(ap);
+
+  return (retval);
+}
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644 (file)
index 0000000..7e31853
--- /dev/null
@@ -0,0 +1,87 @@
+lib_LTLIBRARIES = libXmu.la libXmuu.la
+
+BITMAP_DEFINES = -DBITMAPDIR=\"$(includedir)/X11/bitmaps\"
+
+AM_CPPFLAGS = \
+       -I${top_srcdir}/include \
+       -I${top_srcdir}/include/X11/Xmu \
+       $(BITMAP_DEFINES) -D_BSD_SOURCE
+
+AM_CFLAGS = $(CWARNFLAGS) $(XMU_CFLAGS)
+
+libXmu_la_LDFLAGS = -version-number 6:2:0 -no-undefined
+libXmuu_la_LDFLAGS = -version-number 1:0:0 -no-undefined
+
+libXmu_la_LIBADD = $(XMU_LIBS)
+libXmuu_la_LIBADD = $(XMUU_LIBS)
+
+libXmuu_la_SOURCES = \
+       ClientWin.c \
+       CursorName.c \
+       DefErrMsg.c \
+       GetHost.c \
+       Lower.c
+
+libXmu_la_SOURCES = \
+       $(libXmuu_la_SOURCES) \
+       AllCmap.c \
+       Atoms.c \
+       Clip.c \
+       CloseHook.c \
+       CmapAlloc.c \
+       CrCmap.c \
+       CrPixFBit.c \
+       CvtCache.c \
+       CvtStdSel.c \
+       DelCmap.c \
+       DisplayQue.c \
+       Distinct.c \
+       DrawLogo.c \
+       DrRndRect.c \
+       EditresCom.c \
+       ExtAgent.c \
+       FToCback.c \
+       GrayPixmap.c \
+       Initer.c \
+       LocBitmap.c \
+       Lookup.c \
+       LookupCmap.c \
+       RdBitF.c \
+       ScrOfWin.c \
+       ShapeWidg.c \
+       StdCmap.c \
+       StrToBS.c \
+       StrToBmap.c \
+       StrToCurs.c \
+       StrToGrav.c \
+       StrToJust.c \
+       StrToLong.c \
+       StrToOrnt.c \
+       StrToShap.c \
+       StrToWidg.c \
+       UpdMapHint.c \
+       VisCmap.c \
+       WidgetNode.c \
+       Xct.c \
+       sharedlib.c
+
+
+if LINT
+ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+                $(AM_CPPFLAGS) $(CPPFLAGS)
+
+lint:
+       $(LINT) $(ALL_LINT_FLAGS) $(libXmu_la_SOURCES) $(XEXT_LIBS)
+endif LINT
+
+if MAKE_LINT_LIB
+lintlibdir = $(libdir)
+
+lintlib_DATA = $(LINTLIB) $(LINTLIBUU)
+
+$(LINTLIB): $(libXmu_la_SOURCES)
+       $(LINT) -y -oXmu -x $(ALL_LINT_FLAGS) $(libXmu_la_SOURCES)
+
+$(LINTLIBUU): $(libXmuu_la_SOURCES)
+       $(LINT) -y -oXmuu -x $(ALL_LINT_FLAGS) $(libXmuu_la_SOURCES)
+endif MAKE_LINT_LIB
diff --git a/src/RdBitF.c b/src/RdBitF.c
new file mode 100644 (file)
index 0000000..899113b
--- /dev/null
@@ -0,0 +1,401 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * This file contains miscellaneous utility routines and is not part of the
+ * Xlib standard.
+ *
+ * Public entry points:
+ *
+ *     XmuReadBitmapData               read data from FILE descriptor
+ *     XmuReadBitmapDataFromFile       read X10 or X11 format bitmap files
+ *                                     and return data
+ *
+ * Note that this file and ../X/XRdBitF.c look very similar....  Keep them
+ * that way (but don't use common source code so that people can have one
+ * without the other).
+ */
+
+
+/*
+ * Based on an optimized version provided by Jim Becker, Auguest 5, 1988.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xos.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xlibint.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <X11/Xmu/Drawing.h>
+#ifdef WIN32
+#include <X11/Xwindows.h>
+#endif
+
+#define MAX_SIZE 255
+
+/*
+ * Prototypes
+ */
+static void initHexTable(void);
+static int NextInt(FILE*);
+
+/* shared data for the image read/parse logic */
+static short hexTable[256];            /* conversion value */
+static Bool initialized = False;       /* easier to fill in at run time */
+
+
+/*
+ *     Table index for the hex values. Initialized once, first time.
+ *     Used for translation value or delimiter significance lookup.
+ */
+static void
+initHexTable(void)
+{
+    /*
+     * We build the table at run time for several reasons:
+     *
+     *     1.  portable to non-ASCII machines.
+     *     2.  still reentrant since we set the init flag after setting table.
+     *     3.  easier to extend.
+     *     4.  less prone to bugs.
+     */
+    hexTable['0'] = 0; hexTable['1'] = 1;
+    hexTable['2'] = 2; hexTable['3'] = 3;
+    hexTable['4'] = 4; hexTable['5'] = 5;
+    hexTable['6'] = 6; hexTable['7'] = 7;
+    hexTable['8'] = 8; hexTable['9'] = 9;
+    hexTable['A'] = 10;        hexTable['B'] = 11;
+    hexTable['C'] = 12;        hexTable['D'] = 13;
+    hexTable['E'] = 14;        hexTable['F'] = 15;
+    hexTable['a'] = 10;        hexTable['b'] = 11;
+    hexTable['c'] = 12;        hexTable['d'] = 13;
+    hexTable['e'] = 14;        hexTable['f'] = 15;
+
+    /* delimiters of significance are flagged w/ negative value */
+    hexTable[' '] = -1;        hexTable[','] = -1;
+    hexTable['}'] = -1;        hexTable['\n'] = -1;
+    hexTable['\t'] = -1;
+
+    initialized = True;
+}
+
+/*
+ *     read next hex value in the input stream, return -1 if EOF
+ */
+static int
+NextInt(FILE *fstream)
+{
+    int        ch;
+    int        value = 0;
+    int gotone = 0;
+    int done = 0;
+
+    /* loop, accumulate hex value until find delimiter  */
+    /* skip any initial delimiters found in read stream */
+
+    while (!done) {
+       ch = getc(fstream);
+       if (ch == EOF) {
+           value       = -1;
+           done++;
+       } else {
+           /* trim high bits, check type and accumulate */
+           ch &= 0xff;
+           if (isascii(ch) && isxdigit(ch)) {
+               value = (value << 4) + hexTable[ch];
+               gotone++;
+           } else if ((hexTable[ch]) < 0 && gotone)
+             done++;
+       }
+    }
+    return value;
+}
+
+
+/*
+ * The data returned by the following routine is always in left-most byte
+ * first and left-most bit first.  If it doesn't return BitmapSuccess then
+ * its arguments won't have been touched.  This routine should look as much
+ * like the Xlib routine XReadBitmapfile as possible.
+ */
+int
+XmuReadBitmapData(FILE *fstream, unsigned int *width, unsigned int *height,
+                 unsigned char **datap, int *x_hot, int *y_hot)
+{
+    unsigned char *data = NULL;                /* working variable */
+    char line[MAX_SIZE];               /* input line from file */
+    int size;                          /* number of bytes of data */
+    char name_and_type[MAX_SIZE];      /* an input line */
+    char *type;                                /* for parsing */
+    int value;                         /* from an input line */
+    int version10p;                    /* boolean, old format */
+    int padding;                       /* to handle alignment */
+    int bytes_per_line;                        /* per scanline of data */
+    unsigned int ww = 0;               /* width */
+    unsigned int hh = 0;               /* height */
+    int hx = -1;                       /* x hotspot */
+    int hy = -1;                       /* y hotspot */
+
+#undef  Xmalloc /* see MALLOC_0_RETURNS_NULL in Xlibint.h */
+#define Xmalloc(size) malloc(size)
+
+    /* first time initialization */
+    if (initialized == False) initHexTable();
+
+    /* error cleanup and return macro  */
+#define        RETURN(code) { if (data) free (data); return code; }
+
+    while (fgets(line, MAX_SIZE, fstream)) {
+       if (strlen(line) == MAX_SIZE-1) {
+           RETURN (BitmapFileInvalid);
+       }
+       if (sscanf(line,"#define %s %d",name_and_type,&value) == 2) {
+           if (!(type = strrchr(name_and_type, '_')))
+             type = name_and_type;
+           else
+             type++;
+
+           if (!strcmp("width", type))
+             ww = (unsigned int) value;
+           if (!strcmp("height", type))
+             hh = (unsigned int) value;
+           if (!strcmp("hot", type)) {
+               if (type-- == name_and_type || type-- == name_and_type)
+                 continue;
+               if (!strcmp("x_hot", type))
+                 hx = value;
+               if (!strcmp("y_hot", type))
+                 hy = value;
+           }
+           continue;
+       }
+
+       if (sscanf(line, "static short %s = {", name_and_type) == 1)
+         version10p = 1;
+       else if (sscanf(line,"static unsigned char %s = {",name_and_type) == 1)
+         version10p = 0;
+       else if (sscanf(line, "static char %s = {", name_and_type) == 1)
+         version10p = 0;
+       else
+         continue;
+
+       if (!(type = strrchr(name_and_type, '_')))
+         type = name_and_type;
+       else
+         type++;
+
+       if (strcmp("bits[]", type))
+         continue;
+
+       if (!ww || !hh)
+         RETURN (BitmapFileInvalid);
+
+       if ((ww % 16) && ((ww % 16) < 9) && version10p)
+         padding = 1;
+       else
+         padding = 0;
+
+       bytes_per_line = (ww+7)/8 + padding;
+
+       size = bytes_per_line * hh;
+       data = (unsigned char *) Xmalloc ((unsigned int) size);
+       if (!data)
+         RETURN (BitmapNoMemory);
+
+       if (version10p) {
+           unsigned char *ptr;
+           int bytes;
+
+           for (bytes=0, ptr=data; bytes<size; (bytes += 2)) {
+               if ((value = NextInt(fstream)) < 0)
+                 RETURN (BitmapFileInvalid);
+               *(ptr++) = value;
+               if (!padding || ((bytes+2) % bytes_per_line))
+                 *(ptr++) = value >> 8;
+           }
+       } else {
+           unsigned char *ptr;
+           int bytes;
+
+           for (bytes=0, ptr=data; bytes<size; bytes++, ptr++) {
+               if ((value = NextInt(fstream)) < 0)
+                 RETURN (BitmapFileInvalid);
+               *ptr=value;
+           }
+       }
+       break;
+    }                                  /* end while */
+
+    if (data == NULL) {
+       RETURN (BitmapFileInvalid);
+    }
+
+    *datap = data;
+    data = NULL;
+    *width = ww;
+    *height = hh;
+    if (x_hot) *x_hot = hx;
+    if (y_hot) *y_hot = hy;
+
+    RETURN (BitmapSuccess);
+}
+
+#if defined(WIN32)
+static int
+access_file(char *path, char *pathbuf, int len_pathbuf, char **pathret)
+{
+    if (access (path, F_OK) == 0) {
+       if (strlen (path) < len_pathbuf)
+           *pathret = pathbuf;
+       else
+           *pathret = malloc (strlen (path) + 1);
+       if (*pathret) {
+           strcpy (*pathret, path);
+           return 1;
+       }
+    }
+    return 0;
+}
+
+static int
+AccessFile(char *path, char *pathbuf, int len_pathbuf, char **pathret)
+{
+#ifndef MAX_PATH
+#define MAX_PATH 512
+#endif
+
+    unsigned long drives;
+    int i, len;
+    char* drive;
+    char buf[MAX_PATH];
+    char* bufp;
+
+    /* just try the "raw" name first and see if it works */
+    if (access_file (path, pathbuf, len_pathbuf, pathret))
+       return 1;
+
+    /* try the places set in the environment */
+    drive = getenv ("_XBASEDRIVE");
+#ifdef __UNIXOS2__
+    if (!drive)
+       drive = getenv ("X11ROOT");
+#endif
+    if (!drive)
+       drive = "C:";
+    len = strlen (drive) + strlen (path);
+    if (len < MAX_PATH) bufp = buf;
+    else bufp = malloc (len + 1);
+    strcpy (bufp, drive);
+    strcat (bufp, path);
+    if (access_file (bufp, pathbuf, len_pathbuf, pathret)) {
+       if (bufp != buf) free (bufp);
+       return 1;
+    }
+
+#ifndef __UNIXOS2__
+    /* one last place to look */
+    drive = getenv ("HOMEDRIVE");
+    if (drive) {
+       len = strlen (drive) + strlen (path);
+       if (len < MAX_PATH) bufp = buf;
+       else bufp = malloc (len + 1);
+       strcpy (bufp, drive);
+       strcat (bufp, path);
+       if (access_file (bufp, pathbuf, len_pathbuf, pathret)) {
+           if (bufp != buf) free (bufp);
+           return 1;
+       }
+    }
+
+    /* does OS/2 (with or with gcc-emx) have getdrives? */
+    /* tried everywhere else, go fishing */
+#define C_DRIVE ('C' - 'A')
+#define Z_DRIVE ('Z' - 'A')
+    drives = _getdrives ();
+    for (i = C_DRIVE; i <= Z_DRIVE; i++) { /* don't check on A: or B: */
+       if ((1 << i) & drives) {
+           len = 2 + strlen (path);
+           if (len < MAX_PATH) bufp = buf;
+           else bufp = malloc (len + 1);
+           *bufp = 'A' + i;
+           *(bufp + 1) = ':';
+           *(bufp + 2) = '\0';
+           strcat (bufp, path);
+           if (access_file (bufp, pathbuf, len_pathbuf, pathret)) {
+               if (bufp != buf) free (bufp);
+               return 1;
+           }
+       }
+    }
+#endif
+    return 0;
+}
+
+FILE *
+fopen_file(char *path, char *mode)
+{
+    char buf[MAX_PATH];
+    char* bufp;
+    void* ret = NULL;
+    UINT olderror = SetErrorMode (SEM_FAILCRITICALERRORS);
+
+    if (AccessFile (path, buf, MAX_PATH, &bufp))
+       ret = fopen (bufp, mode);
+
+    (void) SetErrorMode (olderror);
+
+    if (bufp != buf) free (bufp);
+
+    return ret;
+}
+
+#else
+#define fopen_file fopen
+#endif
+
+
+int
+XmuReadBitmapDataFromFile(_Xconst char *filename, unsigned int *width,
+                              unsigned int *height, unsigned char **datap,
+                              int *x_hot, int *y_hot)
+{
+    FILE *fstream;
+    int status;
+
+#ifdef __UNIXOS2__
+    filename = __XOS2RedirRoot(filename);
+#endif
+    if ((fstream = fopen_file (filename, "r")) == NULL) {
+       return BitmapOpenFailed;
+    }
+    status = XmuReadBitmapData(fstream, width, height, datap, x_hot, y_hot);
+    fclose (fstream);
+    return status;
+}
diff --git a/src/ScrOfWin.c b/src/ScrOfWin.c
new file mode 100644 (file)
index 0000000..b8fc09a
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author:  Jim Fulton, MIT X Consortium
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Xlib.h>
+#include <X11/Xmu/WinUtil.h>
+
+Screen *
+XmuScreenOfWindow(Display *dpy, Window w)
+{
+    register int i;
+    Window root;
+    int x, y;                                  /* dummy variables */
+    unsigned int width, height, bw, depth;     /* dummy variables */
+
+    if (!XGetGeometry (dpy, w, &root, &x, &y, &width, &height,
+                      &bw, &depth)) {
+       return NULL;
+    }
+    for (i = 0; i < ScreenCount (dpy); i++) {  /* find root from list */
+       if (root == RootWindow (dpy, i)) {
+           return ScreenOfDisplay (dpy, i);
+       }
+    }
+    return NULL;
+}
+
diff --git a/src/ShapeWidg.c b/src/ShapeWidg.c
new file mode 100644 (file)
index 0000000..32388ee
--- /dev/null
@@ -0,0 +1,248 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/IntrinsicP.h>
+#include <X11/extensions/shape.h>
+#include "Converters.h"
+#include "Drawing.h"
+#include "Misc.h"
+
+/*
+ * Prototypes
+ */
+static void ShapeEllipseOrRoundedRectangle(Widget, Bool, int, int);
+static void ShapeError(Widget);
+static void ShapeOval(Widget);
+static void ShapeRectangle(Widget);
+
+/*
+ * Implementation
+ */
+Boolean
+XmuReshapeWidget(Widget w, int shape_style,
+                int corner_width, int corner_height)
+{
+  switch (shape_style)
+    {
+      case XmuShapeRectangle:
+       ShapeRectangle(w);
+       break;
+      case XmuShapeOval:
+       ShapeOval(w);
+       break;
+      case XmuShapeEllipse:
+      case XmuShapeRoundedRectangle:
+      ShapeEllipseOrRoundedRectangle(w, shape_style == XmuShapeEllipse,
+                                    corner_width, corner_height);
+       break;
+      default:
+       ShapeError(w);
+      return (False);
+    }
+  return (True);
+}
+
+static void
+ShapeError(Widget w)
+{
+    String params[1];
+    Cardinal num_params = 1;
+
+    params[0] = XtName(w);
+  XtAppWarningMsg(XtWidgetToApplicationContext(w),
+                    "shapeUnknown", "xmuReshapeWidget", "XmuLibrary",
+                    "Unsupported shape style for Command widget \"%s\"",
+                 params, &num_params);
+}
+
+static void
+ShapeRectangle(Widget w)
+{
+  XShapeCombineMask(XtDisplay(w), XtWindow(w),
+                   ShapeBounding, 0, 0, None, ShapeSet);
+  XShapeCombineMask(XtDisplay(w), XtWindow(w),
+                   ShapeClip, 0, 0, None, ShapeSet);
+}
+
+/*
+ * Function:
+ *     ShapeOval
+ *
+ * Parameters:
+ *     w - widget to be reshaped
+ *
+ * Description:
+ *     Reshapes a widget to a oval format.
+ *
+ * Notes:
+ *       X11R6.3 behaviour changed. Now if the height is larger than the
+ *     width, this function inverts the sense of the oval, instead of
+ *     fallbacking to ellipse.
+ */
+static void
+ShapeOval(Widget w)
+{
+    Display *dpy = XtDisplay(w);
+    int width = w->core.width;
+    int height = w->core.height;
+    Pixmap p;
+    XGCValues values;
+    GC gc;
+    int rad;
+
+    if (width < 3 || height < 3)
+      return;
+    width += w->core.border_width << 1;
+    height += w->core.border_width << 1;
+
+    p = XCreatePixmap(dpy, XtWindow(w), width, height, 1);
+    values.foreground = 0;
+    values.background = 1;
+    values.cap_style = CapRound;
+    values.line_width = Min(width, height);
+    gc = XCreateGC(dpy, p,
+                   GCForeground | GCBackground | GCLineWidth | GCCapStyle,
+                   &values);
+    XFillRectangle(dpy, p, gc, 0, 0, width, height);
+    XSetForeground(dpy, gc, 1);
+
+    if (width < height)
+      {
+       rad = width >> 1;
+       XDrawLine(dpy, p, gc, rad, rad, rad, height - rad - 1);
+      }
+    else
+      {
+       rad = height >> 1;
+       XDrawLine(dpy, p, gc, rad, rad, width - rad - 1, rad);
+    }
+    XShapeCombineMask(dpy, XtWindow(w), ShapeBounding,
+                     -(int)w->core.border_width, -(int)w->core.border_width,
+                     p, ShapeSet);
+    if (w->core.border_width)
+      {
+       XSetForeground(dpy, gc, 0);
+       XFillRectangle(dpy, p, gc, 0, 0, width, height);
+       values.line_width = Min(w->core.width, w->core.height);
+       values.foreground = 1;
+       XChangeGC(dpy, gc, GCLineWidth | GCForeground, &values);
+       if (w->core.width < w->core.height)
+         {
+           rad = w->core.width >> 1;
+           XDrawLine(dpy, p, gc, rad, rad, rad, w->core.height - rad - 1);
+         }
+       else
+         {
+           rad = w->core.height >> 1;
+           XDrawLine(dpy, p, gc, rad, rad, w->core.width - rad - 1, rad);
+       }
+       XShapeCombineMask(dpy, XtWindow(w), ShapeClip, 0, 0, p, ShapeSet);
+    }
+    else
+      XShapeCombineMask(XtDisplay(w), XtWindow(w),
+                       ShapeClip, 0, 0, None, ShapeSet);
+
+    XFreePixmap(dpy, p);
+    XFreeGC(dpy, gc);
+}
+
+/*
+ * Function:
+ *     ShapeEllipseOrRoundedRectangle
+ *
+ * Parameters:
+ *     w       - widget to be reshaped
+ *     ellipse - True if shape to ellise, rounded rectangle otherwise
+ *     ew      - horizontal radius of rounded rectangle
+ *     eh      - vertical radius of rouded rectangle
+ *
+ * Description:
+ *       Based on the ellipse parameter, gives the widget a elliptical
+ *     shape, or rounded rectangle shape.
+ *
+ * Notes:
+ *       The GC is created with a line width of 2, what seens to draw the
+ *     widget border correctly, if the width - height is not proportional.
+ */
+static void
+ShapeEllipseOrRoundedRectangle(Widget w, Bool ellipse, int ew, int eh)
+{
+    Display *dpy = XtDisplay(w);
+  unsigned width = w->core.width;
+  unsigned height = w->core.height;
+  Pixmap p;
+    XGCValues values;
+    GC gc;
+  unsigned long mask;
+
+  if (width < 3 || width < 3)
+    return;
+  width += w->core.border_width << 1;
+  height += w->core.border_width << 1;
+
+  mask = GCForeground | GCLineWidth;
+  p = XCreatePixmap(dpy, XtWindow(w), width, height, 1);
+
+    values.foreground = 0;
+  values.line_width = 2;
+
+  gc = XCreateGC(dpy, p, mask, &values);
+  XFillRectangle(dpy, p, gc, 0, 0, width, height);
+  XSetForeground(dpy, gc, 1);
+    if (!ellipse)
+    XmuFillRoundedRectangle(dpy, p, gc, 1, 1, width - 2, height - 2, ew, eh);
+    else
+    {
+      XDrawArc(dpy, p, gc, 1, 1, width - 2, height - 2, 0, 360 * 64);
+      XFillArc(dpy, p, gc, 2, 2, width - 4, height - 4, 0, 360 * 64);
+    }
+  XShapeCombineMask(dpy, XtWindow(w), ShapeBounding,
+                   -(int)w->core.border_width, -(int)w->core.border_width,
+                   p, ShapeSet);
+  if (w->core.border_width)
+    {
+      XSetForeground(dpy, gc, 0);
+      XFillRectangle(dpy, p, gc, 0, 0, width, height);
+      XSetForeground(dpy, gc, 1);
+       if (!ellipse)
+       XmuFillRoundedRectangle(dpy, p, gc, 1, 1,
+                               w->core.width - 2, w->core.height - 2,
+                               ew, eh);
+      else
+       XFillArc(dpy, p, gc, 0, 0, w->core.width, w->core.height,
+                0, 360 * 64);
+      XShapeCombineMask(dpy, XtWindow(w), ShapeClip, 0, 0, p, ShapeSet);
+    }
+  else
+    XShapeCombineMask(XtDisplay(w), XtWindow(w),
+                     ShapeClip, 0, 0, None, ShapeSet);
+
+  XFreePixmap(dpy, p);
+  XFreeGC(dpy, gc);
+}
diff --git a/src/StdCmap.c b/src/StdCmap.c
new file mode 100644 (file)
index 0000000..ccc822e
--- /dev/null
@@ -0,0 +1,233 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author:  Donna Converse, MIT X Consortium
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <X11/Xutil.h>
+#include <X11/Xmu/StdCmap.h>
+
+#define lowbit(x) ((x) & (~(x) + 1))
+
+/*
+ * Prototypes
+ */
+/* argument restrictions */
+static Status valid_args(XVisualInfo*, unsigned long, unsigned long,
+                        unsigned long, Atom);
+
+/*
+ * To create any one standard colormap, use XmuStandardColormap().
+ *
+ * Create a standard colormap for the given screen, visualid, and visual
+ * depth, with the given red, green, and blue maximum values, with the
+ * given standard property name.  Return a pointer to an XStandardColormap
+ * structure which describes the newly created colormap, upon success.
+ * Upon failure, return NULL.
+ *
+ * XmuStandardColormap() calls XmuCreateColormap() to create the map.
+ *
+ * Resources created by this function are not made permanent; that is the
+ * caller's responsibility.
+ */
+
+XStandardColormap *
+XmuStandardColormap(Display *dpy, int screen, VisualID visualid,
+                   unsigned int depth, Atom property, Colormap cmap,
+                   unsigned long red_max, unsigned long green_max,
+                   unsigned long blue_max)
+     /*
+      * dpy                            - specifies X server connection
+      * screen                         - specifies display screen
+      * visualid                       - identifies the visual type
+      * depth                          - identifies the visual type
+      * property                       - a standard colormap property
+      * cmap                           - specifies colormap ID or None
+      * red_max, green_max, blue_max   - allocations
+      */
+{
+    XStandardColormap  *stdcmap;
+    Status             status;
+    XVisualInfo                vinfo_template, *vinfo;
+    long               vinfo_mask;
+    int                        n;
+
+    /* Match the required visual information to an actual visual */
+    vinfo_template.visualid = visualid;
+    vinfo_template.screen = screen;
+    vinfo_template.depth = depth;
+    vinfo_mask = VisualIDMask | VisualScreenMask | VisualDepthMask;
+    if ((vinfo = XGetVisualInfo(dpy, vinfo_mask, &vinfo_template, &n)) == NULL)
+       return NULL;
+
+    /* Check the validity of the combination of visual characteristics,
+     * allocation, and colormap property.  Create an XStandardColormap
+     * structure.
+     */
+
+    if (! valid_args(vinfo, red_max, green_max, blue_max, property)
+       || ((stdcmap = XAllocStandardColormap()) == NULL)) {
+       XFree((char *) vinfo);
+       return NULL;
+    }
+
+    /* Fill in the XStandardColormap structure */
+
+    if (cmap == DefaultColormap(dpy, screen)) {
+       /* Allocating out of the default map, cannot use XFreeColormap() */
+       Window win = XCreateWindow(dpy, RootWindow(dpy, screen), 1, 1, 1, 1,
+                                  0, 0, InputOnly, vinfo->visual,
+                                  (unsigned long) 0,
+                                  (XSetWindowAttributes *)NULL);
+       stdcmap->killid  = (XID) XCreatePixmap(dpy, win, 1, 1, depth);
+       XDestroyWindow(dpy, win);
+       stdcmap->colormap = cmap;
+    } else {
+       stdcmap->killid = ReleaseByFreeingColormap;
+       stdcmap->colormap = XCreateColormap(dpy, RootWindow(dpy, screen),
+                                           vinfo->visual, AllocNone);
+    }
+    stdcmap->red_max = red_max;
+    stdcmap->green_max = green_max;
+    stdcmap->blue_max = blue_max;
+    if (property == XA_RGB_GRAY_MAP)
+       stdcmap->red_mult = stdcmap->green_mult = stdcmap->blue_mult = 1;
+    else if (vinfo->class == TrueColor || vinfo->class == DirectColor) {
+       stdcmap->red_mult = lowbit(vinfo->red_mask);
+       stdcmap->green_mult = lowbit(vinfo->green_mask);
+       stdcmap->blue_mult = lowbit(vinfo->blue_mask);
+    } else {
+       stdcmap->red_mult = (red_max > 0)
+           ? (green_max + 1) * (blue_max + 1) : 0;
+       stdcmap->green_mult = (green_max > 0) ? blue_max + 1 : 0;
+       stdcmap->blue_mult = (blue_max > 0) ? 1 : 0;
+    }
+    stdcmap->base_pixel = 0;                   /* base pixel may change */
+    stdcmap->visualid = vinfo->visualid;
+
+    /* Make the colormap */
+
+    status = XmuCreateColormap(dpy, stdcmap);
+
+    /* Clean up */
+
+    XFree((char *) vinfo);
+    if (!status) {
+
+       /* Free the colormap or the pixmap, if we created one */
+       if (stdcmap->killid == ReleaseByFreeingColormap)
+           XFreeColormap(dpy, stdcmap->colormap);
+       else if (stdcmap->killid != None)
+           XFreePixmap(dpy, stdcmap->killid);
+
+       XFree((char *) stdcmap);
+       return (XStandardColormap *) NULL;
+    }
+    return stdcmap;
+}
+
+/****************************************************************************/
+static Status
+valid_args(XVisualInfo *vinfo, unsigned long red_max, unsigned long green_max,
+          unsigned long blue_max, Atom property)
+     /*
+      * vinfo                          - specifies visual
+      * red_max, green_max, blue_max   - specifies alloc
+      * property                       - specifies property name
+      */
+{
+    unsigned long      ncolors;        /* number of colors requested */
+
+    /* Determine that the number of colors requested is <= map size */
+
+    if ((vinfo->class == DirectColor) || (vinfo->class == TrueColor)) {
+       unsigned long mask;
+
+       mask = vinfo->red_mask;
+       while (!(mask & 1))
+           mask >>= 1;
+       if (red_max > mask)
+           return 0;
+       mask = vinfo->green_mask;
+       while (!(mask & 1))
+           mask >>= 1;
+       if (green_max > mask)
+           return 0;
+       mask = vinfo->blue_mask;
+       while (!(mask & 1))
+           mask >>= 1;
+       if (blue_max > mask)
+           return 0;
+    } else if (property == XA_RGB_GRAY_MAP) {
+       ncolors = red_max + green_max + blue_max + 1;
+       if (ncolors > vinfo->colormap_size)
+           return 0;
+    } else {
+       ncolors = (red_max + 1) * (green_max + 1) * (blue_max + 1);
+       if (ncolors > vinfo->colormap_size)
+           return 0;
+    }
+
+    /* Determine that the allocation and visual make sense for the property */
+
+    switch (property)
+    {
+      case XA_RGB_DEFAULT_MAP:
+       if (red_max == 0 || green_max == 0 || blue_max == 0)
+           return 0;
+       break;
+      case XA_RGB_RED_MAP:
+       if (red_max == 0)
+           return 0;
+       break;
+      case XA_RGB_GREEN_MAP:
+       if (green_max == 0)
+           return 0;
+       break;
+      case XA_RGB_BLUE_MAP:
+       if (blue_max == 0)
+           return 0;
+       break;
+      case XA_RGB_BEST_MAP:
+       if (red_max == 0 || green_max == 0 || blue_max == 0)
+           return 0;
+       break;
+      case XA_RGB_GRAY_MAP:
+       if (red_max == 0 || blue_max == 0 || green_max == 0)
+           return 0;
+       break;
+      default:
+       return 0;
+    }
+    return 1;
+}
diff --git a/src/StrToBS.c b/src/StrToBS.c
new file mode 100644 (file)
index 0000000..c515109
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Intrinsic.h>
+#include "Converters.h"
+#include "CharSet.h"
+
+/*
+ * Prototypes
+ */
+static void InitializeQuarks(void);
+
+/*
+ * Initialization
+ */
+static XrmQuark QnotUseful, QwhenMapped, Qalways, Qdefault;
+static Boolean haveQuarks;
+
+/*
+ * Implementation
+ */
+static void
+InitializeQuarks(void)
+{
+  if (!haveQuarks)
+    {
+      char name[11];
+
+      XmuNCopyISOLatin1Lowered(name, XtEnotUseful, sizeof(name));
+      QnotUseful = XrmStringToQuark(name);
+      XmuNCopyISOLatin1Lowered(name, XtEwhenMapped, sizeof(name));
+      QwhenMapped = XrmStringToQuark(name);
+      XmuNCopyISOLatin1Lowered(name, XtEalways, sizeof(name));
+      Qalways = XrmStringToQuark(name);
+      XmuNCopyISOLatin1Lowered(name, XtEdefault, sizeof(name));
+      Qdefault = XrmStringToQuark(name);
+      haveQuarks = True;
+    }
+}
+
+/*ARGSUSED*/
+void
+XmuCvtStringToBackingStore(XrmValue *args, Cardinal *num_args,
+                          XrmValuePtr fromVal, XrmValuePtr toVal)
+{
+    XrmQuark   q;
+  char name[11];
+    static int backingStoreType;
+
+    if (*num_args != 0)
+        XtWarning("String to BackingStore conversion needs no extra arguments");
+
+  InitializeQuarks();
+  XmuNCopyISOLatin1Lowered(name, (char *)fromVal->addr, sizeof(name));
+
+  q = XrmStringToQuark (name);
+  if (q == QnotUseful)
+       backingStoreType = NotUseful;
+  else if (q == QwhenMapped)
+       backingStoreType = WhenMapped;
+  else if (q == Qalways)
+       backingStoreType = Always;
+  else if (q == Qdefault)
+       backingStoreType = Always + WhenMapped + NotUseful;
+  else
+    {
+      XtStringConversionWarning((char *)fromVal->addr, XtRBackingStore);
+      return;
+    }
+  toVal->size = sizeof(int);
+  toVal->addr = (XPointer)&backingStoreType;
+}
+
+/*ARGSUSED*/
+Boolean
+XmuCvtBackingStoreToString(Display *dpy, XrmValuePtr args, Cardinal *num_args,
+                          XrmValuePtr fromVal, XrmValuePtr toVal,
+                          XtPointer *data)
+{
+  static String buffer;
+  Cardinal size;
+
+  switch (*(int *)fromVal->addr)
+    {
+    case NotUseful:
+      buffer = XtEnotUseful;
+      break;
+    case WhenMapped:
+      buffer = XtEwhenMapped;
+      break;
+    case Always:
+      buffer = XtEalways;
+      break;
+    case (Always + WhenMapped + NotUseful):
+      buffer = XtEdefault;
+      break;
+    default:
+      XtWarning("Cannot convert BackingStore to String");
+      toVal->addr = NULL;
+      toVal->size = 0;
+      return (False);
+    }
+
+  size = strlen(buffer) + 1;
+  if (toVal->addr != NULL)
+    {
+      if (toVal->size < size)
+       {
+         toVal->size = size;
+         return (False);
+       }
+      strcpy((char *)toVal->addr, buffer);
+    }
+  else
+    toVal->addr = (XPointer)buffer;
+  toVal->size = sizeof(String);
+
+  return (True);
+}
diff --git a/src/StrToBmap.c b/src/StrToBmap.c
new file mode 100644 (file)
index 0000000..c2b49e3
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/***********************************************************
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include       <X11/Intrinsic.h>
+#include       <X11/StringDefs.h>
+#include       <X11/Xmu/Converters.h>
+#include       <X11/Xmu/Drawing.h>
+
+
+/*
+ * XmuConvertStringToBitmap:
+ *
+ * creates a depth-1 Pixmap suitable for window manager icons.
+ * "string" represents a bitmap(1) filename which may be absolute,
+ * or relative to the global resource bitmapFilePath, class
+ * BitmapFilePath.  If the resource is not defined, the default
+ * value is the build symbol BITMAPDIR.
+ *
+ * shares lots of code with XmuConvertStringToCursor.
+ *
+ * To use, include the following in your ClassInitialize procedure:
+
+static XtConvertArgRec screenConvertArg[] = {
+    {XtBaseOffset, (XtPointer) XtOffset(Widget, core.screen), sizeof(Screen *)}
+};
+
+    XtAddConverter("String", "Bitmap", XmuCvtStringToBitmap,
+                  screenConvertArg, XtNumber(screenConvertArg));
+ *
+ */
+
+#define        done(address, type) \
+       { (*toVal).size = sizeof(type); (*toVal).addr = (XPointer) address; }
+
+
+/*ARGSUSED*/
+void
+XmuCvtStringToBitmap(XrmValuePtr args, Cardinal *num_args,
+                    XrmValuePtr fromVal, XrmValuePtr toVal)
+{
+    static Pixmap pixmap;              /* static for cvt magic */
+    char *name = (char *)fromVal->addr;
+    Screen *screen;
+    Display *dpy;
+    XrmDatabase db;
+    String fn;
+    unsigned int width, height;
+    int xhot, yhot;
+    unsigned char *data;
+
+    if (*num_args != 1)
+     XtErrorMsg("wrongParameters","cvtStringToBitmap","XtToolkitError",
+             "String to pixmap conversion needs screen argument",
+              (String *)NULL, (Cardinal *)NULL);
+
+    if (strcmp(name, "None") == 0) {
+       pixmap = None;
+       done(&pixmap, Pixmap);
+       return;
+    }
+
+    if (strcmp(name, "ParentRelative") == 0) {
+       pixmap = ParentRelative;
+       done(&pixmap, Pixmap);
+       return;
+    }
+
+    screen = *((Screen **) args[0].addr);
+    pixmap = XmuLocateBitmapFile (screen, name,
+                                 NULL, 0, NULL, NULL, NULL, NULL);
+    if (pixmap == None) {
+       dpy = DisplayOfScreen(screen);
+       db = XrmGetDatabase(dpy);
+       XrmSetDatabase(dpy, XtScreenDatabase(screen));
+       fn = XtResolvePathname(dpy, "bitmaps", name, "", NULL, NULL, 0, NULL);
+       if (!fn)
+           fn = XtResolvePathname(dpy, "", name, ".xbm", NULL, NULL, 0, NULL);
+       XrmSetDatabase(dpy, db);
+       if (fn &&
+           XmuReadBitmapDataFromFile (fn, &width, &height, &data,
+                                      &xhot, &yhot) == BitmapSuccess) {
+           pixmap = XCreatePixmapFromBitmapData (dpy,
+                                                 RootWindowOfScreen(screen),
+                                                 (char *) data, width, height,
+                                                 1, 0, 1);
+           XFree ((char *)data);
+       }
+    }
+
+    if (pixmap != None) {
+       done (&pixmap, Pixmap);
+    } else {
+       XtStringConversionWarning (name, "Pixmap");
+       return;
+    }
+}
+
diff --git a/src/StrToCurs.c b/src/StrToCurs.c
new file mode 100644 (file)
index 0000000..ed8aca0
--- /dev/null
@@ -0,0 +1,349 @@
+/*
+
+Copyright 1987, 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/***********************************************************
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include       <X11/Intrinsic.h>
+#include       <X11/StringDefs.h>
+#include       <X11/Xmu/Converters.h>
+#include       <X11/Xmu/Drawing.h>
+#include       <X11/Xmu/CurUtil.h>
+#include       <X11/Xmu/CharSet.h>
+
+#ifndef X_NOT_POSIX
+#include <stdlib.h>
+#ifdef _POSIX_SOURCE
+#include <limits.h>
+#else
+#define _POSIX_SOURCE
+#include <limits.h>
+#undef _POSIX_SOURCE
+#endif
+#endif /* X_NOT_POSIX */
+#ifndef PATH_MAX
+#ifdef WIN32
+#define PATH_MAX 512
+#else
+#include <sys/param.h>
+#endif
+#ifndef PATH_MAX
+#ifdef MAXPATHLEN
+#define PATH_MAX MAXPATHLEN
+#else
+#define PATH_MAX 1024
+#endif
+#endif
+#endif /* PATH_MAX */
+
+/* Kludge source to avoid encountering broken shared library linkers
+   which insist on resolving references unused by the application,
+   and broken object file formats that don't correctly distinguish
+   references to procedures from references to data.
+ */
+#if defined(SUNSHLIB) || defined(SVR4)
+#define XMU_KLUDGE
+#endif
+
+/*
+ * XmuConvertStringToCursor:
+ *
+ * allows String to specify a standard cursor name (from cursorfont.h), a
+ * font name and glyph index of the form "FONT fontname index [[font] index]",
+ * or a bitmap file name (absolute, or relative to the global resource
+ * bitmapFilePath, class BitmapFilePath).  If the resource is not
+ * defined, the default value is the build symbol BITMAPDIR.
+ *
+ * shares lots of code with XmuCvtStringToPixmap, but unfortunately
+ * can't use it as the hotspot info is lost.
+ *
+ * To use, include the following in your ClassInitialize procedure:
+
+static XtConvertArgRec screenConvertArg[] = {
+    {XtBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.screen),
+     sizeof(Screen *)}
+};
+
+    XtAddConverter(XtRString, XtRCursor, XmuCvtStringToCursor,
+                  screenConvertArg, XtNumber(screenConvertArg));
+ *
+ */
+
+#define        done(address, type) \
+       { (*toVal).size = sizeof(type); (*toVal).addr = (XPointer) address; }
+
+#define FONTSPECIFIER          "FONT "
+
+/*ARGSUSED*/
+void
+XmuCvtStringToCursor(XrmValuePtr args, Cardinal *num_args,
+                    XrmValuePtr fromVal, XrmValuePtr toVal)
+{
+    static Cursor cursor;              /* static for cvt magic */
+    char *name = (char *)fromVal->addr;
+    Screen *screen;
+    register int i;
+    char maskname[PATH_MAX];
+    Pixmap source, mask = 0;
+    /* XXX - make fg/bg resources */
+    static XColor bgColor = {0, 0xffff, 0xffff, 0xffff};
+    static XColor fgColor = {0, 0, 0, 0};
+    int xhot, yhot;
+    int len;
+
+
+    if (*num_args != 1)
+     XtErrorMsg("wrongParameters","cvtStringToCursor","XtToolkitError",
+             "String to cursor conversion needs screen argument",
+              (String *)NULL, (Cardinal *)NULL);
+
+    if (XmuCompareISOLatin1(name, "None") == 0)
+      {
+       cursor = None;
+       done(&cursor, Cursor);
+       return;
+      }
+
+    screen = *((Screen **) args[0].addr);
+
+    if (0 == strncmp(FONTSPECIFIER, name, strlen(FONTSPECIFIER))) {
+       char source_name[PATH_MAX], mask_name[PATH_MAX];
+       int source_char, mask_char, fields = 0;
+       Font source_font, mask_font;
+       XrmValue fromString, toFont;
+       XrmValue cvtArg;
+       Boolean success;
+       Display *dpy = DisplayOfScreen(screen);
+       char *strspec = NULL;
+       int strspeclen;
+#ifdef XMU_KLUDGE
+       Cardinal num;
+#endif
+
+       strspeclen = strlen("FONT %s %d %s %d") + 21;
+       strspec = XtMalloc(strspeclen);
+       if (strspec != NULL) {
+           snprintf(strspec, strspeclen, "FONT %%%lds %%d %%%lds %%d",
+                    (unsigned long)sizeof(source_name) - 1,
+                    (unsigned long)sizeof(mask_name) - 1);
+           fields = sscanf(name, strspec,
+                           source_name, &source_char,
+                           mask_name, &mask_char);
+           XtFree(strspec);
+       }
+       if (fields < 2) {
+           XtStringConversionWarning(name, XtRCursor);
+           return;
+       }
+
+       fromString.addr = source_name;
+       fromString.size = strlen(source_name) + 1;
+       toFont.addr = (XPointer) &source_font;
+       toFont.size = sizeof(Font);
+       cvtArg.addr = (XPointer) &dpy;
+       cvtArg.size = sizeof(Display *);
+       /* XXX using display of screen argument as message display */
+#ifdef XMU_KLUDGE
+       /* XXX Sacrifice caching */
+       num = 1;
+       success = XtCvtStringToFont(dpy, &cvtArg, &num, &fromString, &toFont,
+                                   NULL);
+#else
+       success = XtCallConverter(dpy, XtCvtStringToFont, &cvtArg,
+                                 (Cardinal)1, &fromString, &toFont, NULL);
+#endif
+       if (!success) {
+           XtStringConversionWarning(name, XtRCursor);
+           return;
+       }
+
+       switch (fields) {
+         case 2:               /* defaulted mask font & char */
+           mask_font = source_font;
+           mask_char = source_char;
+           break;
+
+         case 3:               /* defaulted mask font */
+           mask_font = source_font;
+           mask_char = atoi(mask_name);
+           break;
+
+         case 4:               /* specified mask font & char */
+           fromString.addr = mask_name;
+           fromString.size = strlen(mask_name) + 1;
+           toFont.addr = (XPointer) &mask_font;
+           toFont.size = sizeof(Font);
+           /* XXX using display of screen argument as message display */
+#ifdef XMU_KLUDGE
+           /* XXX Sacrifice caching */
+           num = 1;
+           success = XtCvtStringToFont(dpy, &cvtArg, &num, &fromString,
+                                       &toFont, NULL);
+#else
+           success = XtCallConverter(dpy, XtCvtStringToFont, &cvtArg,
+                                     (Cardinal)1, &fromString, &toFont, NULL);
+#endif
+           if (!success) {
+               XtStringConversionWarning(name, XtRCursor);
+               return;
+           }
+       }
+
+       cursor = XCreateGlyphCursor( DisplayOfScreen(screen), source_font,
+                                    mask_font, source_char, mask_char,
+                                    &fgColor, &bgColor );
+       done(&cursor, Cursor);
+       return;
+    }
+
+    i = XmuCursorNameToIndex (name);
+    if (i != -1) {
+       cursor = XCreateFontCursor (DisplayOfScreen(screen), i);
+       done(&cursor, Cursor);
+       return;
+    }
+
+    if ((source = XmuLocateBitmapFile (screen, name,
+                                      maskname, (sizeof maskname) - 4,
+                                      NULL, NULL, &xhot, &yhot)) == None) {
+       XtStringConversionWarning (name, XtRCursor);
+       cursor = None;
+       done(&cursor, Cursor);
+       return;
+    }
+    len = strlen (maskname);
+    for (i = 0; i < 2; i++) {
+       strcpy (maskname + len, i == 0 ? "Mask" : "msk");
+       if ((mask = XmuLocateBitmapFile (screen, maskname, NULL, 0,
+                                        NULL, NULL, NULL, NULL)) != None)
+         break;
+    }
+
+    cursor = XCreatePixmapCursor( DisplayOfScreen(screen), source, mask,
+                                 &fgColor, &bgColor, xhot, yhot );
+    XFreePixmap( DisplayOfScreen(screen), source );
+    if (mask != None) XFreePixmap( DisplayOfScreen(screen), mask );
+
+    done(&cursor, Cursor);
+}
+
+#define        new_done(type, value) \
+       {                                                       \
+           if (toVal->addr != NULL) {                          \
+               if (toVal->size < sizeof(type)) {               \
+                   toVal->size = sizeof(type);                 \
+                   return False;                               \
+               }                                               \
+               *(type*)(toVal->addr) = (value);                \
+           }                                                   \
+           else {                                              \
+               static type static_val;                         \
+               static_val = (value);                           \
+               toVal->addr = (XPointer)&static_val;            \
+           }                                                   \
+           toVal->size = sizeof(type);                         \
+           return True;                                        \
+       }
+
+/*     Function Name: XmuCvtStringToColorCursor
+ *     Description: Converts a string into a colored cursor.
+ *     Arguments: dpy
+ *                args - an argument list (see below).
+ *                 num_args - number of elements in the argument list.
+ *                 fromVal - value to convert from.
+ *                 toVal - value to convert to.
+ *                data
+ *     Returns:   True or False
+ */
+
+/*ARGSUSED*/
+Boolean
+XmuCvtStringToColorCursor(Display *dpy, XrmValuePtr args, Cardinal *num_args,
+                         XrmValuePtr fromVal, XrmValuePtr toVal,
+                         XtPointer *converter_data)
+{
+    Cursor cursor;
+    Screen *screen;
+    Pixel fg, bg;
+    Colormap c_map;
+    XColor colors[2];
+    Cardinal number;
+    XrmValue ret_val;
+
+    if (*num_args != 4) {
+       XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
+           "wrongParameters","cvtStringToColorCursor","XmuError",
+            "String to color cursor conversion needs four arguments",
+           (String *)NULL, (Cardinal *)NULL);
+       return False;
+    }
+
+    screen = *((Screen **) args[0].addr);
+    fg = *((Pixel *) args[1].addr);
+    bg = *((Pixel *) args[2].addr);
+    c_map = *((Colormap *) args[3].addr);
+
+    number = 1;
+    XmuCvtStringToCursor(args, &number, fromVal, &ret_val);
+
+    cursor = *((Cursor *) ret_val.addr);
+
+    if (cursor == None || (fg == BlackPixelOfScreen(screen)
+                          && bg == WhitePixelOfScreen(screen)))
+       new_done(Cursor, cursor);
+
+    colors[0].pixel = fg;
+    colors[1].pixel = bg;
+
+    XQueryColors (dpy, c_map, colors, 2);
+    XRecolorCursor(dpy, cursor, colors, colors + 1);
+    new_done(Cursor, cursor);
+}
+
diff --git a/src/StrToGrav.c b/src/StrToGrav.c
new file mode 100644 (file)
index 0000000..ca8bb53
--- /dev/null
@@ -0,0 +1,148 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Intrinsic.h>
+#include <X11/Xmu/Converters.h>
+#include <X11/Xmu/CharSet.h>
+
+#define done(address, type) \
+{ (*toVal).size = sizeof(type); (*toVal).addr = (XPointer) address; }
+
+/*
+ * Initialization
+ */
+static struct _namepair {
+    XrmQuark quark;
+    _Xconst char *name;
+    XtGravity gravity;
+} names[] = {
+    { NULLQUARK, XtEForget, ForgetGravity },
+    { NULLQUARK, XtENorthWest, NorthWestGravity },
+    { NULLQUARK, XtENorth, NorthGravity },
+    { NULLQUARK, XtENorthEast, NorthEastGravity },
+    { NULLQUARK, XtEWest, WestGravity },
+    { NULLQUARK, XtECenter, CenterGravity },
+    { NULLQUARK, XtEEast, EastGravity },
+    { NULLQUARK, XtESouthWest, SouthWestGravity },
+    { NULLQUARK, XtESouth, SouthGravity },
+    { NULLQUARK, XtESouthEast, SouthEastGravity },
+    { NULLQUARK, XtEStatic, StaticGravity },
+    { NULLQUARK, XtEUnmap, UnmapGravity },
+    { NULLQUARK, XtEleft, WestGravity },
+    { NULLQUARK, XtEtop, NorthGravity },
+    { NULLQUARK, XtEright, EastGravity },
+    { NULLQUARK, XtEbottom, SouthGravity },
+    { NULLQUARK, NULL, ForgetGravity }
+};
+
+/*
+ * This function is deprecated as of the addition of
+ * XtCvtStringToGravity in R6
+ */
+void
+XmuCvtStringToGravity(XrmValuePtr args, Cardinal *num_args,
+                     XrmValuePtr fromVal, XrmValuePtr toVal)
+{
+  static Boolean haveQuarks = False;
+  char name[10];
+    XrmQuark q;
+    struct _namepair *np;
+
+    if (*num_args != 0)
+        XtWarningMsg("wrongParameters","cvtStringToGravity","XtToolkitError",
+                  "String to Gravity conversion needs no extra arguments",
+                (String *)NULL, (Cardinal *)NULL);
+
+  if (!haveQuarks)
+    {
+      for (np = names; np->name; np++)
+       np->quark = XrmPermStringToQuark(np->name);
+      haveQuarks = True;
+    }
+
+  XmuNCopyISOLatin1Lowered(name, (char *)fromVal->addr, sizeof(name));
+  q = XrmStringToQuark(name);
+
+  for (np = names; np->name; np++)
+    {
+      if (np->quark == q)
+       {
+         done(&np->gravity, XtGravity);
+               return;
+           }
+       }
+
+  XtStringConversionWarning((char *)fromVal->addr, XtRGravity);
+}
+
+/*ARGSUSED*/
+Boolean
+XmuCvtGravityToString(Display *dpy, XrmValue *args, Cardinal *num_args,
+                     XrmValue *fromVal, XrmValue *toVal, XtPointer *data)
+{
+  static char *buffer;
+  Cardinal size;
+  struct _namepair *np;
+  XtGravity gravity;
+
+  gravity = *(XtGravity *)fromVal->addr;
+  buffer = NULL;
+  for (np = names; np->name; np++)
+    if (np->gravity == gravity)
+      {
+       buffer = np->name;
+       break;
+      }
+
+  if (!buffer)
+    {
+      XtAppWarning(XtDisplayToApplicationContext(dpy),
+                  "Cannot convert Gravity to String");
+      toVal->addr = NULL;
+      toVal->size = 0;
+
+      return (False);
+    }
+
+  size = strlen(buffer) + 1;
+  if (toVal->addr != NULL)
+    {
+      if (toVal->size <= size)
+       {
+         toVal->size = size;
+         return (False);
+       }
+      strcpy((char *)toVal->addr, buffer);
+    }
+  else
+    toVal->addr = (XPointer)buffer;
+  toVal->size = size;
+
+  return (True);
+}
diff --git a/src/StrToJust.c b/src/StrToJust.c
new file mode 100644 (file)
index 0000000..234f3a3
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <string.h>
+#include <X11/Intrinsic.h>
+#include "Converters.h"
+#include "CharSet.h"
+
+/*
+ * Prototypes
+ */
+static void InitializeQuarks(void);
+
+/*
+ * Initialization
+ */
+static XrmQuark Qleft, Qcenter, Qright;
+static Boolean haveQuarks;
+
+/*
+ * Implementation
+ */
+static void
+InitializeQuarks(void)
+{
+  if (!haveQuarks)
+    {
+      Qleft = XrmPermStringToQuark(XtEleft);
+      Qcenter = XrmPermStringToQuark(XtEcenter);
+      Qright = XrmPermStringToQuark(XtEright);
+      haveQuarks = True;
+    }
+}
+
+/*ARGSUSED*/
+void
+XmuCvtStringToJustify(XrmValuePtr args, Cardinal *num_args,
+                     XrmValuePtr fromVal, XrmValuePtr toVal)
+{
+    static XtJustify   e;
+    XrmQuark    q;
+  char *s = (char *)fromVal->addr;
+  char name[7];
+
+  if (s == NULL)
+    return;
+
+  InitializeQuarks();
+  XmuNCopyISOLatin1Lowered(name, s, sizeof(name));
+
+  q = XrmStringToQuark(name);
+
+    toVal->size = sizeof(XtJustify);
+  toVal->addr = (XPointer)&e;
+
+  if (q == Qleft)
+    e = XtJustifyLeft;
+  else if (q == Qcenter)
+    e = XtJustifyCenter;
+  else if (q == Qright)
+    e = XtJustifyRight;
+  else
+    {
+    toVal->addr = NULL;
+    XtStringConversionWarning((char *)fromVal->addr, XtRJustify);
+    }
+}
+
+/*ARGSUSED*/
+Boolean
+XmuCvtJustifyToString(Display *dpy, XrmValue* args, Cardinal *num_args,
+                     XrmValue *fromVal, XrmValue *toVal, XtPointer *data)
+{
+  static String buffer;
+  Cardinal size;
+
+  switch (*(XtJustify *)fromVal->addr)
+    {
+    case XtJustifyLeft:
+      buffer = XtEleft;
+      break;
+    case XtJustifyCenter:
+      buffer = XtEcenter;
+      break;
+    case XtJustifyRight:
+      buffer = XtEright;
+      break;
+    default:
+      XtWarning("Cannot convert Justify to String");
+      toVal->addr = NULL;
+      toVal->size = 0;
+      return (False);
+    }
+
+  size = strlen(buffer) + 1;
+  if (toVal->addr != NULL)
+    {
+      if (toVal->size < size)
+       {
+         toVal->size = size;
+         return (False);
+       }
+      strcpy((char *)toVal->addr, buffer);
+    }
+  else
+    toVal->addr = (XPointer)buffer;
+  toVal->size = sizeof(String);
+
+  return (True);
+}
diff --git a/src/StrToLong.c b/src/StrToLong.c
new file mode 100644 (file)
index 0000000..8ee2ee4
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Intrinsic.h>
+#include <X11/Xmu/SysUtil.h>
+#include <X11/Xmu/Converters.h>
+
+void
+XmuCvtStringToLong(XrmValuePtr args, Cardinal *num_args,
+                  XrmValuePtr fromVal, XrmValuePtr toVal)
+{
+    static long l;
+
+    if (*num_args != 0)
+    XtWarning("String to Long conversion needs no extra arguments");
+  if (sscanf((char *)fromVal->addr, "%ld", &l) == 1)
+    {
+      toVal->size = sizeof(long);
+      toVal->addr = (XPointer)&l;
+    }
+  else
+    XtStringConversionWarning((char *)fromVal->addr, XtRLong);
+}
+
+/*ARGSUSED*/
+Boolean
+XmuCvtLongToString(Display *dpy, XrmValuePtr args, Cardinal *num_args,
+                  XrmValuePtr fromVal, XrmValuePtr toVal, XtPointer *data)
+{
+  static char buffer[32];
+  size_t size;
+
+  if (*num_args != 0)
+    XtWarning("Long to String conversion needs no extra arguments");
+
+  XmuSnprintf(buffer, sizeof(buffer), "%ld", *(long *)fromVal->addr);
+
+  size = strlen(buffer) + 1;
+  if (toVal->addr != NULL)
+    {
+      if (toVal->size < size)
+       {
+         toVal->size = size;
+         return (False);
+    }
+      strcpy((char *)toVal->addr, buffer);
+    }
+  else
+    toVal->addr = (XPointer)buffer;
+  toVal->size = sizeof(String);
+
+  return (True);
+}
diff --git a/src/StrToOrnt.c b/src/StrToOrnt.c
new file mode 100644 (file)
index 0000000..5d54b1a
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+#include "Converters.h"
+#include "CharSet.h"
+
+/*
+ * Prototypes
+ */
+static void InitializeQuarks(void);
+
+/*
+ * Initialization
+ */
+static XrmQuark Qhorizontal, Qvertical;
+static Boolean haveQuarks;
+
+/*
+ * Implementation
+ */
+static void
+InitializeQuarks(void)
+{
+  if (!haveQuarks)
+    {
+      Qhorizontal = XrmPermStringToQuark(XtEhorizontal);
+      Qvertical = XrmPermStringToQuark(XtEvertical);
+      haveQuarks = True;
+    }
+}
+
+/*ARGSUSED*/
+void
+XmuCvtStringToOrientation(XrmValuePtr args, Cardinal *num_args,
+                         XrmValuePtr fromVal, XrmValuePtr toVal)
+{
+    static XtOrientation orient;
+    XrmQuark   q;
+  char name[11];
+
+  InitializeQuarks();
+  XmuNCopyISOLatin1Lowered(name, (char *)fromVal->addr, sizeof(name));
+  q = XrmStringToQuark(name);
+
+  toVal->size = sizeof(XtJustify);
+  toVal->addr = (XPointer)&orient;
+
+  if (q == Qhorizontal)
+       orient = XtorientHorizontal;
+  else if (q == Qvertical)
+       orient = XtorientVertical;
+  else
+    {
+      toVal->addr = NULL;
+      XtStringConversionWarning((char *)fromVal->addr, XtROrientation);
+    }
+}
+
+/*ARGSUSED*/
+Boolean
+XmuCvtOrientationToString(Display *dpy, XrmValuePtr args, Cardinal *num_args,
+                         XrmValuePtr fromVal, XrmValuePtr toVal,
+                         XtPointer *data)
+{
+  static String buffer;
+  Cardinal size;
+
+  switch (*(XtOrientation *)fromVal->addr)
+    {
+    case XtorientVertical:
+      buffer = XtEvertical;
+      break;
+    case XtorientHorizontal:
+      buffer = XtEhorizontal;
+      break;
+    default:
+      XtWarning("Cannot convert Orientation to String");
+      toVal->addr = NULL;
+      toVal->size = 0;
+      return (False);
+    }
+
+  size = strlen(buffer) + 1;
+  if (toVal->addr != NULL)
+    {
+      if (toVal->size < size)
+       {
+         toVal->size = size;
+         return (False);
+       }
+      strcpy((char *)toVal->addr, buffer);
+    }
+  else
+    toVal->addr = (XPointer)buffer;
+  toVal->size = sizeof(String);
+
+  return (True);
+}
diff --git a/src/StrToShap.c b/src/StrToShap.c
new file mode 100644 (file)
index 0000000..0773404
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+
+Copyright 1988, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <string.h>
+#include <X11/Intrinsic.h>
+#include "Converters.h"
+#include "CharSet.h"
+
+/* ARGSUSED */
+#define        done(type, value) \
+       {                                                       \
+           if (toVal->addr != NULL) {                          \
+               if (toVal->size < sizeof(type)) {               \
+                   toVal->size = sizeof(type);                 \
+                   return False;                               \
+               }                                               \
+               *(type*)(toVal->addr) = (value);                \
+           }                                                   \
+           else {                                              \
+               static type static_val;                         \
+               static_val = (value);                           \
+               toVal->addr = (XtPointer)&static_val;           \
+           }                                                   \
+           toVal->size = sizeof(type);                         \
+           return True;                                        \
+       }
+
+
+/*ARGSUSED*/
+Boolean
+XmuCvtStringToShapeStyle(Display *dpy, XrmValue *args, Cardinal *num_args,
+                        XrmValue *from, XrmValue *toVal, XtPointer *data)
+{
+  String name = (String)from->addr;
+
+  if (XmuCompareISOLatin1(name, XtERectangle) == 0)
+    done(int, XmuShapeRectangle);
+  if (XmuCompareISOLatin1(name, XtEOval) == 0)
+    done(int, XmuShapeOval);
+  if (XmuCompareISOLatin1(name, XtEEllipse) == 0)
+    done(int, XmuShapeEllipse);
+  if (XmuCompareISOLatin1(name, XtERoundedRectangle) == 0)
+    done(int, XmuShapeRoundedRectangle);
+
+  XtDisplayStringConversionWarning(dpy, name, XtRShapeStyle);
+
+  return (False);
+}
+
+/*ARGSUSED*/
+Boolean
+XmuCvtShapeStyleToString(Display *dpy, XrmValue *args, Cardinal *num_args,
+                        XrmValue *fromVal, XrmValue *toVal, XtPointer *data)
+{
+  static char *buffer;
+  Cardinal size;
+
+  switch (*(int *)fromVal->addr)
+    {
+    case XmuShapeRectangle:
+      buffer = XtERectangle;
+      break;
+    case XmuShapeOval:
+      buffer = XtEOval;
+      break;
+    case XmuShapeEllipse:
+      buffer = XtEEllipse;
+      break;
+    case XmuShapeRoundedRectangle:
+      buffer = XtERoundedRectangle;
+      break;
+    default:
+      XtAppWarning(XtDisplayToApplicationContext(dpy),
+                  "Cannot convert ShapeStyle to String");
+      toVal->addr = NULL;
+      toVal->size = 0;
+
+      return (False);
+           }
+
+  size = strlen(buffer) + 1;
+  if (toVal->addr != NULL)
+    {
+      if (toVal->size <= size)
+       {
+         toVal->size = size;
+         return (False);
+       }
+      strcpy((char *)toVal->addr, buffer);
+    }
+  else
+    toVal->addr = (XPointer)buffer;
+  toVal->size = size;
+
+  return (True);
+}
diff --git a/src/StrToWidg.c b/src/StrToWidg.c
new file mode 100644 (file)
index 0000000..c22b827
--- /dev/null
@@ -0,0 +1,225 @@
+/*
+
+Copyright 1994, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * XmuCvtStringToWidget
+ *
+ * static XtConvertArgRec parentCvtArgs[] = {
+ *   {XtBaseOffset, (XtPointer)XtOffset(Widget, core.parent), sizeof(Widget)},
+ * };
+ *
+ * matches the string against the name of the immediate children (normal
+ * or popup) of the parent.  If none match, compares string to classname
+ * & returns first match.  Case is significant.
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/IntrinsicP.h>
+#include <X11/StringDefs.h>
+#include <X11/ObjectP.h>
+#include <X11/Xmu/Converters.h>
+
+#define        done(address, type) \
+{                                              \
+  toVal->size = sizeof(type);                  \
+  toVal->addr = (XPointer)address;             \
+         return; \
+}
+
+/*ARGSUSED*/
+void
+XmuCvtStringToWidget(XrmValuePtr args, Cardinal *num_args,
+                    XrmValuePtr fromVal, XrmValuePtr toVal)
+{
+    static Widget widget, *widgetP, parent;
+    XrmName name = XrmStringToName(fromVal->addr);
+    Cardinal i;
+
+    if (*num_args != 1)
+    {
+       i = 0;
+       XtErrorMsg("wrongParameters", "cvtStringToWidget", "xtToolkitError",
+                  "StringToWidget conversion needs parent arg", NULL, &i);
+    }
+
+    parent = *(Widget*)args[0].addr;
+    /* try to match names of normal children */
+  if (XtIsComposite(parent))
+    {
+       i = ((CompositeWidget)parent)->composite.num_children;
+       for (widgetP = ((CompositeWidget)parent)->composite.children;
+          i; i--, widgetP++)
+       if ((*widgetP)->core.xrm_name == name)
+         {
+               widget = *widgetP;
+               done(&widget, Widget);
+           }
+       }
+
+    /* try to match names of popup children */
+    i = parent->core.num_popups;
+  for (widgetP = parent->core.popup_list; i; i--, widgetP++)
+    if ((*widgetP)->core.xrm_name == name)
+      {
+           widget = *widgetP;
+           done(&widget, Widget);
+       }
+
+    /* try to match classes of normal children */
+  if (XtIsComposite(parent))
+    {
+       i = ((CompositeWidget)parent)->composite.num_children;
+       for (widgetP = ((CompositeWidget)parent)->composite.children;
+          i; i--, widgetP++)
+       if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
+         {
+               widget = *widgetP;
+               done(&widget, Widget);
+           }
+       }
+
+    /* try to match classes of popup children */
+    i = parent->core.num_popups;
+  for (widgetP = parent->core.popup_list; i; i--, widgetP++)
+    if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
+      {
+           widget = *widgetP;
+           done(&widget, Widget);
+       }
+
+    XtStringConversionWarning(fromVal->addr, XtRWidget);
+    toVal->addr = NULL;
+    toVal->size = 0;
+}
+
+#undef done
+
+#define        newDone(type, value) \
+       {                                                       \
+           if (toVal->addr != NULL) {                          \
+               if (toVal->size < sizeof(type)) {               \
+                   toVal->size = sizeof(type);                 \
+                   return False;                               \
+               }                                               \
+               *(type*)(toVal->addr) = (value);                \
+           }                                                   \
+           else {                                              \
+               static type static_val;                         \
+               static_val = (value);                           \
+               toVal->addr = (XtPointer)&static_val;           \
+           }                                                   \
+           toVal->size = sizeof(type);                         \
+           return True;                                        \
+       }
+
+
+/*ARGSUSED*/
+Boolean
+XmuNewCvtStringToWidget(Display *dpy, XrmValue *args, Cardinal *num_args,
+                       XrmValue *fromVal, XrmValue *toVal,
+                       XtPointer *converter_data)
+{
+    Widget *widgetP, parent;
+    XrmName name = XrmStringToName(fromVal->addr);
+    int i;
+
+    if (*num_args != 1)
+       XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
+                       "wrongParameters","cvtStringToWidget","xtToolkitError",
+                       "String To Widget conversion needs parent argument",
+                       (String *)NULL, (Cardinal *)NULL);
+
+    parent = *(Widget*)args[0].addr;
+    /* try to match names of normal children */
+  if (XtIsComposite(parent))
+    {
+       i = ((CompositeWidget)parent)->composite.num_children;
+       for (widgetP = ((CompositeWidget)parent)->composite.children;
+          i; i--, widgetP++)
+           if ((*widgetP)->core.xrm_name == name)
+               newDone(Widget, *widgetP);
+       }
+
+    /* try to match names of popup children */
+    i = parent->core.num_popups;
+  for (widgetP = parent->core.popup_list; i; i--, widgetP++)
+       if ((*widgetP)->core.xrm_name == name)
+           newDone(Widget, *widgetP);
+
+    /* try to match classes of normal children */
+  if (XtIsComposite(parent))
+    {
+       i = ((CompositeWidget)parent)->composite.num_children;
+       for (widgetP = ((CompositeWidget)parent)->composite.children;
+          i; i--, widgetP++)
+           if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
+               newDone(Widget, *widgetP);
+       }
+
+    /* try to match classes of popup children */
+    i = parent->core.num_popups;
+  for (widgetP = parent->core.popup_list; i; i--, widgetP++)
+       if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
+           newDone(Widget, *widgetP);
+
+    XtDisplayStringConversionWarning(dpy, (String)fromVal->addr, XtRWidget);
+  return (False);
+}
+
+/*ARGSUSED*/
+Boolean
+XmuCvtWidgetToString(Display *dpy, XrmValuePtr args, Cardinal *num_args,
+                    XrmValuePtr fromVal, XrmValuePtr toVal,
+                    XtPointer *data)
+{
+  static String buffer;
+  Cardinal size;
+  Widget widget;
+
+  widget = *(Widget *)fromVal->addr;
+
+  if (widget)
+    buffer = XrmQuarkToString(widget->core.xrm_name);
+  else
+    buffer = "(null)";
+
+  size = strlen(buffer) + 1;
+  if (toVal->addr != NULL)
+    {
+      if (toVal->size < size)
+       {
+         toVal->size = size;
+         return (False);
+       }
+      strcpy((char *)toVal->addr, buffer);
+    }
+  else
+    toVal->addr = (XPointer)buffer;
+  toVal->size = sizeof(String);
+
+  return (True);
+}
diff --git a/src/UpdMapHint.c b/src/UpdMapHint.c
new file mode 100644 (file)
index 0000000..c5f6d29
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author:  Jim Fulton, MIT X Consortium
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xmu/WinUtil.h>
+
+Bool
+XmuUpdateMapHints(Display *dpy, Window w, XSizeHints *hints)
+{
+    static XSizeHints *shp = NULL;
+
+    if (!hints) {                              /* get them first */
+       long supp;
+
+       if (!shp) {
+           shp = XAllocSizeHints();
+           if (!shp) return False;
+       }
+       if (!XGetWMNormalHints (dpy, w, shp, &supp)) return False;
+       hints = shp;
+    }
+    hints->flags &= ~(PPosition|PSize);
+    hints->flags |= (USPosition|USSize);
+    XSetWMNormalHints (dpy, w, hints);
+    return True;
+}
diff --git a/src/VisCmap.c b/src/VisCmap.c
new file mode 100644 (file)
index 0000000..c3198de
--- /dev/null
@@ -0,0 +1,180 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author:  Donna Converse, MIT X Consortium
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <X11/Xutil.h>
+#include <X11/Xmu/StdCmap.h>
+
+/*
+ * To create all of the appropriate standard colormaps for a given visual on
+ * a given screen, use XmuVisualStandardColormaps.
+ *
+ * Define all appropriate standard colormap properties for the given visual.
+ * If replace is true, any previous definition will be removed.
+ * If retain is true, new properties will be retained for the duration of
+ * the server session.  Return 0 on failure, non-zero on success.
+ * On failure, no new properties will be defined, and, old ones may have
+ * been removed if replace was True.
+ *
+ * Not all standard colormaps are meaningful to all visual classes.  This
+ * routine will check and define the following properties for the following
+ * classes, provided that the size of the colormap is not too small.
+ *
+ *     DirectColor and PseudoColor
+ *         RGB_DEFAULT_MAP
+ *         RGB_BEST_MAP
+ *         RGB_RED_MAP
+ *         RGB_GREEN_MAP
+ *         RGB_BLUE_MAP
+ *          RGB_GRAY_MAP
+ *
+ *     TrueColor and StaticColor
+ *         RGB_BEST_MAP
+ *
+ *     GrayScale and StaticGray
+ *         RGB_GRAY_MAP
+ */
+
+Status
+XmuVisualStandardColormaps(Display *dpy, int screen, VisualID visualid,
+                          unsigned int depth, Bool replace, Bool retain)
+     /*
+      * dpy                    - specifies server connection
+      * screen                 - specifies screen number
+      * visualid               - specifies the visual
+      * depth                  - specifies the visual
+      * replace        specifies       - whether to replace
+      * retain                 - specifies whether to retain
+      */
+{
+    Status             status;
+    int                        n;
+    long               vinfo_mask;
+    XVisualInfo                vinfo_template, *vinfo;
+
+    status = 0;
+    vinfo_template.screen = screen;
+    vinfo_template.visualid = visualid;
+    vinfo_template.depth = depth;
+    vinfo_mask = VisualScreenMask | VisualIDMask | VisualDepthMask;
+    if ((vinfo = XGetVisualInfo(dpy, vinfo_mask, &vinfo_template, &n)) == NULL)
+       return 0;
+
+    if (vinfo->colormap_size <= 2) {
+       /* Monochrome visuals have no standard maps; considered successful */
+       XFree((char *) vinfo);
+       return 1;
+    }
+
+    switch (vinfo->class)
+    {
+      case PseudoColor:
+      case DirectColor:
+       status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
+                                          XA_RGB_DEFAULT_MAP, replace,retain);
+       if (!status) break;
+
+       status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
+                                          XA_RGB_GRAY_MAP, replace, retain);
+       if (!status) {
+           XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
+           break;
+       }
+
+       status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
+                                          XA_RGB_RED_MAP, replace, retain);
+       if (!status) {
+           XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
+           XmuDeleteStandardColormap(dpy, screen, XA_RGB_GRAY_MAP);
+           break;
+       }
+
+       status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
+                                          XA_RGB_GREEN_MAP, replace, retain);
+       if (!status) {
+           XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
+           XmuDeleteStandardColormap(dpy, screen, XA_RGB_GRAY_MAP);
+           XmuDeleteStandardColormap(dpy, screen, XA_RGB_RED_MAP);
+           break;
+       }
+
+       status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
+                                          XA_RGB_BLUE_MAP, replace, retain);
+       if (!status) {
+           XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
+           XmuDeleteStandardColormap(dpy, screen, XA_RGB_GRAY_MAP);
+           XmuDeleteStandardColormap(dpy, screen, XA_RGB_RED_MAP);
+           XmuDeleteStandardColormap(dpy, screen, XA_RGB_GREEN_MAP);
+           break;
+       }
+       /* fall through */
+
+      case StaticColor:
+      case TrueColor:
+
+       status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
+                                          XA_RGB_BEST_MAP, replace, retain);
+       if (!status && (vinfo->class == PseudoColor ||
+                       vinfo->class == DirectColor)) {
+           XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
+           XmuDeleteStandardColormap(dpy, screen, XA_RGB_GRAY_MAP);
+           XmuDeleteStandardColormap(dpy, screen, XA_RGB_RED_MAP);
+           XmuDeleteStandardColormap(dpy, screen, XA_RGB_GREEN_MAP);
+           XmuDeleteStandardColormap(dpy, screen, XA_RGB_BLUE_MAP);
+       }
+       break;
+       /* the end for PseudoColor, DirectColor, StaticColor, and TrueColor */
+
+      case GrayScale:
+       status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
+                                          XA_RGB_DEFAULT_MAP, replace,
+                                          retain);
+       if (! status) break;
+       /*FALLTHROUGH*/
+
+      case StaticGray:
+
+       status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
+                                          XA_RGB_GRAY_MAP, replace, retain);
+       if (! status && vinfo->class == GrayScale) {
+           XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
+           break;
+       }
+    }
+
+    XFree((char *) vinfo);
+    return status;
+}
diff --git a/src/WidgetNode.c b/src/WidgetNode.c
new file mode 100644 (file)
index 0000000..db295bf
--- /dev/null
@@ -0,0 +1,306 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author:  Jim Fulton, MIT X Consortium
+ */
+
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/Xos.h>
+#include <X11/IntrinsicP.h>
+#include <X11/Xmu/CharSet.h>
+#include <X11/Xmu/WidgetNode.h>
+
+/*
+ * Prototypes
+ */
+static char *binsearch(char*, char*, int, int,
+                      int (*__compar)(_Xconst void*, _Xconst void*));
+static int compare_resource_entries(_Xconst void *a,  _Xconst void *b);
+static XmuWidgetNode *find_resource(XmuWidgetNode*, char*, Bool);
+static void mark_resource_owner(XmuWidgetNode*);
+/*
+ * Implementation
+ */
+static char *
+binsearch(char *key, char *base, int nelems, int elemsize,
+         int compar(_Xconst void*, _Xconst void*))
+     /*
+      * key            - template of object to find
+      * base           - beginning of array
+      * nelems         - number of elements in array
+      * elemsize       - sizeof an element
+      * compar         - qsort-style compare function
+      */
+{
+    int lower = 0, upper = nelems - 1;
+
+    while (lower <= upper) {
+       int middle = (lower + upper) / 2;
+       char *p = base + middle * elemsize;
+       int res = (*compar) (p, key);
+
+       if (res < 0) {
+           lower = middle + 1;
+       } else if (res == 0) {
+           return p;
+       } else {
+           upper = middle - 1;
+       }
+    }
+
+    return NULL;
+}
+
+
+static int
+compare_resource_entries(register _Xconst void *a,
+                        register _Xconst void *b)
+{
+    return strcmp (((XtResourceList)a)->resource_name,
+                  ((XtResourceList)b)->resource_name);
+}
+
+
+static XmuWidgetNode *
+find_resource(XmuWidgetNode *node, char *name, Bool cons)
+{
+    register XmuWidgetNode *sup;
+    XtResource res;
+
+#define reslist ((char *) (cons ? sup->constraints : sup->resources))
+#define nreslist (int) (cons ? sup->nconstraints : sup->nresources)
+
+    res.resource_name = name;
+    for (sup = node->superclass;
+        sup && (XtResourceList) binsearch ((char *) &res,
+                                           reslist, nreslist,
+                                           sizeof(XtResource),
+                                           compare_resource_entries);
+        node = sup, sup = sup->superclass) ;
+
+#undef reslist
+#undef nreslist
+
+    return node;
+}
+
+
+static void
+mark_resource_owner(register XmuWidgetNode *node)
+{
+    register Cardinal i;
+    XtResourceList childres;
+
+    childres = node->resources;
+    for (i = 0; i < node->nresources; i++, childres++) {
+       node->resourcewn[i] = find_resource (node, childres->resource_name,
+                                            False);
+    }
+
+    childres = node->constraints;
+    for (i = 0; i < node->nconstraints; i++, childres++) {
+       node->constraintwn[i] = find_resource (node, childres->resource_name,
+                                               True);
+    }
+}
+
+
+/*
+ *                            Public Interfaces
+ */
+
+void
+XmuWnInitializeNodes(XmuWidgetNode *nodearray, int nnodes)
+{
+    int i;
+    XmuWidgetNode *wn;
+
+    /*
+     * Assume that the node array is in alphabetic order, so we need to
+     * search backwards to make sure that the children are listed forward.
+     */
+    for (i = nnodes - 1, wn = nodearray + (nnodes - 1); i >= 0; i--, wn--) {
+       WidgetClass superclass = XmuWnSuperclass(wn);
+       int j;
+       XmuWidgetNode *swn;
+       int lablen = strlen (wn->label);
+       int namelen = strlen (XmuWnClassname(wn));
+
+       wn->lowered_label = XtMalloc (lablen + namelen + 2);
+#if 0
+       /* XtMalloc exits if failed */
+       if (!wn->lowered_label) {
+           fprintf (stderr,
+                    "%s:  unable to allocate %d bytes for widget name\n",
+                    "XmuWnInitializeNodes", lablen + namelen + 2);
+           exit (1);
+       }
+#endif
+       wn->lowered_classname = wn->lowered_label + (lablen + 1);
+       XmuCopyISOLatin1Lowered (wn->lowered_label, wn->label);
+       XmuCopyISOLatin1Lowered (wn->lowered_classname, XmuWnClassname(wn));
+       wn->superclass = NULL;
+       wn->have_resources = False;
+       wn->resources = NULL;
+       wn->resourcewn = NULL;
+       wn->nresources = 0;
+       wn->constraints = NULL;
+       wn->constraintwn = NULL;
+       wn->nconstraints = 0;
+       wn->data = (XtPointer) NULL;
+
+       /*
+        * walk up the superclass chain
+        */
+       while (superclass) {
+           for (j = 0, swn = nodearray; j < nnodes; j++, swn++) {
+               if (superclass == XmuWnClass(swn)) {
+                   wn->superclass = swn;
+                   goto done;          /* stupid C language */
+               }
+           }
+           /*
+            * Hmm, we have a hidden superclass (such as in core in R4); just
+            * ignore it and keep on walking
+            */
+           superclass = superclass->core_class.superclass;
+       }
+      done:
+       if (wn->superclass) {
+           wn->siblings = wn->superclass->children;
+           wn->superclass->children = wn;
+       }
+    }
+
+    return;
+}
+
+
+void
+XmuWnFetchResources(XmuWidgetNode *node, Widget toplevel,
+                   XmuWidgetNode *topnode)
+{
+    Widget dummy;
+    XmuWidgetNode *wn;
+
+    if (node->have_resources) return;
+
+    dummy = XtCreateWidget (node->label, XmuWnClass(node), toplevel,
+                           NULL, 0);
+    if (dummy) XtDestroyWidget (dummy);
+
+
+    /*
+     * walk up tree geting resources; since we've instantiated the widget,
+     * we know that all of our superclasses have been initialized
+     */
+    for (wn = node; wn && !wn->have_resources; wn = wn->superclass) {
+       XtGetResourceList (XmuWnClass(wn), &wn->resources, &wn->nresources);
+       if (wn->resources) {
+           qsort ((char *) wn->resources, wn->nresources,
+                  sizeof(XtResource), compare_resource_entries);
+       }
+       wn->resourcewn = (XmuWidgetNode **) XtCalloc (wn->nresources,
+                                                 sizeof (XmuWidgetNode *));
+       if (!wn->resourcewn) {
+           fprintf (stderr,
+                    "%s:  unable to calloc %d %ld byte widget node ptrs\n",
+                    "XmuWnFetchResources", wn->nresources,
+                    (unsigned long)sizeof (XmuWidgetNode *));
+           exit (1);
+       }
+
+       XtGetConstraintResourceList (XmuWnClass(wn), &wn->constraints,
+                                    &wn->nconstraints);
+       if (wn->constraints) {
+           qsort ((char *) wn->constraints, wn->nconstraints,
+                  sizeof(XtResource), compare_resource_entries);
+       }
+       wn->constraintwn = (XmuWidgetNode **)
+         XtCalloc (wn->nconstraints, sizeof (XmuWidgetNode *));
+       if (!wn->constraintwn) {
+           fprintf (stderr,
+                    "%s:  unable to calloc %d %ld byte widget node ptrs\n",
+                    "XmuWnFetchResources", wn->nconstraints,
+                    (unsigned long)sizeof (XmuWidgetNode *));
+           exit (1);
+       }
+
+       wn->have_resources = True;
+       if (wn == topnode) break;
+    }
+
+
+    /*
+     * Walk up tree removing all resources that appear in superclass; we can
+     * mash the resource list in place since it was copied out of widget.
+     */
+    for (wn = node; wn; wn = wn->superclass) {
+       mark_resource_owner (wn);
+       if (wn == topnode) break;
+    }
+
+    return;
+}
+
+
+int
+XmuWnCountOwnedResources(XmuWidgetNode *node, XmuWidgetNode *ownernode,
+                        Bool cons)
+{
+    register int i;
+    XmuWidgetNode **wn = (cons ? node->constraintwn : node->resourcewn);
+    int nmatches = 0;
+
+    for (i = (cons ? node->nconstraints : node->nresources); i > 0; i--, wn++)
+      if (*wn == ownernode) nmatches++;
+    return nmatches;
+}
+
+
+XmuWidgetNode *
+XmuWnNameToNode(XmuWidgetNode *nodelist, int nnodes, _Xconst char *name)
+{
+    int i;
+    XmuWidgetNode *wn;
+    char tmp[1024];
+
+    XmuNCopyISOLatin1Lowered(tmp, name, sizeof(tmp));
+    for (i = 0, wn = nodelist; i < nnodes; i++, wn++) {
+       if (strcmp (tmp, wn->lowered_label) == 0 ||
+           strcmp (tmp, wn->lowered_classname) == 0) {
+         return wn;
+       }
+    }
+    return NULL;
+}
diff --git a/src/Xct.c b/src/Xct.c
new file mode 100644 (file)
index 0000000..9ff8d3c
--- /dev/null
+++ b/src/Xct.c
@@ -0,0 +1,684 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xfuncs.h>
+#include "Xct.h"
+#include <stdio.h>
+
+#define UsedGraphic    0x0001
+#define UsedDirection  0x0002
+
+typedef struct _XctPriv {
+    XctString          ptr;
+    XctString          ptrend;
+    unsigned           flags;
+    XctHDirection      *dirstack;
+    unsigned           dirsize;
+    char               **encodings;
+    unsigned           enc_count;
+    XctString          itembuf;
+    unsigned           buf_count;
+} *XctPriv;
+
+#define IsMore(priv) ((priv)->ptr != (priv)->ptrend)
+#define AmountLeft(priv) ((priv)->ptrend - (priv)->ptr)
+
+#include <stdlib.h>
+
+#define HT     0x09
+#define NL     0x0a
+#define ESC    0x1b
+#define CSI    0x9b
+
+#define IsLegalC0(data, c) (((c) == HT) || ((c) == NL) || \
+                           (((data)->version > XctVersion) && \
+                            ((data)->flags & XctAcceptC0Extensions)))
+
+#define IsLegalC1(priv, c) (((data)->version > XctVersion) && \
+                           ((data)->flags & XctAcceptC1Extensions))
+
+#define IsI2(c) (((c) >= 0x20) && ((c) <= 0x2f))
+#define IsI3(c) (((c) >= 0x30) && ((c) <= 0x3f))
+#define IsESCF(c) (((c) >= 0x30) && ((c) <= 0x7e))
+#define IsCSIF(c) (((c) >= 0x40) && ((c) <= 0x7e))
+#define IsC0(c) ((c) <= 0x1f)
+#define IsGL(c) (((c) >= 0x20) && ((c) <= 0x7f))
+#define IsC1(c) (((c) >= 0x80) && ((c) <= 0x9f))
+#define IsGR(c) ((c) >= 0xa0)
+
+#define HasC  1
+#define HasGL 2
+#define HasGR 4
+#define ToGL  8
+
+/*
+ * Prototypes
+ */
+static void ComputeGLGR(XctData);
+static int Handle94GR(XctData, int);
+static int Handle96GR(XctData, int);
+static int HandleExtended(XctData data, int);
+static int HandleGL(XctData, int);
+static int HandleMultiGL(XctData, int);
+static int HandleMultiGR(XctData data, int);
+static void ShiftGRToGL(XctData, int);
+
+/*
+ * Implementation
+ */
+static void
+ComputeGLGR(register XctData data)
+{
+    /* XXX this will need more work if more sets are registered */
+    if ((data->GL_set_size == 94) && (data->GL_char_size == 1) &&
+       (data->GL[0] == '\102') &&
+       (data->GR_set_size == 96) && (data->GR_char_size == 1))
+       data->GLGR_encoding = data->GR_encoding;
+    else if ((data->GL_set_size == 94) && (data->GL_char_size == 1) &&
+            (data->GL[0] == '\112') &&
+            (data->GR_set_size == 94) && (data->GR_char_size == 1))
+       data->GLGR_encoding = data->GR_encoding;
+    else
+       data->GLGR_encoding = (char *)NULL;
+}
+
+static int
+HandleGL(register XctData data, int c)
+{
+    switch (c) {
+    case 0x42:
+       data->GL = "\102";
+       data->GL_encoding = "ISO8859-1";
+       break;
+    case 0x4a:
+       data->GL = "\112";
+       data->GL_encoding = "JISX0201.1976-0";
+       break;
+    default:
+       return 0;
+    }
+    data->GL_set_size = 94;
+    data->GL_char_size = 1;
+    ComputeGLGR(data);
+    return 1;
+}
+
+static int
+HandleMultiGL(register XctData data, int c)
+{
+    switch (c) {
+    case 0x41:
+       data->GL = "\101";
+       data->GL_encoding = "GB2312.1980-0";
+       break;
+    case 0x42:
+       data->GL = "\102";
+       data->GL_encoding = "JISX0208.1983-0";
+       break;
+    case 0x43:
+       data->GL = "\103";
+       data->GL_encoding = "KSC5601.1987-0";
+       break;
+    default:
+       return 0;
+    }
+    data->GL_set_size = 94;
+    data->GL_char_size = 2;
+#ifdef notdef
+    if (c < 0x60)
+       data->GL_char_size = 2;
+    else if (c < 0x70)
+       data->GL_char_size = 3;
+    else
+       data->GL_char_size = 4;
+#endif
+    data->GLGR_encoding = (char *)NULL;
+    return 1;
+}
+
+static int
+Handle94GR(register XctData data, int c)
+{
+    switch (c) {
+    case 0x49:
+       data->GR = "\111";
+       data->GR_encoding = "JISX0201.1976-0";
+       break;
+    default:
+       return 0;
+    }
+    data->priv->flags &= ~ToGL;
+    data->GR_set_size = 94;
+    data->GR_char_size = 1;
+    data->GLGR_encoding = (char *)NULL;
+    return 1;
+}
+
+static int
+Handle96GR(register XctData data, int c)
+{
+    switch (c) {
+    case 0x41:
+       data->GR = "\101";
+       data->GR_encoding = "ISO8859-1";
+       break;
+    case 0x42:
+       data->GR = "\102";
+       data->GR_encoding = "ISO8859-2";
+       break;
+    case 0x43:
+       data->GR = "\103";
+       data->GR_encoding = "ISO8859-3";
+       break;
+    case 0x44:
+       data->GR = "\104";
+       data->GR_encoding = "ISO8859-4";
+       break;
+    case 0x46:
+       data->GR = "\106";
+       data->GR_encoding = "ISO8859-7";
+       break;
+    case 0x47:
+       data->GR = "\107";
+       data->GR_encoding = "ISO8859-6";
+       break;
+    case 0x48:
+       data->GR = "\110";
+       data->GR_encoding = "ISO8859-8";
+       break;
+    case 0x4c:
+       data->GR = "\114";
+       data->GR_encoding = "ISO8859-5";
+       break;
+    case 0x4d:
+       data->GR = "\115";
+       data->GR_encoding = "ISO8859-9";
+       break;
+    default:
+       return 0;
+    }
+    data->priv->flags &= ~ToGL;
+    data->GR_set_size = 96;
+    data->GR_char_size = 1;
+    ComputeGLGR(data);
+    return 1;
+}
+
+static int
+HandleMultiGR(register XctData data, int c)
+{
+    switch (c) {
+    case 0x41:
+       data->GR = "\101";
+       if (data->flags & XctShiftMultiGRToGL)
+           data->GR_encoding = "GB2312.1980-0";
+       else
+           data->GR_encoding = "GB2312.1980-1";
+       break;
+    case 0x42:
+       data->GR = "\102";
+       if (data->flags & XctShiftMultiGRToGL)
+           data->GR_encoding = "JISX0208.1983-0";
+       else
+           data->GR_encoding = "JISX0208.1983-1";
+       break;
+    case 0x43:
+       data->GR = "\103";
+       if (data->flags & XctShiftMultiGRToGL)
+           data->GR_encoding = "KSC5601.1987-0";
+       else
+           data->GR_encoding = "KSC5601.1987-1";
+       break;
+    default:
+       return 0;
+    }
+    if (data->flags & XctShiftMultiGRToGL)
+       data->priv->flags |= ToGL;
+    else
+       data->priv->flags &= ~ToGL;
+    data->GR_set_size = 94;
+    data->GR_char_size = 2;
+#ifdef notdef
+    if (c < 0x60)
+       data->GR_char_size = 2;
+    else if (c < 0x70)
+       data->GR_char_size = 3;
+    else
+       data->GR_char_size = 4;
+#endif
+    data->GLGR_encoding = (char *)NULL;
+    return 1;
+}
+
+static int
+HandleExtended(register XctData data, int c)
+{
+    register XctPriv priv = data->priv;
+    XctString enc = data->item + 6;
+    register XctString ptr = enc;
+    unsigned i, len;
+
+    while (*ptr != 0x02) {
+       if (!*ptr || (++ptr == priv->ptr))
+           return 0;
+    }
+    data->item = ptr + 1;
+    data->item_length = priv->ptr - data->item;
+    len = ptr - enc;
+    for (i = 0;
+        (i < priv->enc_count) &&
+        strncmp(priv->encodings[i], (char *)enc, len);
+        i++)
+       ;
+    if (i == priv->enc_count) {
+       XctString cp;
+
+       for (cp = enc; cp != ptr; cp++) {
+           if ((!IsGL(*cp) && !IsGR(*cp)) || (*cp == 0x2a) || (*cp == 0x3f))
+               return 0;
+       }
+       ptr = (XctString)malloc((unsigned)len + 1);
+       (void) memmove((char *)ptr, (char *)enc, len);
+       ptr[len] = 0x00;
+       priv->enc_count++;
+       if (priv->encodings)
+           priv->encodings = (char **)realloc(
+                                           (char *)priv->encodings,
+                                           priv->enc_count * sizeof(char *));
+       else
+           priv->encodings = (char **)malloc(sizeof(char *));
+       priv->encodings[i] = (char *)ptr;
+    }
+    data->encoding = priv->encodings[i];
+    data->char_size = c - 0x30;
+    return 1;
+}
+
+static void
+ShiftGRToGL(register XctData data, int hasCdata)
+{
+    register XctPriv priv = data->priv;
+    register int i;
+
+    if (data->item_length > priv->buf_count) {
+       priv->buf_count = data->item_length;
+       if (priv->itembuf)
+           priv->itembuf = (XctString)realloc((char *)priv->itembuf,
+                                              priv->buf_count);
+       else
+           priv->itembuf = (XctString)malloc(priv->buf_count);
+    }
+    (void) memmove((char *)priv->itembuf, (char *)data->item,
+                  data->item_length);
+    data->item = priv->itembuf;
+    if (hasCdata) {
+       for (i = data->item_length; --i >= 0; ) {
+           if (IsGR(data->item[i]))
+               data->item[i] &= 0x7f;
+       }
+    } else {
+       for (i = data->item_length; --i >= 0; )
+           data->item[i] &= 0x7f;
+    }
+}
+
+/* Create an XctData structure for parsing a Compound Text string. */
+XctData
+XctCreate(_Xconst unsigned char *string, int length, XctFlags flags)
+{
+    register XctData data;
+    register XctPriv priv;
+
+    data = (XctData)malloc(sizeof(struct _XctRec) + sizeof(struct _XctPriv));
+    if (!data)
+       return data;
+    data->priv = priv = (XctPriv)(data + 1);
+    data->total_string = (XctString)string;
+    data->total_length = length;
+    data->flags = flags;
+    priv->dirstack = (XctHDirection *)NULL;
+    priv->dirsize = 0;
+    priv->encodings = (char **)NULL;
+    priv->enc_count = 0;
+    priv->itembuf = (XctString)NULL;
+    priv->buf_count = 0;
+    XctReset(data);
+    return data;
+}
+
+/* Reset the XctData structure to re-parse the string from the beginning. */
+void
+XctReset(register XctData data)
+{
+    register XctPriv priv = data->priv;
+
+    priv->ptr = data->total_string;
+    priv->ptrend = data->total_string + data->total_length;
+    data->item = (XctString)NULL;
+    data->item_length = 0;
+    data->encoding = (char *)NULL;
+    data->char_size = 1;
+    data->horizontal = XctUnspecified;
+    data->horz_depth = 0;
+    priv->flags = 0;
+    data->GL_set_size = data->GR_set_size = 0; /* XXX */
+    (void)HandleGL(data, (unsigned char)0x42);
+    (void)Handle96GR(data, (unsigned char)0x41);
+    data->version = 1;
+    data->can_ignore_exts = 0;
+    /* parse version, if present */
+    if ((data->total_length >= 4) &&
+       (priv->ptr[0] == ESC) && (priv->ptr[1] == 0x23) &&
+       IsI2(priv->ptr[2]) &&
+       ((priv->ptr[3] == 0x30) || (priv->ptr[3] == 0x31))) {
+       data->version = priv->ptr[2] - 0x1f;
+       if (priv->ptr[3] == 0x30)
+           data->can_ignore_exts = 1;
+       priv->ptr += 4;
+    }
+}
+
+/* Parse the next "item" from the Compound Text string.  The return value
+ * indicates what kind of item is returned.  The item itself, and the current
+ * contextual state, are reported as components of the XctData structure.
+ */
+XctResult
+XctNextItem(register XctData data)
+{
+    register XctPriv priv = data->priv;
+    unsigned char c;
+    int len, bits;
+
+#define NEXT data->item_length++; priv->ptr++
+
+    while (IsMore(priv)) {
+       data->item = priv->ptr;
+       data->item_length = 0;
+       c = *priv->ptr;
+       if (c == ESC) {
+           NEXT;
+           while (IsMore(priv) && IsI2(*priv->ptr)) {
+               NEXT;
+           }
+           if (!IsMore(priv))
+               return XctError;
+           c = *priv->ptr;
+           NEXT;
+           if (!IsESCF(c))
+               return XctError;
+           switch (data->item[1]) {
+           case 0x24:
+               if (data->item_length > 3) {
+                   if (data->item[2] == 0x28) {
+                       if (HandleMultiGL(data, c))
+                           continue;
+                   } else if (data->item[2] == 0x29) {
+                       if (HandleMultiGR(data, c))
+                           continue;
+                   }
+               }
+               break;
+           case 0x25:
+               if ((data->item_length == 4) && (data->item[2] == 0x2f) &&
+                   (c <= 0x3f)) {
+                   if ((AmountLeft(priv) < 2) ||
+                       (priv->ptr[0] < 0x80) || (priv->ptr[1] < 0x80))
+                       return XctError;
+                   len = *priv->ptr - 0x80;
+                   NEXT;
+                   len = (len << 7) + (*priv->ptr - 0x80);
+                   NEXT;
+                   if (AmountLeft(priv) < len)
+                       return XctError;
+                   data->item_length += len;
+                   priv->ptr += len;
+                   if (c <= 0x34) {
+                       if (!HandleExtended(data, c) ||
+                           ((data->horz_depth == 0) &&
+                            (priv->flags & UsedDirection)))
+                           return XctError;
+                       priv->flags |= UsedGraphic;
+                       return XctExtendedSegment;
+                   }
+               }
+               break;
+           case 0x28:
+               if (HandleGL(data, c))
+                   continue;
+               break;
+           case 0x29:
+               if (Handle94GR(data, c))
+                   continue;
+               break;
+           case 0x2d:
+               if (Handle96GR(data, c))
+                   continue;
+               break;
+           }
+       } else if (c == CSI) {
+           NEXT;
+           while (IsMore(priv) && IsI3(*priv->ptr)) {
+               NEXT;
+           }
+           while (IsMore(priv) && IsI2(*priv->ptr)) {
+               NEXT;
+           }
+           if (!IsMore(priv))
+               return XctError;
+           c = *priv->ptr;
+           NEXT;
+           if (!IsCSIF(c))
+               return XctError;
+           if (c == 0x5d) {
+               if ((data->item_length == 3) &&
+                   ((data->item[1] == 0x31) || (data->item[1] == 0x32))) {
+                   data->horz_depth++;
+                   if (priv->dirsize < data->horz_depth) {
+                       priv->dirsize += 10;
+                       if (priv->dirstack)
+                           priv->dirstack = (XctHDirection *)
+                                            realloc((char *)priv->dirstack,
+                                                    priv->dirsize *
+                                                    sizeof(XctHDirection));
+                       else
+                           priv->dirstack = (XctHDirection *)
+                                            malloc(priv->dirsize *
+                                                   sizeof(XctHDirection));
+                   }
+                   priv->dirstack[data->horz_depth - 1] = data->horizontal;
+                   if (data->item[1] == 0x31)
+                       data->horizontal = XctLeftToRight;
+                   else
+                       data->horizontal = XctRightToLeft;
+                   if ((priv->flags & UsedGraphic) &&
+                       !(priv->flags & UsedDirection))
+                       return XctError;
+                   priv->flags |= UsedDirection;
+                   if (data->flags & XctHideDirection)
+                       continue;
+                   return XctHorizontal;
+               } else if (data->item_length == 2) {
+                   if (!data->horz_depth)
+                       return XctError;
+                   data->horz_depth--;
+                   data->horizontal = priv->dirstack[data->horz_depth];
+                   if (data->flags & XctHideDirection)
+                       continue;
+                   return XctHorizontal;
+               }
+           }
+       } else if (data->flags & XctSingleSetSegments) {
+           NEXT;
+           if IsC0(c) {
+               data->encoding = (char *)NULL;
+               data->char_size = 1;
+               if (IsLegalC0(data, c))
+                   return XctC0Segment;
+           } else if (IsGL(c)) {
+               data->encoding = data->GL_encoding;
+               data->char_size = data->GL_char_size;
+               while (IsMore(priv) && IsGL(*priv->ptr)) {
+                   NEXT;
+               }
+               if (((data->char_size > 1) &&
+                    (data->item_length % data->char_size)) ||
+                   ((data->horz_depth == 0) &&
+                    (priv->flags & UsedDirection)))
+                   return XctError;
+               priv->flags |= UsedGraphic;
+               return XctGLSegment;
+           } else if (IsC1(c)) {
+               data->encoding = (char *)NULL;
+               data->char_size = 1;
+               if (IsLegalC1(data, c))
+                   return XctC1Segment;
+           } else {
+               data->encoding = data->GR_encoding;
+               data->char_size = data->GR_char_size;
+               while (IsMore(priv) && IsGR(*priv->ptr)) {
+                   NEXT;
+               }
+               if (((data->char_size > 1) &&
+                    (data->item_length % data->char_size)) ||
+                   ((data->horz_depth == 0) &&
+                    (priv->flags & UsedDirection)))
+                   return XctError;
+               priv->flags |= UsedGraphic;
+               if (!(priv->flags & ToGL))
+                   return XctGRSegment;
+               ShiftGRToGL(data, 0);
+               return XctGLSegment;
+           }
+       } else {
+           bits = 0;
+           while (1) {
+               if (IsC0(c) || IsC1(c)) {
+                   if ((c == ESC) || (c == CSI))
+                       break;
+                   if (IsC0(c) ? !IsLegalC0(data, c) : !IsLegalC1(data, c))
+                       break;
+                   bits |= HasC;
+                   NEXT;
+               } else {
+                   len = data->item_length;
+                   if (IsGL(c)) {
+                       if ((data->flags & XctShiftMultiGRToGL) &&
+                           (bits & HasGR))
+                           break;
+                       NEXT;
+                       bits |= HasGL;
+                       while (IsMore(priv) && IsGL(*priv->ptr)) {
+                           NEXT;
+                       }
+                       if ((data->GL_char_size > 1) &&
+                           ((data->item_length - len) % data->GL_char_size))
+                           return XctError;
+                   } else {
+                       if ((data->flags & XctShiftMultiGRToGL) &&
+                           (bits & HasGL))
+                           break;
+                       NEXT;
+                       bits |= HasGR;
+                       while (IsMore(priv) && IsGR(*priv->ptr)) {
+                           NEXT;
+                       }
+                       if ((data->GR_char_size > 1) &&
+                           ((data->item_length - len) % data->GR_char_size))
+                           return XctError;
+                   }
+               }
+               if (!IsMore(priv))
+                   break;
+               c = *priv->ptr;
+           }
+           if (data->item_length) {
+               if (bits & (HasGL|HasGR)) {
+                   priv->flags |= UsedGraphic;
+                   if ((data->horz_depth == 0) &&
+                       (priv->flags & UsedDirection))
+                       return XctError;
+                   if ((data->flags & XctShiftMultiGRToGL) && (bits & HasGR))
+                       ShiftGRToGL(data, bits & HasC);
+               }
+               if ((bits == (HasGL|HasGR)) ||
+                   (data->GLGR_encoding && !(bits & HasC))) {
+                   data->encoding = data->GLGR_encoding;
+                   if (data->GL_char_size == data->GR_char_size)
+                       data->char_size = data->GL_char_size;
+                   else
+                       data->char_size = 0;
+               } else if (bits == HasGL) {
+                   data->encoding = data->GL_encoding;
+                   data->char_size = data->GL_char_size;
+               } else if (bits == HasGR) {
+                   data->encoding = data->GR_encoding;
+                   data->char_size = data->GR_char_size;
+               } else {
+                   data->encoding = (char *)NULL;
+                   data->char_size = 1;
+                   if ((bits & HasGL) &&
+                       (data->GL_char_size != data->char_size))
+                       data->char_size = 0;
+                   if ((bits & HasGR) &&
+                       (data->GR_char_size != data->char_size))
+                       data->char_size = 0;
+               }
+               return XctSegment;
+           }
+           NEXT;
+       }
+       if (data->version <= XctVersion)
+           return XctError;
+       if (data->flags & XctProvideExtensions)
+           return XctExtension;
+       if (!data->can_ignore_exts)
+           return XctError;
+    }
+    return XctEndOfText;
+}
+
+/* Free all data associated with an XctDataStructure. */
+void
+XctFree(register XctData data)
+{
+    unsigned i;
+    register XctPriv priv = data->priv;
+
+    if (priv->dirstack)
+       free((char *)priv->dirstack);
+    if (data->flags & XctFreeString)
+       free((char *)data->total_string);
+    for (i = 0; i < priv->enc_count; i++)
+       free(priv->encodings[i]);
+    if (priv->encodings)
+       free((char *)priv->encodings);
+    if (priv->itembuf)
+       free((char *)priv->itembuf);
+    free((char *)data);
+}
diff --git a/src/sharedlib.c b/src/sharedlib.c
new file mode 100644 (file)
index 0000000..b47213d
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+
+Copyright 1991, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#if defined(SUNSHLIB) && !defined(SHAREDCODE)
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include "Atoms.h"
+
+struct _AtomRec {
+    char *name;
+    struct _DisplayRec* head;
+};
+
+#define DeclareAtom(atom) \
+extern struct _AtomRec __##atom; \
+AtomPtr _##atom = &__##atom;
+
+DeclareAtom(XA_ATOM_PAIR)
+DeclareAtom(XA_CHARACTER_POSITION)
+DeclareAtom(XA_CLASS)
+DeclareAtom(XA_CLIENT_WINDOW)
+DeclareAtom(XA_CLIPBOARD)
+DeclareAtom(XA_COMPOUND_TEXT)
+DeclareAtom(XA_DECNET_ADDRESS)
+DeclareAtom(XA_DELETE)
+DeclareAtom(XA_FILENAME)
+DeclareAtom(XA_HOSTNAME)
+DeclareAtom(XA_IP_ADDRESS)
+DeclareAtom(XA_LENGTH)
+DeclareAtom(XA_LIST_LENGTH)
+DeclareAtom(XA_NAME)
+DeclareAtom(XA_NET_ADDRESS)
+DeclareAtom(XA_NULL)
+DeclareAtom(XA_OWNER_OS)
+DeclareAtom(XA_SPAN)
+DeclareAtom(XA_TARGETS)
+DeclareAtom(XA_TEXT)
+DeclareAtom(XA_TIMESTAMP)
+DeclareAtom(XA_USER)
+DeclareAtom(XA_UTF8_STRING)
+
+#endif /* SUNSHLIB */
diff --git a/xmu.pc.in b/xmu.pc.in
new file mode 100644 (file)
index 0000000..a086f83
--- /dev/null
+++ b/xmu.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Xmu
+Description: Xmu Library
+Version: @PACKAGE_VERSION@
+Requires: xproto x11 xt
+Requires.private: x11 xt xext
+Cflags: -I${includedir}
+Libs: -L${libdir} -lXmu
diff --git a/xmuu.pc.in b/xmuu.pc.in
new file mode 100644 (file)
index 0000000..1e91ac4
--- /dev/null
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Xmuu
+Description: Mini Xmu Library
+Version: @PACKAGE_VERSION@
+Requires: xproto x11
+Requires.private: x11
+Cflags: -I${includedir}
+Libs: -L${libdir} -lXmuu