Filewatcher File Search
FTP Search
  
Directory 
  
Content Search 
   
pkg://lesstif-0.83snap-19980509.src.rpm:2438288/lesstif-current.tar.gz  info  downloads

lesstif-current/ 40775   1005    764           0  6525042615  13413 5ustar  u27113lesstifdevlesstif-current/CVS/ 40775   1005    764           0  6525041765  14053 5ustar  u27113lesstifdevlesstif-current/CVS/Root100664   1005    764          51  6441304526  14744 0ustar  u27113lesstifdev:pserver:lesstif@cvs.hungry.com:/cvsroot
lesstif-current/CVS/Repository100664   1005    764          30  6441111377  16175 0ustar  u27113lesstifdev/cvsroot/hungry/lesstif
lesstif-current/CVS/Entries100644   1752    764        2177  6525040712  16320 0ustar  lesstiflesstifdev/BUG-REPORTING/1.2/Tue Dec  2 23:00:16 1997//
/COPYING/1.1.1.1/Tue Dec  2 23:00:16 1997//
/COPYING.LIB/1.1.1.1/Tue Dec  2 23:00:16 1997//
/CREDITS/1.1/Tue Dec  2 23:00:16 1997//
/KNOWN_BUGS/1.25/Tue Dec  2 23:00:19 1997//
/NEWS/1.1/Tue Dec  2 23:00:19 1997//
/README/1.1/Tue Dec  2 23:00:20 1997//
/RELEASE-POLICY/1.3/Tue Dec  2 23:00:20 1997//
/install-sh/1.2/Tue Dec  2 23:00:22 1997//
/missing/1.1/Tue Dec  2 23:00:34 1997//
/mkinstalldirs/1.1/Tue Dec  2 23:00:34 1997//
D/clients////
D/doc////
D/etc////
D/include////
D/lib////
D/scripts////
D/test////
/acconfig.h/1.2/Thu Dec 11 12:49:56 1997//
/aclocal.m4/1.3/Sun Jan 18 12:48:42 1998//
/config.guess/1.6/Sun Jan 18 12:48:43 1998//
/config.sub/1.8/Sun Jan 18 12:48:44 1998//
/TODO/1.7/Mon Jan 26 12:48:39 1998//
/INSTALL/1.20/Fri Feb 20 12:48:46 1998//
/Makefile.am/1.6/Tue Mar  3 12:50:33 1998//
/AUTHORS/1.3/Fri Mar 13 12:49:46 1998//
/ChangeLog/1.5/Sun Mar 15 12:49:36 1998//
/NOTES/1.27/Wed Mar 18 12:49:19 1998//
/ltconfig/1.5/Tue Mar 31 12:49:32 1998//
/ltmain.sh/1.5/Tue Mar 31 12:49:34 1998//
/CURRENT_NOTES/1.50/Fri Apr 24 11:49:29 1998//
/configure.in/1.103/Fri May  8 11:49:19 1998//
lesstif-current/CVS/Entries.Log100644   1752    764         256  6525042433  17016 0ustar  lesstiflesstifdevA D/config////
A D/libMrm////
A D/libXm////
A D/man////
A D/testMrm////
A D/testXm////
R D/testXm////
R D/testMrm////
R D/man////
R D/libXm////
R D/libMrm////
R D/config////
lesstif-current/clients/ 40775   1005    764           0  6525042507  15054 5ustar  u27113lesstifdevlesstif-current/clients/CVS/ 40775   1005    764           0  6525042516  15507 5ustar  u27113lesstifdevlesstif-current/clients/CVS/Root100664   1005    764          51  6441304526  16405 0ustar  u27113lesstifdev:pserver:lesstif@cvs.hungry.com:/cvsroot
lesstif-current/clients/CVS/Repository100664   1005    764          40  6441111423  17627 0ustar  u27113lesstifdev/cvsroot/hungry/lesstif/clients
lesstif-current/clients/CVS/Entries100644   1752    764         114  6525042511  17725 0ustar  lesstiflesstifdevD/Motif-1.2////
D/Motif-CDE////
/Makefile.am/1.2/Tue Mar  3 12:50:35 1998//
lesstif-current/clients/Motif-1.2/ 40775   1005    764           0  6500055102  16414 5ustar  u27113lesstifdevlesstif-current/clients/Motif-1.2/CVS/ 40775   1005    764           0  6476776235  17104 5ustar  u27113lesstifdevlesstif-current/clients/Motif-1.2/CVS/Root100664   1005    764          51  6441304526  17761 0ustar  u27113lesstifdev:pserver:lesstif@cvs.hungry.com:/cvsroot
lesstif-current/clients/Motif-1.2/CVS/Repository100664   1005    764          52  6441111425  21210 0ustar  u27113lesstifdev/cvsroot/hungry/lesstif/clients/Motif-1.2
lesstif-current/clients/Motif-1.2/CVS/Entries100644   1752    764         212  6476776234  21325 0ustar  lesstiflesstifdev/client.Makefile.in/1.9/Tue Dec  2 23:00:37 1997//
D/lib////
D/mwm////
D/uil////
D/xmbind////
/Makefile.am/1.2/Tue Mar  3 12:50:36 1998//
lesstif-current/clients/Motif-1.2/lib/ 40775   1005    764           0  6502747146  17204 5ustar  u27113lesstifdevlesstif-current/clients/Motif-1.2/lib/CVS/ 40775   1005    764           0  6502747146  17637 5ustar  u27113lesstifdevlesstif-current/clients/Motif-1.2/lib/CVS/Root100664   1005    764          51  6441304526  20527 0ustar  u27113lesstifdev:pserver:lesstif@cvs.hungry.com:/cvsroot
lesstif-current/clients/Motif-1.2/lib/CVS/Repository100664   1005    764          56  6441111426  21763 0ustar  u27113lesstifdev/cvsroot/hungry/lesstif/clients/Motif-1.2/lib
lesstif-current/clients/Motif-1.2/lib/CVS/Entries100644   1752    764         330  6502747145  22061 0ustar  lesstiflesstifdev/gethostname.c/1.1/Tue Dec  2 23:00:39 1997//
/getopt.c/1.2/Tue Dec  2 23:00:39 1997//
/getopt.h/1.1/Tue Dec  2 23:00:41 1997//
/getopt1.c/1.2/Tue Dec  2 23:00:41 1997//
/Makefile.am/1.3/Sun Mar 15 12:49:41 1998//
D
lesstif-current/clients/Motif-1.2/lib/Makefile.in100644   1752    764       16320  6525042545  22202 0ustar  lesstiflesstifdev# Makefile.in generated automatically by automake 1.2 from Makefile.am

# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.

#
# $Header: /cvsroot/hungry/lesstif/clients/Motif-1.2/lib/Makefile.am,v 1.3 1998/03/14 13:13:31 rwscott Exp $
#


SHELL = /bin/sh

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@

bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include

pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@

top_builddir = ../../..

ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@

NORMAL_INSTALL = true
PRE_INSTALL = true
POST_INSTALL = true
NORMAL_UNINSTALL = true
PRE_UNINSTALL = true
POST_UNINSTALL = true
build_alias = @build_alias@
build_triplet = @build@
host_alias = @host_alias@
host_triplet = @host@
target_alias = @target_alias@
target_triplet = @target@
AR = @AR@
CC = @CC@
EXEEXT = @EXEEXT@
Editres = @Editres@
LD = @LD@
LEX = @LEX@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBTOOL = @LIBTOOL@
LIBTOOL_VERSION = @LIBTOOL_VERSION@
LN_S = @LN_S@
MAINT = @MAINT@
MAJOR_VERSION = @MAJOR_VERSION@
MAKEINFO = @MAKEINFO@
MINOR_VERSION = @MINOR_VERSION@
PACKAGE = @PACKAGE@
PICO_VERSION = @PICO_VERSION@
R6libs = @R6libs@
RANLIB = @RANLIB@
VERSION = @VERSION@
VarHaveMan2html = @VarHaveMan2html@
YACC = @YACC@
bindir = @bindir@
extralibs = @extralibs@
include_version_suffix = @include_version_suffix@
libdir = @libdir@
motif_includes = @motif_includes@
motif_libraries = @motif_libraries@
shared_make = @shared_make@
subdirs = @subdirs@
version_suffix = @version_suffix@
x_inc_path = @x_inc_path@
x_includes = @x_includes@
x_lib_path = @x_lib_path@
x_libraries = @x_libraries@

noinst_LIBRARIES=	libltc.a
MAINTAINERCLEANFILES=Makefile.in

@HaveGetHostName_TRUE@libltc_a_SOURCES =	getopt.c getopt1.c getopt.h
@HaveGetHostName_FALSE@libltc_a_SOURCES =	getopt.c getopt1.c getopt.h gethostname.c
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../../include/LTconfig.h
CONFIG_CLEAN_FILES = 
LIBRARIES =  $(noinst_LIBRARIES)


DEFS = @DEFS@ -I. -I$(srcdir) -I../../../include
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
libltc_a_LIBADD = 
@HaveGetHostName_FALSE@libltc_a_OBJECTS =  getopt.o getopt1.o \
@HaveGetHostName_FALSE@gethostname.o
@HaveGetHostName_TRUE@libltc_a_OBJECTS =  getopt.o getopt1.o
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON =  Makefile.am Makefile.in


DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)

TAR = tar
GZIP = --best
SOURCES = $(libltc_a_SOURCES)
OBJECTS = $(libltc_a_OBJECTS)

default: all

.SUFFIXES:
.SUFFIXES: .c .lo .o
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
	cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps clients/Motif-1.2/lib/Makefile

Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
	cd $(top_builddir) \
	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status


mostlyclean-noinstLIBRARIES:

clean-noinstLIBRARIES:
	test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)

distclean-noinstLIBRARIES:

maintainer-clean-noinstLIBRARIES:

.c.o:
	$(COMPILE) -c $<

mostlyclean-compile:
	rm -f *.o core

clean-compile:

distclean-compile:
	rm -f *.tab.c

maintainer-clean-compile:

.c.lo:
	$(LIBTOOL) --mode=compile $(COMPILE) -c $<

mostlyclean-libtool:
	rm -f *.lo

clean-libtool:
	rm -rf .libs

distclean-libtool:

maintainer-clean-libtool:

libltc.a: $(libltc_a_OBJECTS) $(libltc_a_DEPENDENCIES)
	rm -f libltc.a
	$(AR) cru libltc.a $(libltc_a_OBJECTS) $(libltc_a_LIBADD)
	$(RANLIB) libltc.a

tags: TAGS

ID: $(HEADERS) $(SOURCES)
	here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS)

TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES)
	tags=; \
	here=`pwd`; \
	test -z "$(ETAGS_ARGS)$(SOURCES)$(HEADERS)$$tags" \
	  || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags  $(SOURCES) $(HEADERS) -o $$here/TAGS)

mostlyclean-tags:

clean-tags:

distclean-tags:
	rm -f TAGS ID

maintainer-clean-tags:

distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)

subdir = clients/Motif-1.2/lib

distdir: $(DISTFILES)
	@for file in $(DISTFILES); do \
	  d=$(srcdir); \
	  test -f $(distdir)/$$file \
	  || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
	  || cp -p $$d/$$file $(distdir)/$$file; \
	done
info:
dvi:
check: all
	$(MAKE)
installcheck:
install-exec: 
	@$(NORMAL_INSTALL)

install-data: 
	@$(NORMAL_INSTALL)

install: install-exec install-data all
	@:

uninstall: 

all: Makefile $(LIBRARIES)

install-strip:
	$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
installdirs:


mostlyclean-generic:
	test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)

clean-generic:
	test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)

distclean-generic:
	rm -f Makefile $(DISTCLEANFILES)
	rm -f config.cache config.log stamp-h stamp-h[0-9]*
	test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)

maintainer-clean-generic:
	test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
	test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean:  mostlyclean-noinstLIBRARIES mostlyclean-compile \
		mostlyclean-libtool mostlyclean-tags \
		mostlyclean-generic

clean:  clean-noinstLIBRARIES clean-compile clean-libtool clean-tags \
		clean-generic mostlyclean

distclean:  distclean-noinstLIBRARIES distclean-compile \
		distclean-libtool distclean-tags distclean-generic \
		clean
	rm -f config.status
	rm -f libtool

maintainer-clean:  maintainer-clean-noinstLIBRARIES \
		maintainer-clean-compile maintainer-clean-libtool \
		maintainer-clean-tags maintainer-clean-generic \
		distclean
	@echo "This command is intended for maintainers to use;"
	@echo "it deletes files that may require special tools to rebuild."

.PHONY: default mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir info dvi \
installcheck install-exec install-data install uninstall all \
installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean


# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
lesstif-current/clients/Motif-1.2/lib/Makefile.am100644   1752    764         470  6502747145  22133 0ustar  lesstiflesstifdev#
# $Header: /cvsroot/hungry/lesstif/clients/Motif-1.2/lib/Makefile.am,v 1.3 1998/03/14 13:13:31 rwscott Exp $
#
noinst_LIBRARIES=	libltc.a
MAINTAINERCLEANFILES=Makefile.in

if HaveGetHostName
libltc_a_SOURCES =	getopt.c getopt1.c getopt.h
else
libltc_a_SOURCES =	getopt.c getopt1.c getopt.h gethostname.c
endif
lesstif-current/clients/Motif-1.2/lib/gethostname.c100664   1005    764        3564  6441111427  21760 0ustar  u27113lesstifdev/**
 *
 * $Id: gethostname.c,v 1.1 1997/02/20 02:44:54 miers Exp $
 *
 * Based on gethostname.c from GNU sh-utils 1.12.
 * 
 * gethostname emulation for SysV and POSIX.1.
 *
 * Copyright (C) 1996 Free Software Foundation, Inc.
 * Copyright (C) 1992 Free Software Foundation, Inc.
 *
 * This file is part of the GNU LessTif Library.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 **/

 /* David MacKenzie <djm@gnu.ai.mit.edu> */

#include <LTconfig.h>

#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif

#ifdef HAVE_UNAME
#include <sys/utsname.h>
#else
#ifdef HAVE_SYS_SYSTEMINFO_H
#include <sys/systeminfo.h>
#endif
#endif

/* Put up to LEN chars of the host name into NAME.
   Null terminate it if the name is shorter than LEN.
   Return 0 if ok, -1 if error.  */

int
gethostname (name, len)
     char *name;
     int len;
{
#ifdef HAVE_UNAME
  struct utsname uts;

  if (uname (&uts) == -1)
    return -1;
  if (len > sizeof (uts.nodename))
    {
      /* More space than we need is available.  */
      name[sizeof (uts.nodename)] = '\0';
      len = sizeof (uts.nodename);
    }
  strncpy (name, uts.nodename, len);
#else
#ifdef HAVE_SYS_SYSTEMINFO_H
	sysinfo(SI_HOSTNAME, name, len);
#else
#error You lose.
#endif
#endif
  return 0;
}
lesstif-current/clients/Motif-1.2/lib/getopt.c100664   1005    764       52322  6441111427  20760 0ustar  u27113lesstifdev/* Getopt for GNU.
   NOTE: getopt is now part of the C library, so if you don't know what
   "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
   before changing it!

   Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94
   	Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
   Free Software Foundation; either version 2, or (at your option) any
   later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */

/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
   Ditto for AIX 3.2 and <stdlib.h>.  */
#ifndef _NO_PROTO
#define _NO_PROTO
#endif

#if !defined (__STDC__) || !__STDC__
/* This is a separate conditional since some stdc systems
   reject `defined (const)'.  */
#ifndef const
#define const
#endif
#endif

#include <stdio.h>

/* Comment out all this code if we are using the GNU C Library, and are not
   actually compiling the library itself.  This code is part of the GNU C
   Library, but also included in many other GNU distributions.  Compiling
   and linking in this code is a waste when using the GNU C library
   (especially if it is a shared library).  Rather than having every GNU
   program understand `configure --with-gnu-libc' and omit the object files,
   it is simpler to just do this in the source for each such file.  */

#if defined (_LIBC) || !defined (__GNU_LIBRARY__)


/* This needs to come after some library #include
   to get __GNU_LIBRARY__ defined.  */
#ifdef	__GNU_LIBRARY__
/* Don't include stdlib.h for non-GNU C libraries because some of them
   contain conflicting prototypes for getopt.  */
#include <stdlib.h>
#endif	/* GNU C library.  */

/* This version of `getopt' appears to the caller like standard Unix `getopt'
   but it behaves differently for the user, since it allows the user
   to intersperse the options with the other arguments.

   As `getopt' works, it permutes the elements of ARGV so that,
   when it is done, all the options precede everything else.  Thus
   all application programs are extended to handle flexible argument order.

   Setting the environment variable POSIXLY_CORRECT disables permutation.
   Then the behavior is completely standard.

   GNU application programs can use a third alternative mode in which
   they can distinguish the relative order of options and other arguments.  */

#include "getopt.h"

/* For communication from `getopt' to the caller.
   When `getopt' finds an option that takes an argument,
   the argument value is returned here.
   Also, when `ordering' is RETURN_IN_ORDER,
   each non-option ARGV-element is returned here.  */

char *optarg = NULL;

/* Index in ARGV of the next element to be scanned.
   This is used for communication to and from the caller
   and for communication between successive calls to `getopt'.

   On entry to `getopt', zero means this is the first call; initialize.

   When `getopt' returns EOF, this is the index of the first of the
   non-option elements that the caller should itself scan.

   Otherwise, `optind' communicates from one call to the next
   how much of ARGV has been scanned so far.  */

/* XXX 1003.2 says this must be 1 before any call.  */
int optind = 0;

/* The next char to be scanned in the option-element
   in which the last option character we returned was found.
   This allows us to pick up the scan where we left off.

   If this is zero, or a null string, it means resume the scan
   by advancing to the next ARGV-element.  */

static char *nextchar;

/* Callers store zero here to inhibit the error message
   for unrecognized options.  */

int opterr = 1;

/* Set to an option character which was unrecognized.
   This must be initialized on some systems to avoid linking in the
   system's own getopt implementation.  */

int optopt = '?';

/* Describe how to deal with options that follow non-option ARGV-elements.

   If the caller did not specify anything,
   the default is REQUIRE_ORDER if the environment variable
   POSIXLY_CORRECT is defined, PERMUTE otherwise.

   REQUIRE_ORDER means don't recognize them as options;
   stop option processing when the first non-option is seen.
   This is what Unix does.
   This mode of operation is selected by either setting the environment
   variable POSIXLY_CORRECT, or using `+' as the first character
   of the list of option characters.

   PERMUTE is the default.  We permute the contents of ARGV as we scan,
   so that eventually all the non-options are at the end.  This allows options
   to be given in any order, even with programs that were not written to
   expect this.

   RETURN_IN_ORDER is an option available to programs that were written
   to expect options and other ARGV-elements in any order and that care about
   the ordering of the two.  We describe each non-option ARGV-element
   as if it were the argument of an option with character code 1.
   Using `-' as the first character of the list of option characters
   selects this mode of operation.

   The special argument `--' forces an end of option-scanning regardless
   of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
   `--' can cause `getopt' to return EOF with `optind' != ARGC.  */

static enum
{
  REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
} ordering;

/* Value of POSIXLY_CORRECT environment variable.  */
static char *posixly_correct;

#ifdef	__GNU_LIBRARY__
/* We want to avoid inclusion of string.h with non-GNU libraries
   because there are many ways it can cause trouble.
   On some systems, it contains special magic macros that don't work
   in GCC.  */
#include <string.h>
#define	my_index	strchr
#else

/* Avoid depending on library functions or files
   whose names are inconsistent.  */

char *getenv ();

static char *
my_index (str, chr)
     const char *str;
     int chr;
{
  while (*str)
    {
      if (*str == chr)
	return (char *) str;
      str++;
    }
  return 0;
}

/* If using GCC, we can safely declare strlen this way.
   If not using GCC, it is ok not to declare it.  */
#ifdef __GNUC__
/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
   That was relevant to code that was here before.  */
#if !defined (__STDC__) || !__STDC__
/* gcc with -traditional declares the built-in strlen to return int,
   and has done so at least since version 2.4.5. -- rms.  */
extern int strlen (const char *);
#endif /* not __STDC__ */
#endif /* __GNUC__ */

#endif /* not __GNU_LIBRARY__ */

/* Handle permutation of arguments.  */

/* Describe the part of ARGV that contains non-options that have
   been skipped.  `first_nonopt' is the index in ARGV of the first of them;
   `last_nonopt' is the index after the last of them.  */

static int first_nonopt;
static int last_nonopt;

/* Exchange two adjacent subsequences of ARGV.
   One subsequence is elements [first_nonopt,last_nonopt)
   which contains all the non-options that have been skipped so far.
   The other is elements [last_nonopt,optind), which contains all
   the options processed since those non-options were skipped.

   `first_nonopt' and `last_nonopt' are relocated so that they describe
   the new indices of the non-options in ARGV after they are moved.  */

static void
exchange (argv)
     char **argv;
{
  int bottom = first_nonopt;
  int middle = last_nonopt;
  int top = optind;
  char *tem;

  /* Exchange the shorter segment with the far end of the longer segment.
     That puts the shorter segment into the right place.
     It leaves the longer segment in the right place overall,
     but it consists of two parts that need to be swapped next.  */

  while (top > middle && middle > bottom)
    {
      if (top - middle > middle - bottom)
	{
	  /* Bottom segment is the short one.  */
	  int len = middle - bottom;
	  register int i;

	  /* Swap it with the top part of the top segment.  */
	  for (i = 0; i < len; i++)
	    {
	      tem = argv[bottom + i];
	      argv[bottom + i] = argv[top - (middle - bottom) + i];
	      argv[top - (middle - bottom) + i] = tem;
	    }
	  /* Exclude the moved bottom segment from further swapping.  */
	  top -= len;
	}
      else
	{
	  /* Top segment is the short one.  */
	  int len = top - middle;
	  register int i;

	  /* Swap it with the bottom part of the bottom segment.  */
	  for (i = 0; i < len; i++)
	    {
	      tem = argv[bottom + i];
	      argv[bottom + i] = argv[middle + i];
	      argv[middle + i] = tem;
	    }
	  /* Exclude the moved top segment from further swapping.  */
	  bottom += len;
	}
    }

  /* Update records for the slots the non-options now occupy.  */

  first_nonopt += (optind - last_nonopt);
  last_nonopt = optind;
}

/* Initialize the internal data when the first call is made.  */

static const char *
_getopt_initialize (optstring)
     const char *optstring;
{
  /* Start processing options with ARGV-element 1 (since ARGV-element 0
     is the program name); the sequence of previously skipped
     non-option ARGV-elements is empty.  */

  first_nonopt = last_nonopt = optind = 1;

  nextchar = NULL;

  posixly_correct = getenv ("POSIXLY_CORRECT");

  /* Determine how to handle the ordering of options and nonoptions.  */

  if (optstring[0] == '-')
    {
      ordering = RETURN_IN_ORDER;
      ++optstring;
    }
  else if (optstring[0] == '+')
    {
      ordering = REQUIRE_ORDER;
      ++optstring;
    }
  else if (posixly_correct != NULL)
    ordering = REQUIRE_ORDER;
  else
    ordering = PERMUTE;

  return optstring;
}

/* Scan elements of ARGV (whose length is ARGC) for option characters
   given in OPTSTRING.

   If an element of ARGV starts with '-', and is not exactly "-" or "--",
   then it is an option element.  The characters of this element
   (aside from the initial '-') are option characters.  If `getopt'
   is called repeatedly, it returns successively each of the option characters
   from each of the option elements.

   If `getopt' finds another option character, it returns that character,
   updating `optind' and `nextchar' so that the next call to `getopt' can
   resume the scan with the following option character or ARGV-element.

   If there are no more option characters, `getopt' returns `EOF'.
   Then `optind' is the index in ARGV of the first ARGV-element
   that is not an option.  (The ARGV-elements have been permuted
   so that those that are not options now come last.)

   OPTSTRING is a string containing the legitimate option characters.
   If an option character is seen that is not listed in OPTSTRING,
   return '?' after printing an error message.  If you set `opterr' to
   zero, the error message is suppressed but we still return '?'.

   If a char in OPTSTRING is followed by a colon, that means it wants an arg,
   so the following text in the same ARGV-element, or the text of the following
   ARGV-element, is returned in `optarg'.  Two colons mean an option that
   wants an optional arg; if there is text in the current ARGV-element,
   it is returned in `optarg', otherwise `optarg' is set to zero.

   If OPTSTRING starts with `-' or `+', it requests different methods of
   handling the non-option ARGV-elements.
   See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.

   Long-named options begin with `--' instead of `-'.
   Their names may be abbreviated as long as the abbreviation is unique
   or is an exact match for some defined option.  If they have an
   argument, it follows the option name in the same ARGV-element, separated
   from the option name by a `=', or else the in next ARGV-element.
   When `getopt' finds a long-named option, it returns 0 if that option's
   `flag' field is nonzero, the value of the option's `val' field
   if the `flag' field is zero.

   The elements of ARGV aren't really const, because we permute them.
   But we pretend they're const in the prototype to be compatible
   with other systems.

   LONGOPTS is a vector of `struct option' terminated by an
   element containing a name which is zero.

   LONGIND returns the index in LONGOPT of the long-named option found.
   It is only valid when a long-named option has been found by the most
   recent call.

   If LONG_ONLY is nonzero, '-' as well as '--' can introduce
   long-named options.  */

