diff options
Diffstat (limited to 'app/twm')
31 files changed, 2570 insertions, 1682 deletions
diff --git a/app/twm/ChangeLog b/app/twm/ChangeLog index 6b70df76d..1bd6d17e3 100644 --- a/app/twm/ChangeLog +++ b/app/twm/ChangeLog @@ -1,3 +1,209 @@ +commit 4c5e72e9d8571bfb2a98d1ffc9724596764f5b0b +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Wed Jul 27 20:33:13 2011 -0700 + + twm 1.0.7 + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit f21823506dcb956d62c260e6e207f1dc2ce7732a +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Thu Jul 14 22:04:34 2011 -0700 + + Whitespace fixes in src files + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit c6ade914363426facb01a954650b804657114012 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Tue Jul 12 22:30:41 2011 -0700 + + Replace most sprintf calls with snprintf + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit ab689e1a711bbbdfcd6d3a8d2edebbc378ebccb7 +Author: Gaetan Nadon <memsize@videotron.ca> +Date: Mon Mar 7 20:05:45 2011 -0500 + + config: layout the C flags for better readability + + Group pre-processor flags under AM_CPPFLAGS + Might as well do the rest of the file. + + Signed-off-by: Gaetan Nadon <memsize@videotron.ca> + +commit f048770b021d92780c754257c9c1efa7a769c69c +Author: Gaetan Nadon <memsize@videotron.ca> +Date: Mon Mar 7 19:47:48 2011 -0500 + + man: use Autoconf provided $(SED) + + Use platform appropriate version of sed. + + Signed-off-by: Gaetan Nadon <memsize@videotron.ca> + +commit 356ca1db47be674aa9125b65668e8fe0573f7f69 +Author: Gaetan Nadon <memsize@videotron.ca> +Date: Mon Mar 7 19:37:48 2011 -0500 + + config: rm is about removal, not generation + + Automake: + AM_V_at as a prefix to commands that should not output anything in silent mode + + Signed-off-by: Gaetan Nadon <memsize@videotron.ca> + +commit 6f362f8d962ff7054682cfb2d88e8603e1219492 +Author: Gaetan Nadon <memsize@videotron.ca> +Date: Mon Mar 7 16:43:59 2011 -0500 + + deftwmrc.c is not required in MAINTAINERCLEANFILES + + Automake takes care of that as it is part of BUILT_SOURCES + + Signed-off-by: Gaetan Nadon <memsize@videotron.ca> + +commit 98e224e3da245f29d281df357d27b53acdccb5c7 +Author: Gaetan Nadon <memsize@videotron.ca> +Date: Mon Mar 7 16:10:53 2011 -0500 + + lex & yacc: only header file needs to be in BUILT_SOURCES + + http://www.gnu.org/software/automake/manual/automake.html#Yacc-and-Lex + + This completes reversal of commit ea03b6bcd1045dfc0d6947e4858de8994d61170b + The Makefile generates a valid "gram.h: gram.c" rule. + The Makefile already has gram.c gram.h and lex.c in the + maintainer-clean-generic target. + + Signed-off-by: Gaetan Nadon <memsize@videotron.ca> + +commit 70a7f34dfc4d7ea4f7425b9a7359a08a35752bb0 +Author: Jeremy Huddleston <jeremyhu@apple.com> +Date: Wed May 11 22:41:56 2011 -0700 + + Add extra sanity checking to avoid possible NULL dereferences + + menus.c:569:10: warning: Access to field 'func' results in a dereference of a null pointer (loaded from variable 'ActiveItem') + if (ActiveItem->func != F_TITLE && !ActiveItem->state) + ^~~~~~~~~~ + + Found-by: clang static analyzer + Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> + Acked-by: Peter Hutterer <peter.hutterer@who-t.net> + +commit a898b136729660a33d60b317ccb839f6e0428201 +Author: Jeremy Huddleston <jeremyhu@apple.com> +Date: Wed May 11 22:30:56 2011 -0700 + + Add sanity checking to avoid a possible NULL dereference + + menus.c:934:26: warning: Access to field 'fore' results in a dereference of a null pointer (loaded from variable 'cur') + cur->hi_back = cur->fore = f3.pixel; + ~~~ ^ + + Found-by: clang static analyzer + Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> + Acked-by: Peter Hutterer <peter.hutterer@who-t.net> + +commit 1061e063be78f4e233d550649ce297b639193a9f +Author: Jeremy Huddleston <jeremyhu@apple.com> +Date: Wed May 11 22:27:21 2011 -0700 + + Address a possible NULL pointer dereference + + menus.c:523:24: warning: Access to field 'w' results in a dereference of a null pointer (loaded from variable 'ActiveMenu') + if (XFindContext(dpy, ActiveMenu->w, ScreenContext, &context_data) == 0) + ^~~~~~~~~~ + + Found-by: clang static analyzer + Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> + Acked-by: Peter Hutterer <peter.hutterer@who-t.net> + +commit bde0b06b465adb868d38d3721b95ea337bad8eb9 +Author: Jeremy Huddleston <jeremyhu@apple.com> +Date: Wed May 11 22:22:25 2011 -0700 + + Mark Done() as _X_NORETURN + + list.c:103:11: warning: Access to field 'next' results in a dereference of a null pointer (loaded from variable 'nptr') + nptr->next = *list_head; + ~~~~ ^ + + Found-by: clang static analyzer + Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> + +commit 2f5d1e29f5a803ba2417d6fe20782c05ed932612 +Author: Jeremy Huddleston <jeremyhu@apple.com> +Date: Wed May 11 22:17:54 2011 -0700 + + Silence uninitialized warning + + session.c: In function 'ReadWinConfigFile': + session.c:554: warning: 'version' may be used uninitialized in this function + + Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> + +commit ef39179b9fe6d13f7e81098edfc10711c8b40948 +Author: Jeremy Huddleston <jeremyhu@apple.com> +Date: Wed May 11 22:16:23 2011 -0700 + + LP64: Fix formatting for DEBUG printf + + add_window.c: In function 'AddWindow': + add_window.c:169: warning: format '%x' expects type 'unsigned int', but argument 3 has type 'Window' + + Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> + +commit 0f1ccd0b3409ab9b9fce1256fc59ad9bbe69a349 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Tue May 10 15:35:51 2011 -0700 + + Fix: menus.c:2374: warning: implicit declaration of function `putenv` + + Ensure _GNU_SOURCE is defined on Linux builds before including <stdlib.h> + so the prototype is exposed in the header properly. + + https://bugs.freedesktop.org/show_bug.cgi?id=32696 + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + Reviewed-by: Julien Cristau <jcristau@debian.org> + +commit 75dd868133c5c12daa946468e7250d174f842281 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Mon May 9 22:46:03 2011 -0700 + + Remove unused fallback implementation of putenv() + + NOPUTENV was never defined in a modular build, probably because putenv() + is a standard function in Unix98 / SUSv2, and goes back to at least + SVR2 and 4.3BSD-Reno. + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + Reviewed-by: Matthieu Herrb <matthieu.herrb@laas.fr> + Reviewed-by: Mark Kettenis <kettenis@openbsd.org> + +commit 5b763259451b7798b1004c49775d1bd3df2f9d88 +Author: Gaetan Nadon <memsize@videotron.ca> +Date: Fri Mar 4 20:57:30 2011 -0500 + + man: replace hard coded section number with __appmansuffix__ + + Signed-off-by: Gaetan Nadon <memsize@videotron.ca> + +commit 611f20e896aa533f0f3e5cd6c8fdd7c381963c95 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Wed Jan 5 16:12:42 2011 -0800 + + Fix many gcc strict-aliasing warnings + + menus.c:518: warning: dereferencing type-punned pointer will break strict-aliasing rules + + and many more of the same message at different lines + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + commit b160f7bcb99111e631d6701b199f1dad1e40c80d Author: Alan Coopersmith <alan.coopersmith@oracle.com> Date: Wed Jan 5 14:09:15 2011 -0800 diff --git a/app/twm/Makefile.in b/app/twm/Makefile.in index 42c50ec15..3bba98de2 100644 --- a/app/twm/Makefile.in +++ b/app/twm/Makefile.in @@ -43,9 +43,9 @@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c +install_sh_DATA = ${SHELL} $(install_sh) -c -m 644 +install_sh_PROGRAM = ${SHELL} $(install_sh) -c +install_sh_SCRIPT = ${SHELL} $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : @@ -158,6 +158,7 @@ PKG_CONFIG = @PKG_CONFIG@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ TWM_CFLAGS = @TWM_CFLAGS@ TWM_LIBS = @TWM_LIBS@ diff --git a/app/twm/aclocal.m4 b/app/twm/aclocal.m4 index d24c77a27..cdf4062b0 100644 --- a/app/twm/aclocal.m4 +++ b/app/twm/aclocal.m4 @@ -1022,7 +1022,7 @@ dnl DEALINGS IN THE SOFTWARE. # See the "minimum version" comment for each macro you use to see what # version you require. m4_defun([XORG_MACROS_VERSION],[ -m4_define([vers_have], [1.11.0]) +m4_define([vers_have], [1.15.0]) m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.]))) m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.]))) m4_if(m4_cmp(maj_have, maj_needed), 0,, @@ -1049,7 +1049,7 @@ AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], # which is not the best choice for supporting other OS'es, but covers most # of the ones we need for now. AC_MSG_CHECKING([if $RAWCPP requires -undef]) -AC_LANG_CONFTEST([Does cpp redefine unix ?]) +AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])]) if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then AC_MSG_RESULT([no]) else @@ -1067,7 +1067,7 @@ fi rm -f conftest.$ac_ext AC_MSG_CHECKING([if $RAWCPP requires -traditional]) -AC_LANG_CONFTEST([Does cpp preserve "whitespace"?]) +AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve "whitespace"?]])]) if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then AC_MSG_RESULT([no]) else @@ -1417,6 +1417,123 @@ AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes]) AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes]) ]) # XORG_WITH_XMLTO +# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT]) +# -------------------------------------------- +# Minimum version: 1.12.0 +# Minimum version for optional DEFAULT argument: 1.12.0 +# +# XSLT (Extensible Stylesheet Language Transformations) is a declarative, +# XML-based language used for the transformation of XML documents. +# The xsltproc command line tool is for applying XSLT stylesheets to XML documents. +# It is used under the cover by xmlto to generate html files from DocBook/XML. +# The XSLT processor is often used as a standalone tool for transformations. +# It should not be assumed that this tool is used only to work with documnetation. +# When DEFAULT is not specified, --with-xsltproc assumes 'auto'. +# +# Interface to module: +# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation +# XSLTPROC: returns the path of the xsltproc program found +# returns the path set by the user in the environment +# --with-xsltproc: 'yes' user instructs the module to use xsltproc +# 'no' user instructs the module not to use xsltproc +# have_xsltproc: returns yes if xsltproc found in PATH or no +# +# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path. +# +AC_DEFUN([XORG_WITH_XSLTPROC],[ +AC_ARG_VAR([XSLTPROC], [Path to xsltproc command]) +# Preserves the interface, should it be implemented later +m4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])]) +m4_define([_defopt], m4_default([$2], [auto])) +AC_ARG_WITH(xsltproc, + AS_HELP_STRING([--with-xsltproc], + [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]), + [use_xsltproc=$withval], [use_xsltproc=]_defopt) +m4_undefine([_defopt]) + +if test "x$use_xsltproc" = x"auto"; then + AC_PATH_PROG([XSLTPROC], [xsltproc]) + if test "x$XSLTPROC" = "x"; then + AC_MSG_WARN([xsltproc not found - cannot transform XML documents]) + have_xsltproc=no + else + have_xsltproc=yes + fi +elif test "x$use_xsltproc" = x"yes" ; then + AC_PATH_PROG([XSLTPROC], [xsltproc]) + if test "x$XSLTPROC" = "x"; then + AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH]) + fi + have_xsltproc=yes +elif test "x$use_xsltproc" = x"no" ; then + if test "x$XSLTPROC" != "x"; then + AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified]) + fi + have_xsltproc=no +else + AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no']) +fi + +AM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes]) +]) # XORG_WITH_XSLTPROC + +# XORG_WITH_PERL([MIN-VERSION], [DEFAULT]) +# ---------------------------------------- +# Minimum version: 1.15.0 +# +# PERL (Practical Extraction and Report Language) is a language optimized for +# scanning arbitrary text files, extracting information from those text files, +# and printing reports based on that information. +# +# When DEFAULT is not specified, --with-perl assumes 'auto'. +# +# Interface to module: +# HAVE_PERL: used in makefiles to conditionally scan text files +# PERL: returns the path of the perl program found +# returns the path set by the user in the environment +# --with-perl: 'yes' user instructs the module to use perl +# 'no' user instructs the module not to use perl +# have_perl: returns yes if perl found in PATH or no +# +# If the user sets the value of PERL, AC_PATH_PROG skips testing the path. +# +AC_DEFUN([XORG_WITH_PERL],[ +AC_ARG_VAR([PERL], [Path to perl command]) +# Preserves the interface, should it be implemented later +m4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])]) +m4_define([_defopt], m4_default([$2], [auto])) +AC_ARG_WITH(perl, + AS_HELP_STRING([--with-perl], + [Use perl for extracting information from files (default: ]_defopt[)]), + [use_perl=$withval], [use_perl=]_defopt) +m4_undefine([_defopt]) + +if test "x$use_perl" = x"auto"; then + AC_PATH_PROG([PERL], [perl]) + if test "x$PERL" = "x"; then + AC_MSG_WARN([perl not found - cannot extract information and report]) + have_perl=no + else + have_perl=yes + fi +elif test "x$use_perl" = x"yes" ; then + AC_PATH_PROG([PERL], [perl]) + if test "x$PERL" = "x"; then + AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH]) + fi + have_perl=yes +elif test "x$use_perl" = x"no" ; then + if test "x$PERL" != "x"; then + AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified]) + fi + have_perl=no +else + AC_MSG_ERROR([--with-perl expects 'yes' or 'no']) +fi + +AM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes]) +]) # XORG_WITH_PERL + # XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT]) # ---------------- # Minimum version: 1.5.0 @@ -1662,10 +1779,11 @@ AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes]) AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes]) ]) # XORG_WITH_GROFF -# XORG_WITH_FOP([DEFAULT]) -# ---------------- +# XORG_WITH_FOP([MIN-VERSION], [DEFAULT]) +# --------------------------------------- # Minimum version: 1.6.0 # Minimum version for optional DEFAULT argument: 1.11.0 +# Minimum version for optional MIN-VERSION argument: 1.15.0 # # Documentation tools are not always available on all platforms and sometimes # not at the appropriate level. This macro enables a module to test for the @@ -1685,7 +1803,7 @@ AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes]) # AC_DEFUN([XORG_WITH_FOP],[ AC_ARG_VAR([FOP], [Path to fop command]) -m4_define([_defopt], m4_default([$1], [auto])) +m4_define([_defopt], m4_default([$2], [auto])) AC_ARG_WITH(fop, AS_HELP_STRING([--with-fop], [Use fop to regenerate documentation (default: ]_defopt[)]), @@ -1714,6 +1832,22 @@ elif test "x$use_fop" = x"no" ; then else AC_MSG_ERROR([--with-fop expects 'yes' or 'no']) fi + +# Test for a minimum version of fop, if provided. +m4_ifval([$1], +[if test "$have_fop" = yes; then + # scrape the fop version + AC_MSG_CHECKING([for fop minimum version]) + fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3` + AC_MSG_RESULT([$fop_version]) + AS_VERSION_COMPARE([$fop_version], [$1], + [if test "x$use_fop" = xauto; then + AC_MSG_WARN([fop version $fop_version found, but $1 needed]) + have_fop=no + else + AC_MSG_ERROR([fop version $fop_version found, but $1 needed]) + fi]) +fi]) AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes]) ]) # XORG_WITH_FOP @@ -1796,12 +1930,12 @@ AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes]) # parm1: specify the default value, yes or no. # AC_DEFUN([XORG_ENABLE_DOCS],[ -m4_define([default], m4_default([$1], [yes])) +m4_define([docs_default], m4_default([$1], [yes])) AC_ARG_ENABLE(docs, AS_HELP_STRING([--enable-docs], - [Enable building the documentation (default: ]default[)]), - [build_docs=$enableval], [build_docs=]default) -m4_undefine([default]) + [Enable building the documentation (default: ]docs_default[)]), + [build_docs=$enableval], [build_docs=]docs_default) +m4_undefine([docs_default]) AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes]) AC_MSG_CHECKING([whether to build documentation]) AC_MSG_RESULT([$build_docs]) @@ -1873,6 +2007,194 @@ AC_MSG_CHECKING([whether to build functional specifications]) AC_MSG_RESULT([$build_specs]) ]) # XORG_ENABLE_SPECS +# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto) +# ---------------------------------------------- +# Minimum version: 1.13.0 +# +# This macro enables a builder to enable/disable unit testing +# It makes no assumption about the test cases implementation +# Test cases may or may not use Automake "Support for test suites" +# They may or may not use the software utility library GLib +# +# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL +# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib. +# The variable enable_unit_tests is used by other macros in this file. +# +# Interface to module: +# ENABLE_UNIT_TESTS: used in makefiles to conditionally build tests +# enable_unit_tests: used in configure.ac for additional configuration +# --enable-unit-tests: 'yes' user instructs the module to build tests +# 'no' user instructs the module not to build tests +# parm1: specify the default value, yes or no. +# +AC_DEFUN([XORG_ENABLE_UNIT_TESTS],[ +AC_BEFORE([$0], [XORG_WITH_GLIB]) +AC_BEFORE([$0], [XORG_LD_WRAP]) +m4_define([_defopt], m4_default([$1], [auto])) +AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests], + [Enable building unit test cases (default: ]_defopt[)]), + [enable_unit_tests=$enableval], [enable_unit_tests=]_defopt) +m4_undefine([_defopt]) +AM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno]) +AC_MSG_CHECKING([whether to build unit test cases]) +AC_MSG_RESULT([$enable_unit_tests]) +]) # XORG_ENABLE_UNIT_TESTS + +# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT]) +# ---------------------------------------- +# Minimum version: 1.13.0 +# +# GLib is a library which provides advanced data structures and functions. +# This macro enables a module to test for the presence of Glib. +# +# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing. +# Otherwise the value of $enable_unit_tests is blank. +# +# Interface to module: +# HAVE_GLIB: used in makefiles to conditionally build targets +# with_glib: used in configure.ac to know if GLib has been found +# --with-glib: 'yes' user instructs the module to use glib +# 'no' user instructs the module not to use glib +# +AC_DEFUN([XORG_WITH_GLIB],[ +AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +m4_define([_defopt], m4_default([$2], [auto])) +AC_ARG_WITH(glib, AS_HELP_STRING([--with-glib], + [Use GLib library for unit testing (default: ]_defopt[)]), + [with_glib=$withval], [with_glib=]_defopt) +m4_undefine([_defopt]) + +have_glib=no +# Do not probe GLib if user explicitly disabled unit testing +if test "x$enable_unit_tests" != x"no"; then + # Do not probe GLib if user explicitly disabled it + if test "x$with_glib" != x"no"; then + m4_ifval( + [$1], + [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])], + [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])] + ) + fi +fi + +# Not having GLib when unit testing has been explicitly requested is an error +if test "x$enable_unit_tests" = x"yes"; then + if test "x$have_glib" = x"no"; then + AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found]) + fi +fi + +# Having unit testing disabled when GLib has been explicitly requested is an error +if test "x$enable_unit_tests" = x"no"; then + if test "x$with_glib" = x"yes"; then + AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found]) + fi +fi + +# Not having GLib when it has been explicitly requested is an error +if test "x$with_glib" = x"yes"; then + if test "x$have_glib" = x"no"; then + AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found]) + fi +fi + +AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes]) +]) # XORG_WITH_GLIB + +# XORG_LD_WRAP +# ------------ +# Minimum version: 1.13.0 +# +# Check if linker supports -wrap, passed via compiler flags +# +# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing. +# Otherwise the value of $enable_unit_tests is blank. +# +AC_DEFUN([XORG_LD_WRAP],[ +XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no]) +# Not having ld wrap when unit testing has been explicitly requested is an error +if test "x$enable_unit_tests" = x"yes"; then + if test "x$have_ld_wrap" = x"no"; then + AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available]) + fi +fi +AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes]) +# +]) # XORG_LD_WRAP + +# XORG_CHECK_LINKER_FLAGS +# ----------------------- +# SYNOPSIS +# +# XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE]) +# +# DESCRIPTION +# +# Check whether the given linker FLAGS work with the current language's +# linker, or whether they give an error. +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# NOTE: Based on AX_CHECK_COMPILER_FLAGS. +# +# LICENSE +# +# Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org> +# Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu> +# Copyright (c) 2009 Matteo Frigo +# +# 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 3 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, see <http://www.gnu.org/licenses/>. +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well.# +AC_DEFUN([XORG_CHECK_LINKER_FLAGS], +[AC_MSG_CHECKING([whether the linker accepts $1]) +dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname: +AS_LITERAL_IF([$1], + [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [ + ax_save_FLAGS=$LDFLAGS + LDFLAGS="$1" + AC_LINK_IFELSE([AC_LANG_PROGRAM()], + AS_TR_SH(xorg_cv_linker_flags_[$1])=yes, + AS_TR_SH(xorg_cv_linker_flags_[$1])=no) + LDFLAGS=$ax_save_FLAGS])], + [ax_save_FLAGS=$LDFLAGS + LDFLAGS="$1" + AC_LINK_IFELSE([AC_LANG_PROGRAM()], + eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes, + eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no) + LDFLAGS=$ax_save_FLAGS]) +eval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1]) +AC_MSG_RESULT($xorg_check_linker_flags) +if test "x$xorg_check_linker_flags" = xyes; then + m4_default([$2], :) +else + m4_default([$3], :) +fi +]) # XORG_CHECK_LINKER_FLAGS + # XORG_CHECK_MALLOC_ZERO # ---------------------- # Minimum version: 1.0.0 @@ -1889,18 +2211,16 @@ AC_ARG_ENABLE(malloc0returnsnull, AC_MSG_CHECKING([whether malloc(0) returns NULL]) if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then - AC_RUN_IFELSE([ -char *malloc(); -char *realloc(); -char *calloc(); -main() { + AC_RUN_IFELSE([AC_LANG_PROGRAM([ +#include <stdlib.h> +],[ char *m0, *r0, *c0, *p; m0 = malloc(0); p = malloc(10); r0 = realloc(p,0); - c0 = calloc(0); - exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1); -}], + c0 = calloc(0,10); + exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1); +])], [MALLOC_ZERO_RETURNS_NULL=yes], [MALLOC_ZERO_RETURNS_NULL=no], [MALLOC_ZERO_RETURNS_NULL=yes]) @@ -2026,6 +2346,23 @@ AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno]) ]) # XORG_LINT_LIBRARY +# XORG_COMPILER_BRAND +# ------------------- +# Minimum version: 1.14.0 +# +# Checks for various brands of compilers and sets flags as appropriate: +# GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes" +# clang compiler - sets CLANGCC to "yes" +# Intel compiler - sets INTELCC to "yes" +# Sun/Oracle Solaris Studio cc - sets SUNCC to "yes" +# +AC_DEFUN([XORG_COMPILER_BRAND], [ +AC_REQUIRE([AC_PROG_CC_C99]) +AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"]) +AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"]) +AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) +]) # XORG_COMPILER_BRAND + # XORG_CWARNFLAGS # --------------- # Minimum version: 1.2.0 @@ -2034,6 +2371,7 @@ AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno]) # AC_DEFUN([XORG_CWARNFLAGS], [ AC_REQUIRE([AC_PROG_CC_C99]) +AC_REQUIRE([XORG_COMPILER_BRAND]) if test "x$GCC" = xyes ; then CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ -Wmissing-declarations -Wnested-externs -fno-strict-aliasing \ @@ -2044,7 +2382,6 @@ if test "x$GCC" = xyes ; then ;; esac else - AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) if test "x$SUNCC" = "xyes"; then CWARNFLAGS="-v" fi @@ -2056,28 +2393,43 @@ AC_SUBST(CWARNFLAGS) # ----------------------- # Minimum version: 1.3.0 # -# Add configure option to enable strict compilation +# Add configure option to enable strict compilation flags, such as treating +# warnings as fatal errors. +# If --enable-strict-compilation is passed to configure, adds strict flags to +# $CWARNFLAGS. +# +# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or +# when strict compilation is unconditionally desired. AC_DEFUN([XORG_STRICT_OPTION], [ # If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89 AC_REQUIRE([AC_PROG_CC_C99]) +AC_REQUIRE([XORG_COMPILER_BRAND]) AC_REQUIRE([XORG_CWARNFLAGS]) AC_ARG_ENABLE(strict-compilation, AS_HELP_STRING([--enable-strict-compilation], [Enable all warnings from compiler and make them errors (default: disabled)]), [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no]) +if test "x$GCC" = xyes ; then + STRICT_CFLAGS="-pedantic -Werror" + # Add -Werror=attributes if supported (gcc 4.2 & later) + AC_MSG_CHECKING([if $CC supports -Werror=attributes]) + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $STRICT_CFLAGS -Werror=attributes" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([return 0;])], + [STRICT_CFLAGS="$STRICT_CFLAGS -Werror=attributes" + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + CFLAGS="$save_CFLAGS" +elif test "x$SUNCC" = "xyes"; then + STRICT_CFLAGS="-errwarn" +elif test "x$INTELCC" = "xyes"; then + STRICT_CFLAGS="-Werror" +fi if test "x$STRICT_COMPILE" = "xyes"; then - AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) - AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"]) - if test "x$GCC" = xyes ; then - STRICT_CFLAGS="-pedantic -Werror" - elif test "x$SUNCC" = "xyes"; then - STRICT_CFLAGS="-errwarn" - elif test "x$INTELCC" = "xyes"; then - STRICT_CFLAGS="-Werror" - fi + CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS" fi -CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS" +AC_SUBST([STRICT_CFLAGS]) AC_SUBST([CWARNFLAGS]) ]) # XORG_STRICT_OPTION diff --git a/app/twm/config.h.in b/app/twm/config.h.in index fd5811395..3a6943130 100644 --- a/app/twm/config.h.in +++ b/app/twm/config.h.in @@ -66,3 +66,35 @@ /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */ #undef YYTEXT_POINTER + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + diff --git a/app/twm/configure b/app/twm/configure index 4fdd12181..c031cd427 100644 --- a/app/twm/configure +++ b/app/twm/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.62 for twm 1.0.6. +# Generated by GNU Autoconf 2.62 for twm 1.0.7. # # Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>. # @@ -596,8 +596,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='twm' PACKAGE_TARNAME='twm' -PACKAGE_VERSION='1.0.6' -PACKAGE_STRING='twm 1.0.6' +PACKAGE_VERSION='1.0.7' +PACKAGE_STRING='twm 1.0.7' PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg' ac_unique_file="Makefile.am" @@ -674,6 +674,16 @@ LIBS build_alias host_alias target_alias +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +CPP +GREP +EGREP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA @@ -695,16 +705,6 @@ am__leading_dot AMTAR am__tar am__untar -MAINTAINER_MODE_TRUE -MAINTAINER_MODE_FALSE -MAINT -CC -CFLAGS -LDFLAGS -CPPFLAGS -ac_ct_CC -EXEEXT -OBJEXT DEPDIR am__include am__quote @@ -714,10 +714,11 @@ AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE -CPP -GREP -EGREP +MAINTAINER_MODE_TRUE +MAINTAINER_MODE_FALSE +MAINT CWARNFLAGS +STRICT_CFLAGS CHANGELOG_CMD PKG_CONFIG INSTALL_CMD @@ -758,8 +759,8 @@ LTLIBOBJS' ac_subst_files='' ac_user_opts=' enable_option_checking -enable_maintainer_mode enable_dependency_tracking +enable_maintainer_mode enable_strict_compilation ' ac_precious_vars='build_alias @@ -1328,7 +1329,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures twm 1.0.6 to adapt to many kinds of systems. +\`configure' configures twm 1.0.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1398,7 +1399,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of twm 1.0.6:";; + short | recursive ) echo "Configuration of twm 1.0.7:";; esac cat <<\_ACEOF @@ -1406,10 +1407,10 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer --enable-strict-compilation Enable all warnings from compiler and make them errors (default: disabled) @@ -1498,7 +1499,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -twm configure 1.0.6 +twm configure 1.0.7 generated by GNU Autoconf 2.62 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1512,7 +1513,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by twm $as_me 1.0.6, which was +It was created by twm $as_me 1.0.7, which was generated by GNU Autoconf 2.62. Invocation command line was $ $0 $@ @@ -1881,539 +1882,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" - -# Initialize Automake -am__api_version="1.9" -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 -$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} - { (exit 1); exit 1; }; } -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - -done -IFS=$as_save_IFS - -rm -rf conftest.one conftest.two conftest.dir - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. -# By default was `s,x,x', remove it if useless. -ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` - -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` - -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} -fi - -if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' - else - mkdir_p='$(SHELL) $(install_sh) -d' - fi -fi - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AWK+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { $as_echo "$as_me:$LINENO: result: $AWK" >&5 -$as_echo "$AWK" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AWK" && break -done - -{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 -$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} - { (exit 1); exit 1; }; } -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi - - -# Define the identity of the package. - PACKAGE='twm' - VERSION='1.0.6' - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -install_sh=${install_sh-"$am_aux_dir/install-sh"} - -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:$LINENO: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -# Always define AMTAR for backward compatibility. - -AMTAR=${AMTAR-"${am_missing_run}tar"} - -am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' - - - - - -{ $as_echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 -$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } - # Check whether --enable-maintainer-mode was given. -if test "${enable_maintainer_mode+set}" = set; then - enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval -else - USE_MAINTAINER_MODE=no -fi - - { $as_echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 -$as_echo "$USE_MAINTAINER_MODE" >&6; } - - -if test $USE_MAINTAINER_MODE = yes; then - MAINTAINER_MODE_TRUE= - MAINTAINER_MODE_FALSE='#' -else - MAINTAINER_MODE_TRUE='#' - MAINTAINER_MODE_FALSE= -fi - - MAINT=$MAINTAINER_MODE_TRUE - - - -# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS - - - - - - - - - - - -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo done -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote="\"" - _am_result=BSD - fi -fi - - -{ $as_echo "$as_me:$LINENO: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi - - -if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3345,317 +2813,6 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - - -if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - - { $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C99" >&5 -$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } -if test "${ac_cv_prog_cc_c99+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c99=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <stdarg.h> -#include <stdbool.h> -#include <stdlib.h> -#include <wchar.h> -#include <stdio.h> - -// Check varargs macros. These examples are taken from C99 6.10.3.5. -#define debug(...) fprintf (stderr, __VA_ARGS__) -#define showlist(...) puts (#__VA_ARGS__) -#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) -static void -test_varargs_macros (void) -{ - int x = 1234; - int y = 5678; - debug ("Flag"); - debug ("X = %d\n", x); - showlist (The first, second, and third items.); - report (x>y, "x is %d but y is %d", x, y); -} - -// Check long long types. -#define BIG64 18446744073709551615ull -#define BIG32 4294967295ul -#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) -#if !BIG_OK - your preprocessor is broken; -#endif -#if BIG_OK -#else - your preprocessor is broken; -#endif -static long long int bignum = -9223372036854775807LL; -static unsigned long long int ubignum = BIG64; - -struct incomplete_array -{ - int datasize; - double data[]; -}; - -struct named_init { - int number; - const wchar_t *name; - double average; -}; - -typedef const char *ccp; - -static inline int -test_restrict (ccp restrict text) -{ - // See if C++-style comments work. - // Iterate through items via the restricted pointer. - // Also check for declarations in for loops. - for (unsigned int i = 0; *(text+i) != '\0'; ++i) - continue; - return 0; -} - -// Check varargs and va_copy. -static void -test_varargs (const char *format, ...) -{ - va_list args; - va_start (args, format); - va_list args_copy; - va_copy (args_copy, args); - - const char *str; - int number; - float fnumber; - - while (*format) - { - switch (*format++) - { - case 's': // string - str = va_arg (args_copy, const char *); - break; - case 'd': // int - number = va_arg (args_copy, int); - break; - case 'f': // float - fnumber = va_arg (args_copy, double); - break; - default: - break; - } - } - va_end (args_copy); - va_end (args); -} - -int -main () -{ - - // Check bool. - _Bool success = false; - - // Check restrict. - if (test_restrict ("String literal") == 0) - success = true; - char *restrict newvar = "Another string"; - - // Check varargs. - test_varargs ("s, d' f .", "string", 65, 34.234); - test_varargs_macros (); - - // Check flexible array members. - struct incomplete_array *ia = - malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); - ia->datasize = 10; - for (int i = 0; i < ia->datasize; ++i) - ia->data[i] = i * 1.234; - - // Check named initializers. - struct named_init ni = { - .number = 34, - .name = L"Test wide string", - .average = 543.34343, - }; - - ni.number = 58; - - int dynamic_array[ni.number]; - dynamic_array[ni.number - 1] = 543; - - // work around unused variable warnings - return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' - || dynamic_array[ni.number - 1] != 543); - - ; - return 0; -} -_ACEOF -for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99 -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_c99=$ac_arg -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c99" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c99" in - x) - { $as_echo "$as_me:$LINENO: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:$LINENO: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c99" - { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c99" >&5 -$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; -esac - - - ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -4277,6 +3434,1264 @@ done + if test "${ac_cv_header_minix_config_h+set}" = set; then + { $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5 +$as_echo_n "checking for minix/config.h... " >&6; } +if test "${ac_cv_header_minix_config_h+set}" = set; then + $as_echo_n "(cached) " >&6 +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 +$as_echo "$ac_cv_header_minix_config_h" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking minix/config.h usability" >&5 +$as_echo_n "checking minix/config.h usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <minix/config.h> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking minix/config.h presence" >&5 +$as_echo_n "checking minix/config.h presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <minix/config.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: minix/config.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: minix/config.h: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: minix/config.h: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: minix/config.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ---------------------------------------------------------------------- ## +## Report this to https://bugs.freedesktop.org/enter_bug.cgi?product=xorg ## +## ---------------------------------------------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5 +$as_echo_n "checking for minix/config.h... " >&6; } +if test "${ac_cv_header_minix_config_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_header_minix_config_h=$ac_header_preproc +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 +$as_echo "$ac_cv_header_minix_config_h" >&6; } + +fi +if test $ac_cv_header_minix_config_h = yes; then + MINIX=yes +else + MINIX= +fi + + + if test "$MINIX" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define _POSIX_SOURCE 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define _POSIX_1_SOURCE 2 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define _MINIX 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:$LINENO: checking whether it is safe to define __EXTENSIONS__" >&5 +$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if test "${ac_cv_safe_to_define___extensions__+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +# define __EXTENSIONS__ 1 + $ac_includes_default +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_safe_to_define___extensions__=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_safe_to_define___extensions__=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_safe_to_define___extensions__" >&5 +$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } + test $ac_cv_safe_to_define___extensions__ = yes && + cat >>confdefs.h <<\_ACEOF +#define __EXTENSIONS__ 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _ALL_SOURCE 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _GNU_SOURCE 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _POSIX_PTHREAD_SEMANTICS 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _TANDEM_SOURCE 1 +_ACEOF + + + +# Initialize Automake +am__api_version="1.9" +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 +$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} + { (exit 1); exit 1; }; } +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + +done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(SHELL) $(install_sh) -d' + fi +fi + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_AWK+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:$LINENO: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +{ $as_echo "$as_me:$LINENO: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='twm' + VERSION='1.0.7' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:$LINENO: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + +{ $as_echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 +$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } + # Check whether --enable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + { $as_echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 +$as_echo "$USE_MAINTAINER_MODE" >&6; } + + +if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + + +# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS + + + + + + + + + + + + { $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C99" >&5 +$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } +if test "${ac_cv_prog_cc_c99+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdbool.h> +#include <stdlib.h> +#include <wchar.h> +#include <stdio.h> + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +#define debug(...) fprintf (stderr, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + your preprocessor is broken; +#endif +#if BIG_OK +#else + your preprocessor is broken; +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\0'; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static void +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str; + int number; + float fnumber; + + while (*format) + { + switch (*format++) + { + case 's': // string + str = va_arg (args_copy, const char *); + break; + case 'd': // int + number = va_arg (args_copy, int); + break; + case 'f': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); +} + +int +main () +{ + + // Check bool. + _Bool success = false; + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + test_varargs ("s, d' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' + || dynamic_array[ni.number - 1] != 543); + + ; + return 0; +} +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99 +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c99=$ac_arg +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c99" in + x) + { $as_echo "$as_me:$LINENO: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:$LINENO: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c99" + { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c99" >&5 +$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; +esac + + + + + +{ $as_echo "$as_me:$LINENO: checking whether __clang__ is declared" >&5 +$as_echo_n "checking whether __clang__ is declared... " >&6; } +if test "${ac_cv_have_decl___clang__+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef __clang__ + (void) __clang__; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl___clang__=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl___clang__=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl___clang__" >&5 +$as_echo "$ac_cv_have_decl___clang__" >&6; } +if test $ac_cv_have_decl___clang__ = yes; then + CLANGCC="yes" +else + CLANGCC="no" +fi + +{ $as_echo "$as_me:$LINENO: checking whether __INTEL_COMPILER is declared" >&5 +$as_echo_n "checking whether __INTEL_COMPILER is declared... " >&6; } +if test "${ac_cv_have_decl___INTEL_COMPILER+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef __INTEL_COMPILER + (void) __INTEL_COMPILER; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl___INTEL_COMPILER=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl___INTEL_COMPILER=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl___INTEL_COMPILER" >&5 +$as_echo "$ac_cv_have_decl___INTEL_COMPILER" >&6; } +if test $ac_cv_have_decl___INTEL_COMPILER = yes; then + INTELCC="yes" +else + INTELCC="no" +fi + +{ $as_echo "$as_me:$LINENO: checking whether __SUNPRO_C is declared" >&5 +$as_echo_n "checking whether __SUNPRO_C is declared... " >&6; } +if test "${ac_cv_have_decl___SUNPRO_C+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef __SUNPRO_C + (void) __SUNPRO_C; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl___SUNPRO_C=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl___SUNPRO_C=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl___SUNPRO_C" >&5 +$as_echo "$ac_cv_have_decl___SUNPRO_C" >&6; } +if test $ac_cv_have_decl___SUNPRO_C = yes; then + SUNCC="yes" +else + SUNCC="no" +fi + + + if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then @@ -4554,6 +4969,7 @@ $as_echo "$ac_cv_path_SED" >&6; } + if test "x$GCC" = xyes ; then CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ -Wmissing-declarations -Wnested-externs -fno-strict-aliasing \ @@ -4564,65 +4980,6 @@ if test "x$GCC" = xyes ; then ;; esac else - { $as_echo "$as_me:$LINENO: checking whether __SUNPRO_C is declared" >&5 -$as_echo_n "checking whether __SUNPRO_C is declared... " >&6; } -if test "${ac_cv_have_decl___SUNPRO_C+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef __SUNPRO_C - (void) __SUNPRO_C; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_have_decl___SUNPRO_C=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_have_decl___SUNPRO_C=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl___SUNPRO_C" >&5 -$as_echo "$ac_cv_have_decl___SUNPRO_C" >&6; } -if test $ac_cv_have_decl___SUNPRO_C = yes; then - SUNCC="yes" -else - SUNCC="no" -fi - if test "x$SUNCC" = "xyes"; then CWARNFLAGS="-v" fi @@ -4634,6 +4991,7 @@ fi + # Check whether --enable-strict-compilation was given. if test "${enable_strict_compilation+set}" = set; then enableval=$enable_strict_compilation; STRICT_COMPILE=$enableval @@ -4641,29 +4999,20 @@ else STRICT_COMPILE=no fi -if test "x$STRICT_COMPILE" = "xyes"; then - { $as_echo "$as_me:$LINENO: checking whether __SUNPRO_C is declared" >&5 -$as_echo_n "checking whether __SUNPRO_C is declared... " >&6; } -if test "${ac_cv_have_decl___SUNPRO_C+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF +if test "x$GCC" = xyes ; then + STRICT_CFLAGS="-pedantic -Werror" + # Add -Werror=attributes if supported (gcc 4.2 & later) + { $as_echo "$as_me:$LINENO: checking if $CC supports -Werror=attributes" >&5 +$as_echo_n "checking if $CC supports -Werror=attributes... " >&6; } + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $STRICT_CFLAGS -Werror=attributes" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef __SUNPRO_C - (void) __SUNPRO_C; -#endif - - ; - return 0; -} +return 0; _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -4683,92 +5032,28 @@ $as_echo "$ac_try_echo") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_have_decl___SUNPRO_C=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_have_decl___SUNPRO_C=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl___SUNPRO_C" >&5 -$as_echo "$ac_cv_have_decl___SUNPRO_C" >&6; } -if test $ac_cv_have_decl___SUNPRO_C = yes; then - SUNCC="yes" -else - SUNCC="no" -fi - - { $as_echo "$as_me:$LINENO: checking whether __INTEL_COMPILER is declared" >&5 -$as_echo_n "checking whether __INTEL_COMPILER is declared... " >&6; } -if test "${ac_cv_have_decl___INTEL_COMPILER+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef __INTEL_COMPILER - (void) __INTEL_COMPILER; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_have_decl___INTEL_COMPILER=yes + STRICT_CFLAGS="$STRICT_CFLAGS -Werror=attributes" + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_have_decl___INTEL_COMPILER=no + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" +elif test "x$SUNCC" = "xyes"; then + STRICT_CFLAGS="-errwarn" +elif test "x$INTELCC" = "xyes"; then + STRICT_CFLAGS="-Werror" fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl___INTEL_COMPILER" >&5 -$as_echo "$ac_cv_have_decl___INTEL_COMPILER" >&6; } -if test $ac_cv_have_decl___INTEL_COMPILER = yes; then - INTELCC="yes" -else - INTELCC="no" +if test "x$STRICT_COMPILE" = "xyes"; then + CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS" fi - if test "x$GCC" = xyes ; then - STRICT_CFLAGS="-pedantic -Werror" - elif test "x$SUNCC" = "xyes"; then - STRICT_CFLAGS="-errwarn" - elif test "x$INTELCC" = "xyes"; then - STRICT_CFLAGS="-Werror" - fi -fi -CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS" @@ -5322,12 +5607,12 @@ if test -n "$PKG_CONFIG"; then pkg_cv_TWM_CFLAGS="$TWM_CFLAGS" else if test -n "$PKG_CONFIG" && \ - { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"x11 xext xt xmu ice sm\"") >&5 - ($PKG_CONFIG --exists --print-errors "x11 xext xt xmu ice sm") 2>&5 + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"x11 xext xt xmu ice sm xproto >= 7.0.17\"") >&5 + ($PKG_CONFIG --exists --print-errors "x11 xext xt xmu ice sm xproto >= 7.0.17") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_TWM_CFLAGS=`$PKG_CONFIG --cflags "x11 xext xt xmu ice sm" 2>/dev/null` + pkg_cv_TWM_CFLAGS=`$PKG_CONFIG --cflags "x11 xext xt xmu ice sm xproto >= 7.0.17" 2>/dev/null` else pkg_failed=yes fi @@ -5340,12 +5625,12 @@ if test -n "$PKG_CONFIG"; then pkg_cv_TWM_LIBS="$TWM_LIBS" else if test -n "$PKG_CONFIG" && \ - { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"x11 xext xt xmu ice sm\"") >&5 - ($PKG_CONFIG --exists --print-errors "x11 xext xt xmu ice sm") 2>&5 + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"x11 xext xt xmu ice sm xproto >= 7.0.17\"") >&5 + ($PKG_CONFIG --exists --print-errors "x11 xext xt xmu ice sm xproto >= 7.0.17") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_TWM_LIBS=`$PKG_CONFIG --libs "x11 xext xt xmu ice sm" 2>/dev/null` + pkg_cv_TWM_LIBS=`$PKG_CONFIG --libs "x11 xext xt xmu ice sm xproto >= 7.0.17" 2>/dev/null` else pkg_failed=yes fi @@ -5364,14 +5649,14 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - TWM_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "x11 xext xt xmu ice sm"` + TWM_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "x11 xext xt xmu ice sm xproto >= 7.0.17"` else - TWM_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "x11 xext xt xmu ice sm"` + TWM_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "x11 xext xt xmu ice sm xproto >= 7.0.17"` fi # Put the nasty error message in config.log where it belongs echo "$TWM_PKG_ERRORS" >&5 - { { $as_echo "$as_me:$LINENO: error: Package requirements (x11 xext xt xmu ice sm) were not met: + { { $as_echo "$as_me:$LINENO: error: Package requirements (x11 xext xt xmu ice sm xproto >= 7.0.17) were not met: $TWM_PKG_ERRORS @@ -5382,7 +5667,7 @@ Alternatively, you may set the environment variables TWM_CFLAGS and TWM_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " >&5 -$as_echo "$as_me: error: Package requirements (x11 xext xt xmu ice sm) were not met: +$as_echo "$as_me: error: Package requirements (x11 xext xt xmu ice sm xproto >= 7.0.17) were not met: $TWM_PKG_ERRORS @@ -5523,13 +5808,6 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs -if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then - { { $as_echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -$as_echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -5544,6 +5822,13 @@ $as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi : ${CONFIG_STATUS=./config.status} ac_write_fail=0 @@ -5866,7 +6151,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by twm $as_me 1.0.6, which was +This file was extended by twm $as_me 1.0.7, which was generated by GNU Autoconf 2.62. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5919,7 +6204,7 @@ Report bugs to <bug-autoconf@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -twm config.status 1.0.6 +twm config.status 1.0.7 configured by $0, generated by GNU Autoconf 2.62, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/app/twm/configure.ac b/app/twm/configure.ac index 6f1cef730..09657a090 100644 --- a/app/twm/configure.ac +++ b/app/twm/configure.ac @@ -22,10 +22,11 @@ dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT([twm], [1.0.6], +AC_INIT([twm], [1.0.7], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [twm]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) +AC_USE_SYSTEM_EXTENSIONS # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-bzip2]) @@ -49,7 +50,7 @@ AC_PROG_LEX AC_CHECK_FUNCS([mkstemp]) # Checks for pkg-config packages -PKG_CHECK_MODULES(TWM, x11 xext xt xmu ice sm) +PKG_CHECK_MODULES(TWM, x11 xext xt xmu ice sm xproto >= 7.0.17) AC_OUTPUT([Makefile src/Makefile diff --git a/app/twm/man/Makefile.in b/app/twm/man/Makefile.in index 53586afa3..64a21ca30 100644 --- a/app/twm/man/Makefile.in +++ b/app/twm/man/Makefile.in @@ -46,9 +46,9 @@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c +install_sh_DATA = ${SHELL} $(install_sh) -c -m 644 +install_sh_PROGRAM = ${SHELL} $(install_sh) -c +install_sh_SCRIPT = ${SHELL} $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : @@ -146,6 +146,7 @@ PKG_CONFIG = @PKG_CONFIG@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ TWM_CFLAGS = @TWM_CFLAGS@ TWM_LIBS = @TWM_LIBS@ diff --git a/app/twm/man/twm.man b/app/twm/man/twm.man index ab23f7403..43cc9bd79 100644 --- a/app/twm/man/twm.man +++ b/app/twm/man/twm.man @@ -52,7 +52,7 @@ click-to-type and pointer-driven keyboard focus, and user-specified key and pointer button bindings. .PP This program is usually started by the user's session manager or -startup script. When used from \fIxdm(1)\fP or \fIxinit(1)\fP without +startup script. When used from \fIxdm(__appmansuffix__)\fP or \fIxinit(__appmansuffix__)\fP without a session manager, \fItwm\fP is frequently executed in the foreground as the last client. When run this way, exiting \fItwm\fP causes the session to be terminated (i.e., logged out). @@ -143,7 +143,7 @@ If no startup files are found, \fItwm\fP will use the built-in defaults described above. The only resource used by \fItwm\fP is \fIbitmapFilePath\fP for a colon-separated list of directories to search when looking for bitmap files (for more information, see the \fIAthena -Widgets\fP manual and \fIxrdb(1)\fP). +Widgets\fP manual and \fIxrdb(__appmansuffix__)\fP). .PP \fITwm\fP startup files are logically broken up into three types of specifications: \fIVariables\fP, \fIBindings\fP, \fIMenus\fP. The @@ -338,7 +338,7 @@ from bitmap files, the following syntax is used instead: \fIcursorname\fP "\fIimage\fP" "\fImask\fP" .EE The \fIimage\fP and \fImask\fP strings specify the names of files containing -the glyph image and mask in \fIbitmap(1)\fP form. +the glyph image and mask in \fIbitmap(__appmansuffix__)\fP form. The bitmap files are located in the same manner as icon bitmap files. The following example shows the default cursor definitions: .EX 0 @@ -1275,7 +1275,7 @@ This variable is used as the prefix for files that begin with a tilde and for locating the \fItwm\fP startup file. .SH "SEE ALSO" .PP -X(__miscmansuffix__), Xserver(1), xdm(1), xrdb(1) +X(__miscmansuffix__), Xserver(__appmansuffix__), xdm(__appmansuffix__), xrdb(__appmansuffix__) .SH AUTHORS Tom LaStrange, Solbourne Computer; Jim Fulton, MIT X Consortium; Steve Pitschke, Stardent Computer; Keith Packard, MIT X Consortium; diff --git a/app/twm/src/Makefile.am b/app/twm/src/Makefile.am index cb6f615c9..9e5312cf0 100644 --- a/app/twm/src/Makefile.am +++ b/app/twm/src/Makefile.am @@ -27,58 +27,58 @@ bin_PROGRAMS = twm rcdir = ${datadir}/X11/twm dist_rc_DATA = system.twmrc -AM_CFLAGS = $(TWM_CFLAGS) -DXVENDORNAME=\"The\ X.Org\ Foundation\" -DXORG_RELEASE=\"Release\ $(VERSION)\" -D_BSD_SOURCE -AM_CFLAGS += -DSYSTEM_INIT_FILE=\"${datadir}/X11/twm/system.twmrc\" +AM_CPPFLAGS = \ + -DXVENDORNAME=\"The\ X.Org\ Foundation\" \ + -DXORG_RELEASE=\"Release\ $(VERSION)\" \ + -DSYSTEM_INIT_FILE=\"${datadir}/X11/twm/system.twmrc\" +AM_CFLAGS = $(TWM_CFLAGS) twm_LDADD = $(TWM_LIBS) -twm_SOURCES = \ - add_window.c \ - add_window.h \ - cursor.c \ - deftwmrc.c \ - events.c \ - events.h \ - gc.c \ - gc.h \ - iconmgr.c \ - iconmgr.h \ - icons.c \ - icons.h \ - list.c \ - list.h \ - menus.c \ - menus.h \ - parse.c \ - parse.h \ - resize.c \ - resize.h \ - screen.h \ - session.c \ - session.h \ - twm.c \ - twm.h \ - util.c \ - util.h \ - version.c \ - version.h \ - gram.y \ +twm_SOURCES = \ + add_window.c \ + add_window.h \ + cursor.c \ + deftwmrc.c \ + events.c \ + events.h \ + gc.c \ + gc.h \ + iconmgr.c \ + iconmgr.h \ + icons.c \ + icons.h \ + list.c \ + list.h \ + menus.c \ + menus.h \ + parse.c \ + parse.h \ + resize.c \ + resize.h \ + screen.h \ + session.c \ + session.h \ + twm.c \ + twm.h \ + util.c \ + util.h \ + version.c \ + version.h \ + gram.y \ lex.l -BUILT_SOURCES = gram.h gram.c lex.c deftwmrc.c -MAINTAINERCLEANFILES = $(BUILT_SOURCES) - -gram.h: gram.c +BUILT_SOURCES = gram.h deftwmrc.c deftwmrc.c: system.twmrc - $(AM_V_GEN)rm -f $@ ; \ - echo '/* ' >>$@ ; \ - echo ' * This file is generated automatically from the default' >>$@ ; \ - echo ' * twm bindings file system.twmrc by the twm Makefile.' >>$@ ; \ - echo ' */' >>$@ ; \ - echo '' >>$@ ; \ - echo 'unsigned char *defTwmrc[] = {' >>$@ ; \ - sed -f ${srcdir}/deftwmrc.sed < ${srcdir}/system.twmrc >>$@ ; \ + $(AM_V_at)rm -f $@ ; \ + echo '/* ' >>$@ ; \ + echo ' * This file is generated automatically from the default' >>$@ ; \ + echo ' * twm bindings file system.twmrc by the twm Makefile.' >>$@ ; \ + echo ' */' >>$@ ; \ + echo '' >>$@ ; \ + echo 'unsigned char *defTwmrc[] = {' >>$@ ; \ + $(SED) -f ${srcdir}/deftwmrc.sed < ${srcdir}/system.twmrc >>$@ ; \ echo ' (unsigned char *) 0 };' >>$@ EXTRA_DIST = deftwmrc.sed siconify.bm diff --git a/app/twm/src/Makefile.in b/app/twm/src/Makefile.in index 0e36a3d29..c8f3def69 100644 --- a/app/twm/src/Makefile.in +++ b/app/twm/src/Makefile.in @@ -46,9 +46,9 @@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c +install_sh_DATA = ${SHELL} $(install_sh) -c -m 644 +install_sh_PROGRAM = ${SHELL} $(install_sh) -c +install_sh_SCRIPT = ${SHELL} $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : @@ -170,6 +170,7 @@ PKG_CONFIG = @PKG_CONFIG@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ TWM_CFLAGS = @TWM_CFLAGS@ TWM_LIBS = @TWM_LIBS@ @@ -224,45 +225,47 @@ target_alias = @target_alias@ AM_YFLAGS = -d rcdir = ${datadir}/X11/twm dist_rc_DATA = system.twmrc -AM_CFLAGS = $(TWM_CFLAGS) -DXVENDORNAME=\"The\ X.Org\ Foundation\" \ - -DXORG_RELEASE=\"Release\ $(VERSION)\" -D_BSD_SOURCE \ +AM_CPPFLAGS = \ + -DXVENDORNAME=\"The\ X.Org\ Foundation\" \ + -DXORG_RELEASE=\"Release\ $(VERSION)\" \ -DSYSTEM_INIT_FILE=\"${datadir}/X11/twm/system.twmrc\" + +AM_CFLAGS = $(TWM_CFLAGS) twm_LDADD = $(TWM_LIBS) twm_SOURCES = \ - add_window.c \ - add_window.h \ - cursor.c \ - deftwmrc.c \ - events.c \ - events.h \ - gc.c \ - gc.h \ - iconmgr.c \ - iconmgr.h \ - icons.c \ - icons.h \ - list.c \ - list.h \ - menus.c \ - menus.h \ - parse.c \ - parse.h \ - resize.c \ - resize.h \ - screen.h \ - session.c \ - session.h \ - twm.c \ - twm.h \ - util.c \ - util.h \ - version.c \ - version.h \ - gram.y \ + add_window.c \ + add_window.h \ + cursor.c \ + deftwmrc.c \ + events.c \ + events.h \ + gc.c \ + gc.h \ + iconmgr.c \ + iconmgr.h \ + icons.c \ + icons.h \ + list.c \ + list.h \ + menus.c \ + menus.h \ + parse.c \ + parse.h \ + resize.c \ + resize.h \ + screen.h \ + session.c \ + session.h \ + twm.c \ + twm.h \ + util.c \ + util.h \ + version.c \ + version.h \ + gram.y \ lex.l -BUILT_SOURCES = gram.h gram.c lex.c deftwmrc.c -MAINTAINERCLEANFILES = $(BUILT_SOURCES) +BUILT_SOURCES = gram.h deftwmrc.c EXTRA_DIST = deftwmrc.sed siconify.bm all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am @@ -321,6 +324,11 @@ uninstall-binPROGRAMS: clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +gram.h: gram.c + @if test ! -f $@; then \ + rm -f gram.c; \ + $(MAKE) gram.c; \ + else :; fi twm$(EXEEXT): $(twm_OBJECTS) $(twm_DEPENDENCIES) @rm -f twm$(EXEEXT) $(LINK) $(twm_LDFLAGS) $(twm_OBJECTS) $(twm_LDADD) $(LIBS) @@ -519,7 +527,6 @@ maintainer-clean-generic: -rm -f gram.h -rm -f lex.c -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am @@ -583,17 +590,15 @@ uninstall-am: uninstall-binPROGRAMS uninstall-dist_rcDATA \ uninstall-dist_rcDATA uninstall-info-am -gram.h: gram.c - deftwmrc.c: system.twmrc - $(AM_V_GEN)rm -f $@ ; \ - echo '/* ' >>$@ ; \ - echo ' * This file is generated automatically from the default' >>$@ ; \ - echo ' * twm bindings file system.twmrc by the twm Makefile.' >>$@ ; \ - echo ' */' >>$@ ; \ - echo '' >>$@ ; \ - echo 'unsigned char *defTwmrc[] = {' >>$@ ; \ - sed -f ${srcdir}/deftwmrc.sed < ${srcdir}/system.twmrc >>$@ ; \ + $(AM_V_at)rm -f $@ ; \ + echo '/* ' >>$@ ; \ + echo ' * This file is generated automatically from the default' >>$@ ; \ + echo ' * twm bindings file system.twmrc by the twm Makefile.' >>$@ ; \ + echo ' */' >>$@ ; \ + echo '' >>$@ ; \ + echo 'unsigned char *defTwmrc[] = {' >>$@ ; \ + $(SED) -f ${srcdir}/deftwmrc.sed < ${srcdir}/system.twmrc >>$@ ; \ echo ' (unsigned char *) 0 };' >>$@ # 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. diff --git a/app/twm/src/add_window.c b/app/twm/src/add_window.c index af7e38413..8cf23c5e5 100644 --- a/app/twm/src/add_window.c +++ b/app/twm/src/add_window.c @@ -94,13 +94,13 @@ static void CreateWindowTitlebarButtons ( TwmWindow *tmp_win ); char NoName[] = "Untitled"; /* name if no name is specified */ -/** - * map gravity to (x,y) offset signs for adding to x and y when window is +/** + * map gravity to (x,y) offset signs for adding to x and y when window is * mapped to get proper placement. * * \param tmp window from which to get gravity * \param xp,yp return values - * + * */ void GetGravityOffsets (TwmWindow *tmp, int *xp, int *yp) @@ -120,7 +120,7 @@ GetGravityOffsets (TwmWindow *tmp, int *xp, int *yp) { 1, 1 }, /* SouthEastGravity */ { 0, 0 }, /* StaticGravity */ }; - register int g = ((tmp->hints.flags & PWinGravity) + register int g = ((tmp->hints.flags & PWinGravity) ? tmp->hints.win_gravity : NorthWestGravity); if (g < ForgetGravity || g > StaticGravity) { @@ -134,7 +134,7 @@ GetGravityOffsets (TwmWindow *tmp, int *xp, int *yp) -/** +/** * add a new window to the twm list. * * \return pointer to the TwmWindow structure @@ -166,7 +166,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) char *name; #ifdef DEBUG - fprintf(stderr, "AddWindow: w = 0x%x\n", w); + fprintf(stderr, "AddWindow: w = 0x%lx\n", (unsigned long)w); #endif /* allocate space for the twm window */ @@ -212,7 +212,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) tmp_win->widthEverChangedByUser = width_ever_changed_by_user; tmp_win->heightEverChangedByUser = height_ever_changed_by_user; - + if (width_ever_changed_by_user) tmp_win->attr.width = saved_width; @@ -256,7 +256,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) } } - if (tmp_win->wmhints && (tmp_win->wmhints->flags & WindowGroupHint)) + if (tmp_win->wmhints && (tmp_win->wmhints->flags & WindowGroupHint)) tmp_win->group = tmp_win->wmhints->window_group; else tmp_win->group = tmp_win->w/* NULL */; @@ -277,19 +277,19 @@ AddWindow(Window w, int iconm, IconMgr *iconp) tmp_win->full_name = strdup(tmp_win->name); namelen = strlen (tmp_win->name); - tmp_win->highlight = Scr->Highlight && - (!(short)(long) LookInList(Scr->NoHighlight, tmp_win->full_name, + tmp_win->highlight = Scr->Highlight && + (!(short)(long) LookInList(Scr->NoHighlight, tmp_win->full_name, &tmp_win->class)); tmp_win->stackmode = Scr->StackMode && - (!(short)(long) LookInList(Scr->NoStackModeL, tmp_win->full_name, + (!(short)(long) LookInList(Scr->NoStackModeL, tmp_win->full_name, &tmp_win->class)); - tmp_win->titlehighlight = Scr->TitleHighlight && - (!(short)(long) LookInList(Scr->NoTitleHighlight, tmp_win->full_name, + tmp_win->titlehighlight = Scr->TitleHighlight && + (!(short)(long) LookInList(Scr->NoTitleHighlight, tmp_win->full_name, &tmp_win->class)); - tmp_win->auto_raise = (short)(long) LookInList(Scr->AutoRaise, + tmp_win->auto_raise = (short)(long) LookInList(Scr->AutoRaise, tmp_win->full_name, &tmp_win->class); if (tmp_win->auto_raise) Scr->NumAutoRaises++; @@ -300,7 +300,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) !(short)(long) LookInList(Scr->DontIconify, tmp_win->full_name, &tmp_win->class); } - tmp_win->iconify_by_unmapping |= + tmp_win->iconify_by_unmapping |= (short)(long) LookInList(Scr->IconifyByUn, tmp_win->full_name, &tmp_win->class); @@ -324,7 +324,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) * since it is coming from the screen list */ if (HasShape) { - if (!LookInList (Scr->DontSqueezeTitleL, tmp_win->full_name, + if (!LookInList (Scr->DontSqueezeTitleL, tmp_win->full_name, &tmp_win->class)) { tmp_win->squeeze_info = (SqueezeInfo *) LookInList (Scr->SqueezeTitleL, tmp_win->full_name, @@ -387,19 +387,19 @@ AddWindow(Window w, int iconm, IconMgr *iconp) /* * Don't bother user if: - * + * * o the window is a transient, or - * + * * o a USPosition was requested, or - * + * * o a PPosition was requested and UsePPosition is ON or * NON_ZERO if the window is at other than (0,0) */ ask_user = TRUE; - if (tmp_win->transient || + if (tmp_win->transient || (tmp_win->hints.flags & USPosition) || ((tmp_win->hints.flags & PPosition) && Scr->UsePPosition && - (Scr->UsePPosition == PPOS_ON || + (Scr->UsePPosition == PPOS_ON || tmp_win->attr.x != 0 || tmp_win->attr.y != 0))) ask_user = FALSE; @@ -423,7 +423,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) { Bool firsttime = True; - /* better wait until all the mouse buttons have been + /* better wait until all the mouse buttons have been * released. */ while (TRUE) @@ -433,7 +433,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) XGrabServer(dpy); JunkMask = 0; - if (!XQueryPointer (dpy, Scr->Root, &JunkRoot, + if (!XQueryPointer (dpy, Scr->Root, &JunkRoot, &JunkChild, &JunkX, &JunkY, &AddingX, &AddingY, &JunkMask)) JunkMask = 0; @@ -462,7 +462,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) */ if (JunkMask != 0) continue; - /* + /* * this will cause a warp to the indicated root */ stat = XGrabPointer(dpy, Scr->Root, False, @@ -478,7 +478,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) width = (SIZE_HINDENT + MyFont_TextWidth (&Scr->SizeFont, tmp_win->name, namelen)); height = Scr->SizeFont.height + SIZE_VINDENT * 2; - + XResizeWindow (dpy, Scr->SizeWindow, width + SIZE_HINDENT, height); XMapRaised(dpy, Scr->SizeWindow); InstallRootColormap(); @@ -493,16 +493,16 @@ AddWindow(Window w, int iconm, IconMgr *iconp) AddingW = tmp_win->attr.width + bw2; AddingH = tmp_win->attr.height + tmp_win->title_height + bw2; - + if (Scr->DontMoveOff) { /* - * Make sure the initial outline comes up on the screen. + * Make sure the initial outline comes up on the screen. */ if (AddingX < 0) AddingX = 0; if (AddingX > Scr->MyDisplayWidth - AddingW) AddingX = Scr->MyDisplayWidth - AddingW; - + if (AddingY < 0) AddingY = 0; if (AddingY > Scr->MyDisplayHeight - AddingH) @@ -523,29 +523,29 @@ AddWindow(Window w, int iconm, IconMgr *iconp) if (Event.type == ButtonPress) break; } - + if (event.type == ButtonPress) { AddingX = event.xbutton.x_root; AddingY = event.xbutton.y_root; - + /* DontMoveOff prohibits user form off-screen placement */ - if (Scr->DontMoveOff) + if (Scr->DontMoveOff) { int AddingR, AddingB; - + AddingR = AddingX + AddingW; AddingB = AddingY + AddingH; - + if (AddingX < 0) AddingX = 0; if (AddingR > Scr->MyDisplayWidth) AddingX = Scr->MyDisplayWidth - AddingW; - + if (AddingY < 0) AddingY = 0; if (AddingB > Scr->MyDisplayHeight) AddingY = Scr->MyDisplayHeight - AddingH; - + } break; } @@ -563,7 +563,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) AddingR = AddingX + AddingW; AddingB = AddingY + AddingH; - + if (AddingX < 0) AddingX = 0; if (AddingR > Scr->MyDisplayWidth) @@ -594,7 +594,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) if (0/*Scr->AutoRelativeResize*/) { int dx = (tmp_win->attr.width / 4); int dy = (tmp_win->attr.height / 4); - + #define HALF_AVE_CURSOR_SIZE 8 /* so that it is visible */ if (dx < HALF_AVE_CURSOR_SIZE) dx = HALF_AVE_CURSOR_SIZE; if (dy < HALF_AVE_CURSOR_SIZE) dy = HALF_AVE_CURSOR_SIZE; @@ -640,7 +640,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) /* * XXX - if we are going to do a loop, we ought to consider - * using multiple GXxor lines so that we don't need to + * using multiple GXxor lines so that we don't need to * grab the server. */ XQueryPointer(dpy, Scr->Root, &JunkRoot, &JunkChild, @@ -655,7 +655,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) } } - } + } else if (event.xbutton.button == Button3) { int maxw = Scr->MyDisplayWidth - AddingX - bw2; @@ -698,7 +698,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) #ifdef DEBUG - fprintf(stderr, " position window %d, %d %dx%d\n", + fprintf(stderr, " position window %d, %d %dx%d\n", tmp_win->attr.x, tmp_win->attr.y, tmp_win->attr.width, @@ -737,9 +737,9 @@ AddWindow(Window w, int iconm, IconMgr *iconp) /* * Make sure the client window still exists. We don't want to leave an - * orphan frame window if it doesn't. Since we now have the server - * grabbed, the window can't disappear later without having been - * reparented, so we'll get a DestroyNotify for it. We won't have + * orphan frame window if it doesn't. Since we now have the server + * grabbed, the window can't disappear later without having been + * reparented, so we'll get a DestroyNotify for it. We won't have * gotten one for anything up to here, however. */ if (XGetGeometry(dpy, tmp_win->w, &JunkRoot, &JunkX, &JunkY, @@ -798,7 +798,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) attributes.background_pixmap = None; attributes.border_pixel = tmp_win->border; attributes.cursor = Scr->FrameCursor; - attributes.event_mask = (SubstructureRedirectMask | + attributes.event_mask = (SubstructureRedirectMask | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask); if (tmp_win->attr.save_under) { @@ -807,14 +807,14 @@ AddWindow(Window w, int iconm, IconMgr *iconp) } tmp_win->frame = XCreateWindow (dpy, Scr->Root, tmp_win->frame_x, - tmp_win->frame_y, + tmp_win->frame_y, (unsigned int) tmp_win->frame_width, (unsigned int) tmp_win->frame_height, (unsigned int) tmp_win->frame_bw, Scr->d_depth, (unsigned int) CopyFromParent, Scr->d_visual, valuemask, &attributes); - + if (tmp_win->title_height) { valuemask = (CWEventMask | CWBorderPixel | CWBackPixel); @@ -822,10 +822,10 @@ AddWindow(Window w, int iconm, IconMgr *iconp) ButtonReleaseMask | ExposureMask); attributes.border_pixel = tmp_win->border; attributes.background_pixel = tmp_win->title.back; - tmp_win->title_w = XCreateWindow (dpy, tmp_win->frame, + tmp_win->title_w = XCreateWindow (dpy, tmp_win->frame, -tmp_win->frame_bw, -tmp_win->frame_bw, - (unsigned int) tmp_win->attr.width, + (unsigned int) tmp_win->attr.width, (unsigned int) Scr->TitleHeight, (unsigned int) tmp_win->frame_bw, Scr->d_depth, @@ -840,8 +840,8 @@ AddWindow(Window w, int iconm, IconMgr *iconp) if (tmp_win->highlight) { - tmp_win->gray = XCreatePixmapFromBitmapData(dpy, Scr->Root, - gray_bits, gray_width, gray_height, + tmp_win->gray = XCreatePixmapFromBitmapData(dpy, Scr->Root, + gray_bits, gray_width, gray_height, tmp_win->border_tile.fore, tmp_win->border_tile.back, Scr->d_depth); @@ -850,7 +850,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) else tmp_win->gray = None; - + if (tmp_win->title_w) { CreateWindowTitlebarButtons (tmp_win); ComputeTitleLocation (tmp_win); @@ -868,7 +868,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) if (HasShape) XShapeSelectInput (dpy, tmp_win->w, ShapeNotifyMask); - + if (tmp_win->title_w) { XMapWindow (dpy, tmp_win->title_w); } @@ -887,7 +887,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) if (!tmp_win->iconmgr) XAddToSaveSet(dpy, tmp_win->w); - + XReparentWindow(dpy, tmp_win->w, tmp_win->frame, 0, tmp_win->title_height); /* * Reparenting generates an UnmapNotify event, followed by a MapNotify. @@ -901,7 +901,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) tmp_win->frame_width, tmp_win->frame_height, -1, True); /* wait until the window is iconified and the icon window is mapped - * before creating the icon window + * before creating the icon window */ tmp_win->icon_w = (Window) 0; @@ -940,7 +940,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) XUngrabServer(dpy); /* if we were in the middle of a menu activated function, regrab - * the pointer + * the pointer */ if (RootFunction) ReGrab(); @@ -967,7 +967,7 @@ MappedNotOverride(Window w) /** - * attach default bindings so that naive users don't get messed up if they + * attach default bindings so that naive users don't get messed up if they * provide a minimal twmrc. */ static void do_add_binding (int button, int context, int modifier, int func) @@ -1023,9 +1023,9 @@ GrabButtons(TwmWindow *tmp_win) /* twm used to do this grab on the application main window, * tmp_win->w . This was not ICCCM complient and was changed. */ - XGrabButton(dpy, i, j, tmp_win->frame, + XGrabButton(dpy, i, j, tmp_win->frame, True, ButtonPressMask | ButtonReleaseMask, - GrabModeAsync, GrabModeAsync, None, + GrabModeAsync, GrabModeAsync, None, Scr->FrameCursor); } } @@ -1113,12 +1113,12 @@ static Window CreateHighlightWindow (TwmWindow *tmp_win) * Pixmaps { TitleHighlight "hline2" } * * (or whatever the horizontal line bitmap is named) in the startup - * file. If all else fails, use the foreground color to look like a + * file. If all else fails, use the foreground color to look like a * solid line. */ if (!Scr->hilitePm) { - Scr->hilitePm = XCreateBitmapFromData (dpy, tmp_win->title_w, - gray_bits, gray_width, + Scr->hilitePm = XCreateBitmapFromData (dpy, tmp_win->title_w, + gray_bits, gray_width, gray_height); Scr->hilite_pm_width = gray_width; Scr->hilite_pm_height = gray_height; @@ -1134,7 +1134,7 @@ static Window CreateHighlightWindow (TwmWindow *tmp_win) (GCForeground|GCBackground|GCGraphicsExposures), &gcv); if (gc) { - XCopyPlane (dpy, Scr->hilitePm, pm, gc, 0, 0, + XCopyPlane (dpy, Scr->hilitePm, pm, gc, 0, 0, Scr->hilite_pm_width, Scr->hilite_pm_height, 0, 0, 1); XFreeGC (dpy, gc); @@ -1181,11 +1181,11 @@ void ComputeCommonTitleOffsets () void ComputeWindowTitleOffsets (TwmWindow *tmp_win, int width, Bool squeeze) { tmp_win->highlightx = (Scr->TBInfo.titlex + tmp_win->name_width); - if (tmp_win->hilite_w || Scr->TBInfo.nright > 0) + if (tmp_win->hilite_w || Scr->TBInfo.nright > 0) tmp_win->highlightx += Scr->TitlePadding; tmp_win->rightx = width - Scr->TBInfo.rightoff; if (squeeze && tmp_win->squeeze_info) { - int rx = (tmp_win->highlightx + + int rx = (tmp_win->highlightx + (tmp_win->hilite_w ? Scr->TBInfo.width * 2 : 0) + (Scr->TBInfo.nright > 0 ? Scr->TitlePadding : 0) + @@ -1197,8 +1197,8 @@ void ComputeWindowTitleOffsets (TwmWindow *tmp_win, int width, Bool squeeze) /** - * calculate the position of the title window. We need to take the frame_bw - * into account since we want (0,0) of the title window to line up with (0,0) + * calculate the position of the title window. We need to take the frame_bw + * into account since we want (0,0) of the title window to line up with (0,0) * of the frame window. */ void ComputeTitleLocation (register TwmWindow *tmp) @@ -1289,7 +1289,7 @@ static void CreateWindowTitlebarButtons (TwmWindow *tmp_win) if (nb > 0) { tmp_win->titlebuttons = (TBWindow *) malloc (nb * sizeof(TBWindow)); if (!tmp_win->titlebuttons) { - fprintf (stderr, "%s: unable to allocate %d titlebuttons\n", + fprintf (stderr, "%s: unable to allocate %d titlebuttons\n", ProgramName, nb); } else { TBWindow *tbw; @@ -1318,7 +1318,7 @@ static void CreateWindowTitlebarButtons (TwmWindow *tmp_win) } } - tmp_win->hilite_w = (tmp_win->titlehighlight + tmp_win->hilite_w = (tmp_win->titlehighlight ? CreateHighlightWindow (tmp_win) : None); XMapSubwindows(dpy, tmp_win->title_w); @@ -1437,7 +1437,7 @@ CreateColormapWindow(Window w, Bool creating_parent, Bool property_window) return (cwin); } -void +void FetchWmColormapWindows (TwmWindow *tmp) { register int i, j; @@ -1449,14 +1449,14 @@ FetchWmColormapWindows (TwmWindow *tmp) number_cmap_windows = 0; - if (/* SUPPRESS 560 */(previously_installed = + if (/* SUPPRESS 560 */(previously_installed = (Scr->cmapInfo.cmaps == &tmp->cmaps && tmp->cmaps.number_cwins))) { cwins = tmp->cmaps.cwins; for (i = 0; i < tmp->cmaps.number_cwins; i++) cwins[i]->colormap->state = 0; } - if (XGetWMColormapWindows (dpy, tmp->w, &cmap_windows, + if (XGetWMColormapWindows (dpy, tmp->w, &cmap_windows, &number_cmap_windows) && number_cmap_windows > 0) { @@ -1472,7 +1472,7 @@ FetchWmColormapWindows (TwmWindow *tmp) (Window *) malloc (sizeof(Window) * (number_cmap_windows + 1)); if (!new_cmap_windows) { - fprintf (stderr, + fprintf (stderr, "%s: unable to allocate %d element colormap window array\n", ProgramName, number_cmap_windows+1); goto done; @@ -1548,9 +1548,9 @@ FetchWmColormapWindows (TwmWindow *tmp) tmp->cmaps.cwins = cwins; tmp->cmaps.number_cwins = number_cmap_windows; if (number_cmap_windows > 1) - tmp->cmaps.scoreboard = + tmp->cmaps.scoreboard = (char *) calloc(1, ColormapsScoreboardLength(&tmp->cmaps)); - + if (previously_installed) InstallWindowColormaps(PropertyNotify, (TwmWindow *) NULL); @@ -1583,7 +1583,7 @@ void GetWindowSizeHints (TwmWindow *tmp) NorthEastGravity, NorthWestGravity }; int right = tmp->attr.x + tmp->attr.width + 2 * tmp->old_bw; int bottom = tmp->attr.y + tmp->attr.height + 2 * tmp->old_bw; - tmp->hints.win_gravity = + tmp->hints.win_gravity = gravs[((Scr->MyDisplayHeight - bottom < tmp->title_height) ? 0 : 2) | ((Scr->MyDisplayWidth - right < tmp->title_height) ? 0 : 1)]; tmp->hints.flags |= PWinGravity; diff --git a/app/twm/src/add_window.h b/app/twm/src/add_window.h index 9b883cb7a..aba9874a5 100644 --- a/app/twm/src/add_window.h +++ b/app/twm/src/add_window.h @@ -77,7 +77,7 @@ extern void GrabButtons ( TwmWindow *tmp_win ); extern void GrabKeys ( TwmWindow *tmp_win ); extern int MappedNotOverride ( Window w ); extern void SetHighlightPixmap ( char *filename ); -extern int AddingX; +extern int AddingX; extern int AddingY; extern int AddingW; extern int AddingH; diff --git a/app/twm/src/cursor.c b/app/twm/src/cursor.c index 83c827e07..5bfc4f984 100644 --- a/app/twm/src/cursor.c +++ b/app/twm/src/cursor.c @@ -1,5 +1,5 @@ /* - * + * Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its @@ -122,7 +122,7 @@ static struct _CursorName { {"xterm", XC_xterm, None}, }; -void +void NewFontCursor (Cursor *cp, char *str) { int i; @@ -138,7 +138,7 @@ NewFontCursor (Cursor *cp, char *str) return; } } - fprintf (stderr, "%s: unable to find font cursor \"%s\"\n", + fprintf (stderr, "%s: unable to find font cursor \"%s\"\n", ProgramName, str); } @@ -161,7 +161,7 @@ NewBitmapCursor(Cursor *cp, char *source, char *mask) XGetGeometry(dpy, mpm, &JunkRoot, &mx, &my, &mw, &mh, &JunkBW,&JunkDepth); if (sw != mw || sh != mh) { - fprintf (stderr, + fprintf (stderr, "%s: cursor bitmaps \"%s\" and \"%s\" not the same size\n", ProgramName, source, mask); return; diff --git a/app/twm/src/events.c b/app/twm/src/events.c index 7df232aec..2239e6fde 100644 --- a/app/twm/src/events.c +++ b/app/twm/src/events.c @@ -83,8 +83,8 @@ XEvent ButtonEvent; /* button press event */ XEvent Event; /* the current event */ TwmWindow *Tmp_win; /* the current twm window */ -/** Used in HandleEnterNotify to remove border highlight from a window - * that has not recieved a LeaveNotify event because of a pointer grab +/** Used in HandleEnterNotify to remove border highlight from a window + * that has not recieved a LeaveNotify event because of a pointer grab */ TwmWindow *UnHighLight_win = NULL; @@ -271,14 +271,18 @@ Window WindowOfEvent (XEvent *e) Bool DispatchEvent2 () { Window w = Event.xany.window; + XPointer context_data; StashEventTime (&Event); - if (XFindContext (dpy, w, TwmContext, (caddr_t *) &Tmp_win) == XCNOENT) - Tmp_win = NULL; + if (XFindContext (dpy, w, TwmContext, &context_data) == 0) + Tmp_win = (TwmWindow *) context_data; + else + Tmp_win = NULL; - if (XFindContext (dpy, w, ScreenContext, (caddr_t *)&Scr) == XCNOENT) { + if (XFindContext (dpy, w, ScreenContext, &context_data) == 0) + Scr = (struct ScreenInfo *) context_data; + else Scr = FindScreenInfo (WindowOfEvent (&Event)); - } if (!Scr) return False; @@ -298,14 +302,18 @@ Bool DispatchEvent2 () Bool DispatchEvent () { Window w = Event.xany.window; + XPointer context_data; StashEventTime (&Event); - if (XFindContext (dpy, w, TwmContext, (caddr_t *) &Tmp_win) == XCNOENT) - Tmp_win = NULL; + if (XFindContext (dpy, w, TwmContext, &context_data) == 0) + Tmp_win = (TwmWindow *) context_data; + else + Tmp_win = NULL; - if (XFindContext (dpy, w, ScreenContext, (caddr_t *)&Scr) == XCNOENT) { + if (XFindContext (dpy, w, ScreenContext, &context_data) == 0) + Scr = (struct ScreenInfo *) context_data; + else Scr = FindScreenInfo (WindowOfEvent (&Event)); - } if (!Scr) return False; @@ -362,18 +370,25 @@ HandleColormapNotify() ColormapWindow *cwin, **cwins; TwmColormap *cmap; int lost, won, n, number_cwins; + XPointer context_data; - if (XFindContext(dpy, cevent->window, ColormapContext, (caddr_t *)&cwin) == XCNOENT) + if (XFindContext(dpy, cevent->window, ColormapContext, &context_data) == 0) + cwin = (ColormapWindow *) context_data; + else return; + cmap = cwin->colormap; if (cevent->new) { if (XFindContext(dpy, cevent->colormap, ColormapContext, - (caddr_t *)&cwin->colormap) == XCNOENT) + &context_data) == XCNOENT) cwin->colormap = CreateTwmColormap(cevent->colormap); else + { + cwin->colormap = (TwmColormap *) context_data; cwin->colormap->refcnt++; + } cmap->refcnt--; @@ -514,10 +529,13 @@ HandleVisibilityNotify() XVisibilityEvent *vevent = (XVisibilityEvent *) &Event; ColormapWindow *cwin; TwmColormap *cmap; + XPointer context_data; - if (XFindContext(dpy, vevent->window, ColormapContext, (caddr_t *)&cwin) == XCNOENT) + if (XFindContext(dpy, vevent->window, ColormapContext, &context_data) == 0) + cwin = (ColormapWindow *) context_data; + else return; - + /* * when Saber complains about retreiving an <int> from an <unsigned int> * just type "touch vevent->state" and "cont" @@ -580,7 +598,7 @@ HandleKeyPress() (key->cont == Context || key->cont == C_NAME)) { /* weed out the functions that don't make sense to execute - * from a key press + * from a key press */ if (key->func == F_RESIZE) return; @@ -665,7 +683,7 @@ HandleKeyPress() -static void +static void free_window_names (TwmWindow *tmp, Bool nukefull, Bool nukename, Bool nukeicon) { /* @@ -683,7 +701,7 @@ free_window_names (TwmWindow *tmp, Bool nukefull, Bool nukename, Bool nukeicon) -void +void free_cwins (TwmWindow *tmp) { int i; @@ -730,7 +748,7 @@ HandlePropertyNotify() switch (Event.xproperty.state) { case PropertyNewValue: - if (XGetRGBColormaps (dpy, Scr->Root, &maps, &nmaps, + if (XGetRGBColormaps (dpy, Scr->Root, &maps, &nmaps, Event.xproperty.atom)) { /* if got one, then replace any existing entry */ InsertRGBColormap (Event.xproperty.atom, maps, nmaps, True); @@ -770,7 +788,7 @@ HandlePropertyNotify() /* * if the icon name is NoName, set the name of the icon to be - * the same as the window + * the same as the window */ if (Tmp_win->icon_name == NoName) { Tmp_win->icon_name = Tmp_win->name; @@ -871,7 +889,7 @@ HandlePropertyNotify() if (Tmp_win->icon_w && !Tmp_win->forced && Tmp_win->wmhints && (Tmp_win->wmhints->flags & IconPixmapHint)) { if (!XGetGeometry (dpy, Tmp_win->wmhints->icon_pixmap, &JunkRoot, - &JunkX, &JunkY, (unsigned int *)&Tmp_win->icon_width, + &JunkX, &JunkY, (unsigned int *)&Tmp_win->icon_width, (unsigned int *)&Tmp_win->icon_height, &JunkBW, &JunkDepth)) { return; } @@ -1019,9 +1037,11 @@ HandleClientMessage() void HandleExpose() { - MenuRoot *tmp; - if (XFindContext(dpy, Event.xany.window, MenuContext, (caddr_t *)&tmp) == 0) + XPointer context_data; + + if (XFindContext(dpy, Event.xany.window, MenuContext, &context_data) == 0) { + MenuRoot *tmp = (MenuRoot *) context_data; PaintMenu(tmp, &Event); return; } @@ -1040,12 +1060,12 @@ HandleExpose() height = Scr->DefaultFont.height+2; for (i = 0; i < InfoLines; i++) { - MyFont_DrawString(dpy, Scr->InfoWindow, &Scr->DefaultFont, - Scr->NormalGC, 5, (i*height) + Scr->DefaultFont.y, Info[i], + MyFont_DrawString(dpy, Scr->InfoWindow, &Scr->DefaultFont, + Scr->NormalGC, 5, (i*height) + Scr->DefaultFont.y, Info[i], strlen(Info[i])); } flush_expose (Event.xany.window); - } + } else if (Tmp_win != NULL) { if (Event.xany.window == Tmp_win->title_w) @@ -1054,7 +1074,7 @@ HandleExpose() &Scr->TitleBarFont); MyFont_DrawString (dpy, Tmp_win->title_w, &Scr->TitleBarFont, - Scr->NormalGC, Scr->TBInfo.titlex, Scr->TitleBarFont.y, + Scr->NormalGC, Scr->TBInfo.titlex, Scr->TitleBarFont.y, Tmp_win->name, strlen(Tmp_win->name)); flush_expose (Event.xany.window); } @@ -1109,7 +1129,7 @@ HandleExpose() flush_expose (Event.xany.window); return; } - } + } } } @@ -1132,7 +1152,7 @@ static void remove_window_from_ring (TwmWindow *tmp) */ if (prev) prev->ring.next = next; if (next) next->ring.prev = prev; - if (Scr->Ring == tmp) + if (Scr->Ring == tmp) Scr->Ring = (next != tmp ? next : (TwmWindow *) NULL); if (!Scr->Ring || Scr->RingLeader == tmp) Scr->RingLeader = Scr->Ring; @@ -1195,7 +1215,7 @@ HandleDestroyNotify() /* * TwmWindows contain the following pointers - * + * * 1. full_name * 2. name * 3. icon_name @@ -1260,12 +1280,13 @@ HandleCreateNotify() void HandleMapRequest() { - int stat; + XPointer context_data; int zoom_save; Event.xany.window = Event.xmaprequest.window; - stat = XFindContext(dpy, Event.xany.window, TwmContext, (caddr_t *)&Tmp_win); - if (stat == XCNOENT) + if (XFindContext(dpy, Event.xany.window, TwmContext, &context_data) == 0) + Tmp_win = (TwmWindow *) context_data; + else Tmp_win = NULL; /* If the window has never been mapped before ... */ @@ -1298,7 +1319,7 @@ HandleMapRequest() (state == NormalState || state == IconicState))) state = Tmp_win->wmhints->initial_state; - switch (state) + switch (state) { case DontCareState: case NormalState: @@ -1379,6 +1400,7 @@ HandleUnmapNotify() { int dstx, dsty; Window dumwin; + XPointer context_data; /* * The July 27, 1988 ICCCM spec states that a client wishing to switch @@ -1392,7 +1414,9 @@ HandleUnmapNotify() { Event.xany.window = Event.xunmap.window; if (XFindContext(dpy, Event.xany.window, - TwmContext, (caddr_t *)&Tmp_win) == XCNOENT) + TwmContext, &context_data) == 0) + Tmp_win = (TwmWindow *) context_data; + else Tmp_win = NULL; } @@ -1403,8 +1427,8 @@ HandleUnmapNotify() * 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 twm exiting - * won't cause it to get mapped) and then throw away all state (pretend + * We need to reparent the window back to the root (so that twm exiting + * won't cause it to get mapped) and then throw away all state (pretend * that we've received a DestroyNotify). */ @@ -1412,12 +1436,12 @@ HandleUnmapNotify() if (XTranslateCoordinates (dpy, Event.xunmap.window, Tmp_win->attr.root, 0, 0, &dstx, &dsty, &dumwin)) { XEvent ev; - Bool reparented = XCheckTypedWindowEvent (dpy, Event.xunmap.window, + Bool reparented = XCheckTypedWindowEvent (dpy, Event.xunmap.window, ReparentNotify, &ev); SetMapStateProp (Tmp_win, WithdrawnState); if (reparented) { if (Tmp_win->old_bw) XSetWindowBorderWidth (dpy, - Event.xunmap.window, + Event.xunmap.window, Tmp_win->old_bw); if (Tmp_win->wmhints && (Tmp_win->wmhints->flags & IconWindowHint)) XUnmapWindow (dpy, Tmp_win->wmhints->icon_window); @@ -1442,6 +1466,8 @@ HandleUnmapNotify() void HandleMotionNotify() { + XPointer context_data; + if (ResizeWindow != (Window) 0) { XQueryPointer( dpy, Event.xany.window, @@ -1456,7 +1482,8 @@ HandleMotionNotify() || abs (Event.xmotion.y - ResizeOrigY) >= Scr->MoveDelta) WindowMoved = TRUE; - XFindContext(dpy, ResizeWindow, TwmContext, (caddr_t *)&Tmp_win); + if (XFindContext(dpy, ResizeWindow, TwmContext, &context_data) == 0) + Tmp_win = (TwmWindow *) context_data; DoResize(Event.xmotion.x_root, Event.xmotion.y_root, Tmp_win); } } @@ -1471,6 +1498,7 @@ HandleButtonRelease() { int xl, xr, yt, yb, w, h; unsigned mask; + XPointer context_data; if (InfoLines) /* delete info box on 2nd button release */ if (Context == C_IDENTIFY) { @@ -1483,7 +1511,8 @@ HandleButtonRelease() { MoveOutline(Scr->Root, 0, 0, 0, 0, 0, 0); - XFindContext(dpy, DragWindow, TwmContext, (caddr_t *)&Tmp_win); + if (XFindContext(dpy, DragWindow, TwmContext, &context_data) == 0) + Tmp_win = (TwmWindow *) context_data; if (DragWindow == Tmp_win->frame) { xl = Event.xbutton.x_root - DragX - Tmp_win->frame_bw; @@ -1513,7 +1542,7 @@ HandleButtonRelease() xl = ConstMoveX; } } - + if (Scr->DontMoveOff && MoveFunction != F_FORCEMOVE) { xr = xl + w; @@ -1645,7 +1674,7 @@ HandleButtonRelease() * \param menu menu to pop up * \param w invoking window, or None */ -static void +static void do_menu (MenuRoot *menu, Window w) { int x = Event.xbutton.x_root; @@ -1771,7 +1800,7 @@ HandleButtonPress() { Tmp_win = Tmp_win->list->iconmgr->twm_win; XTranslateCoordinates(dpy, Event.xany.window, Tmp_win->w, - Event.xbutton.x, Event.xbutton.y, + Event.xbutton.x, Event.xbutton.y, &JunkX, &JunkY, &JunkChild); Event.xbutton.x = JunkX; @@ -1783,7 +1812,7 @@ HandleButtonPress() { Context = C_TITLE; } - else if (Event.xany.window == Tmp_win->w) + else if (Event.xany.window == Tmp_win->w) { printf("ERROR! ERROR! ERROR! YOU SHOULD NOT BE HERE!!!\n"); Context = C_WINDOW; @@ -1792,7 +1821,7 @@ HandleButtonPress() { Context = C_ICON; } - else if (Event.xany.window == Tmp_win->frame) + else if (Event.xany.window == Tmp_win->frame) { /* since we now place a button grab on the frame instead * of the window, (see GrabButtons() in add_window.c), we @@ -1833,23 +1862,27 @@ HandleButtonPress() * it was the root. We must check to see if it happened to be * inside of a client that was getting button press events. */ + XPointer context_data; + XTranslateCoordinates(dpy, Scr->Root, Scr->Root, - Event.xbutton.x, - Event.xbutton.y, + Event.xbutton.x, + Event.xbutton.y, &JunkX, &JunkY, &Event.xany.window); if (Event.xany.window == 0 || (XFindContext(dpy, Event.xany.window, TwmContext, - (caddr_t *)&Tmp_win) == XCNOENT)) + &context_data) == XCNOENT)) { RootFunction = 0; Bell(XkbBI_MinorError,0,Event.xany.window); return; } + else + Tmp_win = (TwmWindow *) context_data; XTranslateCoordinates(dpy, Scr->Root, Event.xany.window, - Event.xbutton.x, - Event.xbutton.y, + Event.xbutton.x, + Event.xbutton.y, &JunkX, &JunkY, &JunkChild); Event.xbutton.x = JunkX; @@ -1869,7 +1902,7 @@ HandleButtonPress() ButtonEvent = Event; ButtonWindow = Tmp_win; - /* if we get to here, we have to execute a function or pop up a + /* if we get to here, we have to execute a function or pop up a * menu */ modifier = (Event.xbutton.state & mods_used); @@ -1956,7 +1989,8 @@ HandleEnterNotify() XEnterWindowEvent *ewp = &Event.xcrossing; HENScanArgs scanArgs; XEvent dummy; - + XPointer context_data; + /* * Save the id of the window entered. This will be used to remove * border highlight on entering the next application window. @@ -1991,7 +2025,7 @@ HandleEnterNotify() (void) XCheckIfEvent(dpy, &dummy, HENQueueScanner, (char *) &scanArgs); /* - * if entering root window, restore twm default colormap so that + * if entering root window, restore twm default colormap so that * titlebars are legible */ if (ewp->window == Scr->Root) { @@ -2019,7 +2053,7 @@ HandleEnterNotify() XUnmapWindow(dpy, Scr->Focus->hilite_w); /* - * If entering the frame or the icon manager, then do + * If entering the frame or the icon manager, then do * "window activation things": * * 1. turn on highlight window (if any) @@ -2081,7 +2115,10 @@ HandleEnterNotify() /* * Find the menu that we are dealing with now; punt if unknown */ - if (XFindContext (dpy, ewp->window, MenuContext, (caddr_t *)&mr) != XCSUCCESS) return; + if (XFindContext (dpy, ewp->window, MenuContext, &context_data) == 0) + mr = (MenuRoot *) context_data; + else + return; mr->entered = TRUE; if (ActiveMenu && mr == ActiveMenu->prev && RootFunction == 0) { @@ -2216,6 +2253,7 @@ HandleConfigureRequest() int x, y, width, height, bw; int gravx, gravy; XConfigureRequestEvent *cre = &Event.xconfigurerequest; + XPointer context_data; #ifdef DEBUG_EVENTS fprintf(stderr, "ConfigureRequest\n"); @@ -2238,9 +2276,10 @@ HandleConfigureRequest() * be wrong */ Event.xany.window = cre->window; /* mash parent field */ - if (XFindContext (dpy, cre->window, TwmContext, (caddr_t *) &Tmp_win) == - XCNOENT) - Tmp_win = NULL; + if (XFindContext (dpy, cre->window, TwmContext, &context_data) == 0) + Tmp_win = (TwmWindow *) context_data; + else + Tmp_win = NULL; /* @@ -2250,7 +2289,7 @@ HandleConfigureRequest() * to configuration requests for windows which have never been mapped. */ if (!Tmp_win || Tmp_win->icon_w == cre->window) { - xwcm = cre->value_mask & + xwcm = cre->value_mask & (CWX | CWY | CWWidth | CWHeight | CWBorderWidth); xwc.x = cre->x; xwc.y = cre->y; @@ -2262,14 +2301,16 @@ HandleConfigureRequest() } if ((cre->value_mask & CWStackMode) && Tmp_win->stackmode) { - TwmWindow *otherwin; + TwmWindow *otherwin = NULL; - xwc.sibling = (((cre->value_mask & CWSibling) && - (XFindContext (dpy, cre->above, TwmContext, - (caddr_t *) &otherwin) == XCSUCCESS)) - ? otherwin->frame : cre->above); + if (cre->value_mask & CWSibling) { + if (XFindContext (dpy, cre->above, TwmContext, &context_data) == 0) + otherwin = (TwmWindow *) context_data; + } + + xwc.sibling = (otherwin != NULL) ? otherwin->frame : cre->above; xwc.stack_mode = cre->detail; - XConfigureWindow (dpy, Tmp_win->frame, + XConfigureWindow (dpy, Tmp_win->frame, cre->value_mask & (CWSibling | CWStackMode), &xwc); } @@ -2287,8 +2328,8 @@ HandleConfigureRequest() * This means that we need to adjust for the additional title height as * well as for any border width changes that we decide to allow. The * current window gravity is to be used in computing the adjustments, just - * as when initially locating the window. Note that if we do decide to - * allow border width changes, we will need to send the synthetic + * as when initially locating the window. Note that if we do decide to + * allow border width changes, we will need to send the synthetic * ConfigureNotify event. */ GetGravityOffsets (Tmp_win, &gravx, &gravy); @@ -2326,7 +2367,7 @@ HandleConfigureRequest() /* * SetupWindow (x,y) are the location of the upper-left outer corner and * are passed directly to XMoveResizeWindow (frame). The (width,height) - * are the inner size of the frame. The inner width is the same as the + * are the inner size of the frame. The inner width is the same as the * requested client window width; the inner height is the same as the * requested client window height plus any title bar slop. */ @@ -2464,7 +2505,7 @@ InstallWindowColormaps (int type, TwmWindow *tmp) (*cwins)->colormap->state &= ~CM_INSTALLABLE; Scr->cmapInfo.cmaps = &tmp->cmaps; break; - + case PropertyNotify: case VisibilityNotify: case ColormapNotify: @@ -2583,7 +2624,7 @@ UninstallRootColormap() if (Scr->cmapInfo.root_pushes) Scr->cmapInfo.root_pushes--; - + if (!Scr->cmapInfo.root_pushes) { /* * If we have subsequent Enter or Leave Notify events, diff --git a/app/twm/src/iconmgr.c b/app/twm/src/iconmgr.c index e0fea0ae9..b4827ad1c 100644 --- a/app/twm/src/iconmgr.c +++ b/app/twm/src/iconmgr.c @@ -1,5 +1,5 @@ /* - * + * Copyright 1989,1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its @@ -78,7 +78,7 @@ void CreateIconManagers() (unsigned int *) &p->width, (unsigned int *)&p->height); if (mask & XNegative) - JunkX = Scr->MyDisplayWidth - p->width - + JunkX = Scr->MyDisplayWidth - p->width - (2 * Scr->BorderWidth) + JunkX; if (mask & YNegative) @@ -235,7 +235,7 @@ void MoveIconManager(int dir) new_row = 0; if (new_col >= ip->cur_columns) new_col = 0; - + /* Now let's go through the list to see if there is an entry with this * new position */ @@ -251,8 +251,8 @@ void MoveIconManager(int dir) if (!got_it) { - fprintf (stderr, - "%s: unable to find window (%d, %d) in icon manager\n", + fprintf (stderr, + "%s: unable to find window (%d, %d) in icon manager\n", ProgramName, new_row, new_col); return; } @@ -280,7 +280,7 @@ void MoveIconManager(int dir) /** * jump from one icon manager to another, possibly even on another screen * \param dir one of the following: - * - F_NEXTICONMGR - go to the next icon manager + * - F_NEXTICONMGR - go to the next icon manager * - F_PREVICONMGR - go to the previous one */ @@ -397,7 +397,7 @@ WList *AddIconManager(TwmWindow *tmp_win) tmp->me = ip->count; tmp->x = -1; tmp->y = -1; - + valuemask = (CWBackPixel | CWBorderPixel | CWEventMask | CWCursor); attributes.background_pixel = tmp->back; attributes.border_pixel = tmp->back; @@ -405,8 +405,8 @@ WList *AddIconManager(TwmWindow *tmp_win) ButtonReleaseMask | ExposureMask | EnterWindowMask | LeaveWindowMask); attributes.cursor = Scr->IconMgrCursor; - tmp->w = XCreateWindow (dpy, ip->w, 0, 0, (unsigned int) 1, - (unsigned int) h, (unsigned int) 0, + tmp->w = XCreateWindow (dpy, ip->w, 0, 0, (unsigned int) 1, + (unsigned int) h, (unsigned int) 0, CopyFromParent, (unsigned int) CopyFromParent, (Visual *) CopyFromParent, valuemask, &attributes); @@ -457,7 +457,7 @@ void InsertInIconManager(IconMgr *ip, WList *tmp, TwmWindow *tmp_win) { WList *tmp1; int added; - int (*compar)(const char *, const char *) + int (*compar)(const char *, const char *) = (Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1); added = FALSE; @@ -525,7 +525,7 @@ void RemoveIconManager(TwmWindow *tmp_win) ip = tmp->iconmgr; RemoveFromIconManager(ip, tmp); - + XDeleteContext(dpy, tmp->icon, TwmContext); XDeleteContext(dpy, tmp->icon, ScreenContext); XDestroyWindow(dpy, tmp->icon); @@ -587,7 +587,7 @@ void SortIconManager(IconMgr *ip) { WList *tmp1, *tmp2; int done; - int (*compar)(const char *, const char *) + int (*compar)(const char *, const char *) = (Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1); if (ip == NULL) @@ -617,7 +617,7 @@ void SortIconManager(IconMgr *ip) } /** - * pack the icon manager windows following + * pack the icon manager windows following * an addition or deletion * * \param ip a pointer to the icon manager struture diff --git a/app/twm/src/iconmgr.h b/app/twm/src/iconmgr.h index 8e8e5153e..400c44eff 100644 --- a/app/twm/src/iconmgr.h +++ b/app/twm/src/iconmgr.h @@ -1,5 +1,5 @@ /* - * + * Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its diff --git a/app/twm/src/icons.c b/app/twm/src/icons.c index d026f4aad..6ba8066ef 100644 --- a/app/twm/src/icons.c +++ b/app/twm/src/icons.c @@ -1,5 +1,5 @@ /* - * + * Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its @@ -348,7 +348,7 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y) tmp_win->forced = FALSE; tmp_win->icon_not_ours = FALSE; - /* now go through the steps to get an icon window, if ForceIcon is + /* now go through the steps to get an icon window, if ForceIcon is * set, then no matter what else is defined, the bitmap from the * .twmrc file is used */ @@ -396,7 +396,7 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y) if (pm == None && tmp_win->wmhints && tmp_win->wmhints->flags & IconPixmapHint) { - + XGetGeometry(dpy, tmp_win->wmhints->icon_pixmap, &JunkRoot, &JunkX, &JunkY, (unsigned int *)&tmp_win->icon_width, (unsigned int *)&tmp_win->icon_height, &JunkBW, &JunkDepth); @@ -409,7 +409,7 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y) 0,0, tmp_win->icon_width, tmp_win->icon_height, 0, 0, 1 ); } - /* if we still haven't got an icon, let's look in the Icon list + /* if we still haven't got an icon, let's look in the Icon list * if ForceIcon is not set */ if (pm == None && !Scr->ForceIcon) @@ -548,7 +548,7 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y) &attributes); } - /* I need to figure out where to put the icon window now, because + /* I need to figure out where to put the icon window now, because * getting here means that I am going to make the icon visible */ if (tmp_win->wmhints && diff --git a/app/twm/src/icons.h b/app/twm/src/icons.h index c2fcfb3f0..6767459ee 100644 --- a/app/twm/src/icons.h +++ b/app/twm/src/icons.h @@ -1,5 +1,5 @@ /* - * + * Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its @@ -52,11 +52,11 @@ typedef struct IconEntry }IconEntry; extern int roundUp ( int v, int multiple ); -extern void PlaceIcon ( TwmWindow *tmp_win, int def_x, int def_y, +extern void PlaceIcon ( TwmWindow *tmp_win, int def_x, int def_y, int *final_x, int *final_y ); extern void IconUp ( TwmWindow *tmp_win ); extern void IconDown ( TwmWindow *tmp_win ); -extern void AddIconRegion ( char *geom, int grav1, int grav2, +extern void AddIconRegion ( char *geom, int grav1, int grav2, int stepx, int stepy ); extern void CreateIconWindow ( TwmWindow *tmp_win, int def_x, int def_y ); diff --git a/app/twm/src/list.c b/app/twm/src/list.c index d2ba75a23..134e44ff2 100644 --- a/app/twm/src/list.c +++ b/app/twm/src/list.c @@ -75,13 +75,13 @@ struct name_list_struct /** * add a window name to the appropriate list. * - * If the list does not use the ptr value, a non-null value + * If the list does not use the ptr value, a non-null value * should be placed in it. LookInList returns this ptr value - * and procedures calling LookInList will check for a non-null + * and procedures calling LookInList will check for a non-null * return value as an indication of success. * * \param list the address of the pointer to the head of a list - * \param name a pointer to the name of the window + * \param name a pointer to the name of the window * \param ptr pointer to list dependent data */ void @@ -104,12 +104,12 @@ AddToList(name_list **list_head, char *name, char *ptr) nptr->name = name; nptr->ptr = (ptr == NULL) ? (char *)TRUE : ptr; *list_head = nptr; -} +} /** * look through a list for a window name, or class * - * \return the ptr field of the list structure or NULL if the name + * \return the ptr field of the list structure or NULL if the name * or class was not found in the list * * \param list a pointer to the head of a list @@ -158,7 +158,7 @@ LookInNameList(name_list *list_head, char *name) * \param class a pointer to the class to look for * \param[out] ptr fill in the list value if the name was found */ -int GetColorFromList(name_list *list_head, char *name, XClassHint *class, +int GetColorFromList(name_list *list_head, char *name, XClassHint *class, Pixel *ptr) { int save; diff --git a/app/twm/src/list.h b/app/twm/src/list.h index c67785daa..ec77dfec4 100644 --- a/app/twm/src/list.h +++ b/app/twm/src/list.h @@ -70,9 +70,9 @@ typedef struct name_list_struct name_list; extern void AddToList ( name_list **list_head, char *name, char *ptr ); extern void FreeList ( name_list **list ); -extern int GetColorFromList ( name_list *list_head, char *name, +extern int GetColorFromList ( name_list *list_head, char *name, XClassHint *class, Pixel *ptr ); -extern char * LookInList ( name_list *list_head, char *name, +extern char * LookInList ( name_list *list_head, char *name, XClassHint *class ); extern char * LookInNameList ( name_list *list_head, char *name ); diff --git a/app/twm/src/menus.c b/app/twm/src/menus.c index 4c10dedec..449e81213 100644 --- a/app/twm/src/menus.c +++ b/app/twm/src/menus.c @@ -58,6 +58,10 @@ in this Software without prior written authorization from The Open Group. * ***********************************************************************/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include <stdio.h> #include <X11/Xos.h> #include "twm.h" @@ -94,7 +98,7 @@ int ConstMoveXL; int ConstMoveXR; int ConstMoveYT; int ConstMoveYB; - + /* Globals used to keep track of whether the mouse has moved during a resize function. */ int ResizeOrigX; @@ -162,7 +166,7 @@ InitMenus() * \param win_name the window name (if any) * \param action the action string associated with the function (if any) */ -Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name, +Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name, char *action) { FuncKey *tmp; @@ -209,7 +213,7 @@ Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name, -int CreateTitleButton (char *name, int func, char *action, MenuRoot *menuroot, +int CreateTitleButton (char *name, int func, char *action, MenuRoot *menuroot, Bool rightside, Bool append) { TitleButton *tb = (TitleButton *) malloc (sizeof(TitleButton)); @@ -238,7 +242,7 @@ int CreateTitleButton (char *name, int func, char *action, MenuRoot *menuroot, /* * Cases for list: - * + * * 1. empty list, prepend left put at head of list * 2. append left, prepend right put in between left and right * 3. append right put at tail of list @@ -275,8 +279,8 @@ int CreateTitleButton (char *name, int func, char *action, MenuRoot *menuroot, /** - * Do all the necessary stuff to load in a titlebar button. If we can't find - * the button, then put in a question; if we can't find the question mark, + * Do all the necessary stuff to load in a titlebar button. If we can't find + * the button, then put in a question; if we can't find the question mark, * something is wrong and we are probably going to be in trouble later on. */ void InitTitlebarButtons () @@ -395,7 +399,7 @@ PaintEntry(MenuRoot *mr, MenuItem *mi, int exposure) else gc = Scr->MenuGC; - MyFont_DrawString(dpy, mr->w, &Scr->MenuFont, gc, + MyFont_DrawString(dpy, mr->w, &Scr->MenuFont, gc, mi->x, text_y, mi->item, mi->strlen); } @@ -440,7 +444,7 @@ PaintEntry(MenuRoot *mr, MenuItem *mi, int exposure) text_y, mi->item, mi->strlen); } } - + void PaintMenu(MenuRoot *mr, XEvent *e) @@ -474,6 +478,7 @@ UpdateMenu() int i, x, y, x_root, y_root, entry; int done; MenuItem *badItem = NULL; + XPointer context_data; fromMenu = TRUE; @@ -507,15 +512,19 @@ UpdateMenu() if (Event.type != MotionNotify) continue; + if (!ActiveMenu) + continue; + done = FALSE; XQueryPointer( dpy, ActiveMenu->w, &JunkRoot, &JunkChild, &x_root, &y_root, &x, &y, &JunkMask); /* if we haven't recieved the enter notify yet, wait */ - if (ActiveMenu && !ActiveMenu->entered) + if (!ActiveMenu->entered) continue; - XFindContext(dpy, ActiveMenu->w, ScreenContext, (caddr_t *)&Scr); + if (XFindContext(dpy, ActiveMenu->w, ScreenContext, &context_data) == 0) + Scr = (struct ScreenInfo *) context_data; if (x < 0 || y < 0 || x >= ActiveMenu->width || y >= ActiveMenu->height) @@ -545,7 +554,7 @@ UpdateMenu() done = TRUE; /* if we weren't on the active entry, let's turn the old - * active one off + * active one off */ if (!done && ActiveItem->func != F_TITLE) { @@ -555,12 +564,12 @@ UpdateMenu() } /* if we weren't on the active item, change the active item and turn - * it on + * it on */ if (!done) { ActiveItem = mi; - if (ActiveItem->func != F_TITLE && !ActiveItem->state) + if (ActiveItem && ActiveItem->func != F_TITLE && !ActiveItem->state) { ActiveItem->state = 1; PaintEntry(ActiveMenu, ActiveItem, False); @@ -568,16 +577,16 @@ UpdateMenu() } /* now check to see if we were over the arrow of a pull right entry */ - if (ActiveItem->func == F_MENU && + if (ActiveItem && ActiveItem->func == F_MENU && ((ActiveMenu->width - x) < (ActiveMenu->width >> 1))) { MenuRoot *save = ActiveMenu; - int savex = MenuOrigins[MenuDepth - 1].x; + int savex = MenuOrigins[MenuDepth - 1].x; int savey = MenuOrigins[MenuDepth - 1].y; if (MenuDepth < MAXMENUDEPTH) { - PopUpMenu (ActiveItem->sub, - (savex + (ActiveMenu->width >> 1)), + PopUpMenu (ActiveItem->sub, + (savex + (ActiveMenu->width >> 1)), (savey + ActiveItem->item_num * Scr->EntryHeight) /*(savey + ActiveItem->item_num * Scr->EntryHeight + (Scr->EntryHeight >> 1))*/, False); @@ -667,7 +676,7 @@ NewMenuRoot(char *name) * \param back background color string */ MenuItem * -AddToMenu(MenuRoot *menu, char *item, char *action, MenuRoot *sub, int func, +AddToMenu(MenuRoot *menu, char *item, char *action, MenuRoot *sub, int func, char *fore, char *back) { MenuItem *tmp; @@ -801,10 +810,10 @@ MakeMenu(MenuRoot *mr) attributes.save_under = True; } mr->shadow = XCreateWindow (dpy, Scr->Root, 0, 0, - (unsigned int) mr->width, + (unsigned int) mr->width, (unsigned int) mr->height, (unsigned int)0, - CopyFromParent, + CopyFromParent, (unsigned int) CopyFromParent, (Visual *) CopyFromParent, valuemask, &attributes); @@ -911,7 +920,7 @@ MakeMenu(MenuRoot *mr) b3.flags = DoRed | DoGreen | DoBlue; num -= 1; - for (i = 0, cur = start->next; i < num; i++, cur = cur->next) + for (i = 0, cur = start->next; i < num && cur; i++, cur = cur->next) { f3.red += fred; f3.green += fgreen; @@ -945,14 +954,14 @@ MakeMenu(MenuRoot *mr) * \param x,y location of upper left of menu * \param center whether or not to center horizontally over position */ -Bool +Bool PopUpMenu (MenuRoot *menu, int x, int y, Bool center) { int WindowNameCount; TwmWindow **WindowNames; TwmWindow *tmp_win2,*tmp_win3; int i; - int (*compar)(const char *, const char *) = + int (*compar)(const char *, const char *) = (Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1); if (!menu) return False; @@ -973,7 +982,7 @@ PopUpMenu (MenuRoot *menu, int x, int y, Bool center) menu->width = 0; menu->mapped = NEVER_MAPPED; AddToMenu(menu, "TWM Windows", NULLSTR, NULL, F_TITLE,NULLSTR,NULLSTR); - + for(tmp_win = Scr->TwmRoot.next , WindowNameCount=0; tmp_win != NULL; tmp_win = tmp_win->next) @@ -1128,14 +1137,14 @@ FindMenuRoot(char *name) -static Bool +static Bool belongs_to_twm_window (TwmWindow *t, Window w) { if (!t) return False; if (w == t->frame || w == t->title_w || w == t->hilite_w || w == t->icon_w || w == t->icon_bm_w) return True; - + if (t && t->titlebuttons) { register TBWindow *tbw; register int nb = Scr->TBInfo.nleft + Scr->TBInfo.nright; @@ -1148,7 +1157,7 @@ belongs_to_twm_window (TwmWindow *t, Window w) -void +void resizeFromCenter(Window w, TwmWindow *tmp_win) { int lastx, lasty, bw2; @@ -1168,11 +1177,11 @@ resizeFromCenter(Window w, TwmWindow *tmp_win) height = Scr->SizeFont.height + SIZE_VINDENT * 2; #endif XGetGeometry(dpy, w, &JunkRoot, &origDragX, &origDragY, - (unsigned int *)&DragWidth, (unsigned int *)&DragHeight, + (unsigned int *)&DragWidth, (unsigned int *)&DragHeight, &JunkBW, &JunkDepth); XWarpPointer(dpy, None, w, - 0, 0, 0, 0, DragWidth/2, DragHeight/2); - XQueryPointer (dpy, Scr->Root, &JunkRoot, + 0, 0, 0, 0, DragWidth/2, DragHeight/2); + XQueryPointer (dpy, Scr->Root, &JunkRoot, &JunkChild, &JunkX, &JunkY, &AddingX, &AddingY, &JunkMask); #if 0 @@ -1198,7 +1207,7 @@ resizeFromCenter(Window w, TwmWindow *tmp_win) { XMaskEvent(dpy, ButtonPressMask | PointerMotionMask, &event); - + if (event.type == MotionNotify) { /* discard any extra motion events before a release */ while(XCheckMaskEvent(dpy, @@ -1206,38 +1215,38 @@ resizeFromCenter(Window w, TwmWindow *tmp_win) if (event.type == ButtonPress) break; } - + if (event.type == ButtonPress) { MenuEndResize(tmp_win); XMoveResizeWindow(dpy, w, AddingX, AddingY, AddingW, AddingH); break; } - + /* if (!DispatchEvent ()) continue; */ if (event.type != MotionNotify) { continue; } - + /* * XXX - if we are going to do a loop, we ought to consider - * using multiple GXxor lines so that we don't need to + * using multiple GXxor lines so that we don't need to * grab the server. */ XQueryPointer(dpy, Scr->Root, &JunkRoot, &JunkChild, &JunkX, &JunkY, &AddingX, &AddingY, &JunkMask); - + if (lastx != AddingX || lasty != AddingY) { MenuDoResize(AddingX, AddingY, tmp_win); - + lastx = AddingX; lasty = AddingY; } - + } -} +} @@ -1245,32 +1254,32 @@ resizeFromCenter(Window w, TwmWindow *tmp_win) * execute a twm root function. * * \param func the function to execute - * \param action the menu action to execute + * \param action the menu action to execute * \param w the window to execute this function on * \param tmp_win the twm window structure * \param event the event that caused the function * \param context the context in which the button was pressed * \param pulldown flag indicating execution from pull down menu * - * \return TRUE if should continue with remaining actions, + * \return TRUE if should continue with remaining actions, * else FALSE to abort */ int -WarpThere(TwmWindow *t) +WarpThere(TwmWindow *t) { if (Scr->WarpUnmapped || t->mapped) { if (!t->mapped) DeIconify (t); if (!Scr->NoRaiseWarp) XRaiseWindow (dpy, t->frame); - WarpToWindow (t); - return 1; - } + WarpToWindow (t); + return 1; + } return 0; } int -ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, +ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, XEvent *eventp, int context, int pulldown) { static Time last_time = 0; @@ -1381,7 +1390,7 @@ ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, SortIconManager((IconMgr *) NULL); else if (tmp_win->iconmgr) SortIconManager(tmp_win->iconmgrp); - else + else Bell(XkbBI_Info,0,tmp_win->w); Scr->SortIconMgr = save_sort; @@ -1436,39 +1445,39 @@ ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, PopDownMenu(); if (pulldown) - XWarpPointer(dpy, None, Scr->Root, + XWarpPointer(dpy, None, Scr->Root, 0, 0, 0, 0, eventp->xbutton.x_root, eventp->xbutton.y_root); if (w != tmp_win->icon_w) { /* can't resize icons */ if ((Context == C_FRAME || Context == C_WINDOW || Context == C_TITLE) - && fromMenu) + && fromMenu) resizeFromCenter(w, tmp_win); else { /* * see if this is being done from the titlebar */ - fromtitlebar = + fromtitlebar = belongs_to_twm_window (tmp_win, eventp->xbutton.window); - + /* Save pointer position so we can tell if it was moved or not during the resize. */ ResizeOrigX = eventp->xbutton.x_root; ResizeOrigY = eventp->xbutton.y_root; - + StartResize (eventp, tmp_win, fromtitlebar); - + do { XMaskEvent(dpy, ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | ButtonMotionMask, &Event); - + if (fromtitlebar && Event.type == ButtonPress) { fromtitlebar = False; continue; } - + if (Event.type == MotionNotify) { /* discard any extra motion events before a release */ while @@ -1477,13 +1486,13 @@ ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, if (Event.type == ButtonRelease) break; } - + if (!DispatchEvent ()) continue; - + } while (!(Event.type == ButtonRelease || Cancel)); return TRUE; } - } + } break; @@ -1509,7 +1518,7 @@ ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, MoveFunction = func; if (pulldown) - XWarpPointer(dpy, None, Scr->Root, + XWarpPointer(dpy, None, Scr->Root, 0, 0, 0, 0, eventp->xbutton.x_root, eventp->xbutton.y_root); EventHandler[EnterNotify] = HandleUnknown; @@ -1535,8 +1544,8 @@ ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, else if (w != tmp_win->icon_w) { XTranslateCoordinates(dpy, w, tmp_win->frame, - eventp->xbutton.x, - eventp->xbutton.y, + eventp->xbutton.x, + eventp->xbutton.y, &DragX, &DragY, &JunkChild); w = tmp_win->frame; @@ -1557,7 +1566,7 @@ ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, * only do the constrained move if timer is set; need to check it * in case of stupid or wicked fast servers */ - if (ConstrainedMoveTime && + if (ConstrainedMoveTime && (eventp->xbutton.time - last_time) < ConstrainedMoveTime) { int width, height; @@ -1616,15 +1625,15 @@ ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, if (menuFromFrameOrWindowOrTitlebar) { /* warp the pointer to the middle of the window */ - XWarpPointer(dpy, None, Scr->Root, 0, 0, 0, 0, - origDragX + DragWidth / 2, + XWarpPointer(dpy, None, Scr->Root, 0, 0, 0, 0, + origDragX + DragWidth / 2, origDragY + DragHeight / 2); XFlush(dpy); } - + while (TRUE) { - long releaseEvent = menuFromFrameOrWindowOrTitlebar ? + long releaseEvent = menuFromFrameOrWindowOrTitlebar ? ButtonPress : ButtonRelease; long movementMask = menuFromFrameOrWindowOrTitlebar ? PointerMotionMask : ButtonMotionMask; @@ -1637,7 +1646,7 @@ ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, /* throw away enter and leave events until release */ if (Event.xany.type == EnterNotify || - Event.xany.type == LeaveNotify) continue; + Event.xany.type == LeaveNotify) continue; if (Event.type == MotionNotify) { /* discard any extra motion events before a logical release */ @@ -1684,7 +1693,7 @@ ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, CurrentDragY != origDragY))) tmp_win->icon_moved = TRUE; if (!Scr->OpaqueMove && menuFromFrameOrWindowOrTitlebar) - XMoveWindow(dpy, DragWindow, + XMoveWindow(dpy, DragWindow, Event.xbutton.x_root - DragWidth / 2, Event.xbutton.y_root - DragHeight / 2); break; @@ -1765,7 +1774,7 @@ ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, XMoveWindow(dpy, DragWindow, xl, yt); else MoveOutline(eventp->xmotion.root, xl, yt, w, h, - tmp_win->frame_bw, + tmp_win->frame_bw, moving_icon ? 0 : tmp_win->title_height); } } @@ -1779,7 +1788,7 @@ ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, else { xl = eventp->xmotion.x_root - (DragWidth / 2); yt = eventp->xmotion.y_root - (DragHeight / 2); - } + } w = DragWidth + 2 * JunkBW; h = DragHeight + 2 * JunkBW; @@ -1825,7 +1834,7 @@ ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, if ((mroot = FindMenuRoot(action)) == NULL) { - fprintf (stderr, "%s: couldn't find function \"%s\"\n", + fprintf (stderr, "%s: couldn't find function \"%s\"\n", ProgramName, action); return TRUE; } @@ -1873,13 +1882,13 @@ ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, XConfigureWindow (dpy, w, CWStackMode, &xwc); } break; - + case F_RAISE: if (DeferExecution(context, func, Scr->SelectCursor)) return TRUE; /* check to make sure raise is not from the WindowFunction */ - if (w == tmp_win->icon_w && Context != C_ROOT) + if (w == tmp_win->icon_w && Context != C_ROOT) XRaiseWindow(dpy, tmp_win->icon_w); else XRaiseWindow(dpy, tmp_win->frame); @@ -1998,12 +2007,12 @@ ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, if (count > 0) XStoreBytes (dpy, buff, count); close(fd); } else { - fprintf (stderr, - "%s: unable to open cut file \"%s\"\n", + fprintf (stderr, + "%s: unable to open cut file \"%s\"\n", ProgramName, tmp); } if (ptr != tmp) free (ptr); - } + } } else { XFree(ptr); } @@ -2080,23 +2089,23 @@ ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, len = strlen(action); for (t = Scr->TwmRoot.next; t != NULL; t = t->next) { - if (!strncmp(action, t->name, len)) + if (!strncmp(action, t->name, len)) if (WarpThere(t)) break; } if (!t) { for (t = Scr->TwmRoot.next; t != NULL; t = t->next) { - if (!strncmp(action, t->class.res_name, len)) + if (!strncmp(action, t->class.res_name, len)) if (WarpThere(t)) break; } if (!t) { for (t = Scr->TwmRoot.next; t != NULL; t = t->next) { - if (!strncmp(action, t->class.res_class, len)) + if (!strncmp(action, t->class.res_class, len)) if (WarpThere(t)) break; } } } - if (!t) + if (!t) Bell(XkbBI_MinorError,0,None); } break; @@ -2136,7 +2145,7 @@ ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, } } break; - + case F_WARPRING: switch (action[0]) { case 'n': @@ -2164,7 +2173,7 @@ ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, } else { - fprintf (stderr, "%s: unable to open file \"%s\"\n", + fprintf (stderr, "%s: unable to open file \"%s\"\n", ProgramName, ptr); } if (ptr != action) free(ptr); @@ -2234,7 +2243,7 @@ ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, /** - * defer the execution of a function to the next button press if the context + * defer the execution of a function to the next button press if the context * is C_ROOT * * \param context the context in which the mouse button was pressed @@ -2256,7 +2265,7 @@ DeferExecution(int context, int func, Cursor cursor) return (TRUE); } - + return (FALSE); } @@ -2277,7 +2286,7 @@ ReGrab() /** - * checks each function in the list to see if it is one that needs + * checks each function in the list to see if it is one that needs * to be deferred. * * \param root the menu root to check @@ -2326,7 +2335,7 @@ NeedToDefer(MenuRoot *root) * execute the string by /bin/sh * \param s the string containing the command */ -static int +static int System (char *s) { int pid, status; @@ -2460,7 +2469,7 @@ DeIconify(TwmWindow *tmp_win) Zoom(t->icon_w, t->frame); else Zoom(tmp_win->icon_w, t->frame); - + XMapWindow(dpy, t->w); t->mapped = TRUE; if (Scr->NoRaiseDeicon) @@ -2468,7 +2477,7 @@ DeIconify(TwmWindow *tmp_win) else XMapRaised(dpy, t->frame); SetMapStateProp(t, NormalState); - + if (t->icon_w) { XUnmapWindow(dpy, t->icon_w); IconDown (t); @@ -2478,7 +2487,7 @@ DeIconify(TwmWindow *tmp_win) t->icon_on = FALSE; } } - + XSync (dpy, 0); } @@ -2519,7 +2528,7 @@ Iconify(TwmWindow *tmp_win, int def_x, int def_y) else Zoom(t->frame, tmp_win->icon_w); } - + /* * Prevent the receipt of an UnmapNotify, since that would * cause a transition to the Withdrawn state. @@ -2543,8 +2552,8 @@ Iconify(TwmWindow *tmp_win, int def_x, int def_y) t->icon = TRUE; t->icon_on = FALSE; } - } - + } + if (iconify) Zoom(tmp_win->frame, tmp_win->icon_w); @@ -2576,7 +2585,7 @@ Iconify(TwmWindow *tmp_win, int def_x, int def_y) -static void +static void Identify (TwmWindow *t) { int i, n, twidth, width, height; @@ -2587,7 +2596,7 @@ Identify (TwmWindow *t) unsigned udummy; n = 0; - (void) sprintf(Info[n++], "Twm version: %s", Version); + snprintf(Info[n++], INFO_SIZE, "Twm version: %s", Version); Info[n++][0] = '\0'; if (t) { @@ -2595,31 +2604,34 @@ Identify (TwmWindow *t) &wwidth, &wheight, &bw, &depth); (void) XTranslateCoordinates (dpy, t->w, Scr->Root, 0, 0, &x, &y, &junk); - (void) sprintf(Info[n++], "Name = \"%s\"", t->full_name); - (void) sprintf(Info[n++], "Class.res_name = \"%s\"", t->class.res_name); - (void) sprintf(Info[n++], "Class.res_class = \"%s\"", t->class.res_class); + snprintf(Info[n++], INFO_SIZE, + "Name = \"%s\"", t->full_name); + snprintf(Info[n++], INFO_SIZE, + "Class.res_name = \"%s\"", t->class.res_name); + snprintf(Info[n++], INFO_SIZE, + "Class.res_class = \"%s\"", t->class.res_class); Info[n++][0] = '\0'; - (void) sprintf(Info[n++], "Geometry/root = %dx%d+%d+%d", wwidth, wheight, - x, y); - (void) sprintf(Info[n++], "Border width = %d", bw); - (void) sprintf(Info[n++], "Depth = %d", depth); + snprintf(Info[n++], INFO_SIZE, + "Geometry/root = %dx%d+%d+%d", wwidth, wheight, x, y); + snprintf(Info[n++], INFO_SIZE, "Border width = %d", bw); + snprintf(Info[n++], INFO_SIZE, "Depth = %d", depth); if (HasSync) { int priority; (void)XSyncGetPriority(dpy, t->w, &priority); - (void) sprintf(Info[n++], "Priority = %d", priority); + snprintf(Info[n++], INFO_SIZE, "Priority = %d", priority); } } Info[n++][0] = '\0'; - (void) sprintf(Info[n++], "Click to dismiss...."); + snprintf(Info[n++], INFO_SIZE, "Click to dismiss...."); /* figure out the width and height of the info window */ height = n * (Scr->DefaultFont.height+2); width = 1; for (i = 0; i < n; i++) { - twidth = MyFont_TextWidth(&Scr->DefaultFont, Info[i], + twidth = MyFont_TextWidth(&Scr->DefaultFont, Info[i], strlen(Info[i])); if (twidth > width) width = twidth; @@ -2631,9 +2643,9 @@ Identify (TwmWindow *t) &dummy, &dummy, &udummy)) { px -= (width / 2); py -= (height / 3); - if (px + width + BW2 >= Scr->MyDisplayWidth) + if (px + width + BW2 >= Scr->MyDisplayWidth) px = Scr->MyDisplayWidth - width - BW2; - if (py + height + BW2 >= Scr->MyDisplayHeight) + if (py + height + BW2 >= Scr->MyDisplayHeight) py = Scr->MyDisplayHeight - height - BW2; if (px < 0) px = 0; if (py < 0) py = 0; @@ -2641,7 +2653,7 @@ Identify (TwmWindow *t) px = py = 0; } XMoveResizeWindow(dpy, Scr->InfoWindow, px, py, width, height); - XMapRaised(dpy, Scr->InfoWindow); + XMapRaised(dpy, Scr->InfoWindow); InfoLines = n; } @@ -2650,38 +2662,39 @@ void SetMapStateProp(TwmWindow *tmp_win, int state) { unsigned long data[2]; /* "suggested" by ICCCM version 1 */ - + data[0] = (unsigned long) state; - data[1] = (unsigned long) (tmp_win->iconify_by_unmapping ? None : + data[1] = (unsigned long) (tmp_win->iconify_by_unmapping ? None : tmp_win->icon_w); - XChangeProperty (dpy, tmp_win->w, _XA_WM_STATE, _XA_WM_STATE, 32, + XChangeProperty (dpy, tmp_win->w, _XA_WM_STATE, _XA_WM_STATE, 32, PropModeReplace, (unsigned char *) data, 2); } -Bool +Bool GetWMState (Window w, int *statep, Window *iwp) { Atom actual_type; int actual_format; unsigned long nitems, bytesafter; - unsigned long *datap = NULL; + unsigned char *prop_return = NULL; Bool retval = False; if (XGetWindowProperty (dpy, w, _XA_WM_STATE, 0L, 2L, False, _XA_WM_STATE, &actual_type, &actual_format, &nitems, &bytesafter, - (unsigned char **) &datap) != Success || !datap) + &prop_return) != Success || !prop_return) return False; if (nitems <= 2) { /* "suggested" by ICCCM version 1 */ + unsigned long *datap = (unsigned long *) prop_return; *statep = (int) datap[0]; *iwp = (Window) datap[1]; retval = True; } - XFree ((char *) datap); + XFree (prop_return); return retval; } @@ -2696,7 +2709,7 @@ WarpToScreen (int n, int inc) while (!newscr) { /* wrap around */ - if (n < 0) + if (n < 0) n = NumScreens - 1; else if (n >= NumScreens) n = 0; @@ -2707,7 +2720,7 @@ WarpToScreen (int n, int inc) n += inc; continue; } - fprintf (stderr, "%s: unable to warp to unmanaged screen %d\n", + fprintf (stderr, "%s: unable to warp to unmanaged screen %d\n", ProgramName, n); Bell(XkbBI_MinorError,0,None); return; @@ -2741,7 +2754,7 @@ BumpWindowColormap (TwmWindow *tmp, int inc) if (inc && tmp->cmaps.number_cwins > 0) { cwins = (ColormapWindow **) malloc(sizeof(ColormapWindow *)* tmp->cmaps.number_cwins); - if (cwins) { + if (cwins) { if ((previously_installed = /* SUPPRESS 560 */(Scr->cmapInfo.cmaps == &tmp->cmaps && tmp->cmaps.number_cwins))) { @@ -2763,7 +2776,7 @@ BumpWindowColormap (TwmWindow *tmp, int inc) tmp->cmaps.cwins = cwins; if (tmp->cmaps.number_cwins > 1) - bzero (tmp->cmaps.scoreboard, + bzero (tmp->cmaps.scoreboard, ColormapsScoreboardLength(&tmp->cmaps)); if (previously_installed) @@ -2793,11 +2806,11 @@ SetBorder (TwmWindow *tmp, Bool onoroff) if (tmp->highlight) { if (onoroff) { XSetWindowBorder (dpy, tmp->frame, tmp->border); - if (tmp->title_w) + if (tmp->title_w) XSetWindowBorder (dpy, tmp->title_w, tmp->border); } else { XSetWindowBorderPixmap (dpy, tmp->frame, tmp->gray); - if (tmp->title_w) + if (tmp->title_w) XSetWindowBorderPixmap (dpy, tmp->title_w, tmp->gray); } } @@ -2829,14 +2842,14 @@ DestroyMenu (MenuRoot *menu) * warping routines */ -void +void WarpAlongRing (XButtonEvent *ev, Bool forward) { TwmWindow *r, *head; if (Scr->RingLeader) head = Scr->RingLeader; - else if (!(head = Scr->Ring)) + else if (!(head = Scr->Ring)) return; if (forward) { @@ -2851,19 +2864,23 @@ WarpAlongRing (XButtonEvent *ev, Bool forward) if (r && r != head) { TwmWindow *p = Scr->RingLeader, *t; + XPointer context_data; Scr->RingLeader = r; WarpToWindow (r); - if (p && p->mapped && - XFindContext (dpy, ev->window, TwmContext, (caddr_t *)&t) == XCSUCCESS && - p == t) { + if (XFindContext (dpy, ev->window, TwmContext, &context_data) == 0) + t = (TwmWindow *) context_data; + else + t = NULL; + + if (p && p->mapped && p == t) { p->ring.cursor_valid = True; p->ring.curs_x = ev->x_root - t->frame_x; p->ring.curs_y = ev->y_root - t->frame_y; - if (p->ring.curs_x < -p->frame_bw || + if (p->ring.curs_x < -p->frame_bw || p->ring.curs_x >= p->frame_width + p->frame_bw || - p->ring.curs_y < -p->frame_bw || + p->ring.curs_y < -p->frame_bw || p->ring.curs_y >= p->frame_height + p->frame_bw) { /* somehow out of window */ p->ring.curs_x = p->frame_width / 2; @@ -2875,7 +2892,7 @@ WarpAlongRing (XButtonEvent *ev, Bool forward) -void +void WarpToWindow (TwmWindow *t) { int x, y; @@ -2905,7 +2922,7 @@ WarpToWindow (TwmWindow *t) * data[0] message atom * data[1] time stamp */ -static void +static void send_clientmessage (Window w, Atom a, Time timestamp) { XClientMessageEvent ev; diff --git a/app/twm/src/parse.c b/app/twm/src/parse.c index 0734d9e84..26f5ebd3f 100644 --- a/app/twm/src/parse.c +++ b/app/twm/src/parse.c @@ -67,7 +67,7 @@ in this Software without prior written authorization from The Open Group. #include "util.h" #include "gram.h" #include "parse.h" -#include <X11/Xatom.h> +#include <X11/Xatom.h> #include <X11/extensions/sync.h> #ifndef SYSTEM_INIT_FILE @@ -180,7 +180,7 @@ int ParseTwmrc (char *filename) homelen = strlen (home); cp = tmpfilename; (void) snprintf (tmpfilename, sizeof(tmpfilename), - "%s/.twmrc.%d", home, Scr->screen); + "%s/.twmrc.%d", home, Scr->screen); break; } } @@ -384,7 +384,7 @@ typedef struct _TwmKeyword { * in lowercase and only contain the letters a-z). It is fed to a binary * search to parse keywords. */ -static TwmKeyword keytable[] = { +static TwmKeyword keytable[] = { { "all", ALL, 0 }, { "autoraise", AUTO_RAISE, 0 }, { "autorelativeresize", KEYWORD, kw0_AutoRelativeResize }, @@ -729,7 +729,7 @@ int do_string_keyword (int keyword, char *s) { switch (keyword) { case kws_UsePPosition: - { + { int ppos = ParseUsePPosition (s); if (ppos < 0) { twmrc_error_prefix(); @@ -771,7 +771,7 @@ int do_string_keyword (int keyword, char *s) case kws_MaxWindowSize: JunkMask = XParseGeometry (s, &JunkX, &JunkY, &JunkWidth, &JunkHeight); - if ((JunkMask & (WidthValue | HeightValue)) != + if ((JunkMask & (WidthValue | HeightValue)) != (WidthValue | HeightValue)) { twmrc_error_prefix(); fprintf (stderr, "bad MaxWindowSize \"%s\"\n", s); @@ -944,26 +944,29 @@ int do_color_keyword (int keyword, int colormode, char *s) */ void put_pixel_on_root(Pixel pixel) -{ +{ int i, addPixel = 1; - Atom pixelAtom, retAtom; + Atom pixelAtom, retAtom; int retFormat; - unsigned long nPixels, retAfter; - Pixel *retProp; - pixelAtom = XInternAtom(dpy, "_MIT_PRIORITY_COLORS", True); - XGetWindowProperty(dpy, Scr->Root, pixelAtom, 0, 8192, - False, XA_CARDINAL, &retAtom, - &retFormat, &nPixels, &retAfter, - (unsigned char **)&retProp); - - for (i=0; i< nPixels; i++) - if (pixel == retProp[i]) addPixel = 0; - - if (addPixel) + unsigned long nPixels, retAfter; + unsigned char*retProp; + Pixel *pixelProp; + pixelAtom = XInternAtom(dpy, "_MIT_PRIORITY_COLORS", True); + XGetWindowProperty(dpy, Scr->Root, pixelAtom, 0, 8192, + False, XA_CARDINAL, &retAtom, + &retFormat, &nPixels, &retAfter, + &retProp); + + pixelProp = (Pixel *) retProp; + for (i=0; i< nPixels; i++) + if (pixel == pixelProp[i]) + addPixel = 0; + + if (addPixel) XChangeProperty (dpy, Scr->Root, _XA_MIT_PRIORITY_COLORS, - XA_CARDINAL, 32, PropModeAppend, - (unsigned char *)&pixel, 1); -} + XA_CARDINAL, 32, PropModeAppend, + (unsigned char *)&pixel, 1); +} /** * save a color from a string in the twmrc file. @@ -1002,7 +1005,7 @@ do_var_savecolor(int key) * traverse the var save color list placeing the pixels * in the root window property. */ -void +void assign_var_savecolor() { Cptr cp = chead; @@ -1050,7 +1053,7 @@ assign_var_savecolor() } } -static int +static int ParseUsePPosition (char *s) { XmuCopyISOLatin1Lowered (s, s); diff --git a/app/twm/src/parse.h b/app/twm/src/parse.h index 35ef93236..977a3e9ad 100644 --- a/app/twm/src/parse.h +++ b/app/twm/src/parse.h @@ -67,7 +67,7 @@ extern void assign_var_savecolor ( void ); extern int do_single_keyword ( int keyword ); extern int do_string_keyword ( int keyword, char *s ); extern int do_number_keyword ( int keyword, int num ); -extern name_list **do_colorlist_keyword ( int keyword, int colormode, +extern name_list **do_colorlist_keyword ( int keyword, int colormode, char *s ); extern int do_color_keyword ( int keyword, int colormode, char *s ); void put_pixel_on_root ( Pixel pixel ); @@ -78,7 +78,7 @@ extern int ParseTwmrc ( char *filename ); extern int parse_keyword ( char *s, int *nump ); extern void TwmOutput ( int c ); extern void twmUnput ( int c ); -extern void do_squeeze_entry ( name_list **list, char *name, int justify, +extern void do_squeeze_entry ( name_list **list, char *name, int justify, int num, int denom ); diff --git a/app/twm/src/resize.c b/app/twm/src/resize.c index cd7550f68..4ca5eea7a 100644 --- a/app/twm/src/resize.c +++ b/app/twm/src/resize.c @@ -92,7 +92,7 @@ static int last_width; static int last_height; -static void +static void do_auto_clamp (TwmWindow *tmp_win, XEvent *evp) { Window junkRoot; @@ -115,9 +115,9 @@ do_auto_clamp (TwmWindow *tmp_win, XEvent *evp) } h = ((x - dragx) / (dragWidth < 3 ? 1 : (dragWidth / 3))); - v = ((y - dragy - tmp_win->title_height) / + v = ((y - dragy - tmp_win->title_height) / (dragHeight < 3 ? 1 : (dragHeight / 3))); - + if (h <= 0) { clampLeft = 1; clampDX = (x - dragx); @@ -172,7 +172,7 @@ StartResize(XEvent *evp, TwmWindow *tmp_win, Bool fromtitlebar) Scr->SizeStringOffset = SIZE_HINDENT; XResizeWindow (dpy, Scr->SizeWindow, - Scr->SizeStringWidth + SIZE_HINDENT * 2, + Scr->SizeStringWidth + SIZE_HINDENT * 2, Scr->SizeFont.height + SIZE_VINDENT * 2); XMapRaised(dpy, Scr->SizeWindow); InstallRootColormap(); @@ -206,12 +206,12 @@ MenuStartResize(TwmWindow *tmp_win, int x, int y, int w, int h) last_height = 0; Scr->SizeStringOffset = SIZE_HINDENT; XResizeWindow (dpy, Scr->SizeWindow, - Scr->SizeStringWidth + SIZE_HINDENT * 2, + Scr->SizeStringWidth + SIZE_HINDENT * 2, Scr->SizeFont.height + SIZE_VINDENT * 2); XMapRaised(dpy, Scr->SizeWindow); DisplaySize(tmp_win, origWidth, origHeight); MoveOutline (Scr->Root, dragx - tmp_win->frame_bw, - dragy - tmp_win->frame_bw, + dragy - tmp_win->frame_bw, dragWidth + 2 * tmp_win->frame_bw, dragHeight + 2 * tmp_win->frame_bw, tmp_win->frame_bw, tmp_win->title_height); @@ -353,7 +353,7 @@ MenuDoResize(int x_root, int y_root, TwmWindow *tmp_win) /** - * move the rubberband around. This is called for each motion event when + * move the rubberband around. This is called for each motion event when * we are resizing * * \param x_root the X corrdinate in the root window @@ -513,7 +513,7 @@ DisplaySize(TwmWindow *tmp_win, int width, int height) (void) snprintf (str, sizeof(str), " %4d x %-4d ", dwidth, dheight); XRaiseWindow(dpy, Scr->SizeWindow); MyFont_ChangeGC(Scr->DefaultC.fore, Scr->DefaultC.back, &Scr->SizeFont); - MyFont_DrawImageString (dpy, Scr->SizeWindow, &Scr->SizeFont, + MyFont_DrawImageString (dpy, Scr->SizeWindow, &Scr->SizeFont, Scr->NormalGC, Scr->SizeStringOffset, Scr->SizeFont.ascent + SIZE_VINDENT, str, 13); @@ -598,7 +598,7 @@ AddEndResize(TwmWindow *tmp_win) } /** - * adjust the given width and height to account for the constraints imposed + * adjust the given width and height to account for the constraints imposed * by size hints. * * The general algorithm, especially the aspect ratio stuff, is @@ -686,9 +686,9 @@ ConstrainSize (TwmWindow *tmp_win, int *widthp, int *heightp) * * minAspectX * dheight > minAspectY * dwidth * maxAspectX * dheight < maxAspectY * dwidth - * + * */ - + if (tmp_win->hints.flags & PAspect) { if (minAspectX * dheight > minAspectY * dwidth) @@ -728,16 +728,16 @@ ConstrainSize (TwmWindow *tmp_win, int *widthp, int *heightp) /** - * set window sizes, this was called from either AddWindow, EndResize, or + * set window sizes, this was called from either AddWindow, EndResize, or * HandleConfigureNotify. * * Special Considerations: - * This routine will check to make sure the window is not completely off the + * 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 + * 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.) * * \param tmp_win the TwmWindow pointer @@ -826,7 +826,7 @@ void SetupFrame (TwmWindow *tmp_win, int x, int y, int w, int h, int bw, Bool se tmp_win->title_y = xwc.y = -bw; xwcm |= (CWX | CWY | CWBorderWidth); } - + XConfigureWindow(dpy, tmp_win->title_w, xwcm, &xwc); } @@ -842,7 +842,7 @@ void SetupFrame (TwmWindow *tmp_win, int x, int y, int w, int h, int bw, Bool se XMoveResizeWindow (dpy, tmp_win->w, 0, tmp_win->title_height, w, h - tmp_win->title_height); - /* + /* * fix up frame and assign size/location values in tmp_win */ frame_mask = 0; @@ -902,7 +902,7 @@ void SetupFrame (TwmWindow *tmp_win, int x, int y, int w, int h, int bw, Bool se /** - * zooms window to full height of screen or to full height and width of screen. + * zooms window to full height of screen or to full height and width of screen. * (Toggles so that it can undo the zoom - even when switching between fullzoom * and vertical zoom.) * @@ -1083,7 +1083,7 @@ SetFrameShape (TwmWindow *tmp) /* * Squeezed Title: - * + * * tmp->title_x * 0 | * tmp->title_y ........+--------------+......... -+,- tmp->frame_bw @@ -1099,10 +1099,10 @@ SetFrameShape (TwmWindow *tmp) * | | | | * | +---------------------------+ | * +-------------------------------+ - * - * + * + * * Unsqueezed Title: - * + * * tmp->title_x * | 0 * tmp->title_y +-------------------------------+ -+,tmp->frame_bw @@ -1118,11 +1118,11 @@ SetFrameShape (TwmWindow *tmp) * | | | | * | +---------------------------+ | * +-------------------------------+ - * - * - * + * + * + * * Dimensions and Positions: - * + * * frame orgin (0, 0) * frame upper left border (-tmp->frame_bw, -tmp->frame_bw) * frame size w/o border tmp->frame_width , tmp->frame_height @@ -1132,7 +1132,7 @@ SetFrameShape (TwmWindow *tmp) * title origin w/o border (tmp->title_x, tmp->title_y) * client origin (0, Scr->TitleHeight + tmp->frame_bw) * client size tmp->attr.width , tmp->attr.height - * + * * When shaping, need to remember that the width and height of rectangles * are really deltax and deltay to lower right handle corner, so they need * to have -1 subtracted from would normally be the actual extents. diff --git a/app/twm/src/screen.h b/app/twm/src/screen.h index db40be1bf..279813736 100644 --- a/app/twm/src/screen.h +++ b/app/twm/src/screen.h @@ -1,5 +1,5 @@ /* - * + * Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its diff --git a/app/twm/src/session.c b/app/twm/src/session.c index c878ea69e..fd91942bf 100644 --- a/app/twm/src/session.c +++ b/app/twm/src/session.c @@ -113,7 +113,7 @@ Window window; if (prop) XFree (prop); } - + return client_id; } @@ -355,7 +355,7 @@ char *windowRole; if (!write_counted_string (configFile, theWindow->name)) return 0; } - + wm_command = NULL; wm_command_count = 0; XGetCommand (dpy, theWindow->w, &wm_command, &wm_command_count); @@ -450,11 +450,11 @@ ReadWinConfigEntry (FILE *configFile, unsigned short version, goto give_up; if (!read_counted_string (configFile, &entry->wm_name)) goto give_up; - + if (!read_byte (configFile, &byte)) goto give_up; entry->wm_command_count = byte; - + if (entry->wm_command_count == 0) entry->wm_command = NULL; else @@ -534,7 +534,7 @@ give_up: } if (entry->wm_command) free ((char *) entry->wm_command); - + free ((char *) entry); *pentry = NULL; @@ -551,7 +551,7 @@ char *filename; FILE *configFile; TWMWinConfigEntry *entry; int done = 0; - unsigned short version; + unsigned short version = 0; configFile = fopen (filename, "rb"); if (!configFile) @@ -742,18 +742,24 @@ int *pFd; tmp = (char *) mktemp (tempFile); if (tmp) { - char *ptr = strdup(tmp); + char *ptr = (char *) malloc (strlen (tmp) + 1); + strcpy (ptr, tmp); return (ptr); } else return (NULL); #endif -#else +#else char tempFile[PATH_MAX]; char *ptr; snprintf (tempFile, sizeof(tempFile), "%s/%sXXXXXX", path, prefix); - ptr = strdup(tempFile); + ptr = (char *)malloc(strlen(tempFile) + 1); + if (ptr != NULL) + { + strcpy(ptr, tempFile); + *pFd = mkstemp(ptr); + } return ptr; #endif } @@ -803,14 +809,14 @@ SmPointer clientData; prop2.vals = &prop2val; prop2val.value = (SmPointer) userId; prop2val.length = strlen (userId); - + prop3.name = SmRestartStyleHint; prop3.type = SmCARD8; prop3.num_vals = 1; prop3.vals = &prop3val; prop3val.value = (SmPointer) &hint; prop3val.length = 1; - + props[0] = &prop1; props[1] = &prop2; props[2] = &prop3; @@ -836,8 +842,8 @@ SmPointer clientData; #else if ((filename = unique_filename (path, ".twm", &fd)) == NULL) goto bad; - - if (!(configFile = fdopen(fd, "wb"))) + + if (!(configFile = fdopen(fd, "wb"))) goto bad; #endif @@ -872,7 +878,7 @@ SmPointer clientData; } } } - + prop1.name = SmRestartCommand; prop1.type = SmLISTofARRAY8; diff --git a/app/twm/src/session.h b/app/twm/src/session.h index 21f951aeb..e8c2c1cf4 100644 --- a/app/twm/src/session.h +++ b/app/twm/src/session.h @@ -48,7 +48,7 @@ extern int write_byte ( FILE *file, unsigned char b ); extern int write_counted_string ( FILE *file, char *string ); extern int write_short ( FILE *file, short s ); extern int write_ushort ( FILE *file, unsigned short s ); - + extern SmcConn smcConn; #endif diff --git a/app/twm/src/twm.c b/app/twm/src/twm.c index adbd071f4..df441b2b2 100644 --- a/app/twm/src/twm.c +++ b/app/twm/src/twm.c @@ -199,7 +199,7 @@ Bool IsPrintScreen(Screen *s) return True; } } - XFree(pscreens); + XFree(pscreens); } return False; } @@ -293,7 +293,7 @@ main(int argc, char *argv[]) #define newhandler(sig) \ if (signal (sig, SIG_IGN) != SIG_IGN) (void) signal (sig, sigHandler) - + newhandler (SIGINT); newhandler (SIGHUP); newhandler (SIGQUIT); @@ -327,7 +327,7 @@ main(int argc, char *argv[]) appContext = XtCreateApplicationContext (); si = XtAppAddSignal(appContext, Done, NULL); - + if (!(dpy = XtOpenDisplay (appContext, display_name, "twm", "twm", NULL, 0, &zero, NULL))) { fprintf (stderr, "%s: unable to open display \"%s\"\n", @@ -336,7 +336,7 @@ main(int argc, char *argv[]) } if (fcntl(ConnectionNumber(dpy), F_SETFD, 1) == -1) { - fprintf (stderr, + fprintf (stderr, "%s: unable to mark display connection as close-on-exec\n", ProgramName); exit (1); @@ -402,7 +402,7 @@ main(int argc, char *argv[]) RedirectError = FALSE; XSetErrorHandler(CatchRedirectError); XSelectInput(dpy, RootWindow (dpy, scrnum), - ColormapChangeMask | EnterWindowMask | PropertyChangeMask | + ColormapChangeMask | EnterWindowMask | PropertyChangeMask | SubstructureRedirectMask | KeyPressMask | ButtonPressMask | ButtonReleaseMask); XSync(dpy, 0); @@ -422,7 +422,7 @@ main(int argc, char *argv[]) numManaged ++; /* Note: ScreenInfo struct is calloc'ed to initialize to zero. */ - Scr = ScreenList[scrnum] = + Scr = ScreenList[scrnum] = (ScreenInfo *) calloc(1, sizeof(ScreenInfo)); if (Scr == NULL) { @@ -483,7 +483,7 @@ main(int argc, char *argv[]) Scr->cmapInfo.root_pushes = 0; InstallWindowColormaps(0, &Scr->TwmRoot); - Scr->StdCmapInfo.head = Scr->StdCmapInfo.tail = + Scr->StdCmapInfo.head = Scr->StdCmapInfo.tail = Scr->StdCmapInfo.mru = NULL; Scr->StdCmapInfo.mruindex = 0; LocateStandardColormaps(); @@ -504,7 +504,7 @@ main(int argc, char *argv[]) if (DisplayCells(dpy, scrnum) < 3) Scr->Monochrome = MONOCHROME; - else if (DefaultVisual(dpy, scrnum)->class == GrayScale) + else if (DefaultVisual(dpy, scrnum)->class == GrayScale) Scr->Monochrome = GRAYSCALE; else Scr->Monochrome = COLOR; @@ -628,16 +628,16 @@ main(int argc, char *argv[]) } } - + attributes.border_pixel = Scr->DefaultC.fore; attributes.background_pixel = Scr->DefaultC.back; attributes.event_mask = (ExposureMask | ButtonPressMask | KeyPressMask | ButtonReleaseMask); attributes.backing_store = NotUseful; attributes.cursor = XCreateFontCursor (dpy, XC_hand2); - valuemask = (CWBorderPixel | CWBackPixel | CWEventMask | + valuemask = (CWBorderPixel | CWBackPixel | CWEventMask | CWBackingStore | CWCursor); - Scr->InfoWindow = XCreateWindow (dpy, Scr->Root, 0, 0, + Scr->InfoWindow = XCreateWindow (dpy, Scr->Root, 0, 0, (unsigned int) 5, (unsigned int) 5, (unsigned int) BW, 0, (unsigned int) CopyFromParent, @@ -648,7 +648,7 @@ main(int argc, char *argv[]) " 8888 x 8888 ", 13); valuemask = (CWBorderPixel | CWBackPixel | CWBitGravity); attributes.bit_gravity = NorthWestGravity; - Scr->SizeWindow = XCreateWindow (dpy, Scr->Root, 0, 0, + Scr->SizeWindow = XCreateWindow (dpy, Scr->Root, 0, 0, (unsigned int) Scr->SizeStringWidth, (unsigned int) (Scr->SizeFont.height + SIZE_VINDENT*2), @@ -850,7 +850,7 @@ RestoreWithdrawnLocation (TwmWindow *tmp) unsigned int bw, mask; XWindowChanges xwc; - if (XGetGeometry (dpy, tmp->w, &JunkRoot, &xwc.x, &xwc.y, + if (XGetGeometry (dpy, tmp->w, &JunkRoot, &xwc.x, &xwc.y, &JunkWidth, &JunkHeight, &bw, &JunkDepth)) { GetGravityOffsets (tmp, &gravx, &gravy); @@ -891,7 +891,7 @@ RestoreWithdrawnLocation (TwmWindow *tmp) } -void +void Reborder (Time time) { TwmWindow *tmp; /* temp twm window structure */ @@ -917,7 +917,7 @@ Reborder (Time time) SetFocus ((TwmWindow*)NULL, time); } -static SIGNAL_T +static SIGNAL_T sigHandler(int sig) { XtNoticeSignal(si); @@ -930,7 +930,7 @@ sigHandler(int sig) void Done(XtPointer client_data, XtSignalId *si) { - if (dpy) + if (dpy) { Reborder(CurrentTime); XCloseDisplay(dpy); @@ -948,7 +948,7 @@ Done(XtPointer client_data, XtSignalId *si) Bool ErrorOccurred = False; XErrorEvent LastErrorEvent; -static int +static int TwmErrorHandler(Display *dpy, XErrorEvent *event) { LastErrorEvent = *event; @@ -963,7 +963,7 @@ TwmErrorHandler(Display *dpy, XErrorEvent *event) } -static int +static int CatchRedirectError(Display *dpy, XErrorEvent *event) { RedirectError = TRUE; diff --git a/app/twm/src/twm.h b/app/twm/src/twm.h index 420d6c8f5..ec3ca98fd 100644 --- a/app/twm/src/twm.h +++ b/app/twm/src/twm.h @@ -62,6 +62,10 @@ from The Open Group. #ifndef _TWM_ #define _TWM_ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/cursorfont.h> @@ -189,7 +193,7 @@ typedef struct _SqueezeInfo { * ICCCM property. */ typedef struct TwmColormap -{ +{ Colormap c; /* Colormap id */ int state; /* install(ability) state */ unsigned long install_req; /* request number which installed it */ @@ -220,7 +224,7 @@ typedef struct Colormaps ((cm)->number_cwins - 1) / 2) /* for each window that is on the display, one of these structures - * is allocated and linked into a list + * is allocated and linked into a list */ typedef struct TwmWindow { @@ -349,7 +353,7 @@ extern void InitVariables ( void ); extern void CreateFonts ( void ); extern void RestoreWithdrawnLocation ( TwmWindow *tmp ); extern void Reborder( Time time); -extern void Done( XtPointer, XtSignalId * ); +extern void Done( XtPointer, XtSignalId * ) _X_NORETURN; extern void ComputeCommonTitleOffsets ( void ); extern void ComputeTitleLocation ( TwmWindow *tmp ); extern void ComputeWindowTitleOffsets ( TwmWindow *tmp_win, int width, Bool squeeze ); @@ -406,7 +410,7 @@ extern Bool GetWMState ( Window w, int *statep, Window *iwp ); extern void twmrc_error_prefix ( void ); extern int yyparse ( void ); -extern int yylex ( void ); +extern int yylex ( void ); extern void yyerror ( char *s ); extern int doinput ( char *buf, int size ); extern void RemoveDQuote ( char *str ); diff --git a/app/twm/src/util.c b/app/twm/src/util.c index ee30d0602..cba6a3ed0 100644 --- a/app/twm/src/util.c +++ b/app/twm/src/util.c @@ -68,20 +68,20 @@ in this Software without prior written authorization from The Open Group. #include <X11/Xmu/Drawing.h> #include <X11/Xmu/CharSet.h> -static Pixmap CreateXLogoPixmap ( unsigned int *widthp, +static Pixmap CreateXLogoPixmap ( unsigned int *widthp, unsigned int *heightp ); -static Pixmap CreateResizePixmap ( unsigned int *widthp, +static Pixmap CreateResizePixmap ( unsigned int *widthp, unsigned int *heightp ); -static Pixmap CreateDotPixmap ( unsigned int *widthp, +static Pixmap CreateDotPixmap ( unsigned int *widthp, unsigned int *heightp ); -static Pixmap CreateQuestionPixmap ( unsigned int *widthp, +static Pixmap CreateQuestionPixmap ( unsigned int *widthp, unsigned int *heightp ); -static Pixmap CreateMenuPixmap ( unsigned int *widthp, +static Pixmap CreateMenuPixmap ( unsigned int *widthp, unsigned int *heightp ); int HotX, HotY; -/** +/** * move a window outline * * \param root window we are outlining @@ -106,7 +106,7 @@ void MoveOutline(Window root, int x, int y, int width, int height, int bw, int t if (x == lastx && y == lasty && width == lastWidth && height == lastHeight && lastBW == bw && th == lastTH) return; - + r = outline; #define DRAWIT() \ @@ -239,7 +239,7 @@ Zoom(Window wf, Window wt) int y = fy + (int) ((dy * i) / z); unsigned width = (unsigned) (((long) fw) + (dw * i) / z); unsigned height = (unsigned) (((long) fh) + (dh * i) / z); - + XDrawRectangle (dpy, Scr->Root, Scr->DrawGC, x, y, width, height); } @@ -248,7 +248,7 @@ Zoom(Window wf, Window wt) } /** - * expand the tilde character to HOME if it is the first + * expand the tilde character to HOME if it is the first * character of the filename * * \return a pointer to the new name @@ -264,7 +264,7 @@ ExpandFilename(char *name) asprintf(&newname, "%s/%s", Home, &name[1]); if (!newname) { - fprintf (stderr, + fprintf (stderr, "%s: unable to allocate %ld bytes to expand filename %s/%s\n", ProgramName, HomeLen + (unsigned long)strlen(name) + 2, Home, &name[1]); @@ -297,7 +297,7 @@ GetUnknownIcon(char *name) * \param[out] widthp pointer to width of bitmap * \param[out] heightp pointer to height of bitmap */ -Pixmap +Pixmap FindBitmap (char *name, unsigned *widthp, unsigned *heightp) { char *bigname; @@ -324,7 +324,7 @@ FindBitmap (char *name, unsigned *widthp, unsigned *heightp) { TBPM_MENU, CreateMenuPixmap }, { TBPM_QUESTION, CreateQuestionPixmap }, }; - + for (i = 0; i < (sizeof pmtab)/(sizeof pmtab[0]); i++) { if (XmuCompareISOLatin1 (pmtab[i].name, name) == 0) return (*pmtab[i].proc) (widthp, heightp); @@ -366,14 +366,14 @@ FindBitmap (char *name, unsigned *widthp, unsigned *heightp) } if (bigname != name) free (bigname); if (pm == None) { - fprintf (stderr, "%s: unable to find bitmap \"%s\"\n", + fprintf (stderr, "%s: unable to find bitmap \"%s\"\n", ProgramName, name); } return pm; } -Pixmap +Pixmap GetBitmap (char *name) { return FindBitmap (name, &JunkWidth, &JunkHeight); @@ -424,7 +424,7 @@ RemoveRGBColormap (Atom a) StdCmap *sc, *prev; prev = NULL; - for (sc = Scr->StdCmapInfo.head; sc; sc = sc->next) { + for (sc = Scr->StdCmapInfo.head; sc; sc = sc->next) { if (sc->atom == a) break; prev = sc; } @@ -486,7 +486,7 @@ GetColor(int kind, Pixel *what, char *name) stat = XParseColor (dpy, cmap, name, &color); if (!stat) { - fprintf (stderr, "%s: invalid color name \"%s\"\n", + fprintf (stderr, "%s: invalid color name \"%s\"\n", ProgramName, name); return; } @@ -528,7 +528,7 @@ GetColor(int kind, Pixel *what, char *name) stdcmap->blue_max + 0.5) * stdcmap->blue_mult)); } else { - fprintf (stderr, "%s: unable to allocate color \"%s\"\n", + fprintf (stderr, "%s: unable to allocate color \"%s\"\n", ProgramName, name); return; } @@ -553,7 +553,7 @@ GetColorValue(int kind, XColor *what, char *name) if (!XLookupColor (dpy, cmap, name, what, &junkcolor)) { - fprintf (stderr, "%s: invalid color name \"%s\"\n", + fprintf (stderr, "%s: invalid color name \"%s\"\n", ProgramName, name); } else @@ -562,7 +562,7 @@ GetColorValue(int kind, XColor *what, char *name) } } -/* +/* * The following functions are sensible to 'use_fontset'. * When 'use_fontset' is True, * - XFontSet-related internationalized functions are used @@ -661,7 +661,7 @@ MyFont_TextWidth(MyFont *font, char *string, int len) } void -MyFont_DrawImageString(Display *dpy, Drawable d, MyFont *font, GC gc, +MyFont_DrawImageString(Display *dpy, Drawable d, MyFont *font, GC gc, int x, int y, char *string, int len) { if (use_fontset) { @@ -672,7 +672,7 @@ MyFont_DrawImageString(Display *dpy, Drawable d, MyFont *font, GC gc, } void -MyFont_DrawString(Display *dpy, Drawable d, MyFont *font, GC gc, +MyFont_DrawString(Display *dpy, Drawable d, MyFont *font, GC gc, int x, int y, char *string, int len) { if (use_fontset) { @@ -683,7 +683,7 @@ MyFont_DrawString(Display *dpy, Drawable d, MyFont *font, GC gc, } void -MyFont_ChangeGC(unsigned long fix_fore, unsigned long fix_back, +MyFont_ChangeGC(unsigned long fix_fore, unsigned long fix_back, MyFont *fix_font) { Gcv.foreground = fix_fore; @@ -699,9 +699,9 @@ MyFont_ChangeGC(unsigned long fix_fore, unsigned long fix_back, /* * The following functions are internationalized substitutions * for XFetchName and XGetIconName using XGetWMName and - * XGetWMIconName. + * XGetWMIconName. * - * Please note that the third arguments have to be freed using free(), + * Please note that the third arguments have to be freed using free(), * not XFree(). */ Status @@ -711,7 +711,7 @@ I18N_FetchName(Display *dpy, Window w, char **winname) XTextProperty text_prop; char **list; int num; - + status = XGetWMName(dpy, w, &text_prop); if (!status || !text_prop.value || !text_prop.nitems) { *winname = NULL; @@ -719,7 +719,7 @@ I18N_FetchName(Display *dpy, Window w, char **winname) } status = XmbTextPropertyToTextList(dpy, &text_prop, &list, &num); if (status < Success || !num || !*list) { - *winname = NULL; + *winname = NULL; return 0; } XFree(text_prop.value); @@ -735,7 +735,7 @@ I18N_GetIconName(Display *dpy, Window w, char **iconname) XTextProperty text_prop; char **list; int num; - + status = XGetWMIconName(dpy, w, &text_prop); if (!status || !text_prop.value || !text_prop.nitems) return 0; status = XmbTextPropertyToTextList(dpy, &text_prop, &list, &num); @@ -767,73 +767,7 @@ SetFocus (TwmWindow *tmp_win, Time time) XSetInputFocus (dpy, w, RevertToPointerRoot, time); } - -#ifdef NOPUTENV -/** - * define our own putenv() if the system doesn't have one. - * putenv(s): place s (a string of the form "NAME=value") in - * the environment; replacing any existing NAME. s is placed in - * environment, so if you change s, the environment changes (like - * putenv on a sun). Binding removed if you putenv something else - * called NAME. - */ -int -putenv(char *s) -{ - char *v; - int varlen, idx; - extern char **environ; - char **newenv; - static int virgin = 1; /* true while "environ" is a virgin */ - - v = index(s, '='); - if(v == 0) - return 0; /* punt if it's not of the right form */ - varlen = (v + 1) - s; - - for (idx = 0; environ[idx] != 0; idx++) { - if (strncmp(environ[idx], s, varlen) == 0) { - if(v[1] != 0) { /* true if there's a value */ - environ[idx] = s; - return 0; - } else { - do { - environ[idx] = environ[idx+1]; - } while(environ[++idx] != 0); - return 0; - } - } - } - - /* add to environment (unless no value; then just return) */ - if(v[1] == 0) - return 0; - if(virgin) { - register i; - - newenv = (char **) malloc((unsigned) ((idx + 2) * sizeof(char*))); - if(newenv == 0) - return -1; - for(i = idx-1; i >= 0; --i) - newenv[i] = environ[i]; - virgin = 0; /* you're not a virgin anymore, sweety */ - } else { - newenv = (char **) realloc((char *) environ, - (unsigned) ((idx + 2) * sizeof(char*))); - if (newenv == 0) - return -1; - } - - environ = newenv; - environ[idx] = s; - environ[idx+1] = 0; - - return 0; -} -#endif /* NOPUTENV */ - - -static Pixmap +static Pixmap CreateXLogoPixmap (unsigned *widthp, unsigned *heightp) { int h = Scr->TBInfo.width - Scr->TBInfo.border * 2; @@ -868,7 +802,7 @@ CreateXLogoPixmap (unsigned *widthp, unsigned *heightp) } -static Pixmap +static Pixmap CreateResizePixmap (unsigned *widthp, unsigned *heightp) { int h = Scr->TBInfo.width - Scr->TBInfo.border * 2; @@ -895,7 +829,7 @@ CreateResizePixmap (unsigned *widthp, unsigned *heightp) XSetLineAttributes (dpy, gc, lw, LineSolid, CapButt, JoinMiter); /* - * draw the resize button, + * draw the resize button, */ w = (h * 2) / 3; points[0].x = w; @@ -923,7 +857,7 @@ CreateResizePixmap (unsigned *widthp, unsigned *heightp) } -static Pixmap +static Pixmap CreateDotPixmap (unsigned *widthp, unsigned *heightp) { int h = Scr->TBInfo.width - Scr->TBInfo.border * 2; @@ -954,7 +888,7 @@ CreateDotPixmap (unsigned *widthp, unsigned *heightp) static char questionmark_bits[] = { 0x38, 0x7c, 0x64, 0x30, 0x18, 0x00, 0x18, 0x18}; -static Pixmap +static Pixmap CreateQuestionPixmap (unsigned *widthp, unsigned *heightp) { *widthp = questionmark_width; @@ -972,14 +906,14 @@ CreateQuestionPixmap (unsigned *widthp, unsigned *heightp) } -static Pixmap +static Pixmap CreateMenuPixmap (unsigned *widthp, unsigned *heightp) { return CreateMenuIcon (Scr->TBInfo.width - Scr->TBInfo.border * 2, widthp,heightp); } -Pixmap +Pixmap CreateMenuIcon (int height, unsigned *widthp, unsigned *heightp) { int h, w; diff --git a/app/twm/src/util.h b/app/twm/src/util.h index 216e9d988..47b6bf296 100644 --- a/app/twm/src/util.h +++ b/app/twm/src/util.h @@ -61,15 +61,15 @@ in this Software without prior written authorization from The Open Group. #ifndef _UTIL_ #define _UTIL_ -extern void MoveOutline ( Window root, int x, int y, int width, int height, +extern void MoveOutline ( Window root, int x, int y, int width, int height, int bw, int th ); extern void Zoom ( Window wf, Window wt ); extern char * ExpandFilename ( char *name ); extern void GetUnknownIcon ( char *name ); -extern Pixmap FindBitmap ( char *name, unsigned int *widthp, +extern Pixmap FindBitmap ( char *name, unsigned int *widthp, unsigned int *heightp ); extern Pixmap GetBitmap ( char *name ); -extern void InsertRGBColormap ( Atom a, XStandardColormap *maps, int nmaps, +extern void InsertRGBColormap ( Atom a, XStandardColormap *maps, int nmaps, Bool replace ); extern void RemoveRGBColormap ( Atom a ); extern void LocateStandardColormaps ( void ); @@ -77,12 +77,12 @@ extern void GetColor ( int kind, Pixel *what, char *name ); extern void GetColorValue ( int kind, XColor *what, char *name ); extern void GetFont ( MyFont *font ); extern int MyFont_TextWidth( MyFont *font, char *string, int len); -extern void MyFont_DrawImageString( Display *dpy, Drawable d, MyFont *font, - GC gc, int x, int y, char * string, +extern void MyFont_DrawImageString( Display *dpy, Drawable d, MyFont *font, + GC gc, int x, int y, char * string, int len); -extern void MyFont_DrawString( Display *dpy, Drawable d, MyFont *font, +extern void MyFont_DrawString( Display *dpy, Drawable d, MyFont *font, GC gc, int x, int y, char * string, int len); -extern void MyFont_ChangeGC( unsigned long fix_fore, unsigned long fix_back, +extern void MyFont_ChangeGC( unsigned long fix_fore, unsigned long fix_back, MyFont *fix_font); extern Status I18N_FetchName( Display *dpy, Window win, char **winname); extern Status I18N_GetIconName( Display *dpy, Window win, char **iconname); |