int
_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
     int argc;
     char *const *argv;
     const char *optstring;
     const struct option *longopts;
     int *longind;
     int long_only;
{
  optarg = NULL;

  if (optind == 0)
    optstring = _getopt_initialize (optstring);

  if (nextchar == NULL || *nextchar == '\0')
    {
      /* Advance to the next ARGV-element.  */

      if (ordering == PERMUTE)
	{
	  /* If we have just processed some options following some non-options,
	     exchange them so that the options come first.  */

	  if (first_nonopt != last_nonopt && last_nonopt != optind)
	    exchange ((char **) argv);
	  else if (last_nonopt != optind)
	    first_nonopt = optind;

	  /* Skip any additional non-options
	     and extend the range of non-options previously skipped.  */

	  while (optind < argc
		 && (argv[optind][0] != '-' || argv[optind][1] == '\0'))
	    optind++;
	  last_nonopt = optind;
	}

      /* The special ARGV-element `--' means premature end of options.
	 Skip it like a null option,
	 then exchange with previous non-options as if it were an option,
	 then skip everything else like a non-option.  */

      if (optind != argc && !strcmp (argv[optind], "--"))
	{
	  optind++;

	  if (first_nonopt != last_nonopt && last_nonopt != optind)
	    exchange ((char **) argv);
	  else if (first_nonopt == last_nonopt)
	    first_nonopt = optind;
	  last_nonopt = argc;

	  optind = argc;
	}

      /* If we have done all the ARGV-elements, stop the scan
	 and back over any non-options that we skipped and permuted.  */

      if (optind == argc)
	{
	  /* Set the next-arg-index to point at the non-options
	     that we previously skipped, so the caller will digest them.  */
	  if (first_nonopt != last_nonopt)
	    optind = first_nonopt;
	  return EOF;
	}

      /* If we have come to a non-option and did not permute it,
	 either stop the scan or describe it to the caller and pass it by.  */

      if ((argv[optind][0] != '-' || argv[optind][1] == '\0'))
	{
	  if (ordering == REQUIRE_ORDER)
	    return EOF;
	  optarg = argv[optind++];
	  return 1;
	}

      /* We have found another option-ARGV-element.
	 Skip the initial punctuation.  */

      nextchar = (argv[optind] + 1
		  + (longopts != NULL && argv[optind][1] == '-'));
    }

  /* Decode the current option-ARGV-element.  */

  /* Check whether the ARGV-element is a long option.

     If long_only and the ARGV-element has the form "-f", where f is
     a valid short option, don't consider it an abbreviated form of
     a long option that starts with f.  Otherwise there would be no
     way to give the -f short option.

     On the other hand, if there's a long option "fubar" and
     the ARGV-element is "-fu", do consider that an abbreviation of
     the long option, just like "--fu", and not "-f" with arg "u".

     This distinction seems to be the most useful approach.  */

  if (longopts != NULL
      && (argv[optind][1] == '-'
	  || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
    {
      char *nameend;
      const struct option *p;
      const struct option *pfound = NULL;
      int exact = 0;
      int ambig = 0;
      int indfound;
      int option_index;

      for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
	/* Do nothing.  */ ;

      /* Test all long options for either exact match
	 or abbreviated matches.  */
      for (p = longopts, option_index = 0; p->name; p++, option_index++)
	if (!strncmp (p->name, nextchar, nameend - nextchar))
	  {
	    if (nameend - nextchar == strlen (p->name))
	      {
		/* Exact match found.  */
		pfound = p;
		indfound = option_index;
		exact = 1;
		break;
	      }
	    else if (pfound == NULL)
	      {
		/* First nonexact match found.  */
		pfound = p;
		indfound = option_index;
	      }
	    else
	      /* Second or later nonexact match found.  */
	      ambig = 1;
	  }

      if (ambig && !exact)
	{
	  if (opterr)
	    fprintf (stderr, "%s: option `%s' is ambiguous\n",
		     argv[0], argv[optind]);
	  nextchar += strlen (nextchar);
	  optind++;
	  return '?';
	}

      if (pfound != NULL)
	{
	  option_index = indfound;
	  optind++;
	  if (*nameend)
	    {
	      /* Don't test has_arg with >, because some C compilers don't
		 allow it to be used on enums.  */
	      if (pfound->has_arg)
		optarg = nameend + 1;
	      else
		{
		  if (opterr)
		    {
		      if (argv[optind - 1][1] == '-')
			/* --option */
			fprintf (stderr,
				 "%s: option `--%s' doesn't allow an argument\n",
				 argv[0], pfound->name);
		      else
			/* +option or -option */
			fprintf (stderr,
			     "%s: option `%c%s' doesn't allow an argument\n",
			     argv[0], argv[optind - 1][0], pfound->name);
		    }
		  nextchar += strlen (nextchar);
		  return '?';
		}
	    }
	  else if (pfound->has_arg == 1)
	    {
	      if (optind < argc)
		optarg = argv[optind++];
	      else
		{
		  if (opterr)
		    fprintf (stderr, "%s: option `%s' requires an argument\n",
			     argv[0], argv[optind - 1]);
		  nextchar += strlen (nextchar);
		  return optstring[0] == ':' ? ':' : '?';
		}
	    }
	  nextchar += strlen (nextchar);
	  if (longind != NULL)
	    *longind = option_index;
	  if (pfound->flag)
	    {
	      *(pfound->flag) = pfound->val;
	      return 0;
	    }
	  return pfound->val;
	}

      /* Can't find it as a long option.  If this is not getopt_long_only,
	 or the option starts with '--' or is not a valid short
	 option, then it's an error.
	 Otherwise interpret it as a short option.  */
      if (!long_only || argv[optind][1] == '-'
	  || my_index (optstring, *nextchar) == NULL)
	{
	  if (opterr)
	    {
	      if (argv[optind][1] == '-')
		/* --option */
		fprintf (stderr, "%s: unrecognized option `--%s'\n",
			 argv[0], nextchar);
	      else
		/* +option or -option */
		fprintf (stderr, "%s: unrecognized option `%c%s'\n",
			 argv[0], argv[optind][0], nextchar);
	    }
	  nextchar = (char *) "";
	  optind++;
	  return '?';
	}
    }

  /* Look at and handle the next short option-character.  */

  {
    char c = *nextchar++;
    char *temp = my_index (optstring, c);

    /* Increment `optind' when we start to process its last character.  */
    if (*nextchar == '\0')
      ++optind;

    if (temp == NULL || c == ':')
      {
	if (opterr)
	  {
	    if (posixly_correct)
	      /* 1003.2 specifies the format of this message.  */
	      fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c);
	    else
	      fprintf (stderr, "%s: invalid option -- %c\n", argv[0], c);
	  }
	optopt = c;
	return '?';
      }
    if (temp[1] == ':')
      {
	if (temp[2] == ':')
	  {
	    /* This is an option that accepts an argument optionally.  */
	    if (*nextchar != '\0')
	      {
		optarg = nextchar;
		optind++;
	      }
	    else
	      optarg = NULL;
	    nextchar = NULL;
	  }
	else
	  {
	    /* This is an option that requires an argument.  */
	    if (*nextchar != '\0')
	      {
		optarg = nextchar;
		/* If we end this ARGV-element by taking the rest as an arg,
		   we must advance to the next element now.  */
		optind++;
	      }
	    else if (optind == argc)
	      {
		if (opterr)
		  {
		    /* 1003.2 specifies the format of this message.  */
		    fprintf (stderr, "%s: option requires an argument -- %c\n",
			     argv[0], c);
		  }
		optopt = c;
		if (optstring[0] == ':')
		  c = ':';
		else
		  c = '?';
	      }
	    else
	      /* We already incremented `optind' once;
		 increment it again when taking next ARGV-elt as argument.  */
	      optarg = argv[optind++];
	    nextchar = NULL;
	  }
      }
    return c;
  }
}

int
getopt (argc, argv, optstring)
     int argc;
     char *const *argv;
     const char *optstring;
{
  return _getopt_internal (argc, argv, optstring,
			   (const struct option *) 0,
			   (int *) 0,
			   0);
}

#endif	/* _LIBC or not __GNU_LIBRARY__.  */

#ifdef TEST

/* Compile with -DTEST to make an executable for use in testing
   the above definition of `getopt'.  */

int
main (argc, argv)
     int argc;
     char **argv;
{
  int c;
  int digit_optind = 0;

  while (1)
    {
      int this_option_optind = optind ? optind : 1;

      c = getopt (argc, argv, "abc:d:0123456789");
      if (c == EOF)
	break;

      switch (c)
	{
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':
	  if (digit_optind != 0 && digit_optind != this_option_optind)
	    printf ("digits occur in two different argv-elements.\n");
	  digit_optind = this_option_optind;
	  printf ("option %c\n", c);
	  break;

	case 'a':
	  printf ("option a\n");
	  break;

	case 'b':
	  printf ("option b\n");
	  break;

	case 'c':
	  printf ("option c with value `%s'\n", optarg);
	  break;

	case '?':
	  break;

	default:
	  printf ("?? getopt returned character code 0%o ??\n", c);
	}
    }

  if (optind < argc)
    {
      printf ("non-option ARGV-elements: ");
      while (optind < argc)
	printf ("%s ", argv[optind++]);
      printf ("\n");
    }

  exit (0);
}

#endif /* TEST */
lesstif-current/clients/Motif-1.2/lib/getopt.h100664   1005    764       10526  6441111431  20760 0ustar  u27113lesstifdev/* Declarations for getopt.
   Copyright (C) 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
   Free Software Foundation; either version 2, or (at your option) any
   later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */

#ifndef _GETOPT_H
#define _GETOPT_H 1

#ifdef	__cplusplus
extern "C" {
#endif

/* For communication from `getopt' to the caller.
   When `getopt' finds an option that takes an argument,
   the argument value is returned here.
   Also, when `ordering' is RETURN_IN_ORDER,
   each non-option ARGV-element is returned here.  */

extern char *optarg;

/* Index in ARGV of the next element to be scanned.
   This is used for communication to and from the caller
   and for communication between successive calls to `getopt'.

   On entry to `getopt', zero means this is the first call; initialize.

   When `getopt' returns EOF, this is the index of the first of the
   non-option elements that the caller should itself scan.

   Otherwise, `optind' communicates from one call to the next
   how much of ARGV has been scanned so far.  */

extern int optind;

/* Callers store zero here to inhibit the error message `getopt' prints
   for unrecognized options.  */

extern int opterr;

/* Set to an option character which was unrecognized.  */

extern int optopt;

/* Describe the long-named options requested by the application.
   The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
   of `struct option' terminated by an element containing a name which is
   zero.

   The field `has_arg' is:
   no_argument		(or 0) if the option does not take an argument,
   required_argument	(or 1) if the option requires an argument,
   optional_argument 	(or 2) if the option takes an optional argument.

   If the field `flag' is not NULL, it points to a variable that is set
   to the value given in the field `val' when the option is found, but
   left unchanged if the option is not found.

   To have a long-named option do something other than set an `int' to
   a compiled-in constant, such as set a value from `optarg', set the
   option's `flag' field to zero and its `val' field to a nonzero
   value (the equivalent single-letter option character, if there is
   one).  For long options that have a zero `flag' field, `getopt'
   returns the contents of the `val' field.  */

struct option
{
#if defined (__STDC__) && __STDC__
  const char *name;
#else
  char *name;
#endif
  /* has_arg can't be an enum because some compilers complain about
     type mismatches in all the code that assumes it is an int.  */
  int has_arg;
  int *flag;
  int val;
};

/* Names for the values of the `has_arg' field of `struct option'.  */

#define	no_argument		0
#define required_argument	1
#define optional_argument	2

#if defined (__STDC__) && __STDC__
#ifdef __GNU_LIBRARY__
/* Many other libraries have conflicting prototypes for getopt, with
   differences in the consts, in stdlib.h.  To avoid compilation
   errors, only prototype getopt for the GNU C library.  */
extern int getopt (int argc, char *const *argv, const char *shortopts);
#else /* not __GNU_LIBRARY__ */
extern int getopt ();
#endif /* __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
		        const struct option *longopts, int *longind);
extern int getopt_long_only (int argc, char *const *argv,
			     const char *shortopts,
		             const struct option *longopts, int *longind);

/* Internal only.  Users should not call this directly.  */
extern int _getopt_internal (int argc, char *const *argv,
			     const char *shortopts,
		             const struct option *longopts, int *longind,
			     int long_only);
#else /* not __STDC__ */
extern int getopt ();
extern int getopt_long ();
extern int getopt_long_only ();

extern int _getopt_internal ();
#endif /* __STDC__ */

#ifdef	__cplusplus
}
#endif

#endif /* _GETOPT_H */
lesstif-current/clients/Motif-1.2/lib/getopt1.c100664   1005    764       10155  6441111431  21032 0ustar  u27113lesstifdev/* getopt_long and getopt_long_only entry points for GNU getopt.
   Copyright (C) 1987, 88, 89, 90, 91, 92, 1993, 1994
	Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
   Free Software Foundation; either version 2, or (at your option) any
   later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */

#include "getopt.h"

#if !defined (__STDC__) || !__STDC__
/* This is a separate conditional since some stdc systems
   reject `defined (const)'.  */
#ifndef const
#define const
#endif
#endif

#include <stdio.h>

/* Comment out all this code if we are using the GNU C Library, and are not
   actually compiling the library itself.  This code is part of the GNU C
   Library, but also included in many other GNU distributions.  Compiling
   and linking in this code is a waste when using the GNU C library
   (especially if it is a shared library).  Rather than having every GNU
   program understand `configure --with-gnu-libc' and omit the object files,
   it is simpler to just do this in the source for each such file.  */

#if defined (_LIBC) || !defined (__GNU_LIBRARY__)


/* This needs to come after some library #include
   to get __GNU_LIBRARY__ defined.  */
#ifdef __GNU_LIBRARY__
#include <stdlib.h>
#else
char *getenv ();
#endif

#ifndef	NULL
#define NULL 0
#endif

int
getopt_long (argc, argv, options, long_options, opt_index)
     int argc;
     char *const *argv;
     const char *options;
     const struct option *long_options;
     int *opt_index;
{
  return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
}

/* Like getopt_long, but '-' as well as '--' can indicate a long option.
   If an option that starts with '-' (not '--') doesn't match a long option,
   but does match a short option, it is parsed as a short option
   instead.  */

int
getopt_long_only (argc, argv, options, long_options, opt_index)
     int argc;
     char *const *argv;
     const char *options;
     const struct option *long_options;
     int *opt_index;
{
  return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
}


#endif	/* _LIBC or not __GNU_LIBRARY__.  */

#ifdef TEST

#include <stdio.h>

int
main (argc, argv)
     int argc;
     char **argv;
{
  int c;
  int digit_optind = 0;

  while (1)
    {
      int this_option_optind = optind ? optind : 1;
      int option_index = 0;
      static struct option long_options[] =
      {
	{"add", 1, 0, 0},
	{"append", 0, 0, 0},
	{"delete", 1, 0, 0},
	{"verbose", 0, 0, 0},
	{"create", 0, 0, 0},
	{"file", 1, 0, 0},
	{0, 0, 0, 0}
      };

      c = getopt_long (argc, argv, "abc:d:0123456789",
		       long_options, &option_index);
      if (c == EOF)
	break;

      switch (c)
	{
	case 0:
	  printf ("option %s", long_options[option_index].name);
	  if (optarg)
	    printf (" with arg %s", optarg);
	  printf ("\n");
	  break;

	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':
	  if (digit_optind != 0 && digit_optind != this_option_optind)
	    printf ("digits occur in two different argv-elements.\n");
	  digit_optind = this_option_optind;
	  printf ("option %c\n", c);
	  break;

	case 'a':
	  printf ("option a\n");
	  break;

	case 'b':
	  printf ("option b\n");
	  break;

	case 'c':
	  printf ("option c with value `%s'\n", optarg);
	  break;

	case 'd':
	  printf ("option d with value `%s'\n", optarg);
	  break;

	case '?':
	  break;

	default:
	  printf ("?? getopt returned character code 0%o ??\n", c);
	}
    }

  if (optind < argc)
    {
      printf ("non-option ARGV-elements: ");
      while (optind < argc)
	printf ("%s ", argv[optind++]);
      printf ("\n");
    }

  exit (0);
}

#endif /* TEST */
lesstif-current/clients/Motif-1.2/mwm/ 40775   1005    764           0  6524570502  17230 5ustar  u27113lesstifdevlesstif-current/clients/Motif-1.2/mwm/CVS/ 40775   1005    764           0  6524570502  17663 5ustar  u27113lesstifdevlesstif-current/clients/Motif-1.2/mwm/CVS/Root100664   1005    764          51  6441304526  20561 0ustar  u27113lesstifdev:pserver:lesstif@cvs.hungry.com:/cvsroot
lesstif-current/clients/Motif-1.2/mwm/CVS/Repository100664   1005    764          56  6441111432  22012 0ustar  u27113lesstifdev/cvsroot/hungry/lesstif/clients/Motif-1.2/mwm
lesstif-current/clients/Motif-1.2/mwm/CVS/Entries100644   1752    764        2374  6524570502  22140 0ustar  lesstiflesstifdev/COPYING/1.1/Tue Dec  2 23:00:43 1997//
/Mwm/1.2/Tue Dec  2 23:00:43 1997//
/Mwm.mlm/1.1/Tue Dec  2 23:00:44 1997//
/README/1.2/Tue Dec  2 23:00:44 1997//
/alt.map/1.1/Tue Dec  2 23:00:44 1997//
/colormaps.c/1.2/Tue Dec  2 23:00:44 1997//
/cursors.c/1.2/Tue Dec  2 23:00:44 1997//
/decorate.c/1.2/Tue Dec  2 23:00:45 1997//
/defaults.c/1.2/Tue Dec  2 23:00:45 1997//
/desktop.c/1.2/Tue Dec  2 23:00:46 1997//
/events.c/1.3/Tue Dec  2 23:00:46 1997//
/functions.c/1.6/Tue Dec  2 23:00:46 1997//
/menus.c/1.4/Tue Dec  2 23:00:47 1997//
/misc.c/1.5/Tue Dec  2 23:00:47 1997//
/move.c/1.2/Tue Dec  2 23:00:47 1997//
/mwm.c/1.2/Tue Dec  2 23:00:47 1997//
/mwm.h/1.4/Tue Dec  2 23:00:48 1997//
/mwmerr.c/1.2/Tue Dec  2 23:00:48 1997//
/mwmstrings.h/1.2/Tue Dec  2 23:00:49 1997//
/pager.c/1.3/Tue Dec  2 23:00:49 1997//
/pan.c/1.2/Tue Dec  2 23:00:49 1997//
/props.c/1.3/Tue Dec  2 23:00:49 1997//
/resize.c/1.2/Tue Dec  2 23:00:50 1997//
/resources.c/1.5/Tue Dec  2 23:00:50 1997//
/screens.c/1.3/Tue Dec  2 23:00:50 1997//
/system.mwmrc/1.1/Tue Dec  2 23:00:50 1997//
/windows.c/1.9/Tue Dec  2 23:00:51 1997//
/mwmlex.l/1.3/Fri Dec 12 12:50:08 1997//
/mwmparse.y/1.6/Fri Feb 20 12:48:51 1998//
/icons.c/1.5/Thu May  7 11:49:26 1998//
/Makefile.am/1.9/Fri May  8 11:49:21 1998//
D
lesstif-current/clients/Motif-1.2/mwm/Makefile.in100644   1752    764       24470  6525042546  22242 0ustar  lesstiflesstifdev# Makefile.in generated automatically by automake 1.2 from Makefile.am

# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.

#
# $Header: /cvsroot/hungry/lesstif/clients/Motif-1.2/mwm/Makefile.am,v 1.9 1998/05/07 22:23:04 u27113 Exp $
#


SHELL = /bin/sh

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@

bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include

pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@

top_builddir = ../../..

ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@

NORMAL_INSTALL = true
PRE_INSTALL = true
POST_INSTALL = true
NORMAL_UNINSTALL = true
PRE_UNINSTALL = true
POST_UNINSTALL = true
build_alias = @build_alias@
build_triplet = @build@
host_alias = @host_alias@
host_triplet = @host@
target_alias = @target_alias@
target_triplet = @target@
AR = @AR@
CC = @CC@
EXEEXT = @EXEEXT@
Editres = @Editres@
LD = @LD@
LEX = @LEX@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBTOOL = @LIBTOOL@
LIBTOOL_VERSION = @LIBTOOL_VERSION@
LN_S = @LN_S@
MAINT = @MAINT@
MAJOR_VERSION = @MAJOR_VERSION@
MAKEINFO = @MAKEINFO@
MINOR_VERSION = @MINOR_VERSION@
PACKAGE = @PACKAGE@
PICO_VERSION = @PICO_VERSION@
R6libs = @R6libs@
RANLIB = @RANLIB@
VERSION = @VERSION@
VarHaveMan2html = @VarHaveMan2html@
YACC = @YACC@
bindir = @bindir@
extralibs = @extralibs@
include_version_suffix = @include_version_suffix@
libdir = @libdir@
motif_includes = @motif_includes@
motif_libraries = @motif_libraries@
shared_make = @shared_make@
subdirs = @subdirs@
version_suffix = @version_suffix@
x_inc_path = @x_inc_path@
x_includes = @x_includes@
x_lib_path = @x_lib_path@
x_libraries = @x_libraries@

bin_PROGRAMS=	mwm
MAINTAINERCLEANFILES=Makefile.in

BUILT_SOURCES=	mwmparse.c mwmparse.h mwmlex.c

mwm_SOURCES=	colormaps.c cursors.c decorate.c defaults.c desktop.c \
		events.c functions.c icons.c menus.c misc.c move.c \
		mwm.c mwm.h mwmerr.c mwmlex.l mwmparse.y mwmstrings.h \
		pager.c pan.c props.c resize.c resources.c screens.c \
		system.mwmrc windows.c

INCLUDES=	-I$(top_srcdir)/include/Motif-1.2 \
		-I../../../include/Motif-1.2 \
		${X_CFLAGS} \
		-DXLIB_PATH=\"@x_libraries@\" \
		-DXINCL_PATH=\"@x_includes@\"

LDADD=		../../../lib/Xm$(version_suffix)/libXm.la \
		${X_LIBS} -lXt -lXext -lX11 \
		@R6libs@ @LEXLIB@

appdir=		$(libdir)/X11/app-defaults
app_DATA=	Mwm

mwmddir=	$(libdir)/X11/mwm
mwmd_DATA=	system.mwmrc alt.map README

EXTRA_DIST=	Mwm system.mwmrc alt.map Mwm.mlm README

YFLAGS=		-d
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../../include/LTconfig.h
CONFIG_CLEAN_FILES = 
PROGRAMS =  $(bin_PROGRAMS)


DEFS = @DEFS@ -I. -I$(srcdir) -I../../../include
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
mwm_OBJECTS =  colormaps.o cursors.o decorate.o defaults.o desktop.o \
events.o functions.o icons.o menus.o misc.o move.o mwm.o mwmerr.o \
mwmlex.o mwmparse.o pager.o pan.o props.o resize.o resources.o \
screens.o windows.o
mwm_LDADD = $(LDADD)
mwm_DEPENDENCIES =  ../../../lib/Xm$(version_suffix)/libXm.la
mwm_LDFLAGS = 
LEXLIB = @LEXLIB@
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
DATA =  $(app_DATA) $(mwmd_DATA)

DIST_COMMON =  README COPYING Makefile.am Makefile.in mwmlex.c \
mwmparse.c


DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)

TAR = tar
GZIP = --best
SOURCES = $(mwm_SOURCES)
OBJECTS = $(mwm_OBJECTS)

default: all

.SUFFIXES:
.SUFFIXES: .c .h .l .lo .o .y
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
	cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps clients/Motif-1.2/mwm/Makefile

Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
	cd $(top_builddir) \
	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status


mostlyclean-binPROGRAMS:

clean-binPROGRAMS:
	@list='$(bin_PROGRAMS)'; for p in $$list; do \
	  rm -f $$p $$p$(EXEEXT); \
	done

distclean-binPROGRAMS:

maintainer-clean-binPROGRAMS:

install-binPROGRAMS: $(bin_PROGRAMS)
	@$(NORMAL_INSTALL)
	$(mkinstalldirs) $(bindir)
	@list='$(bin_PROGRAMS)'; for p in $$list; do \
	  if test -f $$p; then \
	    echo " $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p$(EXEEXT) $(bindir)/`echo $$p|sed '$(transform)'`$(EXEEXT)"; \
	    $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p$(EXEEXT) $(bindir)/`echo $$p|sed '$(transform)'`$(EXEEXT); \
	  else :; fi; \
	done

uninstall-binPROGRAMS:
	$(NORMAL_UNINSTALL)
	list='$(bin_PROGRAMS)'; for p in $$list; do \
	  rm -f $(bindir)/`echo $$p|sed '$(transform)'`$(EXEEXT); \
	done

.c.o:
	$(COMPILE) -c $<

mostlyclean-compile:
	rm -f *.o core

clean-compile:

distclean-compile:
	rm -f *.tab.c

maintainer-clean-compile:

.c.lo:
	$(LIBTOOL) --mode=compile $(COMPILE) -c $<

mostlyclean-libtool:
	rm -f *.lo

clean-libtool:
	rm -rf .libs

distclean-libtool:

maintainer-clean-libtool:

mwm: $(mwm_OBJECTS) $(mwm_DEPENDENCIES)
	@rm -f mwm$(EXEEXT)
	$(LINK) $(mwm_LDFLAGS) $(mwm_OBJECTS) $(mwm_LDADD) $(LIBS)
	@test -z "$(EXEEXT)" || echo timestamp > mwm
.y.c:
	$(YACC) $(YFLAGS) $< && mv y.tab.c $@
	if test -f y.tab.h; then \
	if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
	else :; fi
.y.h:
	$(YACC) $(YFLAGS) $< && mv y.tab.c $@
	if test -f y.tab.h; then \
	if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
	else :; fi
.l.c:
	$(LEX) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@

install-appDATA: $(app_DATA)
	@$(NORMAL_INSTALL)
	$(mkinstalldirs) $(appdir)
	@list='$(app_DATA)'; for p in $$list; do \
	  if test -f $(srcdir)/$$p; then \
	    echo " $(INSTALL_DATA) $(srcdir)/$$p $(appdir)/$$p"; \
	    $(INSTALL_DATA) $(srcdir)/$$p $(appdir)/$$p; \
	  else if test -f $$p; then \
	    echo " $(INSTALL_DATA) $$p $(appdir)/$$p"; \
	    $(INSTALL_DATA) $$p $(appdir)/$$p; \
	  fi; fi; \
	done

uninstall-appDATA:
	$(NORMAL_UNINSTALL)
	list='$(app_DATA)'; for p in $$list; do \
	  rm -f $(appdir)/$$p; \
	done

install-mwmdDATA: $(mwmd_DATA)
	@$(NORMAL_INSTALL)
	$(mkinstalldirs) $(mwmddir)
	@list='$(mwmd_DATA)'; for p in $$list; do \
	  if test -f $(srcdir)/$$p; then \
	    echo " $(INSTALL_DATA) $(srcdir)/$$p $(mwmddir)/$$p"; \
	    $(INSTALL_DATA) $(srcdir)/$$p $(mwmddir)/$$p; \
	  else if test -f $$p; then \
	    echo " $(INSTALL_DATA) $$p $(mwmddir)/$$p"; \
	    $(INSTALL_DATA) $$p $(mwmddir)/$$p; \
	  fi; fi; \
	done

uninstall-mwmdDATA:
	$(NORMAL_UNINSTALL)
	list='$(mwmd_DATA)'; for p in $$list; do \
	  rm -f $(mwmddir)/$$p; \
	done

tags: TAGS

ID: $(HEADERS) $(SOURCES)
	here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS)

TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES)
	tags=; \
	here=`pwd`; \
	test -z "$(ETAGS_ARGS)$(SOURCES)$(HEADERS)$$tags" \
	  || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags  $(SOURCES) $(HEADERS) -o $$here/TAGS)

mostlyclean-tags:

clean-tags:

distclean-tags:
	rm -f TAGS ID

maintainer-clean-tags:

distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)

subdir = clients/Motif-1.2/mwm

distdir: $(DISTFILES)
	@for file in $(DISTFILES); do \
	  d=$(srcdir); \
	  test -f $(distdir)/$$file \
	  || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
	  || cp -p $$d/$$file $(distdir)/$$file; \
	done
info:
dvi:
check: all
	$(MAKE)
installcheck:
install-exec: install-binPROGRAMS
	@$(NORMAL_INSTALL)

install-data: install-appDATA install-mwmdDATA
	@$(NORMAL_INSTALL)

install: install-exec install-data all
	@:

uninstall: uninstall-binPROGRAMS uninstall-appDATA uninstall-mwmdDATA

all: Makefile $(PROGRAMS) $(DATA)

install-strip:
	$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
installdirs:
	$(mkinstalldirs)  $(bindir) $(appdir) $(mwmddir)


mostlyclean-generic:
	test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)

clean-generic:
	test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)

distclean-generic:
	rm -f Makefile $(DISTCLEANFILES)
	rm -f config.cache config.log stamp-h stamp-h[0-9]*
	test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)

maintainer-clean-generic:
	test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
	test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean:  mostlyclean-binPROGRAMS mostlyclean-compile \
		mostlyclean-libtool mostlyclean-tags \
		mostlyclean-generic

clean:  clean-binPROGRAMS clean-compile clean-libtool clean-tags \
		clean-generic mostlyclean

distclean:  distclean-binPROGRAMS distclean-compile distclean-libtool \
		distclean-tags distclean-generic clean
	rm -f config.status
	rm -f libtool

maintainer-clean:  maintainer-clean-binPROGRAMS maintainer-clean-compile \
		maintainer-clean-libtool maintainer-clean-tags \
		maintainer-clean-generic distclean
	@echo "This command is intended for maintainers to use;"
	@echo "it deletes files that may require special tools to rebuild."

.PHONY: default mostlyclean-binPROGRAMS distclean-binPROGRAMS \
clean-binPROGRAMS maintainer-clean-binPROGRAMS uninstall-binPROGRAMS \
install-binPROGRAMS mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
clean-libtool maintainer-clean-libtool uninstall-appDATA \
install-appDATA uninstall-mwmdDATA install-mwmdDATA tags \
mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
distdir info dvi installcheck install-exec install-data install \
uninstall all installdirs mostlyclean-generic distclean-generic \
clean-generic maintainer-clean-generic clean mostlyclean distclean \
maintainer-clean


@HaveGetHostNameInNSL_TRUE@LDADD +=	-lnsl

mwmlex.o:	mwmparse.h

# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
lesstif-current/clients/Motif-1.2/mwm/COPYING100664   1005    764       51477  6441111433  20406 0ustar  u27113lesstifdev
This window manager is an offshoot of "fvwm", and as such is a derived work.  

-----------------------------------------------------------------------------
Portions of this work were created by Rob Nation, and have the following
copyright:

/****************************************************************************
 * This module is all original code 
 * by Rob Nation
 * Copyright 1993, Robert Nation
 *     You may use this code for any purpose, as long as the original
 *     copyright remains in the source code and all documentation
 ****************************************************************************/

-----------------------------------------------------------------------------
Rob Nation, in fact, derived much of fvwm from twm, which carries the
following copyright:

/*****************************************************************************/
/**       Copyright 1988 by Evans & Sutherland Computer Corporation,        **/
/**                          Salt Lake City, Utah                           **/
/**  Portions Copyright 1989 by the Massachusetts Institute of Technology   **/
/**                        Cambridge, 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  permis-    **/
/**    sion  notice appear in supporting  documentation,  and  that  the    **/
/**    names of Evans & Sutherland and M.I.T. not be used in advertising    **/
/**    in publicity pertaining to distribution of the  software  without    **/
/**    specific, written prior permission.                                  **/
/**                                                                         **/
/**    EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD    **/
/**    TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES  OF  MERCHANT-    **/
/**    ABILITY  AND  FITNESS,  IN  NO  EVENT SHALL EVANS & SUTHERLAND OR    **/
/**    M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL  DAM-    **/
/**    AGES 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.                                     **/
/*****************************************************************************/

-----------------------------------------------------------------------------
For lesstif, all code not covered under the copyrights above (i.e., any and
all modifications made for Lesstif), are copyrighted by the Hungry Programmers,
and distributed under the following License:

		    GNU GENERAL PUBLIC LICENSE
		       Version 2, June 1991

 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
                          675 Mass Ave, Cambridge, MA 02139, USA
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

			    Preamble

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it.  (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.)  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must show them these terms so they know their
rights.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary.  To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.

  The precise terms and conditions for copying, distribution and
modification follow.

		    GNU GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License.  The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language.  (Hereinafter, translation is included without limitation in
the term "modification".)  Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.

  1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.

You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.

  2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

    a) You must cause the modified files to carry prominent notices
    stating that you changed the files and the date of any change.

    b) You must cause any work that you distribute or publish, that in
    whole or in part contains or is derived from the Program or any
    part thereof, to be licensed as a whole at no charge to all third
    parties under the terms of this License.

    c) If the modified program normally reads commands interactively
    when run, you must cause it, when started running for such
    interactive use in the most ordinary way, to print or display an
    announcement including an appropriate copyright notice and a
    notice that there is no warranty (or else, saying that you provide
    a warranty) and that users may redistribute the program under
    these conditions, and telling the user how to view a copy of this
    License.  (Exception: if the Program itself is interactive but
    does not normally print such an announcement, your work based on
    the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.

In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:

    a) Accompany it with the complete corresponding machine-readable
    source code, which must be distributed under the terms of Sections
    1 and 2 above on a medium customarily used for software interchange; or,

    b) Accompany it with a written offer, valid for at least three
    years, to give any third party, for a charge no more than your
    cost of physically performing source distribution, a complete
    machine-readable copy of the corresponding source code, to be
    distributed under the terms of Sections 1 and 2 above on a medium
    customarily used for software interchange; or,

    c) Accompany it with the information you received as to the offer
    to distribute corresponding source code.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form with such
    an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable.  However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.

If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.

  4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License.  Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.

  5. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Program or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.

  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.

  7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all.  For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

  8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded.  In such case, this License incorporates
the limitation as if written in the body of this License.

  9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

Each version is given a distinguishing version number.  If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.

  10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

			    NO WARRANTY

  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

		     END OF TERMS AND CONDITIONS

	Appendix: How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) 19yy  <name of author>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

    Gnomovision version 69, Copyright (C) 19yy name of author
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary.  Here is a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  `Gnomovision' (which makes passes at compilers) written by James Hacker.

  <signature of Ty Coon>, 1 April 1989
  Ty Coon, President of Vice

This General Public License does not permit incorporating your program into
proprietary programs.  If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library.  If this is what you want to do, use the GNU Library General
Public License instead of this License.
-----------------------------------------------------------------------------

This code is freely distributable, assuming the above licenses and copyrights
are adhered to.
lesstif-current/clients/Motif-1.2/mwm/Makefile.am100644   1752    764        1742  6524570501  22202 0ustar  lesstiflesstifdev#
# $Header: /cvsroot/hungry/lesstif/clients/Motif-1.2/mwm/Makefile.am,v 1.9 1998/05/07 22:23:04 u27113 Exp $
#
bin_PROGRAMS=	mwm
MAINTAINERCLEANFILES=Makefile.in

BUILT_SOURCES=	mwmparse.c mwmparse.h mwmlex.c

mwm_SOURCES=	colormaps.c cursors.c decorate.c defaults.c desktop.c \
		events.c functions.c icons.c menus.c misc.c move.c \
		mwm.c mwm.h mwmerr.c mwmlex.l mwmparse.y mwmstrings.h \
		pager.c pan.c props.c resize.c resources.c screens.c \
		system.mwmrc windows.c

INCLUDES=	-I$(top_srcdir)/include/Motif-1.2 \
		-I../../../include/Motif-1.2 \
		${X_CFLAGS} \
		-DXLIB_PATH=\"@x_libraries@\" \
		-DXINCL_PATH=\"@x_includes@\"

LDADD=		../../../lib/Xm$(version_suffix)/libXm.la \
		${X_LIBS} -lXt -lXext -lX11 \
		@R6libs@ @LEXLIB@

if HaveGetHostNameInNSL
LDADD +=	-lnsl
endif

appdir=		$(libdir)/X11/app-defaults
app_DATA=	Mwm

mwmddir=	$(libdir)/X11/mwm
mwmd_DATA=	system.mwmrc alt.map README

EXTRA_DIST=	Mwm system.mwmrc alt.map Mwm.mlm README

mwmlex.o:	mwmparse.h

YFLAGS=		-d
lesstif-current/clients/Motif-1.2/mwm/Mwm100664   1005    764       22366  6441111433  20031 0ustar  u27113lesstifdev!!
!! app defaults for mwm
!!
!! When reading the resources, the uncommented ones work, the commented ones
!! either don't work, or you probably don't want to set values for them here
!! as their default value depends on other resources (focusAutoRaise, for
!! example, depends on the keyboardFocusPolicy.  At the bottom of this file,
!! you will find some resources that I've customized to demonstrate behaviors.
!! With all resources, I've tried to be faithful to what Mwm does, but if
!! you find a particular hole, please let me know.
!!

!!
!! fonts for everone
!!
Mwm*fontList:			variable

!!
!! The following resources have been implemented, and can be altered.
!!
Mwm*autoKeyFocus:		True
Mwm*autoRaiseDelay:		500
Mwm*bitmapDirectory:		/usr/include/X11/bitmaps
Mwm*buttonBindings:		DefaultButtonBindings
Mwm*cleanText:			True
Mwm*clickTime:			100
Mwm*clientAutoPlace:		True
Mwm*colormapFocusPolicy:	keyboard
Mwm*configFile:			.mwmrc
Mwm*deiconifyKeyFocus		True
!Mwm*doubleClickTime:		"varies"
!Mwm*edgeScrollX:		0
!Mwm*edgeScrollY:		0
Mwm*frameBorderWidth:		5
Mwm*iconAutoPlace:		True
Mwm*iconClick:			True
Mwm*keyBindings:		DefaultKeyBindings
Mwm*keyboardFocusPolicy:	explicit
Mwm*lowerOnIconify:		True
Mwm*moveThreshold:		4
Mwm*multiScreen:		False
Mwm*quitTimeout:		1000
Mwm*resizeBorderWidth:		8
Mwm*resizeCursors:		True
Mwm*showFeedback:		all
Mwm*startupKeyFocus:		True
Mwm*transientDecorations:	menu title border
Mwm*transientFunctions:		-minimize -maximize
!Mwm*usePager:			False
!Mwm*smartPlacment:		True
Mwm*wMenuButtonClick:		True
Mwm*wMenuButtonClick2:		True

!!
!! not tracked yet.  Some are implemented, but you can't change the default
!! behavior.
!!
!Mwm*enableWarp:		True
!Mwm*enforceKeyFocus:		True
!Mwm*fadeNormalIcon:		False
!Mwm*feedbackGeometry:		"center on screen"
!Mwm*iconBoxGeometry:		6x1+0-0
!Mwm*iconBoxName:		iconbox
!Mwm*iconBoxSBDisplayPolicy:	all
!Mwm*iconBoxTitle:		Icons
!Mwm*iconDecoration:		"varies"
!Mwm*iconImageMaximimum:	50x50
!Mwm*iconImageMinimimum:	16x16
!Mwm*iconPlacement:		left bottom
!Mwm*iconPlacementMargin:	"varies"
!Mwm*interactivePlacement:	False
!Mwm*limitResize:		True
!Mwm*maximumMaximumSize:	"2 * screen_width x 2 * screen_height"
!Mwm*moveOpaque:		False
!Mwm*passButtons:		False
!Mwm*passSelectButtons:		True
!Mwm*positionIsFrame:		True
!Mwm*positionOnScreen:		True
!Mwm*screens:			"varies"
!Mwm*useIconBox:		False

!!
!! component appearance resources.  We go farther than Motif in that you
!! can specify values for all Mwm components.  Not all are implemented,
!! though (why would a menu button want a font?).
!!
Mwm*menu.background:			rgb:72/9f/ff
!Mwm*menu.backgroundPixmap:		"varies"
!Mwm*menu.bottomShadowColor:		"varies"
!Mwm*menu.bottomShadowPixmap:		"varies"
Mwm*menu.fontList:			variable
Mwm*menu.foreground:			Black
Mwm*menu.saveUnder:			True
!Mwm*menu.topShadowColor:		"varies"
!Mwm*menu.topShadowPixmap:		"varies"

Mwm*feedback.background:		Cadet Blue
!Mwm*feedback.backgroundPixmap:		"varies"
!Mwm*feedback.bottomShadowColor:	"varies"
!Mwm*feedback.bottomShadowPixmap:	"varies"
Mwm*feedback.fontList:			variable
Mwm*feedback.foreground:		Black
Mwm*feedback.saveUnder:			True
!Mwm*feedback.topShadowColor:		"varies"
!Mwm*feedback.topShadowPixmap:		"varies"

Mwm*pager.background:			White
!Mwm*pager.backgroundPixmap:		"varies"
!Mwm*pager.bottomShadowColor:		"varies"
!Mwm*pager.bottomShadowPixmap:		"varies"
Mwm*pager.fontList:			fixed
Mwm*pager.foreground:			Black
Mwm*pager.saveUnder:			True
!Mwm*pager.topShadowColor:		"varies"
!Mwm*pager.topShadowPixmap:		"varies"

Mwm*icon.background:			LightGrey
!Mwm*icon.backgroundPixmap:		"varies"
!Mwm*icon.bottomShadowColor:		"varies"
!Mwm*icon.bottomShadowPixmap:		"varies"
Mwm*icon.fontList:			fixed
Mwm*icon.foreground:			Black
Mwm*icon.saveUnder:			True
!Mwm*icon.topShadowColor:		"varies"
!Mwm*icon.topShadowPixmap:		"varies"
Mwm*icon.activeBackground:		Cadet Blue
!Mwm*icon.activeBackgroundPixmap:	"varies"
!Mwm*icon.activeBottomShadowColor:	"varies"
!Mwm*icon.activeBottomShadowPixmap:	"varies"
Mwm*icon.activeForeground:		Black
!Mwm*icon.activeTopShadowColor:		"varies"

Mwm*client*title.background:			LightGrey
!Mwm*client*title.backgroundPixmap:		"varies"
!Mwm*client*title.bottomShadowColor:		"varies"
!Mwm*client*title.bottomShadowPixmap:		"varies"
Mwm*client*title.fontList:			variable
Mwm*client*title.foreground:			Black
Mwm*client*title.saveUnder:			True
!Mwm*client*title.topShadowColor:		"varies"
Mwm*client*title.activeBackground:		Cadet Blue
!Mwm*client*title.activeBackgroundPixmap:	"varies"
!Mwm*client*title.activeBottomShadowColor:	"varies"
!Mwm*client*title.activeBottomShadowPixmap:	"varies"
Mwm*client*title.activeForeground:		Black
!Mwm*client*title.activeTopShadowColor:		"varies"
!Mwm*client*title.activeTopShadowPixmap:	"varies"

Mwm*client*resizeh.background:			LightGrey
!Mwm*client*resizeh.backgroundPixmap:		"varies"
!Mwm*client*resizeh.bottomShadowColor:		"varies"
!Mwm*client*resizeh.bottomShadowPixmap:		"varies"
Mwm*client*resizeh.foreground:			Black
Mwm*client*resizeh.saveUnder:			True
!Mwm*client*resizeh.topShadowColor:		"varies"
Mwm*client*resizeh.activeBackground:		Cadet Blue
!Mwm*client*resizeh.activeBackgroundPixmap:	"varies"
!Mwm*client*resizeh.activeBottomShadowColor:	"varies"
!Mwm*client*resizeh.activeBottomShadowPixmap:	"varies"
Mwm*client*resizeh.activeForeground:		Black
!Mwm*client*resizeh.activeTopShadowColor:	"varies"
!Mwm*client*resizeh.activeTopShadowPixmap:	"varies"

Mwm*client*border.background:			LightGrey
!Mwm*client*border.backgroundPixmap:		"varies"
!Mwm*client*border.bottomShadowColor:		"varies"
!Mwm*client*border.bottomShadowPixmap:		"varies"
Mwm*client*border.foreground:			Black
Mwm*client*border.saveUnder:			True
!Mwm*client*border.topShadowColor:		"varies"
Mwm*client*border*activeBackground:		Cadet Blue
!Mwm*client*border.activeBackgroundPixmap:	"varies"
!Mwm*client*border.activeBottomShadowColor:	"varies"
!Mwm*client*border.activeBottomShadowPixmap:	"varies"
Mwm*client*border.activeForeground:		Black
!Mwm*client*border.activeTopShadowColor:	"varies"
!Mwm*client*border.activeTopShadowPixmap:	"varies"

Mwm*client*maximizeb.background:		LightGrey
!Mwm*client*maximizeb.backgroundPixmap:		"varies"
!Mwm*client*maximizeb.bottomShadowColor:	"varies"
!Mwm*client*maximizeb.bottomShadowPixmap:	"varies"
Mwm*client*maximizeb.foreground:		Black
Mwm*client*maximizeb.saveUnder:			True
!Mwm*client*maximizeb.topShadowColor:		"varies"
Mwm*client*maximizeb.activeBackground:		Cadet Blue
!Mwm*client*maximizeb.activeBackgroundPixmap:	"varies"
!Mwm*client*maximizeb.activeBottomShadowColor:	"varies"
!Mwm*client*maximizeb.activeBottomShadowPixmap:	"varies"
Mwm*client*maximizeb.activeForeground:		Black
!Mwm*client*maximizeb.activeTopShadowColor:	"varies"
!Mwm*client*maximizeb.activeTopShadowPixmap:	"varies"

Mwm*client*minimizeb.background:		LightGrey
!Mwm*client*minimizeb.backgroundPixmap:		"varies"
!Mwm*client*minimizeb.bottomShadowColor:	"varies"
!Mwm*client*minimizeb.bottomShadowPixmap:	"varies"
Mwm*client*minimizeb.foreground:		Black
Mwm*client*minimizeb.saveUnder:			True
!Mwm*client*minimizeb.topShadowColor:		"varies"
Mwm*client*minimizeb.activeBackground:		Cadet Blue
!Mwm*client*minimizeb.activeBackgroundPixmap:	"varies"
!Mwm*client*minimizeb.activeBottomShadowColor:	"varies"
!Mwm*client*minimizeb.activeBottomShadowPixmap:	"varies"
Mwm*client*minimizeb.activeForeground:		Black
!Mwm*client*minimizeb.activeTopShadowColor:	"varies"
!Mwm*client*minimizeb.activeTopShadowPixmap:	"varies"

Mwm*client*menub.background:			LightGrey
!Mwm*client*menub.backgroundPixmap:		"varies"
!Mwm*client*menub.bottomShadowColor:		"varies"
!Mwm*client*menub.bottomShadowPixmap:		"varies"
Mwm*client*menub.foreground:			Black
!Mwm*client*menub.saveUnder:			True
!Mwm*client*menub.topShadowColor:		"varies"
Mwm*client*menub.activeBackground:		Cadet Blue
!Mwm*client*menub.activeBackgroundPixmap:	"varies"
!Mwm*client*menub.activeBottomShadowColor:	"varies"
!Mwm*client*menub.activeBottomShadowPixmap:	"varies"
Mwm*client*menub.activeForeground:		Black
!Mwm*client*menub.activeTopShadowColor:		"varies"
!Mwm*client*menub.activeTopShadowPixmap:	"varies"

!!
!! client resources implemented
!!
Mwm*.clientDecorations:				all
Mwm*.clientFunctions:				all
!Mwm*focusAutoRaise:				"varies"
!Mwm*iconImageBackground:			"varies"
!Mwm*iconImageBottomShadowColor:		"varies"
!Mwm*iconImageBottomShadowPixmap:		"varies"
!Mwm*iconImageForeground:			"varies"
!Mwm*iconImageTopShadowColor:			"varies"
!Mwm*iconImageTopShadowPixmap:			"varies"
Mwm*matteBackground:				Light Coral
!Mwm*matteBottomShadowColor:			"varies"
!Mwm*matteBottomShadowPixmap:			"varies"
Mwm*matteForeground:				Black
!Mwm*matteTopShadowColor:			"varies"
!Mwm*matteTopShadowPixmap:			"varies"
Mwm*.matteWidth:				0
Mwm*.windowMenu:				DefaultWindowMenu
Mwm*usePPosition:				nonzero
Mwm*useClientIcon:				False

!!
!! client resources that are either unimplemented or unchangeable.
!!
!Mwm*iconImage:					"varies"
!Mwm*maximumClientSize:				"screen size"

!!
!! Client decorations for common clients - SAMPLES
!!
Mwm*XClock.clientDecoration:		border
!Mwm*XLoad.clientDecoration:		border
!Mwm*XBiff.clientDecoration:		border

!!
!! uncomment these to see what they do.
!! some entertainment.  Can you tell I live in Florida?;)
!!
!Mwm*client*resizeh.activeBackground:	gold3
!Mwm*client*pager.background:		DarkTurquoise
!Mwm*client*pager.foreground:		Black
!Mwm*matteBackground:			Light Coral
!Mwm*matteWidth:			5
lesstif-current/clients/Motif-1.2/mwm/Mwm.mlm100664   1005    764       22360  6441111434  20610 0ustar  u27113lesstifdev!!
!! app defaults for mwm
!!
!! When reading the resources, the uncommented ones work, the commented ones
!! either don't work, or you probably don't want to set values for them here
!! as their default value depends on other resources (focusAutoRaise, for
!! example, depends on the keyboardFocusPolicy.  At the bottom of this file,
!! you will find some resources that I've customized to demonstrate behaviors.
!! With all resources, I've tried to be faithful to what Mwm does, but if
!! you find a particular hole, please let me know.
!!

!!
!! fonts for everone
!!
Mwm*fontList:			variable

!!
!! The following resources have been implemented, and can be altered.
!!
Mwm*autoKeyFocus:		True
Mwm*autoRaiseDelay:		500
Mwm*bitmapDirectory:		/usr/include/X11/bitmaps
Mwm*buttonBindings:		DefaultButtonBindings
Mwm*cleanText:			True
Mwm*clickTime:			100
Mwm*clientAutoPlace:		True
Mwm*colormapFocusPolicy:	keyboard
Mwm*configFile:			.mwmrc
Mwm*deiconifyKeyFocus		True
!Mwm*doubleClickTime:		"varies"
!Mwm*edgeScrollX:		0
!Mwm*edgeScrollY:		0
Mwm*frameBorderWidth:		2
Mwm*iconAutoPlace:		True
Mwm*iconClick:			True
Mwm*keyBindings:		DefaultKeyBindings
Mwm*keyboardFocusPolicy:	explicit
Mwm*lowerOnIconify:		True
Mwm*moveThreshold:		4
Mwm*multiScreen:		False
Mwm*quitTimeout:		1000
Mwm*resizeBorderWidth:		8
Mwm*resizeCursors:		True
Mwm*showFeedback:		all
Mwm*startupKeyFocus:		True
Mwm*transientDecorations:	menu title border
Mwm*transientFunctions:		-minimize -maximize
!Mwm*usePager:			False
!Mwm*smartPlacment:		True
Mwm*wMenuButtonClick:		True
Mwm*wMenuButtonClick2:		True

!!
!! not tracked yet.  Some are implemented, but you can't change the default
!! behavior.
!!
!Mwm*enableWarp:		True
!Mwm*enforceKeyFocus:		True
!Mwm*fadeNormalIcon:		False
!Mwm*feedbackGeometry:		"center on screen"
!Mwm*iconBoxGeometry:		6x1+0-0
!Mwm*iconBoxName:		iconbox
!Mwm*iconBoxSBDisplayPolicy:	all
!Mwm*iconBoxTitle:		Icons
!Mwm*iconDecoration:		"varies"
!Mwm*iconImageMaximimum:	50x50
!Mwm*iconImageMinimimum:	16x16
!Mwm*iconPlacement:		left bottom
!Mwm*iconPlacementMargin:	"varies"
!Mwm*interactivePlacement:	False
!Mwm*limitResize:		True
!Mwm*maximumMaximumSize:	"2 * screen_width x 2 * screen_height"
!Mwm*moveOpaque:		False
!Mwm*passButtons:		False
!Mwm*passSelectButtons:		True
!Mwm*positionIsFrame:		True
!Mwm*positionOnScreen:		True
!Mwm*screens:			"varies"
!Mwm*useIconBox:		False

!!
!! component appearance resources.  We go farther than Motif in that you
!! can specify values for all Mwm components.  Not all are implemented,
!! though (why would a menu button want a font?).
!!
Mwm*menu.background:			rgb:72/9f/ff
!Mwm*menu.backgroundPixmap:		"varies"
!Mwm*menu.bottomShadowColor:		"varies"
!Mwm*menu.bottomShadowPixmap:		"varies"
Mwm*menu.fontList:			variable
Mwm*menu.foreground:			Black
Mwm*menu.saveUnder:			True
!Mwm*menu.topShadowColor:		"varies"
!Mwm*menu.topShadowPixmap:		"varies"

Mwm*feedback.background:		Cadet Blue
!Mwm*feedback.backgroundPixmap:		"varies"
!Mwm*feedback.bottomShadowColor:	"varies"
!Mwm*feedback.bottomShadowPixmap:	"varies"
Mwm*feedback.fontList:			variable
Mwm*feedback.foreground:		Black
Mwm*feedback.saveUnder:			True
!Mwm*feedback.topShadowColor:		"varies"
!Mwm*feedback.topShadowPixmap:		"varies"

Mwm*pager.background:			White
!Mwm*pager.backgroundPixmap:		"varies"
!Mwm*pager.bottomShadowColor:		"varies"
!Mwm*pager.bottomShadowPixmap:		"varies"
Mwm*pager.fontList:			5x7
Mwm*pager.foreground:			Black
Mwm*pager.saveUnder:			True
!Mwm*pager.topShadowColor:		"varies"
!Mwm*pager.topShadowPixmap:		"varies"

Mwm*icon.background:			LightGrey
!Mwm*icon.backgroundPixmap:		"varies"
!Mwm*icon.bottomShadowColor:		"varies"
!Mwm*icon.bottomShadowPixmap:		"varies"
Mwm*icon.fontList:			fixed
Mwm*icon.foreground:			Black
Mwm*icon.saveUnder:			True
!Mwm*icon.topShadowColor:		"varies"
!Mwm*icon.topShadowPixmap:		"varies"
Mwm*icon.activeBackground:		Cadet Blue
!Mwm*icon.activeBackgroundPixmap:	"varies"
!Mwm*icon.activeBottomShadowColor:	"varies"
!Mwm*icon.activeBottomShadowPixmap:	"varies"
Mwm*icon.activeForeground:		Black
!Mwm*icon.activeTopShadowColor:		"varies"

Mwm*client*title.background:			LightGrey
!Mwm*client*title.backgroundPixmap:		"varies"
!Mwm*client*title.bottomShadowColor:		"varies"
!Mwm*client*title.bottomShadowPixmap:		"varies"
Mwm*client*title.fontList:			variable
Mwm*client*title.foreground:			Black
Mwm*client*title.saveUnder:			True
!Mwm*client*title.topShadowColor:		"varies"
Mwm*client*title.activeBackground:		Cadet Blue
!Mwm*client*title.activeBackgroundPixmap:	"varies"
!Mwm*client*title.activeBottomShadowColor:	"varies"
!Mwm*client*title.activeBottomShadowPixmap:	"varies"
Mwm*client*title.activeForeground:		Black
!Mwm*client*title.activeTopShadowColor:		"varies"
!Mwm*client*title.activeTopShadowPixmap:	"varies"

Mwm*client*resizeh.background:			LightGrey
!Mwm*client*resizeh.backgroundPixmap:		"varies"
!Mwm*client*resizeh.bottomShadowColor:		"varies"
!Mwm*client*resizeh.bottomShadowPixmap:		"varies"
Mwm*client*resizeh.foreground:			Black
Mwm*client*resizeh.saveUnder:			True
!Mwm*client*resizeh.topShadowColor:		"varies"
Mwm*client*resizeh.activeBackground:		Cadet Blue
!Mwm*client*resizeh.activeBackgroundPixmap:	"varies"
!Mwm*client*resizeh.activeBottomShadowColor:	"varies"
!Mwm*client*resizeh.activeBottomShadowPixmap:	"varies"
Mwm*client*resizeh.activeForeground:		Black
!Mwm*client*resizeh.activeTopShadowColor:	"varies"
!Mwm*client*resizeh.activeTopShadowPixmap:	"varies"

Mwm*client*border.background:			LightGrey
!Mwm*client*border.backgroundPixmap:		"varies"
!Mwm*client*border.bottomShadowColor:		"varies"
!Mwm*client*border.bottomShadowPixmap:		"varies"
Mwm*client*border.foreground:			Black
Mwm*client*border.saveUnder:			True
!Mwm*client*border.topShadowColor:		"varies"
Mwm*client*border*activeBackground:		Cadet Blue
!Mwm*client*border.activeBackgroundPixmap:	"varies"
!Mwm*client*border.activeBottomShadowColor:	"varies"
!Mwm*client*border.activeBottomShadowPixmap:	"varies"
Mwm*client*border.activeForeground:		Black
!Mwm*client*border.activeTopShadowColor:	"varies"
!Mwm*client*border.activeTopShadowPixmap:	"varies"

Mwm*client*maximizeb.background:		LightGrey
!Mwm*client*maximizeb.backgroundPixmap:		"varies"
!Mwm*client*maximizeb.bottomShadowColor:	"varies"
!Mwm*client*maximizeb.bottomShadowPixmap:	"varies"
Mwm*client*maximizeb.foreground:		Black
Mwm*client*maximizeb.saveUnder:			True
!Mwm*client*maximizeb.topShadowColor:		"varies"
Mwm*client*maximizeb.activeBackground:		Cadet Blue
!Mwm*client*maximizeb.activeBackgroundPixmap:	"varies"
!Mwm*client*maximizeb.activeBottomShadowColor:	"varies"
!Mwm*client*maximizeb.activeBottomShadowPixmap:	"varies"
Mwm*client*maximizeb.activeForeground:		Black
!Mwm*client*maximizeb.activeTopShadowColor:	"varies"
!Mwm*client*maximizeb.activeTopShadowPixmap:	"varies"

Mwm*client*minimizeb.background:		LightGrey
!Mwm*client*minimizeb.backgroundPixmap:		"varies"
!Mwm*client*minimizeb.bottomShadowColor:	"varies"
!Mwm*client*minimizeb.bottomShadowPixmap:	"varies"
Mwm*client*minimizeb.foreground:		Black
Mwm*client*minimizeb.saveUnder:			True
!Mwm*client*minimizeb.topShadowColor:		"varies"
Mwm*client*minimizeb.activeBackground:		Cadet Blue
!Mwm*client*minimizeb.activeBackgroundPixmap:	"varies"
!Mwm*client*minimizeb.activeBottomShadowColor:	"varies"
!Mwm*client*minimizeb.activeBottomShadowPixmap:	"varies"
Mwm*client*minimizeb.activeForeground:		Black
!Mwm*client*minimizeb.activeTopShadowColor:	"varies"
!Mwm*client*minimizeb.activeTopShadowPixmap:	"varies"

Mwm*client*menub.background:			LightGrey
!Mwm*client*menub.backgroundPixmap:		"varies"
!Mwm*client*menub.bottomShadowColor:		"varies"
!Mwm*client*menub.bottomShadowPixmap:		"varies"
Mwm*client*menub.foreground:			Black
!Mwm*client*menub.saveUnder:			True
!Mwm*client*menub.topShadowColor:		"varies"
Mwm*client*menub.activeBackground:		Cadet Blue
!Mwm*client*menub.activeBackgroundPixmap:	"varies"
!Mwm*client*menub.activeBottomShadowColor:	"varies"
!Mwm*client*menub.activeBottomShadowPixmap:	"varies"
Mwm*client*menub.activeForeground:		Black
!Mwm*client*menub.activeTopShadowColor:		"varies"
!Mwm*client*menub.activeTopShadowPixmap:	"varies"

!!
!! client resources implemented
!!
Mwm*.clientDecorations:				all
Mwm*.clientFunctions:				all
!Mwm*focusAutoRaise:				"varies"
!Mwm*iconImageBackground:			"varies"
!Mwm*iconImageBottomShadowColor:		"varies"
!Mwm*iconImageBottomShadowPixmap:		"varies"
!Mwm*iconImageForeground:			"varies"
!Mwm*iconImageTopShadowColor:			"varies"
!Mwm*iconImageTopShadowPixmap:			"varies"
Mwm*matteBackground:				Light Coral
!Mwm*matteBottomShadowColor:			"varies"
!Mwm*matteBottomShadowPixmap:			"varies"
Mwm*matteForeground:				Black
!Mwm*matteTopShadowColor:			"varies"
!Mwm*matteTopShadowPixmap:			"varies"
Mwm*.matteWidth:				0
Mwm*.windowMenu:				DefaultWindowMenu
Mwm*usePPosition:				nonzero
Mwm*useClientIcon:				False

!!
!! client resources that are either unimplemented or unchangeable.
!!
!Mwm*iconImage:					"varies"
!Mwm*maximumClientSize:				"screen size"

!!
!! Client decorations for common clients - SAMPLES
!!
Mwm*XClock.clientDecoration:		border
!Mwm*XLoad.clientDecoration:		border
!Mwm*XBiff.clientDecoration:		border

!!
!! uncomment these to see what they do.
!! some entertainment.  Can you tell I live in Florida?;)
!!
Mwm*client*resizeh.activeBackground:	gold3
Mwm*client*pager.background:		DarkTurquoise
Mwm*client*pager.foreground:		Black
Mwm*matteBackground:			Light Coral
Mwm*matteWidth:				4
lesstif-current/clients/Motif-1.2/mwm/README100664   1005    764       10052  6441111434  20214 0ustar  u27113lesstifdev
This is lesstif's mwm.  It is derived from fvwm, with a new parser that
understands mwmrc syntax, and a general understanding of Mwm resources.
The window manager is freely redistributable;  see the file COPYING for
details.

You should know and understand both mwmrc syntax and Mwm resource
specifications if you want to modify mwm's behavior.

I departed from mwm's specification in that all window decorations have
separate resources; see the Mwm resource file for examples of this.

If you are familiar with fvwm, you'll notice the modules are gone; I didn't
particularly like the IPC mechanism.  The virtual screen and the
builtin pager are still there; you can turn off the pager, and the virtual
screen, via judicious use of some not-quite-mwm resources.

  If you don't want/don't like the pager, set the Mwm*usePager resource to
    False (or uncomment the line in Mwm that does this).

  If you don't like the panning mechanism (virtual screen), set the
    edgeScrollX/edgeScrollY resources to 0 (or uncomment the lines in Mwm
    that do this).  That will disable panning.  The edgeScroll resources
    default to the width of the screen; setting smaller values will pan
    the screen in smaller increments than one full page.

  If you prefer fvwm's "smart placement" policy, you can enable the
    Mwm*smartPlacement resource to true (or uncomment the line in mwm
    that does this).

Some of the additional flags that fvwm provides are still included, and likely
will not go away.  They are specified by the resource "clientFlags".  These
include:
    "sticky",
    "circulate_skip",
    "start_iconic",
    "list_skip"
The pager is "sticky" by default:  you'll have to change code if you don't like
this.

To use this version of mwm:
 o - copy the file 'system.mwmrc' to $HOME/.mwmrc (or to
     XLIB_PATH/system.mwmrc) and make any modifications that you prefer.

 o - Copy Mwm to your app-defaults directory, again making any modifications
     that you prefer (note: not all resources do anything yet, so don't be
     surprised if you request something and it doesn't happen.  All uncommented
     resources are working.  Those commented may work, or may yet require
     changes to libXm).  If you've been using lesstif's mwm for sometime, I'd
     advise copying the latest one in.  See comments in Mwm for details.

 o - If you haven't mapped your Alt keys to a modifier yet, use the provided
     alt.map file.  You can add the line
	xmodmap /usr/X11R6/lib/mwm/alt.map
     to your xinitrc to get this mapping consistently (assuming that you put
     alt.map somewhere logical).  There are other ways to do this; use
     whichever you prefer.  Unlike CSF/M*tif, you can bind any modifier to
     the Alt key in LessTif; so feel free to replace the Mod1 mapping in
     alt.map to whatever you prefer (thanks, Harald, for the clues in VirtKeys).

Things that work:
  o - menus.  Not all functions are implemented, so not all Motif functions
      work.
  o - button bindings in general.  Specifically, work needs to be done to
      pay attention to up/down/click/click2.
  o - resource specification work, but not all resources are paid attention
      to.
  o - key bindings work.  WARNING: if you use XFree86 on Linux, be aware
      that the server eats (Ctrl+Alt) sequences (or the console does; I'm
      not sure which), so some mwm accelerators may not work for you.
  o - defaults, resource conversion, colors.  The resource converters are
      sort of crude.  If someone has some free time, take a look at
      resources.c: anyplace you see strstr(), the function needs work (hint:
      split the string, then use strcmp()).
  o - font resources.
  o - multiscreen behavior is working, but screen specific resources aren't
      handled yet.
  o - If you didn't know, the pager is Input/Output.  Clicking on a window's
      representation in the pager will set the focus to that window.  Even
      clicking on a virtual screen will page you to that screen.
      

Things that don't work:
  o - icons are sort of a general problem.
  o - bugs, bugs, bugs.
  o - everything else I've forgotten:).
lesstif-current/clients/Motif-1.2/mwm/alt.map100664   1005    764          42  6441111434  20531 0ustar  u27113lesstifdevadd Mod1 = Alt_L
add Mod1 = Alt_R
lesstif-current/clients/Motif-1.2/mwm/colormaps.c100664   1005    764        6001  6441111434  21456 0ustar  u27113lesstifdev/****************************************************************************
 * This module is all new
 * by Rob Nation
 *
 * This code handles colormaps for mwm.
 *
 * Copyright 1994 Robert Nation. No restrictions are placed on this code,
 * as long as the copyright notice is preserved. No guarantees or
 * warrantees of any sort whatsoever are given or implied or anything.
 ****************************************************************************/
/***********************************************************************
 * The rest of it is all my fault -- MLM
 * mwm - "LessTif Window Manager"
 ***********************************************************************/

#include "mwm.h"

/*
 * install the colormaps for one mwm window
 */
void
COLOR_InstallWindowColorMap(ScreenInfo *scr, MwmWindow *tmp)
{
    int i;
    XWindowAttributes attributes;
    Window w;
    Bool ThisWinInstalled = False;


    /* If no window, then install root colormap */
    if (!tmp)
	tmp = &scr->mwm_root;

    scr->mwm_colormap = tmp;

    /*
     * Save the colormap to be loaded for when force loading of
     * root colormap(s) ends.
     */
    scr->mwm_pushed = tmp;

    /*
     * Don't load any new colormap if root colormap(s) has been
     * force loaded.
     */
    if (scr->root_pushes)
	return;

    if (tmp->number_cmap_windows > 0)
    {
	for (i = tmp->number_cmap_windows - 1; i >= 0; i--)
	{
	    w = tmp->cmap_windows[i];
	    if (w == tmp->w)
		ThisWinInstalled = True;
	    XGetWindowAttributes(dpy, w, &attributes);

	    if (scr->last_cmap != attributes.colormap)
	    {
		scr->last_cmap = attributes.colormap;
		XInstallColormap(dpy, attributes.colormap);
	    }
	}
    }

    if (!ThisWinInstalled)
    {
	if (scr->last_cmap != tmp->attr.colormap)
	{
	    scr->last_cmap = tmp->attr.colormap;
	    XInstallColormap(dpy, tmp->attr.colormap);
	}
    }
}

/*
 * The next two matching routines provide a mechanism to insure
 * that the root colormap(s) is installed during operations like
 * rubber banding or menu display that require colors from
 * that colormap.  Calls may be nested arbitrarily deeply,
 * as long as there is one UninstallRootColormap call per
 * COLOR_InstallRootColormap call.
 *
 * The final UninstallRootColormap will cause the colormap list
 * which would otherwise have be loaded to be loaded, unless
 * Enter or Leave Notify events are queued, indicating some
 * other colormap list would potentially be loaded anyway.
 */

/*
 * force (un)loads root colormap(s)
 */
void
COLOR_PushRootColorMap(ScreenInfo *scr)
{
    MwmWindow *tmp;

    if (scr->root_pushes == 0)
    {
	tmp = scr->mwm_pushed;
	COLOR_InstallWindowColorMap(scr, &scr->mwm_root);
	scr->mwm_pushed = tmp;
    }
    scr->root_pushes++;
    return;
}

/*
 * Unstacks one layer of root colormap pushing 
 * If we peel off the last layer, re-install the application colormap
 */
void
COLOR_PopRootColorMap(ScreenInfo *scr)
{
    if (scr->root_pushes)
	scr->root_pushes--;

    if (!scr->root_pushes)
	COLOR_InstallWindowColorMap(scr, scr->mwm_pushed);

    return;
}
lesstif-current/clients/Motif-1.2/mwm/cursors.c100664   1005    764       15545  6441111434  21214 0ustar  u27113lesstifdev/*****************************************************************************/
/**       Copyright 1988 by Evans & Sutherland Computer Corporation,        **/
/**                          Salt Lake City, Utah                           **/
/**  Portions Copyright 1989 by the Massachusetts Institute of Technology   **/
/**                        Cambridge, 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  permis-    **/
/**    sion  notice appear in supporting  documentation,  and  that  the    **/
/**    names of Evans & Sutherland and M.I.T. not be used in advertising    **/
/**    in publicity pertaining to distribution of the  software  without    **/
/**    specific, written prior permission.                                  **/
/**                                                                         **/
/**    EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD    **/
/**    TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES  OF  MERCHANT-    **/
/**    ABILITY  AND  FITNESS,  IN  NO  EVENT SHALL EVANS & SUTHERLAND OR    **/
/**    M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL  DAM-    **/
/**    AGES 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.                                     **/
/*****************************************************************************/
/****************************************************************************
 * This module is based on Twm, but has been siginificantly modified 
 * by Rob Nation 
 ****************************************************************************/
/***********************************************************************
 * The rest of it is all my fault -- MLM
 * mwm - "LessTif Window Manager"
 ***********************************************************************/

#include "mwm.h"

#define modal_width 16
#define modal_height 16
static unsigned char modal_bits[] =
{
    0xc0, 0x03, 0xf0, 0x0f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfe, 0x7f, 0xfe, 0x7f,
    0xff, 0xff, 0x01, 0x80, 0x01, 0x80, 0xff, 0xff, 0xfe, 0x7f, 0xfe, 0x7f,
    0xfc, 0x3f, 0xfc, 0x3f, 0xf0, 0x0f, 0xc0, 0x03};
#define modal_x_hot 8
#define modal_y_hot 8

#define modal_mask_width 16
#define modal_mask_height 16
static unsigned char modal_mask_bits[] =
{
    0xc0, 0x03, 0xf0, 0x0f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfe, 0x7f, 0xfe, 0x7f,
    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xfe, 0x7f,
    0xfc, 0x3f, 0xfc, 0x3f, 0xf0, 0x0f, 0xc0, 0x03};


#define hourglass_width 16
#define hourglass_height 16
static unsigned char hourglass_bits[] =
{
    0x00, 0x00, 0xfe, 0x7f, 0x04, 0x20, 0x0c, 0x30, 0xf4, 0x2f, 0xe4, 0x27,
    0xc4, 0x23, 0x84, 0x21, 0x84, 0x21, 0xc4, 0x22, 0x24, 0x25, 0x94, 0x28,
    0xfc, 0x3f, 0xfc, 0x7f, 0xfe, 0x7f, 0x00, 0x00};
#define hourglass_x_hot 8
#define hourglass_y_hot 8

#define hourglass_mask_width 16
#define hourglass_mask_height 16
static unsigned char hourglass_mask_bits[] =
{
    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
    0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
    0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};

/*
 * define cursors
 */
void
CURS_Initialize(ScreenInfo *scr)
{
    Pixmap modal, modal_mask;
    Pixmap hourglass, hourglass_mask;
    XColor black, white;

    scr->cursors[POSITION_CURS] = XCreateFontCursor(dpy, XC_top_left_corner);
    scr->cursors[DEFAULT_CURS] = XCreateFontCursor(dpy, XC_top_left_arrow);
    scr->cursors[SYS_CURS] = XCreateFontCursor(dpy, XC_hand2);
    scr->cursors[TITLE_CURS] = XCreateFontCursor(dpy, XC_top_left_arrow);
    scr->cursors[MOVE_CURS] = XCreateFontCursor(dpy, XC_fleur);
    scr->cursors[MENU_CURS] = XCreateFontCursor(dpy, XC_arrow);
    scr->cursors[WAIT_CURS] = XCreateFontCursor(dpy, XC_watch);
    scr->cursors[SELECT_CURS] = XCreateFontCursor(dpy, XC_dot);
    scr->cursors[DESTROY_CURS] = XCreateFontCursor(dpy, XC_pirate);
    scr->cursors[LEFT_CURS] = XCreateFontCursor(dpy, XC_left_side);
    scr->cursors[RIGHT_CURS] = XCreateFontCursor(dpy, XC_right_side);
    scr->cursors[TOP_CURS] = XCreateFontCursor(dpy, XC_top_side);
    scr->cursors[BOTTOM_CURS] = XCreateFontCursor(dpy, XC_bottom_side);
    scr->cursors[TOP_LEFT_CURS] = XCreateFontCursor(dpy, XC_top_left_corner);
    scr->cursors[TOP_RIGHT_CURS] = XCreateFontCursor(dpy, XC_top_right_corner);
    scr->cursors[BOT_LEFT_CURS] =
	XCreateFontCursor(dpy, XC_bottom_left_corner);
    scr->cursors[BOT_RIGHT_CURS] =
	XCreateFontCursor(dpy, XC_bottom_right_corner);

    if (!XParseColor(dpy, DefaultColormap(dpy, scr->screen), "White", &white))
    {
	if (!XParseColor(dpy, DefaultColormap(dpy, scr->screen),
			 "#FFFFFFFFFFFF", &white))
	    white.pixel = WhitePixel(dpy, scr->screen);
	else
	    XAllocColor(dpy, DefaultColormap(dpy, scr->screen), &white);
    }
    else
	XAllocColor(dpy, DefaultColormap(dpy, scr->screen), &white);

    if (!XParseColor(dpy, DefaultColormap(dpy, scr->screen), "Black", &black))
    {
	if (!XParseColor(dpy, DefaultColormap(dpy, scr->screen),
			 "#000000000000", &black))
	    black.pixel = BlackPixel(dpy, scr->screen);
	else
	    XAllocColor(dpy, DefaultColormap(dpy, scr->screen), &black);
    }
    else
	XAllocColor(dpy, DefaultColormap(dpy, scr->screen), &black);


    modal = XCreateBitmapFromData(dpy, RootWindow(dpy, scr->screen),
				  (char *)modal_bits,
				  modal_width, modal_height);
    modal_mask = XCreateBitmapFromData(dpy, RootWindow(dpy, scr->screen),
				       (char *)modal_mask_bits,
				       modal_mask_width, modal_mask_height);
    scr->cursors[SYS_MODAL_CURS] = XCreatePixmapCursor(dpy,
						       modal,
						       modal_mask,
						       &black, &white,
						       modal_x_hot,
						       modal_y_hot);


    hourglass = XCreateBitmapFromData(dpy, RootWindow(dpy, scr->screen),
				      (char *)hourglass_bits,
				      hourglass_width, hourglass_height);
    hourglass_mask = XCreateBitmapFromData(dpy, RootWindow(dpy, scr->screen),
					   (char *)hourglass_mask_bits,
					   hourglass_mask_width,
					   hourglass_mask_height);
    scr->cursors[HOURGLASS_CURS] = XCreatePixmapCursor(dpy,
						       hourglass,
						       hourglass_mask,
						       &black, &white,
						       hourglass_x_hot,
						       hourglass_y_hot);
}
lesstif-current/clients/Motif-1.2/mwm/decorate.c100664   1005    764      174225  6441111435  21324 0ustar  u27113lesstifdev/*****************************************************************************/
/**       Copyright 1988 by Evans & Sutherland Computer Corporation,        **/
/**                          Salt Lake City, Utah                           **/
/**  Portions Copyright 1989 by the Massachusetts Institute of Technology   **/
/**                        Cambridge, 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  permis-    **/
/**    sion  notice appear in supporting  documentation,  and  that  the    **/
/**    names of Evans & Sutherland and M.I.T. not be used in advertising    **/
/**    in publicity pertaining to distribution of the  software  without    **/
/**    specific, written prior permission.                                  **/
/**                                                                         **/
/**    EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD    **/
/**    TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES  OF  MERCHANT-    **/
/**    ABILITY  AND  FITNESS,  IN  NO  EVENT SHALL EVANS & SUTHERLAND OR    **/
/**    M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL  DAM-    **/
/**    AGES 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.                                     **/
/*****************************************************************************/
/****************************************************************************
 * This module is based on Twm, but has been siginificantly modified 
 * by Rob Nation 
 ****************************************************************************/
/***********************************************************************
 * The rest of it is all my fault -- MLM
 * mwm - "LessTif Window Manager"
 ***********************************************************************/

#include "mwm.h"

#include <X11/Intrinsic.h>

/*
 * button dimensions
 */
static int lbut_styles[2] =
{
    22,
    55
};
static int rbut_style_min[2] =
{
    22,
    22
};
static int rbut_style_max[2] =
{
    55,
    55
};


/*
 * change some window attributes
 */
static void
set_value_attributes(ScreenInfo *scr, MwmWindow *t, unsigned long *valuemask,
		     XSetWindowAttributes *attributes, ComponentInfo *comp)
{

    *valuemask = CWBorderPixel;
    if (scr->mwm_highlight == t)
    {
	attributes->border_pixel = comp->active_background;
	if (comp->active_background_pixmap != XmUNSPECIFIED_PIXMAP)
	{
	    attributes->background_pixmap = comp->active_background_pixmap;
	    *valuemask |= CWBackPixmap;
	}
	else
	{
	    attributes->background_pixel = comp->active_background;
	    *valuemask |= CWBackPixel;
	}
    }
    else
    {
	attributes->border_pixel = comp->background;
	if (comp->background_pixmap != XmUNSPECIFIED_PIXMAP)
	{
	    attributes->background_pixmap = comp->background_pixmap;
	    *valuemask |= CWBackPixmap;
	}
	else
	{
	    attributes->background_pixel = comp->background;
	    *valuemask |= CWBackPixel;
	}
    }
}

static void
draw_corners(MwmWindow *t, int i, GC hor, GC vert)
{
    XSegment seg[2];
    int n = 0;

    if (t->boundary_width < 3)
    {
	switch (i)
	{
	case 0:
	    seg[0].x1 = t->boundary_width - 1;
	    seg[0].x2 = t->corner_width;
	    seg[0].y1 = t->boundary_width - 1;
	    seg[0].y2 = t->boundary_width - 1;
	    n = 1;
	    break;
	case 1:
	    seg[0].x1 = 0;
	    seg[0].x2 = t->corner_width - t->boundary_width /* -1 */ ;
	    seg[0].y1 = t->boundary_width - 1;
	    seg[0].y2 = t->boundary_width - 1;
	    n = 1;
	    break;
	case 2:
	    seg[0].x1 = t->boundary_width - 1;
	    seg[0].x2 = t->corner_width - 2;
	    seg[0].y1 = t->corner_width - t->boundary_width + t->bw;
	    seg[0].y2 = t->corner_width - t->boundary_width + t->bw;
	    n = 1;
	    break;
	case 3:
	    seg[0].x1 = 0;
	    seg[0].x2 = t->corner_width - t->boundary_width;
	    seg[0].y1 = t->corner_width - t->boundary_width + t->bw;
	    seg[0].y2 = t->corner_width - t->boundary_width + t->bw;
	    n = 1;
	    break;
	}
	XDrawSegments(dpy, t->corners[i], hor, seg, n);
	switch (i)
	{
	case 0:
	    seg[0].y1 = t->boundary_width - 1;
	    seg[0].y2 = t->corner_width;
	    seg[0].x1 = t->boundary_width - 1;
	    seg[0].x2 = t->boundary_width - 1;
	    n = 1;
	    break;
	case 1:
	    seg[0].y1 = t->boundary_width - 1;
	    seg[0].y2 = t->corner_width - 2;
	    seg[0].x1 = t->corner_width - t->boundary_width;
	    seg[0].x2 = t->corner_width - t->boundary_width;
	    n = 1;
	    break;
	case 2:
	    seg[0].y1 = 0;
	    seg[0].y2 = t->corner_width - t->boundary_width;
	    seg[0].x1 = t->boundary_width - 1;
	    seg[0].x2 = t->boundary_width - 1;
	    n = 1;
	    break;
	case 3:
	    seg[0].y1 = 0;
	    seg[0].y2 = t->corner_width - t->boundary_width + t->bw;
	    seg[0].x1 = t->corner_width - t->boundary_width;
	    seg[0].x2 = t->corner_width - t->boundary_width;
	    n = 1;
	    break;
	}
	XDrawSegments(dpy, t->corners[i], vert, seg, 1);
    }
    else
    {
	switch (i)
	{
	case 0:
	    seg[0].x1 = t->boundary_width - 2;
	    seg[0].x2 = t->corner_width;
	    seg[0].y1 = t->boundary_width - 2;
	    seg[0].y2 = t->boundary_width - 2;

	    seg[1].x1 = t->boundary_width - 2;
	    seg[1].x2 = t->corner_width;
	    seg[1].y1 = t->boundary_width - 1;
	    seg[1].y2 = t->boundary_width - 1;
	    n = 2;
	    break;
	case 1:
	    seg[0].x1 = 1;
	    seg[0].x2 = t->corner_width - t->boundary_width;
	    seg[0].y1 = t->boundary_width - 2;
	    seg[0].y2 = t->boundary_width - 2;

	    seg[1].x1 = 0;
	    seg[1].x2 = t->corner_width - t->boundary_width - 1;
	    seg[1].y1 = t->boundary_width - 1;
	    seg[1].y2 = t->boundary_width - 1;
	    n = 2;
	    break;
	case 2:
	    seg[0].x1 = t->boundary_width - 1;
	    seg[0].x2 = t->corner_width - 2;
	    seg[0].y1 = t->corner_width - t->boundary_width + 1;
	    seg[0].y2 = t->corner_width - t->boundary_width + 1;
	    n = 1;
	    if (t->boundary_width > 3)
	    {
		seg[1].x1 = t->boundary_width - 2;
		seg[1].x2 = t->corner_width - 3;
		seg[1].y1 = t->corner_width - t->boundary_width + 2;
		seg[1].y2 = t->corner_width - t->boundary_width + 2;
		n = 2;
	    }
	    break;
	case 3:
	    seg[0].x1 = 0;
	    seg[0].x2 = t->corner_width - t->boundary_width;
	    seg[0].y1 = t->corner_width - t->boundary_width + 1;
	    seg[0].y2 = t->corner_width - t->boundary_width + 1;
	    n = 1;
	    if (t->boundary_width > 3)
	    {
		seg[0].x2 = t->corner_width - t->boundary_width + 1;

		seg[1].x1 = 0;
		seg[1].x2 = t->corner_width - t->boundary_width + 1;
		seg[1].y1 = t->corner_width - t->boundary_width + 2;
		seg[1].y2 = t->corner_width - t->boundary_width + 2;
		n = 2;
	    }
	    break;
	}
	XDrawSegments(dpy, t->corners[i], hor, seg, n);
	switch (i)
	{
	case 0:
	    seg[0].y1 = t->boundary_width - 2;
	    seg[0].y2 = t->corner_width;
	    seg[0].x1 = t->boundary_width - 2;
	    seg[0].x2 = t->boundary_width - 2;

	    seg[1].y1 = t->boundary_width - 2;
	    seg[1].y2 = t->corner_width;
	    seg[1].x1 = t->boundary_width - 1;
	    seg[1].x2 = t->boundary_width - 1;
	    n = 2;
	    break;
	case 1:
	    seg[0].y1 = t->boundary_width - 1;
	    seg[0].y2 = t->corner_width - 2;
	    seg[0].x1 = t->corner_width - t->boundary_width;
	    seg[0].x2 = t->corner_width - t->boundary_width;
	    n = 1;
	    if (t->boundary_width > 3)
	    {
		seg[1].y1 = t->boundary_width - 2;
		seg[1].y2 = t->corner_width - 3;
		seg[1].x1 = t->corner_width - t->boundary_width + 1;
		seg[1].x2 = t->corner_width - t->boundary_width + 1;
		n = 2;
	    }
	    break;
	case 2:
	    seg[0].y1 = 1;
	    seg[0].y2 = t->corner_width - t->boundary_width + 1;
	    seg[0].x1 = t->boundary_width - 2;
	    seg[0].x2 = t->boundary_width - 2;
	    n = 1;

	    if (t->boundary_width > 3)
	    {
		seg[1].y1 = 0;
		seg[1].y2 = t->corner_width - t->boundary_width;
		seg[1].x1 = t->boundary_width - 1;
		seg[1].x2 = t->boundary_width - 1;
	    }
	    break;
	case 3:
	    seg[0].y1 = 0;
	    seg[0].y2 = t->corner_width - t->boundary_width + 1;
	    seg[0].x1 = t->corner_width - t->boundary_width;
	    seg[0].x2 = t->corner_width - t->boundary_width;
	    n = 1;

	    if (t->boundary_width > 3)
	    {
		seg[0].y2 = t->corner_width - t->boundary_width + 2;
		seg[1].y1 = 0;
		seg[1].y2 = t->corner_width - t->boundary_width + 2;
		seg[1].x1 = t->corner_width - t->boundary_width + 1;
		seg[1].x2 = t->corner_width - t->boundary_width + 1;
		n = 2;
	    }
	    break;
	}
	XDrawSegments(dpy, t->corners[i], vert, seg, n);
    }
}

/*
 * draws a pattern within a window
 */
void
draw_pattern(Window win, GC ShadowGC, GC ReliefGC, int h1, int w1, int t1)
{
    XSegment seg[2];
    int i, h, b, u, w, r, l;

    h = t1 * h1 / 200;
    b = (t1 >> 1) + h;
    u = t1 - b - 1;
    w = t1 * w1 / 200;
    r = (t1 >> 1) + w;
    l = t1 - r - 1;

    i = 0;
    seg[i].x1 = l;
    seg[i].y1 = u;
    seg[i].x2 = r;
    seg[i++].y2 = u;

    seg[i].x1 = l;
    seg[i].y1 = u;
    seg[i].x2 = l;
    seg[i++].y2 = b;
    XDrawSegments(dpy, win, ShadowGC, seg, i);

    i = 0;
    seg[i].x1 = l;
    seg[i].y1 = b;
    seg[i].x2 = r;
    seg[i++].y2 = b;

    seg[i].x1 = r;
    seg[i].y1 = u;
    seg[i].x2 = r;
    seg[i++].y2 = b;
    XDrawSegments(dpy, win, ReliefGC, seg, i);
}

/*
 * relieve a rectangle
 */
static void
relieve_rectangle(Window win, int x, int y, int w, int h, GC Hilite, GC Shadow)
{
    XDrawLine(dpy, win, Hilite, x, y, w + x - 1, y);
    XDrawLine(dpy, win, Hilite, x, y, x, h + y - 1);
    XDrawLine(dpy, win, Hilite, x, y + 1, w + x - 2, y + 1);
    XDrawLine(dpy, win, Hilite, x + 1, y + 1, x + 1, h + y - 2);

    XDrawLine(dpy, win, Shadow, x, h + y - 1, w + x - 1, h + y - 1);
    XDrawLine(dpy, win, Shadow, w + x - 1, y, w + x - 1, h + y - 1);
    XDrawLine(dpy, win, Shadow, x + 1, h + y - 2, w + x - 2, h + y - 2);
    XDrawLine(dpy, win, Shadow, w + x - 2, y + 1, w + x - 2, h + y - 2);
}

/*
 * draw border windows
 */
void
DEC_DrawBorder(MwmWindow *t, Window win, int x, int y, int w, int h,
	       GC ReliefGC, GC ShadowGC)
{
    XSegment seg[4];
    int i;

    /* top */
    if (win == t->sides[0])
    {
	i = 0;
	seg[i].x1 = x;
	seg[i].y1 = y;
	seg[i].x2 = w + x - 1;
	seg[i++].y2 = y;

	seg[i].x1 = x;
	seg[i].y1 = y;
	seg[i].x2 = x;
	seg[i++].y2 = h + y - 1;

	XDrawSegments(dpy, win, ReliefGC, seg, i);

	i = 0;
	seg[i].x1 = x + t->boundary_width;
	seg[i].y1 = y + h - 1;
	seg[i].x2 = w + x - 1 - t->boundary_width;
	seg[i++].y2 = y + h - 1;

	seg[i].x1 = x + w - 1;
	seg[i].y1 = y;
	seg[i].x2 = x + w - 1;
	seg[i++].y2 = y + h - 1;

	XDrawSegments(dpy, win, ShadowGC, seg, i);
    }
    /* right */
    else if (win == t->sides[1])
    {
	i = 0;
	seg[i].x1 = x;
	seg[i].y1 = y;
	seg[i].x2 = w + x - 1;
	seg[i++].y2 = y;

	seg[i].x1 = x;
	seg[i].y1 = y + t->boundary_width - 1;
	seg[i].x2 = x;
	seg[i++].y2 = h + y - 1 - t->boundary_width;

	XDrawSegments(dpy, win, ReliefGC, seg, i);

	i = 0;
	seg[i].x1 = x;
	seg[i].y1 = y + h - 1;
	seg[i].x2 = w + x - 1;
	seg[i++].y2 = y + h - 1;

	seg[i].x1 = x + w - 1;
	seg[i].y1 = y;
	seg[i].x2 = x + w - 1;
	seg[i++].y2 = y + h - 1;

	XDrawSegments(dpy, win, ShadowGC, seg, i);
    }
    /* bottom */
    else if (win == t->sides[2])
    {
	i = 0;
	seg[i].x1 = x + t->boundary_width;
	seg[i].y1 = y;
	seg[i].x2 = w + x - t->boundary_width;
	seg[i++].y2 = y;

	seg[i].x1 = x;
	seg[i].y1 = y;
	seg[i].x2 = x;
	seg[i++].y2 = h + y - 1;

	XDrawSegments(dpy, win, ReliefGC, seg, i);

	i = 0;
	seg[i].x1 = x;
	seg[i].y1 = y + h - 1;
	seg[i].x2 = w + x - 1;
	seg[i++].y2 = y + h - 1;

	seg[i].x1 = x + w - 1;
	seg[i].y1 = y;
	seg[i].x2 = x + w - 1;
	seg[i++].y2 = y + h - 1;

	XDrawSegments(dpy, win, ShadowGC, seg, i);
    }
    /* left */
    else
    {
	i = 0;
	seg[i].x1 = x;
	seg[i].y1 = y;
	seg[i].x2 = w + x - 1;
	seg[i++].y2 = y;

	seg[i].x1 = x;
	seg[i].y1 = y;
	seg[i].x2 = x;
	seg[i++].y2 = h + y - 1;

	XDrawSegments(dpy, win, ReliefGC, seg, i);

	i = 0;
	seg[i].x1 = x;
	seg[i].y1 = y + h - 1;
	seg[i].x2 = w + x - 1;
	seg[i++].y2 = y + h - 1;

	seg[i].x1 = x + w - 1;
	seg[i].y1 = y + t->boundary_width - 1;
	seg[i].x2 = x + w - 1;
	seg[i++].y2 = y + h - t->boundary_width;

	XDrawSegments(dpy, win, ShadowGC, seg, i);
    }
}

/*
 * draws the relief pattern around a window
 */
void
DEC_DrawShadows(MwmWindow *t, Window win, int x, int y, int w, int h,
		GC ReliefGC, GC ShadowGC)
{
    XSegment seg[4];
    int i;

    i = 0;
    seg[i].x1 = x;
    seg[i].y1 = y;
    seg[i].x2 = w + x - 1;
    seg[i++].y2 = y;

    seg[i].x1 = x;
    seg[i].y1 = y;
    seg[i].x2 = x;
    seg[i++].y2 = h + y - 1;

    XDrawSegments(dpy, win, ReliefGC, seg, i);

    i = 0;
    seg[i].x1 = x;
    seg[i].y1 = y + h - 1;
    seg[i].x2 = w + x - 1;
    seg[i++].y2 = y + h - 1;

    seg[i].x1 = x + w - 1;
    seg[i].y1 = y;
    seg[i].x2 = x + w - 1;
    seg[i++].y2 = y + h - 1;

    XDrawSegments(dpy, win, ShadowGC, seg, i);
}

/*
 * Interprets the property MOTIF_WM_HINTS, sets decoration and functions
 * accordingly
 */
void
DEC_SelectDecorations(ScreenInfo *scr, MwmWindow *t)
{
    int border_width, resize_width;

    border_width = Mwm.frame_border_width;
    resize_width = Mwm.resize_border_width;

    if (t->mwm_hints && (t->mwm_hints->flags & MWM_HINTS_FUNCTIONS))
    {
	t->functions = t->mwm_hints->functions;

	/*
	 * functions affect the decorations! if the user says no iconify
	 * function, then the iconify button doesn't show up.  So do functions
	 * first.
	 */
	if (t->functions & MWM_FUNC_ALL)
	{
	    /* If we get ALL + some other things, that means to use ALL except
	     * the other things... */
	    t->functions &= ~MWM_FUNC_ALL;
	    t->functions = (MWM_FUNC_RESIZE | MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE |
			    MWM_FUNC_MAXIMIZE | MWM_FUNC_CLOSE)
		& (~(t->functions));
	}

	if (t->flags & TRANSIENT)
	    t->functions &= Mwm.transient_functions;
	else
	    t->functions &= t->client_functions;

    }
    else if (t->flags & TRANSIENT)
	t->functions = Mwm.transient_functions;
    else
	t->functions = t->client_functions;


    if (t->mwm_hints && (t->mwm_hints->flags & MWM_HINTS_DECORATIONS))
    {
	t->decorations = t->mwm_hints->decorations;

	/*
	 * next, figure out the decorations
	 */
	if (t->decorations & MWM_DECOR_ALL)
	{
	    /* If we get ALL + some other things, that means to use ALL except
	     * the other things... */
	    t->decorations &= ~MWM_DECOR_ALL;
	    t->decorations = (MWM_DECOR_BORDER | MWM_DECOR_RESIZEH |
			      MWM_DECOR_TITLE | MWM_DECOR_MENU |
			      MWM_DECOR_MINIMIZE | MWM_DECOR_MAXIMIZE)
		& (~t->decorations);
	}

	if (t->flags & TRANSIENT)
	    t->decorations &= Mwm.transient_decoration;
	else
	    t->decorations &= t->client_decoration;

    }
    else if (t->flags & TRANSIENT)
	t->decorations = Mwm.transient_decoration;
    else
	t->decorations = t->client_decoration;

    /*
     * Now I have the un-altered decor and functions, but with the ALL
     * attribute cleared and interpreted. I need to modify the decorations
     * that are affected by the functions
     */
    if (!(t->functions & MWM_FUNC_RESIZE))
	t->decorations &= ~MWM_DECOR_RESIZEH;
    /* MWM_FUNC_MOVE has no impact on decorations. */
    if (!(t->functions & MWM_FUNC_MINIMIZE))
	t->decorations &= ~MWM_DECOR_MINIMIZE;
    if (!(t->functions & MWM_FUNC_MAXIMIZE))
	t->decorations &= ~MWM_DECOR_MAXIMIZE;
    /* MWM_FUNC_CLOSE has no impact on decorations. */

    /*
     * This rule is implicit, but its easier to deal with if I take care of 
     * it now
     */
    if (t->decorations & (MWM_DECOR_MENU | MWM_DECOR_MINIMIZE | MWM_DECOR_MAXIMIZE))
	t->decorations |= MWM_DECOR_TITLE;

    if (t->decorations & (MWM_DECOR_TITLE | MWM_DECOR_RESIZEH))
	t->decorations |= MWM_DECOR_BORDER;

    if (t->wShaped)
	t->decorations &= ~(MWM_DECOR_BORDER | MWM_DECOR_RESIZEH);

    /*
     * Assume no decorations, and build up
     */
    t->boundary_width = 0;
    t->corner_width = 0;
    t->title_height = 0;

    if (t->decorations & MWM_DECOR_BORDER)
    {
	/* A narrow border is displayed (5 pixels - 2 relief, 1 top, 2
	 * shadow) */
	t->boundary_width = border_width;
    }

    if (t->decorations & MWM_DECOR_TITLE)
    {
	/* A title barm with no buttons in it - window gets a 1 pixel wide
	 * black border. */
	t->title_height = scr->components[MWM_TITLE_A].f_height + 3;
    }

    if (t->decorations & MWM_DECOR_RESIZEH)
    {
	/* A wide border, with corner tiles is desplayed (10 pixels - 2
	 * relief, 2 shadow) */
	t->boundary_width = resize_width;
	t->corner_width = scr->components[MWM_TITLE_A].f_height + 3 +
	    t->boundary_width;
    }

    t->bw = 0;
    if (t->title_height > 0)
	t->title_height += t->bw;
}

/*
 * Interprets the property MOTIF_WM_HINTS, sets decoration and functions
 * accordingly
 */
void
DEC_ReselectDecorations(ScreenInfo *scr, MwmWindow *t)
{
    int border_width, resize_width, i;
    unsigned long valuemask;	/* mask for create windows */
    XSetWindowAttributes attributes;	/* attributes for create windows */

    border_width = Mwm.frame_border_width;
    resize_width = Mwm.resize_border_width;

    if (t->mwm_hints && (t->mwm_hints->flags & MWM_HINTS_FUNCTIONS))
    {
	t->functions = t->mwm_hints->functions;

	/*
	 * functions affect the decorations! if the user says no iconify
	 * function, then the iconify button doesn't show up.  So do functions
	 * first.
	 */
	if (t->functions & MWM_FUNC_ALL)
	{
	    /* If we get ALL + some other things, that means to use ALL except
	     * the other things... */
	    t->functions &= ~MWM_FUNC_ALL;
	    t->functions = (MWM_FUNC_RESIZE | MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE |
			    MWM_FUNC_MAXIMIZE | MWM_FUNC_CLOSE)
		& (~(t->functions));
	}

	if (t->flags & TRANSIENT)
	    t->functions &= Mwm.transient_functions;
	else
	    t->functions &= t->client_functions;

    }
    else if (t->flags & TRANSIENT)
	t->functions = Mwm.transient_functions;
    else
	t->functions = t->client_functions;


    if (t->mwm_hints && (t->mwm_hints->flags & MWM_HINTS_DECORATIONS))
    {
	t->decorations = t->mwm_hints->decorations;

	/*
	 * next, figure out the decorations
	 */
	if (t->decorations & MWM_DECOR_ALL)
	{
	    /* If we get ALL + some other things, that means to use ALL except
	     * the other things... */
	    t->decorations &= ~MWM_DECOR_ALL;
	    t->decorations = (MWM_DECOR_BORDER | MWM_DECOR_RESIZEH |
			      MWM_DECOR_TITLE | MWM_DECOR_MENU |
			      MWM_DECOR_MINIMIZE | MWM_DECOR_MAXIMIZE)
		& (~t->decorations);
	}

	if (t->flags & TRANSIENT)
	    t->decorations &= Mwm.transient_decoration;
	else
	    t->decorations &= t->client_decoration;

    }
    else if (t->flags & TRANSIENT)
	t->decorations = Mwm.transient_decoration;
    else
	t->decorations = t->client_decoration;

    /*
     * Now I have the un-altered decor and functions, but with the ALL
     * attribute cleared and interpreted. I need to modify the decorations
     * that are affected by the functions
     */
    if (!(t->functions & MWM_FUNC_RESIZE))
	t->decorations &= ~MWM_DECOR_RESIZEH;
    /* MWM_FUNC_MOVE has no impact on decorations. */
    if (!(t->functions & MWM_FUNC_MINIMIZE))
	t->decorations &= ~MWM_DECOR_MINIMIZE;
    if (!(t->functions & MWM_FUNC_MAXIMIZE))
	t->decorations &= ~MWM_DECOR_MAXIMIZE;
    /* MWM_FUNC_CLOSE has no impact on decorations. */

    /*
     * This rule is implicit, but its easier to deal with if I take care of 
     * it now
     */
    if (t->decorations & (MWM_DECOR_MENU | MWM_DECOR_MINIMIZE | MWM_DECOR_MAXIMIZE))
	t->decorations |= MWM_DECOR_TITLE;

    if (t->decorations & (MWM_DECOR_TITLE | MWM_DECOR_RESIZEH))
	t->decorations |= MWM_DECOR_BORDER;

    if (t->wShaped)
	t->decorations &= ~(MWM_DECOR_BORDER | MWM_DECOR_RESIZEH);

    /*
     * Assume no decorations, and build up
     */
    t->boundary_width = 0;
    t->corner_width = 0;
    t->title_height = 0;

    valuemask = CWBorderPixel | CWCursor | CWEventMask |
	CWSaveUnder | CWBackingStore;
    attributes.backing_store = WhenMapped;
    if (scr->components[MWM_BORDER].background_pixmap
	!= XmUNSPECIFIED_PIXMAP)
    {
	attributes.background_pixmap =
	    scr->components[MWM_BORDER].background_pixmap;
	valuemask &= ~CWBackPixel;
	valuemask |= CWBackPixmap;
    }
    else
    {
	attributes.background_pixel = scr->components[MWM_BORDER].background;
	valuemask &= ~CWBackPixmap;
	valuemask |= CWBackPixel;
    }
    attributes.event_mask = (ButtonPressMask | ButtonReleaseMask |
			     ExposureMask | EnterWindowMask | LeaveWindowMask);


    if (t->decorations & MWM_DECOR_BORDER)
    {
	/* A narrow border is displayed (5 pixels - 2 relief, 1 top, 2
	 * shadow) */
	t->boundary_width = border_width;

	if (t->sides[0] == None)
	{

	    for (i = 0; i < 4; i++)
	    {
		if (Mwm.resize_cursors)
		    attributes.cursor = scr->cursors[TOP_CURS + i];
		else
		    attributes.cursor = scr->cursors[DEFAULT_CURS];
		attributes.save_under =
		    scr->components[MWM_BORDER].save_under;
		t->sides[i] = XCreateWindow(dpy, t->frame, 0, 0,
					    t->boundary_width,
					    t->boundary_width,
					    0,
					    CopyFromParent, InputOutput,
					    CopyFromParent,
					    valuemask, &attributes);

		XSaveContext(dpy, t->sides[i], MwmContext, (_Xconst char *)t);
	    }
	}
	for (i = 0; i < 4; i++)
	    XRaiseWindow(dpy, t->sides[i]);
    }
    else if (t->sides[0] != None)
    {
	for (i = 0; i < 4; i++)
	{
	    XDeleteContext(dpy, t->sides[i], MwmContext);
	    XDestroyWindow(dpy, t->sides[i]);
	    t->sides[i] = None;
	}
    }

    if (scr->components[MWM_RESIZE_H].background_pixmap
	!= XmUNSPECIFIED_PIXMAP)
    {
	attributes.background_pixmap =
	    scr->components[MWM_RESIZE_H].background_pixmap;
	valuemask &= ~CWBackPixel;
	valuemask |= CWBackPixmap;
    }
    else
    {
	attributes.background_pixel =
	    scr->components[MWM_RESIZE_H].background;
	valuemask &= ~CWBackPixmap;
	valuemask |= CWBackPixel;
    }
    if (t->decorations & MWM_DECOR_RESIZEH)
    {
	/* A wide border, with corner tiles is desplayed (10 pixels - 2
	 * relief, 2 shadow) */
	t->boundary_width = resize_width;
	t->corner_width = scr->components[MWM_TITLE_A].f_height + 3 +
	    t->boundary_width;

	if (t->corners[0] == None)
	{

	    attributes.event_mask = (ButtonPressMask | ButtonReleaseMask |
			     ExposureMask | EnterWindowMask | LeaveWindowMask);

	    /*
	     * Just dump the windows any old place and let
	     * DEC_ConfigureDecorations take care of the mess
	     */
	    for (i = 0; i < 4; i++)
	    {
		if (Mwm.resize_cursors)
		    attributes.cursor = scr->cursors[TOP_LEFT_CURS + i];
		else
		    attributes.cursor = scr->cursors[DEFAULT_CURS];
		attributes.save_under =
		    scr->components[MWM_RESIZE_H].save_under;
		t->corners[i] = XCreateWindow(dpy, t->frame, 0, 0,
					      t->corner_width,
					      t->corner_width,
					      0, CopyFromParent,
					      InputOutput, CopyFromParent,
					      valuemask, &attributes);

		XSaveContext(dpy, t->corners[i], MwmContext, (_Xconst char *)t);
	    }
	}
	for (i = 0; i < 4; i++)
	    XRaiseWindow(dpy, t->corners[i]);
    }
    else if (t->corners[0] != None)
    {
	for (i = 0; i < 4; i++)
	{
	    XDestroyWindow(dpy, t->corners[i]);
	    XDeleteContext(dpy, t->corners[i], MwmContext);
	    t->corners[i] = None;
	}
    }

    if (scr->components[MWM_TITLE_A].background_pixmap
	!= XmUNSPECIFIED_PIXMAP)
    {
	attributes.background_pixmap =
	    scr->components[MWM_TITLE_A].background_pixmap;
	valuemask &= ~CWBackPixel;
	valuemask |= CWBackPixmap;
    }
    else
    {
	attributes.background_pixel =
	    scr->components[MWM_TITLE_A].background;
	valuemask &= ~CWBackPixmap;
	valuemask |= CWBackPixel;
    }
    if (t->decorations & MWM_DECOR_TITLE)
    {
	/* A title barm with no buttons in it - window gets a 1 pixel wide
	 * black border. */
	t->title_height = scr->components[MWM_TITLE_A].f_height + 3;
	if (t->title_height > 0)
	    t->title_height += t->bw;

	t->title_x = t->title_y = 0;
	t->title_width = t->frame_width - 2 * t->corner_width - 3 + t->bw;
	if (t->title_width < 1)
	    t->title_width = 1;

	if (t->title == None)
	{

	    attributes.cursor = scr->cursors[TITLE_CURS];
	    attributes.save_under = scr->components[MWM_TITLE_A].save_under;
	    t->title = XCreateWindow(dpy, t->frame,
				     t->title_x, t->title_y,
				     t->title_width, t->title_height,
				     0,
				     CopyFromParent, InputOutput,
				     CopyFromParent,
				     valuemask, &attributes);

	    XSaveContext(dpy, t->title, MwmContext, (_Xconst char *)t);
	}
	XRaiseWindow(dpy, t->title);
    }
    else if (t->title != None)
    {
	XDeleteContext(dpy, t->title, MwmContext);
	XDestroyWindow(dpy, t->title);
	t->title = None;
    }

    if (scr->components[MWM_MENU_B].background_pixmap
	!= XmUNSPECIFIED_PIXMAP)
    {
	attributes.background_pixmap =
	    scr->components[MWM_MENU_B].background_pixmap;
	valuemask &= ~CWBackPixel;
	valuemask |= CWBackPixmap;
    }
    else
    {
	attributes.background_pixel =
	    scr->components[MWM_MENU_B].background;
	valuemask &= ~CWBackPixmap;
	valuemask |= CWBackPixel;
    }
    if (t->decorations & MWM_DECOR_MENU)
    {
	/* title-bar menu button window gets 1 pixel wide black border */
	if (t->menub == None)
	{
	    attributes.save_under = scr->components[MWM_MENU_B].save_under;
	    t->menub = XCreateWindow(dpy, t->frame,
				     t->title_height, 0,
				     t->title_height, t->title_height,
				     0,
				     CopyFromParent, InputOutput,
				     CopyFromParent,
				     valuemask, &attributes);

	    XSaveContext(dpy, t->menub, MwmContext, (_Xconst char *)t);
	}
	XRaiseWindow(dpy, t->menub);
    }
    else if (t->menub != None)
    {
	XDeleteContext(dpy, t->menub, MwmContext);
	XDestroyWindow(dpy, t->menub);
	t->menub = None;
    }

    if (scr->components[MWM_MINIMIZE_B].background_pixmap
	!= XmUNSPECIFIED_PIXMAP)
    {
	attributes.background_pixmap =
	    scr->components[MWM_MINIMIZE_B].background_pixmap;
	valuemask &= ~CWBackPixel;
	valuemask |= CWBackPixmap;
    }
    else
    {
	attributes.background_pixel =
	    scr->components[MWM_MINIMIZE_B].background;
	valuemask &= ~CWBackPixmap;
	valuemask |= CWBackPixel;
    }
    if (t->decorations & MWM_DECOR_MINIMIZE)
    {
	/* title-bar + iconify button, no menu button. window gets 1 pixel
	 * wide black border */
	if (t->minimizeb == None)
	{
	    attributes.save_under = scr->components[MWM_MINIMIZE_B].save_under;
	    t->minimizeb = XCreateWindow(dpy, t->frame,
					 t->title_width - t->title_height * 2,
					 0,
					 t->title_height, t->title_height,
					 0,
					 CopyFromParent, InputOutput,
					 CopyFromParent,
					 valuemask, &attributes);

	    XSaveContext(dpy, t->minimizeb, MwmContext, (_Xconst char *)t);
	}
	XRaiseWindow(dpy, t->minimizeb);
    }
    else if (t->minimizeb != None)
    {
	XDeleteContext(dpy, t->minimizeb, MwmContext);
	XDestroyWindow(dpy, t->minimizeb);
	t->minimizeb = None;
    }

    if (scr->components[MWM_MAXIMIZE_B].background_pixmap
	!= XmUNSPECIFIED_PIXMAP)
    {
	attributes.background_pixmap =
	    scr->components[MWM_MAXIMIZE_B].background_pixmap;
	valuemask &= ~CWBackPixel;
	valuemask |= CWBackPixmap;
    }
    else
    {
	attributes.background_pixel =
	    scr->components[MWM_MAXIMIZE_B].background;
	valuemask &= ~CWBackPixmap;
	valuemask |= CWBackPixel;
    }
    if (t->decorations & MWM_DECOR_MAXIMIZE)
    {
	/* title-bar + maximize button, no menu button, no iconify. * window
	 * has 1 pixel wide black border */
	if (t->maximizeb == None)
	{
	    attributes.save_under = scr->components[MWM_MINIMIZE_B].save_under;
	    t->maximizeb = XCreateWindow(dpy, t->frame,
					 t->title_width - t->title_height * 1,
					 0,
					 t->title_height, t->title_height,
					 0,
					 CopyFromParent, InputOutput,
					 CopyFromParent,
					 valuemask, &attributes);

	    XSaveContext(dpy, t->maximizeb, MwmContext, (_Xconst char *)t);
	}
	XRaiseWindow(dpy, t->maximizeb);
    }
    else if (t->maximizeb != None)
    {
	XDeleteContext(dpy, t->maximizeb, MwmContext);
	XDestroyWindow(dpy, t->maximizeb);
	t->maximizeb = None;
    }

    XMapSubwindows(dpy, t->frame);
    XLowerWindow(dpy, t->shield);
    XRaiseWindow(dpy, t->parent);

    t->bw = 0;
}

/*
 * create the decoration windows
 */
void
DEC_CreateDecorations(ScreenInfo *scr, MwmWindow *tmp_win)
{
    unsigned long valuemask;	/* mask for create windows */
    XSetWindowAttributes attributes;	/* attributes for create windows */
    int i;

    /*
     * create windows
     */
    tmp_win->frame_x = tmp_win->attr.x + tmp_win->old_bw - tmp_win->bw;
    tmp_win->frame_y = tmp_win->attr.y + tmp_win->old_bw - tmp_win->bw;

    tmp_win->frame_width = tmp_win->attr.width +
	2 * tmp_win->boundary_width +
	2 * tmp_win->matte_width;
    tmp_win->frame_height = tmp_win->attr.height + tmp_win->title_height +
	2 * tmp_win->matte_width +
	2 * tmp_win->boundary_width;

    valuemask = CWBorderPixel | CWCursor | CWEventMask;
    if (scr->components[MWM_BORDER].background_pixmap
	!= XmUNSPECIFIED_PIXMAP)
    {
	attributes.background_pixmap =
	    scr->components[MWM_BORDER].background_pixmap;
	valuemask &= ~CWBackPixel;
	valuemask |= CWBackPixmap;
    }
    else
    {
	attributes.background_pixel =
	    scr->components[MWM_BORDER].background;
	valuemask &= ~CWBackPixmap;
	valuemask |= CWBackPixel;
    }

    attributes.border_pixel = scr->components[MWM_BORDER].bottom_shadow_color;

    attributes.cursor = scr->cursors[DEFAULT_CURS];
    attributes.event_mask = (SubstructureRedirectMask | ButtonPressMask |
			     ButtonReleaseMask | EnterWindowMask |
			     LeaveWindowMask | ExposureMask);
    valuemask |= CWSaveUnder;
    attributes.save_under = True;

    /* What the heck, we'll always reparent everything from now on! */
    tmp_win->frame =
	XCreateWindow(dpy, scr->root_win, tmp_win->frame_x, tmp_win->frame_y,
		      tmp_win->frame_width, tmp_win->frame_height,
		      tmp_win->bw, CopyFromParent, InputOutput,
		      CopyFromParent, valuemask, &attributes);

    attributes.save_under = False;

    /* Thats not all, we'll double-reparent the window ! */
    attributes.cursor = scr->cursors[DEFAULT_CURS];
    attributes.background_pixel = tmp_win->matte_background;
    valuemask &= ~CWBackPixmap;
    valuemask |= CWBackPixel;
    tmp_win->parent =
	XCreateWindow(dpy, tmp_win->frame,
		      tmp_win->boundary_width,
		      tmp_win->boundary_width + tmp_win->title_height,
		      (tmp_win->frame_width - 2 * tmp_win->boundary_width),
		      (tmp_win->frame_height - 2 * tmp_win->boundary_width -
		       tmp_win->title_height), tmp_win->bw, CopyFromParent,
		      InputOutput, CopyFromParent, valuemask, &attributes);

    attributes.cursor = scr->cursors[SYS_MODAL_CURS];
    attributes.override_redirect = True;
    attributes.event_mask = ButtonPressMask | ButtonPressMask;

    tmp_win->shield =
	XCreateWindow(dpy, tmp_win->frame,
		      tmp_win->boundary_width,
		      tmp_win->boundary_width + tmp_win->title_height,
		      (tmp_win->frame_width - 2 * tmp_win->boundary_width),
		      (tmp_win->frame_height - 2 * tmp_win->boundary_width -
		       tmp_win->title_height),
		      tmp_win->bw,
		      0, InputOnly, CopyFromParent,
		      CWEventMask | CWCursor | CWOverrideRedirect, &attributes);

    valuemask |= CWBackingStore;
    attributes.backing_store = WhenMapped;
    attributes.event_mask = (SubstructureRedirectMask | ButtonPressMask |
			     ButtonReleaseMask | EnterWindowMask |
			     LeaveWindowMask | ExposureMask);

    attributes.cursor = scr->cursors[DEFAULT_CURS];
    if (scr->pager_win)
    {
	if (scr->components[MWM_PAGER].background_pixmap
	    != XmUNSPECIFIED_PIXMAP)
	{
	    attributes.background_pixmap =
		scr->components[MWM_PAGER].background_pixmap;
	    valuemask |= CWBackPixmap;
	}
	else
	{
	    attributes.background_pixel = scr->components[MWM_PAGER].background;
	    valuemask |= CWBackPixel;
	}

	/* Create the pager_view window even if we're sticky, in case the
	 * user unsticks the window */
	attributes.event_mask = ExposureMask;
	tmp_win->pager_view = XCreateWindow(dpy, scr->pager_win,
					    -10, -10,
					    2, 2,
					    1,
					    CopyFromParent, InputOutput,
					    CopyFromParent, valuemask,
					    &attributes);
	XMapRaised(dpy, tmp_win->pager_view);
    }

    attributes.event_mask = (ButtonPressMask | ButtonReleaseMask |
			     ExposureMask | EnterWindowMask | LeaveWindowMask);
    tmp_win->title_x = tmp_win->title_y = 0;
    tmp_win->title_width = tmp_win->frame_width - 2 * tmp_win->corner_width
	- 3 + tmp_win->bw;
    if (tmp_win->title_width < 1)
	tmp_win->title_width = 1;

    if (scr->components[MWM_RESIZE_H].background_pixmap
	!= XmUNSPECIFIED_PIXMAP)
    {
	attributes.background_pixmap =
	    scr->components[MWM_RESIZE_H].background_pixmap;
	valuemask &= ~CWBackPixel;
	valuemask |= CWBackPixmap;
    }
    else
    {
	attributes.background_pixel =
	    scr->components[MWM_RESIZE_H].background;
	valuemask &= ~CWBackPixmap;
	valuemask |= CWBackPixel;
    }
    if (tmp_win->decorations & MWM_DECOR_RESIZEH)
    {
	/* Just dump the windows any old place and let
	 * DEC_ConfigureDecorations take care of the mess */
	attributes.save_under = scr->components[MWM_RESIZE_H].save_under;
	for (i = 0; i < 4; i++)
	{
	    attributes.cursor = scr->cursors[TOP_LEFT_CURS + i];
	    tmp_win->corners[i] =
		XCreateWindow(dpy, tmp_win->frame, 0, 0,
			      tmp_win->corner_width, tmp_win->corner_width,
			      0, CopyFromParent, InputOutput,
			      CopyFromParent, valuemask, &attributes);
	}
    }
    else
    {
	for (i = 0; i < 4; i++)
	    tmp_win->corners[i] = None;
    }

    if (scr->components[MWM_TITLE_A].background_pixmap
	!= XmUNSPECIFIED_PIXMAP)
    {
	attributes.background_pixmap =
	    scr->components[MWM_TITLE_A].background_pixmap;
	valuemask &= ~CWBackPixel;
	valuemask |= CWBackPixmap;
    }
    else
    {
	attributes.background_pixel =
	    scr->components[MWM_TITLE_A].background;
	valuemask &= ~CWBackPixmap;
	valuemask |= CWBackPixel;
    }
    if (tmp_win->decorations & MWM_DECOR_TITLE)
    {
	tmp_win->title_x = tmp_win->boundary_width + tmp_win->title_height + 1;
	tmp_win->title_y = tmp_win->boundary_width;
	attributes.cursor = scr->cursors[TITLE_CURS];
	attributes.save_under = scr->components[MWM_TITLE_A].save_under;
	tmp_win->title =
	    XCreateWindow(dpy, tmp_win->frame,
			  tmp_win->title_x, tmp_win->title_y,
			  tmp_win->title_width, tmp_win->title_height,
			  0,
			  CopyFromParent, InputOutput, CopyFromParent,
			  valuemask, &attributes);
    }
    else
	tmp_win->title = None;

    if (scr->components[MWM_MENU_B].background_pixmap
	!= XmUNSPECIFIED_PIXMAP)
    {
	attributes.background_pixmap =
	    scr->components[MWM_MENU_B].background_pixmap;
	valuemask &= ~CWBackPixel;
	valuemask |= CWBackPixmap;
    }
    else
    {
	attributes.background_pixel =
	    scr->components[MWM_MENU_B].background;
	valuemask &= ~CWBackPixmap;
	valuemask |= CWBackPixel;
    }
    if (tmp_win->decorations & MWM_DECOR_MENU)
    {
	attributes.cursor = scr->cursors[SYS_CURS];
	attributes.save_under = scr->components[MWM_MENU_B].save_under;
	tmp_win->menub =
	    XCreateWindow(dpy, tmp_win->frame,
			  tmp_win->title_height, 0,
			  tmp_win->title_height, tmp_win->title_height,
			  0,
			  CopyFromParent, InputOutput, CopyFromParent,
			  valuemask, &attributes);
    }
    else
	tmp_win->menub = None;

    if (scr->components[MWM_MINIMIZE_B].background_pixmap
	!= XmUNSPECIFIED_PIXMAP)
    {
	attributes.background_pixmap =
	    scr->components[MWM_MINIMIZE_B].background_pixmap;
	valuemask &= ~CWBackPixel;
	valuemask |= CWBackPixmap;
    }
    else
    {
	attributes.background_pixel =
	    scr->components[MWM_MINIMIZE_B].background;
	valuemask &= ~CWBackPixmap;
	valuemask |= CWBackPixel;
    }
    if (tmp_win->decorations & MWM_DECOR_MINIMIZE)
    {
	attributes.save_under = scr->components[MWM_MINIMIZE_B].save_under;
	tmp_win->minimizeb =
	    XCreateWindow(dpy, tmp_win->frame,
			  tmp_win->title_width -
			  tmp_win->title_height * 2, 0,
			  tmp_win->title_height, tmp_win->title_height,
			  0,
			  CopyFromParent, InputOutput, CopyFromParent,
			  valuemask, &attributes);
    }
    else
	tmp_win->minimizeb = None;

    if (scr->components[MWM_MAXIMIZE_B].background_pixmap
	!= XmUNSPECIFIED_PIXMAP)
    {
	attributes.background_pixmap =
	    scr->components[MWM_MAXIMIZE_B].background_pixmap;
	valuemask &= ~CWBackPixel;
	valuemask |= CWBackPixmap;
    }
    else
    {
	attributes.background_pixel =
	    scr->components[MWM_MAXIMIZE_B].background;
	valuemask &= ~CWBackPixmap;
	valuemask |= CWBackPixel;
    }
    if (tmp_win->decorations & MWM_DECOR_MAXIMIZE)
    {
	attributes.save_under = scr->components[MWM_MAXIMIZE_B].save_under;
	tmp_win->maximizeb =
	    XCreateWindow(dpy, tmp_win->frame,
			  tmp_win->title_width -
			  tmp_win->title_height * 1, 0,
			  tmp_win->title_height, tmp_win->title_height,
			  0,
			  CopyFromParent, InputOutput, CopyFromParent,
			  valuemask, &attributes);
    }
    else
	tmp_win->maximizeb = None;

    if (scr->components[MWM_BORDER].background_pixmap
	!= XmUNSPECIFIED_PIXMAP)
    {
	attributes.background_pixmap =
	    scr->components[MWM_BORDER].background_pixmap;
	valuemask &= ~CWBackPixel;
	valuemask |= CWBackPixmap;
    }
    else
    {
	attributes.background_pixel =
	    scr->components[MWM_BORDER].background;
	valuemask &= ~CWBackPixmap;
	valuemask |= CWBackPixel;
    }
    if (tmp_win->decorations & MWM_DECOR_BORDER)
    {
	attributes.save_under = scr->components[MWM_BORDER].save_under;
	for (i = 0; i < 4; i++)
	{
	    attributes.cursor = scr->cursors[TOP_CURS + i];
	    tmp_win->sides[i] =
		XCreateWindow(dpy, tmp_win->frame,
			      0, 0,
			      tmp_win->boundary_width, tmp_win->boundary_width,
			      0,
			      CopyFromParent, InputOutput, CopyFromParent,
			      valuemask, &attributes);
	}
    }
    else
    {
	for (i = 0; i < 4; i++)
	    tmp_win->sides[i] = None;
    }

    XMapSubwindows(dpy, tmp_win->frame);
    XLowerWindow(dpy, tmp_win->shield);
    XRaiseWindow(dpy, tmp_win->parent);
    XReparentWindow(dpy, tmp_win->w, tmp_win->parent,
		    tmp_win->matte_width, tmp_win->matte_width);

    valuemask = (CWEventMask | CWDontPropagate);
    attributes.event_mask = (StructureNotifyMask | PropertyChangeMask |
			     VisibilityChangeMask | EnterWindowMask |
			     LeaveWindowMask | ColormapChangeMask |
			     FocusChangeMask);

    if (tmp_win->w == scr->pager_win)
    {
	scr->mwm_pager = tmp_win;
	tmp_win->flags |= STICKY;
	attributes.event_mask |= ButtonPressMask | ButtonReleaseMask |
	    ExposureMask | ButtonMotionMask;
	attributes.do_not_propagate_mask = ButtonPressMask;
    }
    else
	attributes.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask;

    valuemask |= CWBackingStore;
    attributes.backing_store = WhenMapped;

    XChangeWindowAttributes(dpy, tmp_win->w, valuemask, &attributes);
}

/*
 *  Inputs:
 *      tmp_win - the MwmWindow pointer
 *      x       - the x coordinate of the upper-left outer corner of the frame
 *      y       - the y coordinate of the upper-left outer corner of the frame
 *      w       - the width of the frame window w/o border
 *      h       - the height of the frame window w/o border
 *
 *  Special Considerations:
 *      This routine will check to make sure the window is not completely
 *      off the display, if it is, it'll bring some of it back on.
 *
 *      The tmp_win->frame_XXX variables should NOT be updated with the
 *      values of x,y,w,h prior to calling this routine, since the new
 *      values are compared against the old to see whether a synthetic
 *      ConfigureNotify event should be sent.  (It should be sent if the
 *      window was moved but not resized.)
 *
 */
void
DEC_ConfigureDecorations(ScreenInfo *scr, MwmWindow *tmp_win,
			 int x, int y, int w, int h, Boolean sendEvent)
{
    XEvent client_event;
    XWindowChanges frame_wc, xwc;
    unsigned long frame_mask, xwcm;
    int cx, cy, i;
    Bool Resized = False;
    MwmWindow *t;
    int xwidth, ywidth;

    /* if windows is not being maximized, save size in case of maximization */
    if (!(tmp_win->flags & MAXIMIZED))
    {
	tmp_win->orig_x = x;
	tmp_win->orig_y = y;
	tmp_win->orig_wd = w;
	tmp_win->orig_ht = h;
    }

    /* make sure we stay on the screen -- used to be DontMoveOff */
    if (x + scr->virt_x + w < 16)
	x = 16 - scr->virt_x - w;
    if (y + scr->virt_y + h < 16)
	y = 16 - scr->virt_y - h;

    if (x >= scr->d_width + scr->virt_x_max - scr->virt_x - 16)
	x = scr->d_width + scr->virt_x_max - scr->virt_x - 16;
    if (y >= scr->d_height + scr->virt_y_max - scr->virt_y - 16)
	y = scr->d_height + scr->virt_y_max - scr->virt_y - 16;

    /*
     * According to the July 27, 1988 ICCCM draft, we should send a
     * "synthetic" ConfigureNotify event to the client if the window
     * was moved but not resized.
     */
    if ((x != tmp_win->frame_x || y != tmp_win->frame_y) &&
	(w == tmp_win->frame_width && h == tmp_win->frame_height))
	sendEvent = True;

    if ((w != tmp_win->frame_width) || (h != tmp_win->frame_height))
	Resized = True;

    if (Resized)
    {
	if (tmp_win->menub != None && tmp_win->minimizeb != None &&
	    tmp_win->maximizeb != None)
	{
	    tmp_win->title_width = w - 3 * tmp_win->title_height -
		2 * tmp_win->boundary_width + tmp_win->bw;
	}
	else if ((tmp_win->menub != None && tmp_win->minimizeb != None) ||
		 (tmp_win->menub != None && tmp_win->maximizeb != None) ||
		 (tmp_win->menub != None && tmp_win->minimizeb != None))
	{
	    tmp_win->title_width = w - 2 * tmp_win->title_height -
		2 * tmp_win->boundary_width + tmp_win->bw;
	}
	else if ((tmp_win->menub != None) || (tmp_win->minimizeb != None) ||
		 (tmp_win->maximizeb != None))
	{
	    tmp_win->title_width = w - 1 * tmp_win->title_height -
		2 * tmp_win->boundary_width + tmp_win->bw;
	}
	else
	{
	    tmp_win->title_width = w - 2 * tmp_win->boundary_width +
		tmp_win->bw;
	}


	if (tmp_win->title_width < 1)
	    tmp_win->title_width = 1;

	if (tmp_win->decorations & MWM_DECOR_TITLE)
	{
	    xwcm = CWWidth | CWX | CWY;

	    if (tmp_win->menub != None)
		tmp_win->title_x = tmp_win->boundary_width +
		    (1) * tmp_win->title_height;
	    else
		tmp_win->title_x = tmp_win->boundary_width;

	    if (tmp_win->title_x >= w - tmp_win->boundary_width)
		tmp_win->title_x = -10;
	    tmp_win->title_y = tmp_win->boundary_width;

	    xwc.width = tmp_win->title_width;
	    xwc.x = tmp_win->title_x;
	    xwc.y = tmp_win->title_y;
	    XConfigureWindow(dpy, tmp_win->title, xwcm, &xwc);
	}

	if (tmp_win->decorations & MWM_DECOR_MENU)
	{
	    xwcm = CWX | CWY;
	    xwc.x = tmp_win->boundary_width;
	    xwc.y = tmp_win->boundary_width;

	    if (tmp_win->menub != None)
	    {
		if (xwc.x + tmp_win->title_height < w - tmp_win->boundary_width)
		    XConfigureWindow(dpy, tmp_win->menub, xwcm, &xwc);
		else
		{
		    xwc.x = -tmp_win->title_height;
		    XConfigureWindow(dpy, tmp_win->menub, xwcm, &xwc);
		}
		xwc.x += tmp_win->title_height;
	    }
	}

	/* Note that we set X here.  That's because MINIMIZE will use what's
	 * computed by maximize (if it's around) to adjust it's right margin */
	xwc.x = w - tmp_win->boundary_width + tmp_win->bw;
	if (tmp_win->decorations & MWM_DECOR_MAXIMIZE)
	{
	    xwcm = CWX | CWY;
	    xwc.y = tmp_win->boundary_width;

	    if (tmp_win->maximizeb != None)
	    {
		xwc.x -= tmp_win->title_height;
		if (xwc.x > tmp_win->boundary_width)
		    XConfigureWindow(dpy, tmp_win->maximizeb, xwcm, &xwc);
		else
		{
		    xwc.x = -tmp_win->title_height;
		    XConfigureWindow(dpy, tmp_win->maximizeb, xwcm, &xwc);
		}
	    }
	}

	if (tmp_win->decorations & MWM_DECOR_MINIMIZE)
	{
	    xwcm = CWX | CWY;
	    /* note that X doesn't appear here.  See comment in paragraph
	     * above */
	    xwc.y = tmp_win->boundary_width;

	    if (tmp_win->minimizeb != None)
	    {
		xwc.x -= tmp_win->title_height;
		if (xwc.x > tmp_win->boundary_width)
		    XConfigureWindow(dpy, tmp_win->minimizeb, xwcm, &xwc);
		else
		{
		    xwc.x = -tmp_win->title_height;
		    XConfigureWindow(dpy, tmp_win->minimizeb, xwcm, &xwc);
		}
	    }
	}

	if (tmp_win->decorations & MWM_DECOR_BORDER)
	{
	    xwcm = CWWidth | CWHeight | CWX | CWY;
	    xwidth = w - 2 * tmp_win->corner_width + tmp_win->bw;
	    ywidth = h - 2 * tmp_win->corner_width;

	    if (xwidth < 2)
		xwidth = 2;
	    if (ywidth < 2)
		ywidth = 2;

	    for (i = 0; i < 4; i++)
	    {
		if (i == 0)
		{
		    xwc.x = tmp_win->corner_width;
		    xwc.y = 0;
		    xwc.height = tmp_win->boundary_width;
		    xwc.width = xwidth;
		}
		else if (i == 1)
		{
		    xwc.x = w - tmp_win->boundary_width + tmp_win->bw;
		    xwc.y = tmp_win->corner_width;
		    xwc.width = tmp_win->boundary_width;
		    xwc.height = ywidth;

		}
		else if (i == 2)
		{
		    xwc.x = tmp_win->corner_width;
		    xwc.y = h - tmp_win->boundary_width + tmp_win->bw;
		    xwc.height = tmp_win->boundary_width + tmp_win->bw;
		    xwc.width = xwidth;
		}
		else
		{
		    xwc.x = 0;
		    xwc.y = tmp_win->corner_width;
		    xwc.width = tmp_win->boundary_width;
		    xwc.height = ywidth;
		}
		XConfigureWindow(dpy, tmp_win->sides[i], xwcm, &xwc);
	    }
	}

	if (tmp_win->decorations & MWM_DECOR_RESIZEH)
	{
	    xwcm = CWX | CWY;

	    for (i = 0; i < 4; i++)
	    {
		if (i % 2)
		    xwc.x = w - tmp_win->corner_width + tmp_win->bw;
		else
		    xwc.x = 0;

		if (i / 2)
		    xwc.y = h - tmp_win->corner_width;
		else
		    xwc.y = 0;

		XConfigureWindow(dpy, tmp_win->corners[i], xwcm, &xwc);
	    }
	}
    }

    tmp_win->attr.width = w - 2 * tmp_win->boundary_width -
	2 * tmp_win->matte_width;
    tmp_win->attr.height = h - tmp_win->title_height -
	2 * tmp_win->boundary_width -
	2 * tmp_win->matte_width;
    /* may need to omit the -1 for shaped windows, next two lines */
    cx = tmp_win->boundary_width - tmp_win->bw;
    cy = tmp_win->title_height + tmp_win->boundary_width - tmp_win->bw;

    XMoveResizeWindow(dpy, tmp_win->w,
		      tmp_win->matte_width, tmp_win->matte_width,
		      tmp_win->attr.width, tmp_win->attr.height);
    XMoveResizeWindow(dpy, tmp_win->parent, cx, cy,
		      tmp_win->attr.width + 2 * tmp_win->matte_width,
		      tmp_win->attr.height + 2 * tmp_win->matte_width);
    XMoveResizeWindow(dpy, tmp_win->shield, cx, cy,
		      tmp_win->attr.width + 2 * tmp_win->matte_width,
		      tmp_win->attr.height + 2 * tmp_win->matte_width);

    /* 
     * fix up frame and assign size/location values in tmp_win
     */
    frame_wc.x = tmp_win->frame_x = x;
    frame_wc.y = tmp_win->frame_y = y;
    frame_wc.width = tmp_win->frame_width = w;
    frame_wc.height = tmp_win->frame_height = h;
    frame_mask = (CWX | CWY | CWWidth | CWHeight);
    XConfigureWindow(dpy, tmp_win->frame, frame_mask, &frame_wc);


    if ((Resized) && (tmp_win->wShaped))
    {
	DEC_SetShape(tmp_win, w);
    }
    XSync(dpy, 0);
    if (sendEvent)
    {
	client_event.type = ConfigureNotify;
	client_event.xconfigure.display = dpy;
	client_event.xconfigure.event = tmp_win->w;
	client_event.xconfigure.window = tmp_win->w;

	client_event.xconfigure.x = x + tmp_win->boundary_width +
	    tmp_win->matte_width;
	client_event.xconfigure.y = y + tmp_win->title_height +
	    tmp_win->boundary_width +
	    tmp_win->matte_width;
	client_event.xconfigure.width = w - 2 * tmp_win->boundary_width -
	    2 * tmp_win->matte_width;
	client_event.xconfigure.height = h - tmp_win->title_height -
	    2 * tmp_win->boundary_width -
	    2 * tmp_win->matte_width;

	client_event.xconfigure.border_width = tmp_win->bw;
	/* Real ConfigureNotify events say we're above title window, so ... */
	/* what if we don't have a title ????? */
	client_event.xconfigure.above = tmp_win->frame;
	client_event.xconfigure.override_redirect = False;
	XSendEvent(dpy, tmp_win->w, False, StructureNotifyMask, &client_event);
    }
    if (tmp_win == scr->mwm_pager)
    {
	PAGER_UpdateViewPort(scr);
	for (t = scr->mwm_root.next; t != NULL; t = t->next)
	{
	    PAGER_UpdateView(scr, t);
	}
    }
    else
	PAGER_UpdateView(scr, tmp_win);
}



/*
 *  draws the title bar
 */
void
DEC_DrawTitleBar(ScreenInfo *scr, MwmWindow *t, Bool onoroff, Bool NewTitle)
{
    int hor_off, w;
    GC ReliefGC, ShadowGC;
    Pixel Forecolor, BackColor;

    if (!t)
	return;
    if (!(t->decorations & MWM_DECOR_TITLE))
	return;

    if (onoroff)
    {
	Forecolor = scr->components[MWM_TITLE_A].active_foreground;
	BackColor = scr->components[MWM_TITLE_A].active_background;
	ReliefGC = scr->pressed_win == t->title
	    ? scr->components[MWM_TITLE_A].active_bot_GC
	    : scr->components[MWM_TITLE_A].active_top_GC;
	ShadowGC = scr->pressed_win == t->title
	    ? scr->components[MWM_TITLE_A].active_top_GC
	    : scr->components[MWM_TITLE_A].active_bot_GC;
    }
    else
    {
	Forecolor = scr->components[MWM_TITLE_A].foreground;
	BackColor = scr->components[MWM_TITLE_A].background;
	ReliefGC = scr->pressed_win == t->title
	    ? scr->components[MWM_TITLE_A].bot_GC
	    : scr->components[MWM_TITLE_A].top_GC;
	ShadowGC = scr->pressed_win == t->title
	    ? scr->components[MWM_TITLE_A].top_GC
	    : scr->components[MWM_TITLE_A].bot_GC;
    }
    MISC_FlushExpose(t->title);

    if (t->name != (char *)NULL)
    {
	w = XTextWidth(scr->components[MWM_TITLE_A].font,
		       t->name, strlen(t->name));
	if (w > t->title_width - 12)
	    w = t->title_width - 4;
	if (w < 0)
	    w = 0;
    }
    else
	w = 0;


    hor_off = (t->title_width - w) / 2;

    if (NewTitle)
	XClearWindow(dpy, t->title);

    if (t->name != (char *)NULL)
    {
	if (Mwm.clean_text)
	{
	    XClearArea(dpy, t->title,
		       hor_off - 2, 0, w + 4, t->title_height, False);
	}

	XDrawString(dpy, t->title,
		    onoroff
		    ? scr->components[MWM_TITLE_A].active_GC
		    : scr->components[MWM_TITLE_A].normal_GC,
		    hor_off,
		    scr->components[MWM_TITLE_A].f_y + 1,
		    t->name, strlen(t->name));

	DEC_DrawShadows(t, t->title, 0, 0, t->title_width, t->title_height,
			ReliefGC, ShadowGC);
    }

    XFlush(dpy);
}

/*
 * draws the windows decorations
 */
void
DEC_DrawDecorations(ScreenInfo *scr, MwmWindow *t,
		    Bool onoroff, Bool force, Bool Mapped, Window expose_win)
{
    Window w = None;
    int y, x;
    Bool NewColor = False;
    XSetWindowAttributes attributes;
    unsigned long valuemask;
    GC top_GC, bot_GC;

    if (!t)
	return;

    if (onoroff)
    {
	/* don't re-draw just for kicks */
	if ((!force) && (scr->mwm_highlight == t))
	    return;

	if (scr->mwm_highlight != t)
	    NewColor = True;

	/* make sure that the previously highlighted window got unhighlighted */
	if ((scr->mwm_highlight != t) && (scr->mwm_highlight != NULL))
	    DEC_DrawDecorations(scr, scr->mwm_highlight, False, False, True, None);

	/* set the keyboard focus */
	if ((Mapped) && (t->flags & MAPPED) && (scr->mwm_highlight != t))
	    w = t->w;
	else if ((t->flags & ICONIFIED) && scr->mwm_highlight != t)
	    w = t->icon_w;
	scr->mwm_highlight = t;
    }
    else
    {
	/* don't re-draw just for kicks */
	if ((!force) && (scr->mwm_highlight != t))
	    return;

	if (scr->mwm_highlight == t)
	{
	    scr->mwm_highlight = NULL;
	    NewColor = True;
	}
    }

    if ((scr->pager_win) && !(t->flags & STICKY))
    {
	if (NewColor)
	{
	    if (scr->components[MWM_PAGER].background_pixmap
		!= XmUNSPECIFIED_PIXMAP)
		XSetWindowBackgroundPixmap(dpy,
					   t->pager_view,
				 scr->components[MWM_PAGER].background_pixmap);
	    else
		XSetWindowBackground(dpy, t->pager_view,
				     scr->components[MWM_PAGER].background);
	    XClearWindow(dpy, t->pager_view);
	}

	if ((t->icon_image != NULL) &&
	    (scr->components[MWM_PAGER].f_height > 0))
	{
	    XDrawImageString(dpy, t->pager_view,
			     scr->components[MWM_PAGER].normal_GC,
			     2, scr->components[MWM_PAGER].f_y + 2,
			     t->icon_image, strlen(t->icon_image));
	}
    }

    if (t->flags & ICONIFIED)
    {
	ICON_DrawWindow(scr, t);
	return;
    }

    set_value_attributes(scr, t, &valuemask, &attributes, &scr->components[MWM_BORDER]);

    if (t->decorations & (MWM_DECOR_TITLE | MWM_DECOR_BORDER))
    {
	XSetWindowBorder(dpy, t->parent, attributes.background_pixel);
	XSetWindowBorder(dpy, t->frame, attributes.background_pixel);
    }


    if (t->decorations & MWM_DECOR_TITLE)
    {
	set_value_attributes(scr, t, &valuemask, &attributes, &scr->components[MWM_TITLE_A]);
	if (NewColor)
	{
	    XChangeWindowAttributes(dpy, t->title, valuemask, &attributes);
	    XClearWindow(dpy, t->title);
	}
    }
    if (t->decorations & MWM_DECOR_MENU)
    {
	if (t->menub != None)
	{
	    set_value_attributes(scr, t, &valuemask, &attributes, &scr->components[MWM_MENU_B]);
	    if (scr->mwm_highlight == t)
	    {
		top_GC = scr->components[MWM_MENU_B].active_top_GC;
		bot_GC = scr->components[MWM_MENU_B].active_bot_GC;
	    }
	    else
	    {
		top_GC = scr->components[MWM_MENU_B].top_GC;
		bot_GC = scr->components[MWM_MENU_B].bot_GC;
	    }
	    if (NewColor)
	    {
		XChangeWindowAttributes(dpy, t->menub, valuemask, &attributes);
		XClearWindow(dpy, t->menub);
	    }
	    if (MISC_FlushExpose(t->menub) || (expose_win == t->menub) ||
		(expose_win == None))
	    {
		DEC_DrawShadows(t, t->menub, 0, 0, t->title_height,
				t->title_height,
				(scr->pressed_win == t->menub
				 ? bot_GC
				 : top_GC),
				(scr->pressed_win == t->menub
				 ? top_GC
				 : bot_GC));
		draw_pattern(t->menub, top_GC, bot_GC,
			     lbut_styles[0],
			     lbut_styles[1],
			     t->title_height);
	    }
	}
    }

    if (t->decorations & MWM_DECOR_MAXIMIZE)
    {
	if (t->maximizeb != None)
	{
	    set_value_attributes(scr, t, &valuemask, &attributes,
				 &scr->components[MWM_MAXIMIZE_B]);
	    if (NewColor)
	    {
		XChangeWindowAttributes(dpy, t->maximizeb, valuemask, &attributes);
		XClearWindow(dpy, t->maximizeb);
	    }
	    if (scr->mwm_highlight == t)
	    {
		top_GC = scr->components[MWM_MAXIMIZE_B].active_top_GC;
		bot_GC = scr->components[MWM_MAXIMIZE_B].active_bot_GC;
	    }
	    else
	    {
		top_GC = scr->components[MWM_MAXIMIZE_B].top_GC;
		bot_GC = scr->components[MWM_MAXIMIZE_B].bot_GC;
	    }
	    if (MISC_FlushExpose(t->maximizeb) || (expose_win == t->maximizeb) ||
		(expose_win == None))
	    {
		DEC_DrawShadows(t, t->maximizeb, 0, 0, t->title_height,
				t->title_height,
				(scr->pressed_win == t->maximizeb
				 ? bot_GC
				 : top_GC),
				(scr->pressed_win == t->maximizeb
				 ? top_GC
				 : bot_GC));
		draw_pattern(t->maximizeb, top_GC, bot_GC,
			     rbut_style_max[0],
			     rbut_style_max[1],
			     t->title_height);
	    }
	}
    }

    if (t->decorations & MWM_DECOR_MINIMIZE)
    {
	if (t->minimizeb != None)
	{
	    set_value_attributes(scr, t, &valuemask, &attributes, &scr->components[MWM_MINIMIZE_B]);
	    if (NewColor)
	    {
		XChangeWindowAttributes(dpy, t->minimizeb, valuemask, &attributes);
		XClearWindow(dpy, t->minimizeb);
	    }
	    if (scr->mwm_highlight == t)
	    {
		top_GC = scr->components[MWM_MINIMIZE_B].active_top_GC;
		bot_GC = scr->components[MWM_MINIMIZE_B].active_bot_GC;
	    }
	    else
	    {
		top_GC = scr->components[MWM_MINIMIZE_B].top_GC;
		bot_GC = scr->components[MWM_MINIMIZE_B].bot_GC;
	    }
	    if (MISC_FlushExpose(t->minimizeb) || (expose_win == t->minimizeb) ||
		(expose_win == None))
	    {
		DEC_DrawShadows(t, t->minimizeb, 0, 0, t->title_height,
				t->title_height,
				(scr->pressed_win == t->minimizeb
				 ? bot_GC
				 : top_GC),
				(scr->pressed_win == t->minimizeb
				 ? top_GC
				 : bot_GC));
		draw_pattern(t->minimizeb, top_GC, bot_GC,
			     rbut_style_min[0],
			     rbut_style_min[1],
			     t->title_height);
	    }
	}
    }

    if (t->decorations & MWM_DECOR_TITLE)
	DEC_DrawTitleBar(scr, t, onoroff, False);

    if (t->decorations & MWM_DECOR_BORDER)
    {
	int i;

	/* draw relief lines */
	y = t->frame_height - 2 * t->corner_width;
	x = t->frame_width - 2 * t->corner_width + t->bw;

	for (i = 0; i < 4; i++)
	{
	    set_value_attributes(scr, t, &valuemask, &attributes, &scr->components[MWM_BORDER]);
	    if (NewColor)
	    {
		XChangeWindowAttributes(dpy, t->sides[i], valuemask, &attributes);
		XClearWindow(dpy, t->sides[i]);
	    }
	    if (scr->mwm_highlight == t)
	    {
		top_GC = scr->components[MWM_BORDER].active_top_GC;
		bot_GC = scr->components[MWM_BORDER].active_bot_GC;
	    }
	    else
	    {
		top_GC = scr->components[MWM_BORDER].top_GC;
		bot_GC = scr->components[MWM_BORDER].bot_GC;
	    }

	    if ((MISC_FlushExpose(t->sides[i])) || (expose_win == t->sides[i]) ||
		(expose_win == None))
	    {
		GC sgc, rgc;

		sgc = bot_GC;
		rgc = top_GC;
		/* index    side
		 * 0        TOP
		 * 1        RIGHT
		 * 2        BOTTOM
		 * 3        LEFT
		 */

		if (t->decorations & MWM_DECOR_RESIZEH)
		    DEC_DrawShadows(t, t->sides[i], 0, 0,
				    ((i % 2) ? t->boundary_width : x),
				    ((i % 2) ? y : t->boundary_width),
				    rgc, sgc);
		else
		    DEC_DrawBorder(t, t->sides[i], 0, 0,
				   ((i % 2) ? t->boundary_width : x),
				   ((i % 2) ? y : t->boundary_width),
				   rgc, sgc);
	    }
	}
    }


    if (t->decorations & MWM_DECOR_RESIZEH)
    {
	int i;

	/* draw relief lines */
	y = t->frame_height - 2 * t->corner_width;
	x = t->frame_width - 2 * t->corner_width + t->bw;

	for (i = 0; i < 4; i++)
	{
	    set_value_attributes(scr, t, &valuemask, &attributes, &scr->components[MWM_RESIZE_H]);
	    if (NewColor)
	    {
		XChangeWindowAttributes(dpy, t->corners[i], valuemask, &attributes);
		XClearWindow(dpy, t->corners[i]);
	    }
	    if (scr->mwm_highlight == t)
	    {
		top_GC = scr->components[MWM_RESIZE_H].active_top_GC;
		bot_GC = scr->components[MWM_RESIZE_H].active_bot_GC;
	    }
	    else
	    {
		top_GC = scr->components[MWM_RESIZE_H].top_GC;
		bot_GC = scr->components[MWM_RESIZE_H].bot_GC;
	    }
	    if ((MISC_FlushExpose(t->corners[i])) ||
		(expose_win == t->corners[i]) || (expose_win == None))
	    {
		GC rgc, sgc;

		rgc = top_GC;
		sgc = bot_GC;
		DEC_DrawShadows(t, t->corners[i], 0, 0, t->corner_width,
				(i / 2)
				? t->corner_width + t->bw
				: t->corner_width,
				rgc, sgc);
		if (t->boundary_width > 1)
		    draw_corners(t, i, ((i / 2) ? rgc : sgc), ((i % 2) ? rgc : sgc));
		else
		    draw_corners(t, i, ((i / 2) ? sgc : sgc), ((i % 2) ? sgc : sgc));
	    }
	}
    }

    if (t->matte_width > 1)
    {
	if (MISC_FlushExpose(t->parent) || expose_win == t->parent ||
	    expose_win == None)
	{
	    XGCValues gcv;
	    unsigned long gcm;

	    if (t->matte_bottom_shadow_pixmap != None &&
		t->matte_bottom_shadow_pixmap != XmUNSPECIFIED_PIXMAP)
	    {
		gcm = GCTile | GCFillStyle;

		gcv.tile = t->matte_bottom_shadow_pixmap;
		gcv.fill_style = FillTiled;
	    }
	    else
	    {
		gcm = GCForeground | GCBackground;

		gcv.foreground = t->matte_bottom_shadow_color;
		gcv.background = t->matte_background;
	    }
	    gcm |= GCLineWidth | GCLineStyle | GCCapStyle | GCGraphicsExposures;
	    gcv.line_width = 0;
	    gcv.line_style = LineSolid;
	    gcv.cap_style = CapButt;
	    gcv.graphics_exposures = False;
	    XChangeGC(dpy, scr->matte_bs_GC, gcm, &gcv);

	    if (t->matte_top_shadow_pixmap != None &&
		t->matte_top_shadow_pixmap != XmUNSPECIFIED_PIXMAP)
	    {
		gcm = GCTile | GCFillStyle;

		gcv.tile = t->matte_top_shadow_pixmap;
		gcv.fill_style = FillTiled;
	    }
	    else
	    {
		gcm = GCForeground | GCBackground;

		gcv.foreground = t->matte_top_shadow_color;
		gcv.background = t->matte_background;
	    }
	    gcm |= GCLineWidth | GCLineStyle | GCCapStyle | GCGraphicsExposures;
	    gcv.line_width = 0;
	    gcv.line_style = LineSolid;
	    gcv.cap_style = CapButt;
	    gcv.graphics_exposures = False;
	    XChangeGC(dpy, scr->matte_ts_GC, gcm, &gcv);

	    if (t->matte_width > 3)
	    {
		DEC_DrawShadows(t, t->parent, 0, 0,
				t->attr.width + 2 * t->matte_width,
				t->attr.height + 2 * t->matte_width,
				scr->matte_ts_GC, scr->matte_bs_GC);
		relieve_rectangle(t->parent,
				  t->matte_width - 2, t->matte_width - 2,
				  t->attr.width + 4, t->attr.height + 4,
				  scr->matte_bs_GC, scr->matte_ts_GC);
	    }
	    else
	    {
		DEC_DrawShadows(t, t->parent,
				t->matte_width - 2, t->matte_width - 2,
				t->attr.width + 3, t->attr.height + 3,
				scr->matte_bs_GC, scr->matte_ts_GC);
	    }
	}
    }

    if (!(t->decorations & MWM_DECOR_BORDER))
    {				/* no decorative border */
	/* for mono - put a black border on 
	 * for color, make it the color of the decoration background */
	if (t->boundary_width < 2)
	{
	    MISC_FlushExpose(t->frame);
	    XSetWindowBorder(dpy, t->frame, scr->components[MWM_BORDER].background);
	    XSetWindowBorder(dpy, t->parent, scr->components[MWM_BORDER].background);
	    if (scr->components[MWM_BORDER].background_pixmap)
		XSetWindowBackgroundPixmap(dpy, t->frame, scr->components[MWM_BORDER].background_pixmap);
	    XClearWindow(dpy, t->frame);
	    if (scr->components[MWM_BORDER].background_pixmap)
		XSetWindowBackgroundPixmap(dpy, t->parent, scr->components[MWM_BORDER].background_pixmap);
	    XClearWindow(dpy, t->parent);
	}
	else
	{
	    GC rgc, sgc;

	    if (scr->mwm_highlight == t)
	    {
		top_GC = scr->components[MWM_BORDER].active_top_GC;
		bot_GC = scr->components[MWM_BORDER].active_bot_GC;
	    }
	    else
	    {
		top_GC = scr->components[MWM_BORDER].top_GC;
		bot_GC = scr->components[MWM_BORDER].bot_GC;
	    }
	    XSetWindowBorder(dpy, t->parent, scr->components[MWM_BORDER].background);
	    XSetWindowBorder(dpy, t->frame, scr->components[MWM_BORDER].background);

	    rgc = top_GC;
	    sgc = bot_GC;
	    if (NewColor)
	    {
		XChangeWindowAttributes(dpy, t->frame, valuemask, &attributes);
		XClearWindow(dpy, t->frame);
	    }
	    if ((MISC_FlushExpose(t->frame)) || (expose_win == t->frame) ||
		(expose_win == None))
	    {
		if (t->boundary_width > 2)
		{
		    DEC_DrawShadows(t, t->frame, t->boundary_width - 1 - t->bw,
				    t->boundary_width - 1 - t->bw,
				    t->frame_width -
				    (t->boundary_width << 1) + 2 + 3 * t->bw,
				    t->frame_height -
				    (t->boundary_width << 1) + 2 + 3 * t->bw,
				    sgc, rgc);
		    DEC_DrawShadows(t, t->frame, 0, 0, t->frame_width + t->bw,
				    t->frame_height + t->bw, rgc, sgc);
		}
		else
		{
		    DEC_DrawShadows(t, t->frame, 0, 0, t->frame_width + t->bw,
				    t->frame_height + t->bw, rgc, rgc);
		}
	    }
	    else
	    {
		XSetWindowBackground(dpy, t->parent, scr->components[MWM_BORDER].background);
	    }
	}
    }
}

/*
 * set up the shaped window borders 
 */
void
DEC_SetShape(MwmWindow *tmp_win, int w)
{
    XRectangle rect;

    XShapeCombineShape(dpy, tmp_win->frame, ShapeBounding,
		       tmp_win->boundary_width,
		       tmp_win->title_height + tmp_win->boundary_width,
		       tmp_win->w,
		       ShapeBounding, ShapeSet);
    if (tmp_win->title)
    {
	/* windows w/ titles */
	rect.x = tmp_win->boundary_width;
	rect.y = tmp_win->title_y;
	rect.width = w - 2 * tmp_win->boundary_width + tmp_win->bw;
	rect.height = tmp_win->title_height;


	XShapeCombineRectangles(dpy, tmp_win->frame, ShapeBounding,
				0, 0, &rect, 1, ShapeUnion, Unsorted);
    }
}
lesstif-current/clients/Motif-1.2/mwm/defaults.c100664   1005    764       37315  6441111435  21323 0ustar  u27113lesstifdev/**
 *
 * $Id: defaults.c,v 1.2 1997/07/12 18:36:35 miers Exp $
 *
 * Copyright (C) 1995 Free Software Foundation, Inc.
 *
 * This file is part of the GNU LessTif Library.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 **/
#include "mwm.h"
#include "mwmstrings.h"

/*
 * This stuff will get used as I write stuff
 *
 Icons
 "Pack Icons" _P  Shift Alt<Key>F7 f.pack_icons
 XBMLANGPATH
 * function names came from running strings against mwm on Solaris
 */
void *working_base = NULL;
ScreenInfo *rscr = NULL;

#if 1
extern void __XmRGB2HSV();
#else
#define FLOOR(x) ((int)((x) - 0.5) > (x) ? (x) : (x)-1)

/* Convert between RGB and HSV */
void
__XmRGB2HSV(unsigned short r,
	    unsigned short g,
	    unsigned short b,
	    double *hr,
	    double *sr,
	    double *vr)
{
    double rd, gd, bd, max, min, del;
    double rc, gc, bc;
    double v, h, s;

    /* convert RGB to HSV */
    rd = r / 65535.0;		/* rd,gd,bd range 0-1 instead of 0-65535 */
    gd = g / 65535.0;
    bd = b / 65535.0;

    /* compute maximum of rd,gd,bd */
    if (rd >= gd)
    {
	if (rd >= bd)
	    max = rd;
	else
	    max = bd;
    }
    else
    {
	if (gd >= bd)
	    max = gd;
	else
	    max = bd;
    }

    /* compute minimum of rd,gd,bd */
    if (rd <= gd)
    {
	if (rd <= bd)
	    min = rd;
	else
	    min = bd;
    }
    else
    {
	if (gd <= bd)
	    min = gd;
	else
	    min = bd;
    }


    del = max - min;
    v = max;
    if (max != 0.0)
	s = (del) / max;
    else
	s = 0.0;

    h = -1;
    if (s != 0.0)
    {
	rc = (max - rd) / del;
	gc = (max - gd) / del;
	bc = (max - bd) / del;

	if (rd == max)
	    h = bc - gc;
	else if (gd == max)
	    h = 2 + rc - bc;
	else if (bd == max)
	    h = 4 + gc - rc;

	h = h * 60;
	if (h < 0)
	    h += 360;
    }

    *hr = h;
    *sr = s;
    *vr = v;
}
#endif

void
_WmMultiClickTimeDefault(Widget widget, int offset, XrmValue *val)
{
    static int time;

    time = XtGetMultiClickTime(dpy);
    val->addr = (XtPointer)&time;
}

void
_WmDefaultBorderWidth(Widget widget, int offset, XrmValue *val)
{
    static Dimension border_width;

    border_width = 5;
    val->addr = (XtPointer)&border_width;
}

void
_WmDefaultResizeBorderWidth(Widget widget, int offset, XrmValue *val)
{
    static Dimension border_width;

    border_width = Mwm.frame_border_width + 3;
    val->addr = (XtPointer)&border_width;
}

void
_WmFocusAutoRaiseDefault(Widget widget, int offset, XrmValue *val)
{
    static Boolean raise;

    if (Mwm.keyboard_focus_policy == XmEXPLICIT)
	raise = True;
    else if (Mwm.keyboard_focus_policy == XmPOINTER)
	raise = False;
    else
    {
	_XmWarning(toplevel, "Keyboard Focus Policy is unknown.\n");
	raise = True;
    }
    val->addr = (XtPointer)&raise;
}

void
_WmIconImageBDefault(Widget widget, int offset, XrmValue *val)
{
    val->addr = (XtPointer)&rscr->components[MWM_ICON].background;
}

void
_WmIconImageBSCDefault(Widget widget, int offset, XrmValue *val)
{
    val->addr = (XtPointer)&rscr->components[MWM_ICON].bottom_shadow_color;
}

void
_WmIconImageBSPDefault(Widget widget, int offset, XrmValue *val)
{
    val->addr = (XtPointer)&rscr->components[MWM_ICON].bottom_shadow_pixmap;
}

void
_WmIconImageFDefault(Widget widget, int offset, XrmValue *val)
{
    val->addr = (XtPointer)&rscr->components[MWM_ICON].foreground;
}

void
_WmIconImageTSCDefault(Widget widget, int offset, XrmValue *val)
{
    val->addr = (XtPointer)&rscr->components[MWM_ICON].top_shadow_color;
}

void
_WmIconImageTSPDefault(Widget widget, int offset, XrmValue *val)
{
    val->addr = (XtPointer)&rscr->components[MWM_ICON].top_shadow_pixmap;
}

void
_WmMatteBDefault(Widget widget, int offset, XrmValue *val)
{
    static XColor backgroundColor;

    if (!XParseColor(XtDisplay(toplevel),
		     DefaultColormap(dpy, rscr->screen),
		     "LightGrey",
		     &backgroundColor))
    {
	if (!XParseColor(XtDisplay(toplevel),
			 DefaultColormap(dpy, rscr->screen),
			 "#A8A8A8A8A8A8",
			 &backgroundColor))
	{
	    backgroundColor.pixel = WhitePixel(dpy, rscr->screen);
	}
	else
	{
	    XAllocColor(XtDisplay(toplevel),
			DefaultColormap(dpy, rscr->screen),
			&backgroundColor);
	}
    }
    else
    {
	XAllocColor(XtDisplay(toplevel),
		    DefaultColormap(dpy, rscr->screen),
		    &backgroundColor);
    }

    val->addr = (XtPointer)&backgroundColor.pixel;
}

void
_WmMatteBSCDefault(Widget widget, int offset, XrmValue *val)
{
    XColor _widgetBackground;
    static XColor bottomShadowColor;
    void *w = working_base;

    _widgetBackground.pixel = ((MwmWindow *)w)->matte_background;

    XQueryColor(XtDisplay(toplevel),
		DefaultColormap(dpy, rscr->screen),
		&_widgetBackground);

    bottomShadowColor.blue = _widgetBackground.blue * .5;
    bottomShadowColor.green = _widgetBackground.green * .5;
    bottomShadowColor.red = _widgetBackground.red * .5;

    if (!XAllocColor(XtDisplay(toplevel),
		     DefaultColormap(dpy, rscr->screen),
		     &bottomShadowColor))
	bottomShadowColor.pixel = WhitePixel(dpy, rscr->screen);

    val->addr = (XtPointer)&bottomShadowColor.pixel;
}

void
_WmMatteBSPDefault(Widget widget, int offset, XrmValue *val)
{
    static Pixmap pix = XmUNSPECIFIED_PIXMAP;

    val->addr = (XtPointer)&pix;
}

void
_WmMatteFDefault(Widget widget, int offset, XrmValue *val)
{
    double h, s, v;
    XColor _widgetBackground;
    static XColor foregroundColor;
    void *w = working_base;

    _widgetBackground.pixel = ((MwmWindow *)w)->matte_background;

    XQueryColor(XtDisplay(toplevel),
		DefaultColormap(dpy, rscr->screen),
		&_widgetBackground);

    __XmRGB2HSV(_widgetBackground.red,
		_widgetBackground.green,
		_widgetBackground.blue,
		&h, &s, &v);

    if (v < 0.5)
	foregroundColor.pixel = WhitePixel(dpy, rscr->screen);
    else
	foregroundColor.pixel = BlackPixel(dpy, rscr->screen);

    XQueryColor(XtDisplay(toplevel),
		DefaultColormap(dpy, rscr->screen),
		&foregroundColor);

    val->addr = (XtPointer)&foregroundColor.pixel;
}

void
_WmMatteTSCDefault(Widget widget, int offset, XrmValue *val)
{
    XColor _widgetBackground;
    static XColor topShadowColor;
    void *w = working_base;

    _widgetBackground.pixel = ((MwmWindow *)w)->matte_background;

    XQueryColor(XtDisplay(toplevel),
		DefaultColormap(dpy, rscr->screen),
		&_widgetBackground);

    if (_widgetBackground.red > 65535 / 1.5)
	topShadowColor.red = 65535;
    else
	topShadowColor.red = _widgetBackground.red * 1.5;

    if (_widgetBackground.green > 65535 / 1.5)
	topShadowColor.green = 65535;
    else
	topShadowColor.green = _widgetBackground.green * 1.5;

    if (_widgetBackground.blue > 65535 / 1.5)
	topShadowColor.blue = 65535;
    else
	topShadowColor.blue = _widgetBackground.blue * 1.5;


    if (!XAllocColor(XtDisplay(toplevel),
		     DefaultColormap(dpy, rscr->screen),
		     &topShadowColor))
	topShadowColor.pixel = WhitePixel(dpy, rscr->screen);

    val->addr = (XtPointer)&topShadowColor.pixel;
}

void
_WmMatteTSPDefault(Widget widget, int offset, XrmValue *val)
{
    static Pixmap pix = XmUNSPECIFIED_PIXMAP;

    val->addr = (XtPointer)&pix;
}

void
_WmBackgroundDefault(Widget widget, int offset, XrmValue *val)
{
    static XColor backgroundColor;
    ComponentInfo *comp = (ComponentInfo *)working_base;

    if (comp->type == MWM_MENU)
    {
	if (!XParseColor(XtDisplay(toplevel),
			 DefaultColormap(dpy, rscr->screen),
			 "#72729f9fffff",
			 &backgroundColor))
	{
	    backgroundColor.pixel = WhitePixel(dpy, rscr->screen);
	}
	else
	{
	    XAllocColor(XtDisplay(toplevel),
			DefaultColormap(dpy, rscr->screen),
			&backgroundColor);
	}

	val->addr = (XtPointer)&backgroundColor.pixel;
    }
    else if (comp->type == MWM_FEEDBACK)
    {
	if (!XParseColor(XtDisplay(toplevel),
			 DefaultColormap(dpy, rscr->screen),
			 "Cadet Blue",
			 &backgroundColor))
	{
	    if (!XParseColor(XtDisplay(toplevel),
			     DefaultColormap(dpy, rscr->screen),
			     "#5F5F92929E9E",
			     &backgroundColor))
	    {
		backgroundColor.pixel = WhitePixel(dpy, rscr->screen);
	    }
	    else
	    {
		XAllocColor(XtDisplay(toplevel),
			    DefaultColormap(dpy, rscr->screen),
			    &backgroundColor);
	    }
	}
	else
	{
	    XAllocColor(XtDisplay(toplevel),
			DefaultColormap(dpy, rscr->screen),
			&backgroundColor);
	}

	val->addr = (XtPointer)&backgroundColor.pixel;
    }
    else
    {
	if (!XParseColor(XtDisplay(toplevel),
			 DefaultColormap(dpy, rscr->screen),
			 "LightGrey",
			 &backgroundColor))
	{
	    if (!XParseColor(XtDisplay(toplevel),
			     DefaultColormap(dpy, rscr->screen),
			     "#A8A8A8A8A8A8",
			     &backgroundColor))
	    {
		backgroundColor.pixel = WhitePixel(dpy, rscr->screen);
	    }
	    else
	    {
		XAllocColor(XtDisplay(toplevel),
			    DefaultColormap(dpy, rscr->screen),
			    &backgroundColor);
	    }
	}
	else
	{
	    XAllocColor(XtDisplay(toplevel),
			DefaultColormap(dpy, rscr->screen),
			&backgroundColor);
	}
	val->addr = (XtPointer)&backgroundColor.pixel;
    }
}

void
_WmBackgroundPixmapDefault(Widget widget, int offset, XrmValue *val)
{
    static Pixmap pix = XmUNSPECIFIED_PIXMAP;

    val->addr = (XtPointer)&pix;
}

void
_WmBottomShadowColorDefault(Widget widget, int offset, XrmValue *val)
{
    XColor _widgetBackground;
    static XColor bottomShadowColor;
    void *w = working_base;

    _widgetBackground.pixel = ((ComponentInfo *)w)->background;

    XQueryColor(XtDisplay(toplevel),
		DefaultColormap(dpy, rscr->screen),
		&_widgetBackground);

    bottomShadowColor.blue = _widgetBackground.blue * .5;
    bottomShadowColor.green = _widgetBackground.green * .5;
    bottomShadowColor.red = _widgetBackground.red * .5;
    if (!XAllocColor(XtDisplay(toplevel),
		     DefaultColormap(dpy, rscr->screen),
		     &bottomShadowColor))
	bottomShadowColor.pixel = WhitePixel(dpy, rscr->screen);

    val->addr = (XtPointer)&bottomShadowColor.pixel;
}

void
_WmBottomShadowPixmapDefault(Widget widget, int offset, XrmValue *val)
{
    static Pixmap pix = XmUNSPECIFIED_PIXMAP;

    val->addr = (XtPointer)&pix;
}

void
_WmForegroundDefault(Widget widget, int offset, XrmValue *val)
{
    double h, s, v;
    XColor _widgetBackground;
    static XColor foregroundColor;
    void *w = working_base;

    _widgetBackground.pixel = ((ComponentInfo *)w)->background;

    XQueryColor(XtDisplay(toplevel),
		DefaultColormap(dpy, rscr->screen),
		&_widgetBackground);

    __XmRGB2HSV(_widgetBackground.red,
		_widgetBackground.green,
		_widgetBackground.blue,
		&h, &s, &v);

    if (v < 0.5)
	foregroundColor.pixel = WhitePixel(dpy, rscr->screen);
    else
	foregroundColor.pixel = BlackPixel(dpy, rscr->screen);

    XQueryColor(XtDisplay(toplevel),
		DefaultColormap(dpy, rscr->screen),
		&foregroundColor);

    val->addr = (XtPointer)&foregroundColor.pixel;
}

void
_WmTopShadowColorDefault(Widget widget, int offset, XrmValue *val)
{
    XColor _widgetBackground;
    static XColor topShadowColor;
    void *w = working_base;

    _widgetBackground.pixel = ((ComponentInfo *)w)->background;

    XQueryColor(XtDisplay(toplevel),
		DefaultColormap(dpy, rscr->screen),
		&_widgetBackground);

    if (_widgetBackground.red > 65535 / 1.5)
	topShadowColor.red = 65535;
    else
	topShadowColor.red = _widgetBackground.red * 1.5;

    if (_widgetBackground.green > 65535 / 1.5)
	topShadowColor.green = 65535;
    else
	topShadowColor.green = _widgetBackground.green * 1.5;

    if (_widgetBackground.blue > 65535 / 1.5)
	topShadowColor.blue = 65535;
    else
	topShadowColor.blue = _widgetBackground.blue * 1.5;


    if (!XAllocColor(XtDisplay(toplevel),
		     DefaultColormap(dpy, rscr->screen),
		     &topShadowColor))
	topShadowColor.pixel = WhitePixel(dpy, rscr->screen);

    val->addr = (XtPointer)&topShadowColor.pixel;
}

void
_WmTopShadowPixmapDefault(Widget widget, int offset, XrmValue *val)
{
    static Pixmap pix = XmUNSPECIFIED_PIXMAP;

    val->addr = (XtPointer)&pix;
}

void
_WmABackgroundDefault(Widget widget, int offset, XrmValue *val)
{
    static XColor backgroundColor;

    if (!XParseColor(XtDisplay(toplevel),
		     DefaultColormap(dpy, rscr->screen),
		     "Cadet Blue",
		     &backgroundColor))
    {
	if (!XParseColor(XtDisplay(toplevel),
			 DefaultColormap(dpy, rscr->screen),
			 "#5F5F92929E9E",
			 &backgroundColor))
	{
	    backgroundColor.pixel = WhitePixel(dpy, rscr->screen);
	}
	else
	{
	    XAllocColor(XtDisplay(toplevel),
			DefaultColormap(dpy, rscr->screen),
			&backgroundColor);
	}
    }
    else
    {
	XAllocColor(XtDisplay(toplevel),
		    DefaultColormap(dpy, rscr->screen),
		    &backgroundColor);
    }

    val->addr = (XtPointer)&backgroundColor.pixel;
}

void
_WmAForegroundDefault(Widget widget, int offset, XrmValue *val)
{
    double h, s, v;
    XColor _widgetBackground;
    static XColor foregroundColor;
    void *w = working_base;

    _widgetBackground.pixel = ((ComponentInfo *)w)->active_background;

    XQueryColor(XtDisplay(toplevel),
		DefaultColormap(dpy, rscr->screen),
		&_widgetBackground);

    __XmRGB2HSV(_widgetBackground.red,
		_widgetBackground.green,
		_widgetBackground.blue,
		&h, &s, &v);

    if (v < 0.5)
	foregroundColor.pixel = WhitePixel(dpy, rscr->screen);
    else
	foregroundColor.pixel = BlackPixel(dpy, rscr->screen);

    XQueryColor(XtDisplay(toplevel),
		DefaultColormap(dpy, rscr->screen),
		&foregroundColor);

    val->addr = (XtPointer)&foregroundColor.pixel;
}

void
_WmABottomShadowColorDefault(Widget widget, int offset, XrmValue *val)
{
    XColor _widgetBackground;
    static XColor bottomShadowColor;
    void *w = working_base;

    _widgetBackground.pixel = ((ComponentInfo *)w)->active_background;

    XQueryColor(XtDisplay(toplevel),
		DefaultColormap(dpy, rscr->screen),
		&_widgetBackground);

    bottomShadowColor.blue = _widgetBackground.blue * .5;
    bottomShadowColor.green = _widgetBackground.green * .5;
    bottomShadowColor.red = _widgetBackground.red * .5;

    if (!XAllocColor(XtDisplay(toplevel),
		     DefaultColormap(dpy, rscr->screen),
		     &bottomShadowColor))
	bottomShadowColor.pixel = WhitePixel(dpy, rscr->screen);

    val->addr = (XtPointer)&bottomShadowColor.pixel;
}

void
_WmATopShadowColorDefault(Widget widget, int offset, XrmValue *val)
{
    XColor _widgetBackground;
    static XColor topShadowColor;
    void *w = working_base;

    _widgetBackground.pixel = ((ComponentInfo *)w)->active_background;

    XQueryColor(XtDisplay(toplevel),
		DefaultColormap(dpy, rscr->screen),
		&_widgetBackground);

    if (_widgetBackground.red > 65535 / 1.5)
	topShadowColor.red = 65535;
    else
	topShadowColor.red = _widgetBackground.red * 1.5;

    if (_widgetBackground.green > 65535 / 1.5)
	topShadowColor.green = 65535;
    else
	topShadowColor.green = _widgetBackground.green * 1.5;

    if (_widgetBackground.blue > 65535 / 1.5)
	topShadowColor.blue = 65535;
    else
	topShadowColor.blue = _widgetBackground.blue * 1.5;


    if (!XAllocColor(XtDisplay(toplevel),
		     DefaultColormap(dpy, rscr->screen),
		     &topShadowColor))
	topShadowColor.pixel = WhitePixel(dpy, rscr->screen);

    val->addr = (XtPointer)&topShadowColor.pixel;
}

void
_WmABackgroundPixmapDefault(Widget widget, int offset, XrmValue *val)
{
    static Pixmap pix = XmUNSPECIFIED_PIXMAP;

    val->addr = (XtPointer)&pix;
}

void
_WmATopShadowPixmapDefault(Widget widget, int offset, XrmValue *val)
{
    static Pixmap pix = XmUNSPECIFIED_PIXMAP;

    val->addr = (XtPointer)&pix;
}
lesstif-current/clients/Motif-1.2/mwm/desktop.c100664   1005    764       16206  6441111436  21162 0ustar  u27113lesstifdev/*****************************************************************************/
/**       Copyright 1988 by Evans & Sutherland Computer Corporation,        **/
/**                          Salt Lake City, Utah                           **/
/**  Portions Copyright 1989 by the Massachusetts Institute of Technology   **/
/**                        Cambridge, 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  permis-    **/
/**    sion  notice appear in supporting  documentation,  and  that  the    **/
/**    names of Evans & Sutherland and M.I.T. not be used in advertising    **/
/**    in publicity pertaining to distribution of the  software  without    **/
/**    specific, written prior permission.                                  **/
/**                                                                         **/
/**    EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD    **/
/**    TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES  OF  MERCHANT-    **/
/**    ABILITY  AND  FITNESS,  IN  NO  EVENT SHALL EVANS & SUTHERLAND OR    **/
/**    M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL  DAM-    **/
/**    AGES 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.                                     **/
/*****************************************************************************/
/****************************************************************************
 * This module is based on Twm, but has been siginificantly modified 
 * by Rob Nation 
 ****************************************************************************/
/***********************************************************************
 * The rest of it is all my fault -- MLM
 * mwm - "LessTif Window Manager"
 ***********************************************************************/

#include "mwm.h"

/****************************************************************************
 *
 * <Desktop description>
 *
 ****************************************************************************/

/*
 * Unmaps a window on transition to a new desktop
 */
static void
remove_from_desktop(ScreenInfo *scr, MwmWindow *t)
{
    XWindowAttributes winattrs;
    unsigned long eventMask;

    /*
     * Prevent the receipt of an UnmapNotify, since that would
     * cause a transition to the Withdrawn state.
     */
    XGetWindowAttributes(dpy, t->w, &winattrs);
    eventMask = winattrs.your_event_mask;
    XSelectInput(dpy, t->w, eventMask & ~StructureNotifyMask);
    if (t->flags & ICONIFIED)
    {
	if (t->icon_pixmap_w != None)
	    XUnmapWindow(dpy, t->icon_pixmap_w);
	if (t->icon_w != None)
	    XUnmapWindow(dpy, t->icon_w);
    }
    else if (t->flags & (MAPPED | MAP_PENDING))
    {
	XUnmapWindow(dpy, t->frame);
    }
    XSelectInput(dpy, t->w, eventMask);
    PAGER_UpdateView(scr, t);
}

/*
 * Maps a window on transition to a new desktop
 */
static void
add_to_desktop(ScreenInfo *scr, MwmWindow *t)
{
    if (t->flags & ICONIFIED)
    {
	if (t->icon_pixmap_w != None)
	    XMapWindow(dpy, t->icon_pixmap_w);
	if (t->icon_w != None)
	    XMapWindow(dpy, t->icon_w);
    }
    else if (t->flags & MAPPED)
    {
	XMapWindow(dpy, t->frame);
	t->flags |= MAP_PENDING;
	XMapWindow(dpy, t->parent);
    }
    PAGER_UpdateView(scr, t);
}

/*
 * save the desktop state
 */
void
DT_SaveState(ScreenInfo *scr)
{
    MwmWindow *t;
    unsigned long data[1];

    for (t = scr->mwm_root.next; t != NULL; t = t->next)
    {
	data[0] = (unsigned long)t->Desk;
	XChangeProperty(dpy, t->w, XA_WM_DESKTOP, XA_WM_DESKTOP, 32,
			PropModeReplace, (unsigned char *)data, 1);
    }

    data[0] = (unsigned long)scr->current_desk;
    XChangeProperty(dpy, scr->root_win, XA_WM_DESKTOP, XA_WM_DESKTOP, 32,
		    PropModeReplace, (unsigned char *)data, 1);

    XSync(dpy, 0);
}

/*
 * Move to a new desktop
 */
void
DT_ChangeDesks(ScreenInfo *scr, int val1, int val2)
{
    int oldDesk;
    MwmWindow *t;
    MwmWindow *FocusWin = 0;
    static MwmWindow *StickyWin = 0;

    oldDesk = scr->current_desk;

    if (val1 != 0)
    {
	scr->current_desk = scr->current_desk + val1;
    }
    else
    {
	scr->current_desk = val2;
	if (scr->current_desk == oldDesk)
	    return;
    }

    /* Scan the window list, mapping windows on the new Desk,
     * unmapping windows on the old Desk */
    XGrabServer(dpy);
    for (t = scr->mwm_root.next; t != NULL; t = t->next)
    {
	/* Only change mapping for non-sticky windows */
	if ((!(t->flags & STICKY)) && (!(t->flags & ICON_UNMAPPED)))
	{
	    if (t->Desk == oldDesk)
	    {
		if (scr->mwm_focus == t)
		    t->FocusDesk = oldDesk;
		else
		    t->FocusDesk = -1;
		remove_from_desktop(scr, t);
	    }
	    else if (t->Desk == scr->current_desk)
	    {
		add_to_desktop(scr, t);
		if (t->FocusDesk == scr->current_desk)
		{
		    FocusWin = t;
		}
	    }
	}
	else
	{
	    /* Window is sticky */
	    t->Desk = scr->current_desk;
	    if (scr->mwm_focus == t)
	    {
		t->FocusDesk = oldDesk;
		StickyWin = t;
	    }
	}
    }
    XUngrabServer(dpy);
    for (t = scr->mwm_root.next; t != NULL; t = t->next)
    {
	/* If its an icon, and its sticking, autoplace it so
	 * that it doesn't wind up on top a a stationary
	 * icon */
	if ((t->flags & STICKY) && (t->flags & ICONIFIED) &&
	    (!(t->flags & ICON_MOVED)) && (!(t->flags & ICON_UNMAPPED)))
	    ICON_AutoPlace(scr, t);
    }
    /* Better re-draw the pager now */
    PAGER_Clear(scr);

    if (Mwm.keyboard_focus_policy == XmEXPLICIT)
    {
	if (Mwm.auto_key_focus)
	{
	    if (FocusWin)
	    {
		WIN_SetFocusInTree(FocusWin);
		WIN_SetFocus(scr, FocusWin->w, FocusWin);
	    }
	    else if (StickyWin && (StickyWin->flags && STICKY))
	    {
		WIN_SetFocusInTree(StickyWin);
		WIN_SetFocus(scr, StickyWin->w, StickyWin);
	    }
	}
	else
	    WIN_SetFocus(scr, scr->no_focus_win, NULL);
    }
}

/*
 * Move to a new desktop
 */
void
DT_WindowChangingDesks(ScreenInfo *scr, MwmWindow *t, int val1)
{
    if (val1 == t->Desk)
	return;

    /* Scan the window list, mapping windows on the new Desk,
     * unmapping windows on the old Desk */
    /* Only change mapping for non-sticky windows */
    if ((!(t->flags & STICKY)) && (!(t->flags & ICON_UNMAPPED)))
    {
	if (t->Desk == scr->current_desk)
	{
	    t->Desk = val1;
	    remove_from_desktop(scr, t);
	}
	else if (val1 == scr->current_desk)
	{
	    t->Desk = val1;
	    /* If its an icon, auto-place it */
	    if (t->flags & ICONIFIED)
		ICON_AutoPlace(scr, t);
	    add_to_desktop(scr, t);
	}
	else
	    t->Desk = val1;

    }
    /* Better re-draw the pager now */
    PAGER_Clear(scr);
}
lesstif-current/clients/Motif-1.2/mwm/events.c100664   1005    764      115463  6441111436  21042 0ustar  u27113lesstifdev/*****************************************************************************/
/**       Copyright 1988 by Evans & Sutherland Computer Corporation,        **/
/**                          Salt Lake City, Utah                           **/
/**  Portions Copyright 1989 by the Massachusetts Institute of Technology   **/
/**                        Cambridge, 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  permis-    **/
/**    sion  notice appear in supporting  documentation,  and  that  the    **/
/**    names of Evans & Sutherland and M.I.T. not be used in advertising    **/
/**    in publicity pertaining to distribution of the  software  without    **/
/**    specific, written prior permission.                                  **/
/**                                                                         **/
/**    EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD    **/
/**    TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES  OF  MERCHANT-    **/
/**    ABILITY  AND  FITNESS,  IN  NO  EVENT SHALL EVANS & SUTHERLAND OR    **/
/**    M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL  DAM-    **/
/**    AGES 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.                                     **/
/*****************************************************************************/
/****************************************************************************
 * This module is based on Twm, but has been siginificantly modified 
 * by Rob Nation 
 ****************************************************************************/
/***********************************************************************
 * The rest of it is all my fault -- MLM
 * mwm - "LessTif Window Manager"
 ***********************************************************************/

#include "mwm.h"

#ifdef ISC
#include <sys/bsdtypes.h>
#endif

#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#ifdef TIME_WITH_SYS_TIME
#include <time.h>
#endif
#endif

#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif

/*
 * shorthand defines
 */
#define MAX_NAME_LEN 200L	/* truncate to this many */
#define MAX_ICON_NAME_LEN 200L	/* ditto */
#define MOD_MASK	(ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|\
			 Mod4Mask | Mod5Mask)

extern int menuFromFrameOrWindowOrTitlebar;
MwmWindow *win;			/* the current mwm window */
static int ShapeEventBase, ShapeErrorBase;
extern volatile int alarmed;
extern Bool EnablePagerRedraw;

/*
 * Waits Mwm.click_time, or until it is evident that the user is not
 * clicking, but is moving the cursor.
 */
static Boolean
is_click(ScreenInfo *scr, int x, int y, XEvent *d)
{
    int xcurrent, ycurrent, total = 0;
    XEvent trash;

    xcurrent = x;
    ycurrent = y;
#if 0
    XAllowEvents(dpy, ReplayPointer, CurrentTime);
#endif
    while ((total < Mwm.click_time) &&
	   (x - xcurrent < Mwm.move_threshold) &&
	   (x - xcurrent > -Mwm.move_threshold) &&
	   (y - ycurrent < Mwm.move_threshold) &&
	   (y - ycurrent > -Mwm.move_threshold))
    {

	MISC_usleep(10000);
	total += 10;

	if (XCheckMaskEvent(dpy, ButtonPressMask | ButtonReleaseMask, &trash))
	{
	    MISC_StashEventTime(&trash);
	    if (trash.xbutton.button == d->xbutton.button)
	    {
		*d = trash;
		return True;
	    }
	}

	if (XCheckMaskEvent(dpy, ButtonMotionMask | PointerMotionMask, &trash))
	{
	    xcurrent = trash.xmotion.x_root;
	    ycurrent = trash.xmotion.y_root;
	    MISC_StashEventTime(&trash);
	}
    }

    return False;
}

/*
 * This procedure handles both a client changing its own colormap, and
 * a client explicitly installing its colormap itself (only the window
 * manager should do that, so we must set it correctly).
 */
static void
color_map_notify(ScreenInfo *scr, MwmWindow *win, XEvent *event)
{
    XColormapEvent *cevent = (XColormapEvent *)event;
    Boolean reinstall = False;


    if (!win)
	return;

    if (cevent->new)
    {
	XGetWindowAttributes(dpy, win->w, &(win->attr));
	if (win == scr->mwm_colormap && win->number_cmap_windows == 0)
	    scr->last_cmap = win->attr.colormap;
	reinstall = True;
    }
    else if ((cevent->state == ColormapUninstalled) &&
	     (scr->last_cmap == cevent->colormap))
    {
	/* Some window installed its colormap, change it back */
	reinstall = True;
    }

    while (XCheckTypedEvent(dpy, ColormapNotify, event))
    {
	if (XFindContext(dpy, cevent->window,
			 MwmContext, (XPointer *)&win) == XCNOENT)
	    win = NULL;
	if ((win) && (cevent->new))
	{
	    XGetWindowAttributes(dpy, win->w, &(win->attr));
	    if (win == scr->mwm_colormap &&
		win->number_cmap_windows == 0)
		scr->last_cmap = win->attr.colormap;
	    reinstall = True;
	}
	else if ((win) &&
		 (cevent->state == ColormapUninstalled) &&
		 (scr->last_cmap == cevent->colormap))
	{
	    /* Some window installed its colormap, change it back */
	    reinstall = True;
	}
	else if ((win) &&
		 (cevent->state == ColormapInstalled) &&
		 (scr->last_cmap == cevent->colormap))
	{
	    /* The last color map installed was the correct one. Don't 
	     * change anything */
	    reinstall = False;
	}
    }

    if (reinstall)
	XInstallColormap(dpy, scr->last_cmap);
}

/*
 * handles focus in events
 */
static void
focus_in(ScreenInfo *scr, MwmWindow *win, XEvent *event)
{
    XEvent d;
    Window w;

    w = event->xany.window;
    while (XCheckTypedEvent(dpy, FocusIn, &d))
	w = d.xany.window;

    if (XFindContext(dpy, w, MwmContext, (XPointer *)&win) == XCNOENT)
	win = NULL;

    if (!win)
	DEC_DrawDecorations(scr, scr->mwm_highlight, False, True, True, None);
    else if (win != scr->mwm_highlight)
	DEC_DrawDecorations(scr, win, True, True, True, None);

    if (win && Mwm.colormap_focus_policy == XmKEYBOARD)
	COLOR_InstallWindowColorMap(scr, win);
}

/*
 * key press event handler
 */
static void
key_press(ScreenInfo *scr, MwmWindow *win, XEvent *event)
{
    FuncKey *key;
    unsigned int modifier;
    Window dummy;

    if (event->xkey.window == scr->shield_win)
    {
	XBell(dpy, 100);
	return;
    }

    scr->event_context = EVENT_GetContext(scr, win, event, &dummy);

    modifier = (event->xkey.state & MOD_MASK);
    for (key = scr->keys; key != NULL; key = key->next)
    {
	scr->mwm_event = win;
	/* Here's a real hack - some systems have two keys with the
	 * same keysym and different keycodes. This converts all
	 * the cases to one keycode. */
	event->xkey.keycode =
	    XKeysymToKeycode(dpy,
			     XKeycodeToKeysym(dpy, event->xkey.keycode, 0));

	if ((key->keycode == event->xkey.keycode) &&
	    ((key->mods == (modifier & (~LockMask))) ||
	     (key->mods == AnyModifier)) &&
	    (key->cont & scr->event_context))
	{
	    FUNC_Execute(scr, key->func, key->action, event->xany.window, win,
			 event, scr->event_context, key->val1, key->val2,
			 key->val1_unit, key->val2_unit,
			 key->menu);
	    return;
	}
    }

    /* if we get here, no function key was bound to the key.  Send it
     * to the client if it was in a window we know about.
     */
    if (win)
    {
	if (event->xkey.window != win->w)
	{
	    event->xkey.window = win->w;
	    XSendEvent(dpy, win->w, False, KeyPressMask, event);
	}
    }
    scr->mwm_event = NULL;
}

/*
 * property notify event handler
 */
static void
property_notify(ScreenInfo *scr, MwmWindow *win, XEvent *event)
{
    char *prop = NULL;
    Atom actual = None;
    int actual_format;
    unsigned long nitems, bytesafter;

    if ((!win) || (XGetGeometry(dpy, win->w, &JunkRoot, &JunkX, &JunkY,
			   &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth) == 0))
	return;

    switch (event->xproperty.atom)
    {
    case XA_WM_NAME:
	if (XGetWindowProperty(dpy, win->w, event->xproperty.atom, 0L,
			       MAX_NAME_LEN, False, XA_STRING, &actual,
			       &actual_format, &nitems, &bytesafter,
			       (unsigned char **)&prop) != Success ||
	    actual == None)
	    return;
	if (!prop)
	    prop = NoName;
	WIN_FreeNames(win, True, False);

	win->name = prop;

	/* fix the name in the title bar */
	if (!(win->flags & ICONIFIED))
	    DEC_DrawTitleBar(scr, win, (scr->mwm_highlight == win), True);

	/*
	 * if the icon name is NoName, set the name of the icon to be
	 * the same as the window 
	 */
	if (win->icon_active_label == NoName)
	{
	    win->icon_active_label = win->name;
	    ICON_UpdateWindow(scr, win, False);
	}
	break;

    case XA_WM_ICON_NAME:
	if (XGetWindowProperty(dpy, win->w, event->xproperty.atom, 0,
			       MAX_ICON_NAME_LEN, False, XA_STRING, &actual,
			       &actual_format, &nitems, &bytesafter,
			       (unsigned char **)&prop) != Success ||
	    actual == None)
	    return;
	if (!prop)
	    prop = NoName;
	WIN_FreeNames(win, False, True);
	win->icon_label = prop;
	ICON_UpdateWindow(scr, win, False);
	break;

    case XA_WM_HINTS:
	if (win->wmhints)
	    XFree((char *)win->wmhints);
	win->wmhints = XGetWMHints(dpy, event->xany.window);

	if (win->wmhints == NULL)
	    return;

	if ((win->wmhints->flags & IconPixmapHint) ||
	    (win->wmhints->flags & IconWindowHint))
	{
	    if (win->icon_w)
		XDestroyWindow(dpy, win->icon_w);
	    XDeleteContext(dpy, win->icon_w, MwmContext);
	    if (win->flags & ICON_OURS)
	    {
		if (win->icon_pixmap_w != None)
		{
		    XDestroyWindow(dpy, win->icon_pixmap_w);
		    XDeleteContext(dpy, win->icon_pixmap_w, MwmContext);
		}
	    }
	    else
		XUnmapWindow(dpy, win->icon_pixmap_w);
	    win->icon_w = None;
	    win->icon_pixmap_w = None;
	    win->icon_pixmap = (Window)NULL;
	    if (win->flags & ICONIFIED)
	    {
		win->flags &= ~ICONIFIED;
		win->flags &= ~ICON_UNMAPPED;
		ICON_CreateWindow(scr, win,
				  win->icon_x_loc, win->icon_y_loc);

		WIN_Lower(scr, win);
		ICON_AutoPlace(scr, win);
		if (win->Desk == scr->current_desk)
		{
		    if (win->icon_w)
			XMapWindow(dpy, win->icon_w);
		    if (win->icon_pixmap_w != None)
			XMapWindow(dpy, win->icon_pixmap_w);
		}
		win->flags |= ICONIFIED;
		ICON_DrawWindow(scr, win);
	    }
	}
	break;

    case XA_WM_NORMAL_HINTS:
	PROP_GetWindowSizeHints(win);
	break;

    default:
	if (event->xproperty.atom == XA_WM_PROTOCOLS)
	{
	    PROP_GetWmProtocols(win);
	}
	else if (event->xproperty.atom == XA_WM_COLORMAP_WINDOWS)
	{
	    PROP_GetWmColormapWindows(win);	/* frees old data */
	    COLOR_InstallWindowColorMap(scr, scr->mwm_colormap);
	}
	else if (event->xproperty.atom == XA_WM_STATE)
	{
	    if ((Mwm.keyboard_focus_policy == XmEXPLICIT) &&
		(win == scr->mwm_focus) && (win != NULL))
	    {
		scr->mwm_focus = NULL;
		WIN_SetFocusInTree(win);
		WIN_SetFocus(scr, win->w, win);
		MISC_SetFocusSequence(scr);
	    }
	}
	else if (event->xproperty.atom == XA_MWM_HINTS)
	{
	    if (win)
	    {
		int width, height;

		PROP_GetMwmHints(win);

		DEC_ReselectDecorations(scr, win);

		win->frame_width = win->attr.width +
		    2 * win->boundary_width +
		    2 * win->matte_width;
		win->frame_height = win->attr.height +
		    win->title_height +
		    2 * win->boundary_width +
		    2 * win->matte_width;

		WIN_ConstrainWindow(scr, win,
				    &win->frame_width,
				    &win->frame_height);

		width = win->frame_width;
		win->frame_width = 0;
		height = win->frame_height;
		win->frame_height = 0;

		DEC_ConfigureDecorations(scr, win,
					 win->frame_x, win->frame_y,
					 width, height,
					 True);

		if (scr->mwm_highlight == win)
		{
		    scr->mwm_highlight = NULL;
		    DEC_DrawDecorations(scr, win, True, True, True, None);
		}
		else
		    DEC_DrawDecorations(scr, win, False, False, True, None);
	    }
	}
	else if (event->xproperty.atom == XA_MWM_MENU)
	{
	    if (win)
	    {
		if (win->mwm_menu)
		    XFree((char *)win->mwm_menu);

		MENU_DestroyWindowMenu(scr, win);

		PROP_GetMwmMenu(win);

		MENU_BuildWindowMenu(scr, win);
	    }
	}
	else if (event->xproperty.atom == XA_MWM_MESSAGES)
	{
	    if (win)
	    {

		if (win->mwm_messages)
		    XFree((char *)win->mwm_messages);

		PROP_GetMwmMessages(win);
	    }
	}
    }
}

/*
 * client message event handler
 */
static void
client_message(ScreenInfo *scr, MwmWindow *win, XEvent *event)
{
    XEvent button;

    if ((event->xclient.message_type == XA_WM_CHANGE_STATE) &&
	(win) && (event->xclient.data.l[0] == IconicState) &&
	!(win->flags & ICONIFIED))
    {
	XQueryPointer(dpy, scr->root_win, &JunkRoot, &JunkChild,
		      &(button.xmotion.x_root),
		      &(button.xmotion.y_root),
		      &JunkX, &JunkY, &JunkMask);
	button.type = 0;
	FUNC_Execute(scr, F_ICONIFY, NULLSTR, event->xany.window,
		     win, &button, C_FRAME, 0, 0, 0, 0,
		     (MenuRoot *) 0);
    }
}

/*
 * expose event handler
 */
static void
expose(ScreenInfo *scr, MwmWindow *win, XEvent *event)
{
    if (event->xexpose.count != 0)
	return;

    if (win)
    {
	if ((win->w == scr->pager_win) ||
	    (win->w == scr->pager_child_win))
	{
	    PAGER_Redraw(scr);
	}
	if ((event->xany.window == win->title))
	{
	    DEC_DrawTitleBar(scr, win, (scr->mwm_highlight == win), False);
	}
	else
	{
	    DEC_DrawDecorations(scr, win,
				(scr->mwm_highlight == win),
				True, True, event->xany.window);
	}
    }
    else
    {
	if (WIN_WindowToStruct(scr, event->xany.window))
	    PAGER_Redraw(scr);
    }
    return;
}

/*
 * DestroyNotify event handler
 */
static void
destroy_notify(ScreenInfo *scr, MwmWindow *win, XEvent *event)
{
    WIN_DestroyWindow(scr, win);
}

/*
 * MapRequest event handler
 */
static void
map_request(ScreenInfo *scr, MwmWindow *win, XEvent *event)
{
    WIN_MapWindow(scr, event->xmaprequest.window);
}

/*
 * MapNotify event handler
 */
static void
map_notify(ScreenInfo *scr, MwmWindow *win, XEvent *event)
{
    if (!win)
	return;

    /*
     * Need to do the grab to avoid race condition of having server send
     * MapNotify to client before the frame gets mapped; this is bad because
     * the client would think that the window has a chance of being viewable
     * when it really isn't.
     */
    XGrabServer(dpy);
    if (win->icon_w)
	XUnmapWindow(dpy, win->icon_w);
    if (win->icon_pixmap_w != None)
	XUnmapWindow(dpy, win->icon_pixmap_w);

    if (win->mwm_hints &&
	(win->mwm_hints->flags & MWM_HINTS_INPUT_MODE) &&
	(win->mwm_hints->input_mode == MWM_INPUT_SYSTEM_MODAL))
    {
	XMapRaised(dpy, scr->shield_win);
	WIN_Raise(scr, win);
    }

    XMapSubwindows(dpy, win->frame);

    if (win->Desk == scr->current_desk)
    {
	XMapWindow(dpy, win->frame);
    }

    if (Mwm.keyboard_focus_policy == XmEXPLICIT && Mwm.startup_key_focus)
    {
	WIN_SetFocusInTree(win);
	WIN_SetFocus(scr, win->w, win);
	MISC_SetFocusSequence(scr);
    }
    if ((!(win->decorations & (MWM_DECOR_BORDER | MWM_DECOR_TITLE))) &&
	(win->boundary_width < 2))
    {
	DEC_DrawDecorations(scr, win, False, True, True, win->frame);
    }
    XSync(dpy, 0);
    XUngrabServer(dpy);
    XFlush(dpy);
    win->flags |= MAPPED;
    win->flags &= ~MAP_PENDING;
    win->flags &= ~ICONIFIED;
    win->flags &= ~ICON_UNMAPPED;
}

/*
 * UnmapNotify event handler
 */
static void
unmap_notify(ScreenInfo *scr, MwmWindow *win, XEvent *event)
{
    int dstx, dsty;
    Window dumwin;
    XEvent dummy;

    /*
     * The July 27, 1988 ICCCM spec states that a client wishing to switch
     * to WithdrawnState should send a synthetic UnmapNotify with the
     * event field set to (pseudo-)root, in case the window is already
     * unmapped (which is the case for mwm for IconicState).  Unfortunately,
     * we looked for the MwmContext using that field, so try the window
     * field also.
     */
    if (!win)
    {
	event->xany.window = event->xunmap.window;
	if (XFindContext(dpy, event->xany.window,
			 MwmContext, (XPointer *)&win) == XCNOENT)
	    win = NULL;
    }

    if (!win)
	return;

    if (win->mwm_hints &&
	(win->mwm_hints->flags & MWM_HINTS_INPUT_MODE) &&
	(win->mwm_hints->input_mode == MWM_INPUT_SYSTEM_MODAL))
    {
	XUnmapWindow(dpy, scr->shield_win);
    }

    if (win == scr->mwm_highlight)
	scr->mwm_highlight = NULL;

    if (scr->mwm_last_focus == win)
	scr->mwm_last_focus = NULL;

    if (win == scr->mwm_focus && Mwm.keyboard_focus_policy == XmEXPLICIT &&
	Mwm.auto_key_focus)
    {
	if (win->next)
	{
	    WIN_SetFocusInTree(win->next);
	    WIN_SetFocus(scr, win->next->w, win->next);
	}
	else if (win->ancestor)
	{
	    WIN_SetFocusInTree(win->ancestor);
	    WIN_SetFocus(scr, win->ancestor->w, win->ancestor);
	}
	else
	    WIN_SetFocus(scr, scr->no_focus_win, NULL);
    }

    if (scr->mwm_focus == win)
	WIN_SetFocus(scr, scr->no_focus_win, NULL);

    if (win == scr->mwm_pushed)
	scr->mwm_pushed = NULL;

    MISC_SetFocusSequence(scr);
    if (win == scr->mwm_colormap)
	scr->mwm_colormap = NULL;

    if (!(win->flags & MAPPED) && !(win->flags & ICONIFIED))
	return;

    XGrabServer(dpy);

    if (XCheckTypedWindowEvent(dpy, event->xunmap.window,
			       DestroyNotify, &dummy))
    {
	WIN_DestroyWindow(scr, win);
	XUngrabServer(dpy);
	return;
    }

    /*
     * The program may have unmapped the client window, from either
     * NormalState or IconicState.  Handle the transition to WithdrawnState.
     *
     * We need to reparent the window back to the root (so that mwm exiting 
     * won't cause it to get mapped) and then throw away all state (pretend 
     * that we've received a DestroyNotify).
     */
    if (XTranslateCoordinates(dpy, event->xunmap.window, scr->root_win,
			      0, 0, &dstx, &dsty, &dumwin))
    {
	XEvent ev;
	Bool reparented;

	reparented = XCheckTypedWindowEvent(dpy, event->xunmap.window,
					    ReparentNotify, &ev);
	PROP_SetState(win, WithdrawnState);
	if (reparented)
	{
	    if (win->old_bw)
		XSetWindowBorderWidth(dpy, event->xunmap.window,
				      win->old_bw);
	    if (win->wmhints && (win->wmhints->flags & IconWindowHint))
		XUnmapWindow(dpy, win->wmhints->icon_window);
	}
	else
	    WIN_RestoreWithdrawn(scr, win, False);

	if (event->xunmap.window != scr->restart_win &&
	    event->xunmap.window != scr->quit_win &&
	    event->xunmap.window != scr->toggle_win)
	{
	    XRemoveFromSaveSet(dpy, event->xunmap.window);
	    XSelectInput(dpy, event->xunmap.window, NoEventMask);
	}
	else
	    XDeleteContext(dpy, event->xunmap.window, MwmContext);

	WIN_DestroyWindow(scr, win);	/* do not need to mash event before */
    }
    /* else window no longer exists and we'll get a destroy notify */

    XUngrabServer(dpy);

    XFlush(dpy);
}

/*
 * MotionNotify event handler
 */
static void
motion_notify(ScreenInfo *scr, MwmWindow *win, XEvent *event)
{
    /* here is the code for dragging the viewport around within the pager. */
    if ((win) && (win->w == scr->pager_win) &&
	(!(win->flags & ICONIFIED)))
    {
	if (event->xmotion.state == Button3MotionMask)
	{
	    EnablePagerRedraw = False;
	    PAGER_SwitchPage(scr, False, False, event);
	}
    }
}

/*
 * ButtonPress event handler
 */
static void
button_press(ScreenInfo *scr, MwmWindow *win, XEvent *event)
{
    unsigned int modifier;
    MouseButton *MouseEntry;
    char *Action;
    Window x;
    int LocalContext;
    static Time last_time = 0;
    Boolean click = False, click2 = False, match = False;

    if (event->xbutton.window == scr->shield_win)
    {
	XBell(dpy, 100);
	return;
    }

    /* click to focus stuff goes here */
    if ((Mwm.keyboard_focus_policy == XmEXPLICIT) &&
	(win != scr->mwm_grabbing) &&
	((event->xbutton.state &
	 (ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) == 0))
    {
	if (win)
	{
	    WIN_SetFocusInTree(win);
	    WIN_SetFocus(scr, win->w, win);
	    MISC_SetFocusSequence(scr);

	    if (win->focus_auto_raise)
	    {
		WIN_Raise(scr, win);
	    }

	    /* Why is this here? Seems to cause breakage with
	     * non-focusing windows! */
	    if (!(win->flags & ICONIFIED))
	    {
		XSync(dpy, 0);
		XAllowEvents(dpy, ReplayPointer, CurrentTime);
		XSync(dpy, 0);
		return;
	    }

	}
    }

    XSync(dpy, 0);
    XAllowEvents(dpy, ReplayPointer, CurrentTime);
    XSync(dpy, 0);

    /* here is the code for moving windows in the pager. */
    if ((win) && (win->w == event->xbutton.window) &&
	(win->w == scr->pager_win) && (event->xbutton.button == Button2))
    {
	PAGER_Update(scr, event);
	return;
    }
    if ((win) && (win->w == scr->pager_win) &&
	(!(win->flags & ICONIFIED)) &&
	(event->xbutton.button == Button3) &&
	(event->xany.window == scr->pager_win))
    {
	EnablePagerRedraw = False;
	PAGER_SwitchPage(scr, False, False, event);
    }

    scr->event_context = EVENT_GetContext(scr, win, event, &scr->pressed_win);
    LocalContext = scr->event_context;
    x = scr->pressed_win;

    if (scr->event_context == C_TITLE)
    {
	DEC_DrawTitleBar(scr, win, (scr->mwm_highlight == win), False);
    }
    else
    {
	DEC_DrawDecorations(scr, win, (scr->mwm_highlight == win),
			    True, True, scr->pressed_win);
    }

    scr->mwm_event = win;

    /* we have to execute a function or pop up a menu
     */
    modifier = (event->xbutton.state & MOD_MASK);
    /* need to search for an appropriate mouse binding */

    click = is_click(scr, event->xbutton.x, event->xbutton.y, event);
    if (click && (MISC_FetchEventTime() - last_time) < Mwm.double_click_time)
    {
	click2 = True;
    }

    last_time = MISC_FetchEventTime();

    MouseEntry = scr->buttons;
    while (click2 && MouseEntry != (MouseButton *)0)
    {
	if ((MouseEntry->button == event->xbutton.button ||
	     MouseEntry->button == 0) &&
	    (MouseEntry->context & scr->event_context) &&
	    (MouseEntry->modifier == AnyModifier ||
	     MouseEntry->modifier == (modifier & (~LockMask))) &&
	    (MouseEntry->mask & (ButtonPressMask | ButtonReleaseMask)))
	{
	    /* got a match, now process it */
	    if (MouseEntry->func != F_NOP)
	    {
		if (MouseEntry->count == 2)
		{
		    match = True;
		    Action = MouseEntry->item ? MouseEntry->item->action : NULL;
		    FUNC_Execute(scr, MouseEntry->func, Action,
				 event->xany.window, win, event,
				 scr->event_context,
				 MouseEntry->val1, MouseEntry->val2,
				 MouseEntry->val1_unit, MouseEntry->val2_unit,
				 MouseEntry->menu);
		}
	    }
	}
	MouseEntry = MouseEntry->next;
    }
    if (match)
    {
	scr->pressed_win = None;
	if (LocalContext != C_TITLE)
	{
	    DEC_DrawDecorations(scr, scr->mwm_event,
				(scr->mwm_highlight == scr->mwm_event),
				True, True, x);
	}
	else
	{
	    DEC_DrawTitleBar(scr, scr->mwm_event,
			     (scr->mwm_highlight == scr->mwm_event), False);
	}
	scr->mwm_event = NULL;
	return;
    }

    MouseEntry = scr->buttons;
    while (MouseEntry != (MouseButton *)0)
    {
	if ((MouseEntry->button == event->xbutton.button ||
	     MouseEntry->button == 0) &&
	    (MouseEntry->context & scr->event_context) &&
	    (MouseEntry->modifier == AnyModifier ||
	     MouseEntry->modifier == (modifier & (~LockMask))) &&
	    (MouseEntry->mask & ButtonPressMask))
	{
	    /* got a match, now process it, unless the user clicked, and it's
	     * interactive */
	    if (MouseEntry->func != F_NOP &&
		!(click && !click2 && (MouseEntry->func == F_MOVE ||
				       MouseEntry->func == F_R
Results 1 - 1
Help - FTP Sites List - Software Dir.
Searching half a billion files worldwide
© 1997-2009 MARUHN Internet Solutions