diff options
Diffstat (limited to 'app/twm/src')
-rw-r--r-- | app/twm/src/Makefile.am | 6 | ||||
-rw-r--r-- | app/twm/src/Makefile.in | 413 | ||||
-rw-r--r-- | app/twm/src/add_window.c | 47 | ||||
-rw-r--r-- | app/twm/src/cursor.c | 4 | ||||
-rw-r--r-- | app/twm/src/events.c | 96 | ||||
-rw-r--r-- | app/twm/src/events.h | 1 | ||||
-rw-r--r-- | app/twm/src/gc.c | 2 | ||||
-rw-r--r-- | app/twm/src/gram.y | 71 | ||||
-rw-r--r-- | app/twm/src/iconmgr.c | 20 | ||||
-rw-r--r-- | app/twm/src/iconmgr.h | 2 | ||||
-rw-r--r-- | app/twm/src/icons.c | 22 | ||||
-rw-r--r-- | app/twm/src/icons.h | 3 | ||||
-rw-r--r-- | app/twm/src/lex.l | 10 | ||||
-rw-r--r-- | app/twm/src/list.c | 4 | ||||
-rw-r--r-- | app/twm/src/menus.c | 88 | ||||
-rw-r--r-- | app/twm/src/menus.h | 27 | ||||
-rw-r--r-- | app/twm/src/parse.c | 28 | ||||
-rw-r--r-- | app/twm/src/parse.h | 2 | ||||
-rw-r--r-- | app/twm/src/resize.c | 6 | ||||
-rw-r--r-- | app/twm/src/resize.h | 1 | ||||
-rw-r--r-- | app/twm/src/session.c | 220 | ||||
-rw-r--r-- | app/twm/src/session.h | 18 | ||||
-rw-r--r-- | app/twm/src/twm.c | 31 | ||||
-rw-r--r-- | app/twm/src/twm.h | 24 | ||||
-rw-r--r-- | app/twm/src/util.c | 30 | ||||
-rw-r--r-- | app/twm/src/util.h | 18 | ||||
-rw-r--r-- | app/twm/src/version.c | 2 | ||||
-rw-r--r-- | app/twm/src/version.h | 2 |
28 files changed, 611 insertions, 587 deletions
diff --git a/app/twm/src/Makefile.am b/app/twm/src/Makefile.am index 9e5312cf0..092d8ce7a 100644 --- a/app/twm/src/Makefile.am +++ b/app/twm/src/Makefile.am @@ -1,6 +1,6 @@ -# +# # Copyright 2005 Red Hat, Inc. -# +# # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that @@ -10,7 +10,7 @@ # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. -# +# # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR diff --git a/app/twm/src/Makefile.in b/app/twm/src/Makefile.in index c8f3def69..4dc4eae16 100644 --- a/app/twm/src/Makefile.in +++ b/app/twm/src/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -14,9 +14,9 @@ @SET_MAKE@ -# +# # Copyright 2005 Red Hat, Inc. -# +# # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that @@ -26,7 +26,7 @@ # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. -# +# # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR @@ -37,18 +37,32 @@ # -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = ${SHELL} $(install_sh) -c -m 644 -install_sh_PROGRAM = ${SHELL} $(install_sh) -c -install_sh_SCRIPT = ${SHELL} $(install_sh) -c +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : @@ -62,16 +76,17 @@ host_triplet = @host@ bin_PROGRAMS = twm$(EXEEXT) subdir = src DIST_COMMON = $(dist_rc_DATA) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in gram.c gram.h lex.c + $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ + $(top_srcdir)/ylwrap gram.c gram.h lex.c ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(install_sh) -d +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(rcdir)" -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am_twm_OBJECTS = add_window.$(OBJEXT) cursor.$(OBJEXT) \ deftwmrc.$(OBJEXT) events.$(OBJEXT) gc.$(OBJEXT) \ @@ -82,24 +97,83 @@ am_twm_OBJECTS = add_window.$(OBJEXT) cursor.$(OBJEXT) \ twm_OBJECTS = $(am_twm_OBJECTS) am__DEPENDENCIES_1 = twm_DEPENDENCIES = $(am__DEPENDENCIES_1) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles +am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) -YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +@MAINTAINER_MODE_FALSE@am__skiplex = test -f $@ || +LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS) +AM_V_LEX = $(am__v_LEX_@AM_V@) +am__v_LEX_ = $(am__v_LEX_@AM_DEFAULT_V@) +am__v_LEX_0 = @echo " LEX " $@; +am__v_LEX_1 = +YLWRAP = $(top_srcdir)/ylwrap +@MAINTAINER_MODE_FALSE@am__skipyacc = test -f $@ || +am__yacc_c2h = sed -e s/cc$$/hh/ -e s/cpp$$/hpp/ -e s/cxx$$/hxx/ \ + -e s/c++$$/h++/ -e s/c$$/h/ +YACCCOMPILE = $(YACC) $(AM_YFLAGS) $(YFLAGS) +AM_V_YACC = $(am__v_YACC_@AM_V@) +am__v_YACC_ = $(am__v_YACC_@AM_DEFAULT_V@) +am__v_YACC_0 = @echo " YACC " $@; +am__v_YACC_1 = SOURCES = $(twm_SOURCES) DIST_SOURCES = $(twm_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -dist_rcDATA_INSTALL = $(INSTALL_DATA) +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } DATA = $(dist_rc_DATA) ETAGS = etags CTAGS = ctags @@ -107,8 +181,6 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APP_MAN_DIR = @APP_MAN_DIR@ @@ -117,6 +189,7 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BASE_CFLAGS = @BASE_CFLAGS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -137,6 +210,7 @@ EXEEXT = @EXEEXT@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ GREP = @GREP@ +INSTALL = @INSTALL@ INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -152,21 +226,23 @@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ +MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -179,9 +255,11 @@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ YACC = @YACC@ YACC_INST = @YACC_INST@ YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -193,6 +271,7 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ @@ -220,8 +299,12 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ AM_YFLAGS = -d rcdir = ${datadir}/X11/twm dist_rc_DATA = system.twmrc @@ -276,14 +359,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/Makefile + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -301,37 +384,53 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ - else :; fi; \ - done + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ - rm -f "$(DESTDIR)$(bindir)/$$f"; \ - done + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files 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) + @if test ! -f $@; then rm -f gram.c; else :; fi + @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) gram.c; else :; fi +twm$(EXEEXT): $(twm_OBJECTS) $(twm_DEPENDENCIES) $(EXTRA_twm_DEPENDENCIES) @rm -f twm$(EXEEXT) - $(LINK) $(twm_LDFLAGS) $(twm_OBJECTS) $(twm_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(twm_OBJECTS) $(twm_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -358,135 +457,139 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .l.c: - $(LEXCOMPILE) $< - sed '/^#/ s|$(LEX_OUTPUT_ROOT)\.c|$@|' $(LEX_OUTPUT_ROOT).c >$@ - rm -f $(LEX_OUTPUT_ROOT).c + $(AM_V_LEX)$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) .y.c: - $(YACCCOMPILE) $< - if test -f y.tab.h; then \ - to=`echo "$*_H" | sed \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ - -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`; \ - sed -e "/^#/!b" -e "s/Y_TAB_H/$$to/g" -e "s|y\.tab\.h|$*.h|" \ - y.tab.h >$*.ht; \ - rm -f y.tab.h; \ - if cmp -s $*.ht $*.h; then \ - rm -f $*.ht ;\ - else \ - mv $*.ht $*.h; \ - fi; \ - fi - if test -f y.output; then \ - mv y.output $*.output; \ - fi - sed '/^#/ s|y\.tab\.c|$@|' y.tab.c >$@t && mv $@t $@ - rm -f y.tab.c -uninstall-info-am: + $(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h `echo $@ | $(am__yacc_c2h)` y.output $*.output -- $(YACCCOMPILE) install-dist_rcDATA: $(dist_rc_DATA) @$(NORMAL_INSTALL) - test -z "$(rcdir)" || $(mkdir_p) "$(DESTDIR)$(rcdir)" - @list='$(dist_rc_DATA)'; for p in $$list; do \ + @list='$(dist_rc_DATA)'; test -n "$(rcdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(rcdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(rcdir)" || exit 1; \ + fi; \ + for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(dist_rcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(rcdir)/$$f'"; \ - $(dist_rcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(rcdir)/$$f"; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(rcdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(rcdir)" || exit $$?; \ done uninstall-dist_rcDATA: @$(NORMAL_UNINSTALL) - @list='$(dist_rc_DATA)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(rcdir)/$$f'"; \ - rm -f "$(DESTDIR)$(rcdir)/$$f"; \ - done + @list='$(dist_rc_DATA)'; test -n "$(rcdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(rcdir)'; $(am__uninstall_files_from_dir) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - tags=; \ + set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @@ -496,7 +599,7 @@ check: $(BUILT_SOURCES) all-am: Makefile $(PROGRAMS) $(DATA) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(rcdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am @@ -509,16 +612,22 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -543,18 +652,38 @@ dvi-am: html: html-am +html-am: + info: info-am info-am: install-data-am: install-dist_rcDATA +install-dvi: install-dvi-am + +install-dvi-am: + install-exec-am: install-binPROGRAMS +install-html: install-html-am + +install-html-am: + install-info: install-info-am +install-info-am: + install-man: +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am @@ -574,20 +703,23 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binPROGRAMS uninstall-dist_rcDATA \ - uninstall-info-am +uninstall-am: uninstall-binPROGRAMS uninstall-dist_rcDATA + +.MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic ctags distclean distclean-compile \ + clean-generic cscopelist ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-dist_rcDATA install-exec \ - install-exec-am install-info install-info-am install-man \ + install-data install-data-am install-dist_rcDATA install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-binPROGRAMS \ - uninstall-dist_rcDATA uninstall-info-am + uninstall-dist_rcDATA deftwmrc.c: system.twmrc @@ -600,6 +732,7 @@ deftwmrc.c: system.twmrc 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. .NOEXPORT: diff --git a/app/twm/src/add_window.c b/app/twm/src/add_window.c index 8cf23c5e5..99481b0f5 100644 --- a/app/twm/src/add_window.c +++ b/app/twm/src/add_window.c @@ -170,8 +170,8 @@ AddWindow(Window w, int iconm, IconMgr *iconp) #endif /* allocate space for the twm window */ - tmp_win = (TwmWindow *)calloc(1, sizeof(TwmWindow)); - if (tmp_win == 0) + tmp_win = calloc(1, sizeof(TwmWindow)); + if (tmp_win == NULL) { fprintf (stderr, "%s: Unable to allocate memory to manage window ID %lx.\n", ProgramName, w); @@ -362,7 +362,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) { if (!tmp_win->wmhints) { - tmp_win->wmhints = (XWMHints *)malloc(sizeof(XWMHints)); + tmp_win->wmhints = malloc(sizeof(XWMHints)); tmp_win->wmhints->flags = 0; } tmp_win->wmhints->initial_state = IconicState; @@ -745,7 +745,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) if (XGetGeometry(dpy, tmp_win->w, &JunkRoot, &JunkX, &JunkY, &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth) == 0) { - free((char *)tmp_win); + free(tmp_win); XUngrabServer(dpy); return(NULL); } @@ -981,7 +981,7 @@ static void do_add_binding (int button, int context, int modifier, int func) } void -AddDefaultBindings () +AddDefaultBindings (void) { /* * The bindings are stored in Scr->Mouse, indexed by @@ -1161,7 +1161,7 @@ static Window CreateHighlightWindow (TwmWindow *tmp_win) } -void ComputeCommonTitleOffsets () +void ComputeCommonTitleOffsets (void) { int buttonwidth = (Scr->TBInfo.width + Scr->TBInfo.pad); @@ -1287,7 +1287,7 @@ static void CreateWindowTitlebarButtons (TwmWindow *tmp_win) tmp_win->titlebuttons = NULL; nb = Scr->TBInfo.nleft + Scr->TBInfo.nright; if (nb > 0) { - tmp_win->titlebuttons = (TBWindow *) malloc (nb * sizeof(TBWindow)); + tmp_win->titlebuttons = malloc (nb * sizeof(TBWindow)); if (!tmp_win->titlebuttons) { fprintf (stderr, "%s: unable to allocate %d titlebuttons\n", ProgramName, nb); @@ -1360,7 +1360,7 @@ FetchWmProtocols (TwmWindow *tmp) if (*ap == _XA_WM_SAVE_YOURSELF) flags |= DoesWmSaveYourself; if (*ap == _XA_WM_DELETE_WINDOW) flags |= DoesWmDeleteWindow; } - if (protocols) XFree ((char *) protocols); + if (protocols) XFree (protocols); } tmp->protocols = flags; } @@ -1369,10 +1369,10 @@ TwmColormap * CreateTwmColormap(Colormap c) { TwmColormap *cmap; - cmap = (TwmColormap *) malloc(sizeof(TwmColormap)); + cmap = malloc(sizeof(TwmColormap)); if (!cmap || XSaveContext(dpy, c, ColormapContext, (caddr_t) cmap)) { - if (cmap) free((char *) cmap); + if (cmap) free(cmap); return (NULL); } cmap->c = c; @@ -1390,11 +1390,11 @@ CreateColormapWindow(Window w, Bool creating_parent, Bool property_window) TwmColormap *cmap; XWindowAttributes attributes; - cwin = (ColormapWindow *) malloc(sizeof(ColormapWindow)); + cwin = malloc(sizeof(ColormapWindow)); if (cwin) { if (!XGetWindowAttributes(dpy, w, &attributes) || XSaveContext(dpy, w, ColormapContext, (caddr_t) cwin)) { - free((char *) cwin); + free(cwin); return (NULL); } @@ -1403,7 +1403,7 @@ CreateColormapWindow(Window w, Bool creating_parent, Bool property_window) cwin->colormap = cmap = CreateTwmColormap(attributes.colormap); if (!cmap) { XDeleteContext(dpy, w, ColormapContext); - free((char *) cwin); + free(cwin); return (NULL); } } else { @@ -1469,7 +1469,7 @@ FetchWmColormapWindows (TwmWindow *tmp) } if (i == number_cmap_windows) { /* not in list */ Window *new_cmap_windows = - (Window *) malloc (sizeof(Window) * (number_cmap_windows + 1)); + malloc (sizeof(Window) * (number_cmap_windows + 1)); if (!new_cmap_windows) { fprintf (stderr, @@ -1481,14 +1481,13 @@ FetchWmColormapWindows (TwmWindow *tmp) for (i = 0; i < number_cmap_windows; i++) { /* append rest */ new_cmap_windows[i+1] = cmap_windows[i]; } - XFree ((char *) cmap_windows); + XFree (cmap_windows); can_free_cmap_windows = True; /* do not use XFree any more */ cmap_windows = new_cmap_windows; number_cmap_windows++; } - cwins = (ColormapWindow **) malloc(sizeof(ColormapWindow *) * - number_cmap_windows); + cwins = malloc(sizeof(ColormapWindow *) * number_cmap_windows); if (cwins) { for (i = 0; i < number_cmap_windows; i++) { @@ -1533,12 +1532,14 @@ FetchWmColormapWindows (TwmWindow *tmp) number_cmap_windows = 1; - cwins = (ColormapWindow **) malloc(sizeof(ColormapWindow *)); + cwins = malloc(sizeof(ColormapWindow *)); if (XFindContext(dpy, tmp->w, ColormapContext, (caddr_t *)&cwins[0]) == - XCNOENT) + XCNOENT) { cwins[0] = CreateColormapWindow(tmp->w, (Bool) tmp->cmaps.number_cwins == 0, False); - else + if (cwins[0] == NULL) + number_cmap_windows = 0; + } else cwins[0]->refcnt++; } @@ -1549,7 +1550,7 @@ FetchWmColormapWindows (TwmWindow *tmp) tmp->cmaps.number_cwins = number_cmap_windows; if (number_cmap_windows > 1) tmp->cmaps.scoreboard = - (char *) calloc(1, ColormapsScoreboardLength(&tmp->cmaps)); + calloc(1, ColormapsScoreboardLength(&tmp->cmaps)); if (previously_installed) InstallWindowColormaps(PropertyNotify, (TwmWindow *) NULL); @@ -1557,9 +1558,9 @@ FetchWmColormapWindows (TwmWindow *tmp) done: if (cmap_windows) { if (can_free_cmap_windows) - free ((char *) cmap_windows); + free (cmap_windows); else - XFree ((char *) cmap_windows); + XFree (cmap_windows); } return; diff --git a/app/twm/src/cursor.c b/app/twm/src/cursor.c index 5bfc4f984..bbe05f083 100644 --- a/app/twm/src/cursor.c +++ b/app/twm/src/cursor.c @@ -38,7 +38,7 @@ in this Software without prior written authorization from The Open Group. #include "util.h" static struct _CursorName { - char *name; + const char *name; unsigned int shape; Cursor cursor; } cursor_names[] = { @@ -123,7 +123,7 @@ static struct _CursorName { }; void -NewFontCursor (Cursor *cp, char *str) +NewFontCursor (Cursor *cp, const char *str) { int i; diff --git a/app/twm/src/events.c b/app/twm/src/events.c index 2239e6fde..ac26d887a 100644 --- a/app/twm/src/events.c +++ b/app/twm/src/events.c @@ -76,17 +76,17 @@ in this Software without prior written authorization from The Open Group. #define MAX_X_EVENT 256 event_proc EventHandler[MAX_X_EVENT]; /* event handler jump table */ -char *Action; +static const char *Action; int Context = C_NO_CONTEXT; /* current button press context */ -TwmWindow *ButtonWindow; /* button press window structure */ -XEvent ButtonEvent; /* button press event */ +static TwmWindow *ButtonWindow; /* button press window structure */ +static XEvent ButtonEvent; /* button press event */ XEvent Event; /* the current event */ -TwmWindow *Tmp_win; /* the current twm window */ +static 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 */ -TwmWindow *UnHighLight_win = NULL; +static TwmWindow *UnHighLight_win = NULL; Window DragWindow; /* variables used in moving windows */ int origDragX; @@ -109,6 +109,7 @@ static Bool HENQueueScanner ( Display *dpy, XEvent *ev, char *args ); static Bool HLNQueueScanner ( Display *dpy, XEvent *ev, char *args ); static void flush_expose ( Window w ); static Bool UninstallRootColormapQScanner ( Display *dpy, XEvent *ev, char *args ); +static void RedoIconName ( void ); int ButtonPressed = -1; int Cancel = FALSE; @@ -137,7 +138,7 @@ void SetRaiseWindow (TwmWindow *tmp) * initialize the event jump table. */ void -InitEvents() +InitEvents(void) { int i; @@ -268,7 +269,7 @@ Window WindowOfEvent (XEvent *e) * handle a single X event stored in global var Event * this routine for is for a call during an f.move */ -Bool DispatchEvent2 () +Bool DispatchEvent2 (void) { Window w = Event.xany.window; XPointer context_data; @@ -299,7 +300,7 @@ Bool DispatchEvent2 () /** * handle a single X event stored in global var Event */ -Bool DispatchEvent () +Bool DispatchEvent (void) { Window w = Event.xany.window; XPointer context_data; @@ -330,7 +331,7 @@ Bool DispatchEvent () * handle X events */ void -HandleEvents() +HandleEvents(void) { while (TRUE) { @@ -364,7 +365,7 @@ HandleEvents() * */ void -HandleColormapNotify() +HandleColormapNotify(void) { XColormapEvent *cevent = (XColormapEvent *) &Event; ColormapWindow *cwin, **cwins; @@ -403,7 +404,7 @@ HandleColormapNotify() if (cmap->refcnt == 0) { XDeleteContext(dpy, cmap->c, ColormapContext); - free((char *) cmap); + free(cmap); } return; @@ -524,7 +525,7 @@ HandleColormapNotify() * */ void -HandleVisibilityNotify() +HandleVisibilityNotify(void) { XVisibilityEvent *vevent = (XVisibilityEvent *) &Event; ColormapWindow *cwin; @@ -561,7 +562,7 @@ int MovedFromKeyPress = False; * key press event handler */ void -HandleKeyPress() +HandleKeyPress(void) { KeySym ks; FuncKey *key; @@ -713,13 +714,13 @@ free_cwins (TwmWindow *tmp) cmap = tmp->cmaps.cwins[i]->colormap; if (--cmap->refcnt == 0) { XDeleteContext(dpy, cmap->c, ColormapContext); - free((char *) cmap); + free(cmap); } XDeleteContext(dpy, tmp->cmaps.cwins[i]->w, ColormapContext); - free((char *) tmp->cmaps.cwins[i]); + free(tmp->cmaps.cwins[i]); } } - free((char *) tmp->cmaps.cwins); + free(tmp->cmaps.cwins); if (tmp->cmaps.number_cwins > 1) { free(tmp->cmaps.scoreboard); tmp->cmaps.scoreboard = NULL; @@ -734,7 +735,7 @@ free_cwins (TwmWindow *tmp) * property notify event handler */ void -HandlePropertyNotify() +HandlePropertyNotify(void) { char *name = NULL; unsigned long valuemask; /* mask for create windows */ @@ -806,7 +807,7 @@ HandlePropertyNotify() break; case XA_WM_HINTS: - if (Tmp_win->wmhints) XFree ((char *) Tmp_win->wmhints); + if (Tmp_win->wmhints) XFree (Tmp_win->wmhints); Tmp_win->wmhints = XGetWMHints(dpy, Event.xany.window); if (Tmp_win->wmhints && (Tmp_win->wmhints->flags & WindowGroupHint)) @@ -942,8 +943,8 @@ HandlePropertyNotify() /** * procedure to re-position the icon window and name */ -void -RedoIconName() +static void +RedoIconName(void) { int x, y; @@ -1006,7 +1007,7 @@ RedoIconName() *client message event handler */ void -HandleClientMessage() +HandleClientMessage(void) { if (Event.xclient.message_type == _XA_WM_CHANGE_STATE) { @@ -1035,7 +1036,7 @@ HandleClientMessage() * expose event handler */ void -HandleExpose() +HandleExpose(void) { XPointer context_data; @@ -1164,7 +1165,7 @@ static void remove_window_from_ring (TwmWindow *tmp) * DestroyNotify event handler */ void -HandleDestroyNotify() +HandleDestroyNotify(void) { int i; @@ -1243,26 +1244,26 @@ HandleDestroyNotify() free_window_names (Tmp_win, True, True, True); /* 1, 2, 3 */ if (Tmp_win->wmhints) /* 4 */ - XFree ((char *)Tmp_win->wmhints); + XFree (Tmp_win->wmhints); if (Tmp_win->class.res_name && Tmp_win->class.res_name != NoName) /* 5 */ - XFree ((char *)Tmp_win->class.res_name); + XFree (Tmp_win->class.res_name); if (Tmp_win->class.res_class && Tmp_win->class.res_class != NoName) /* 6 */ - XFree ((char *)Tmp_win->class.res_class); + XFree (Tmp_win->class.res_class); free_cwins (Tmp_win); /* 9 */ if (Tmp_win->titlebuttons) /* 10 */ - free ((char *) Tmp_win->titlebuttons); + free (Tmp_win->titlebuttons); remove_window_from_ring (Tmp_win); /* 11 */ if (UnHighLight_win == Tmp_win) UnHighLight_win = NULL; - free((char *)Tmp_win); + free(Tmp_win); } void -HandleCreateNotify() +HandleCreateNotify(void) { #ifdef DEBUG_EVENTS fprintf(stderr, "CreateNotify w = 0x%x\n", Event.xcreatewindow.window); @@ -1278,7 +1279,7 @@ HandleCreateNotify() * HandleMapRequest - MapRequest event handler */ void -HandleMapRequest() +HandleMapRequest(void) { XPointer context_data; int zoom_save; @@ -1349,8 +1350,8 @@ HandleMapRequest() -void SimulateMapRequest (w) - Window w; +void +SimulateMapRequest (Window w) { Event.xmaprequest.window = w; HandleMapRequest (); @@ -1362,7 +1363,7 @@ void SimulateMapRequest (w) * MapNotify event handler */ void -HandleMapNotify() +HandleMapNotify(void) { if (Tmp_win == NULL) return; @@ -1396,7 +1397,7 @@ HandleMapNotify() * UnmapNotify event handler */ void -HandleUnmapNotify() +HandleUnmapNotify(void) { int dstx, dsty; Window dumwin; @@ -1464,7 +1465,7 @@ HandleUnmapNotify() * MotionNotify event handler */ void -HandleMotionNotify() +HandleMotionNotify(void) { XPointer context_data; @@ -1494,7 +1495,7 @@ HandleMotionNotify() * ButtonRelease event handler */ void -HandleButtonRelease() +HandleButtonRelease(void) { int xl, xr, yt, yb, w, h; unsigned mask; @@ -1705,7 +1706,7 @@ do_menu (MenuRoot *menu, Window w) * ButtonPress event handler */ void -HandleButtonPress() +HandleButtonPress(void) { unsigned int modifier; Cursor cur; @@ -1983,7 +1984,7 @@ HENQueueScanner(Display *dpy, XEvent *ev, char *args) * EnterNotify event handler */ void -HandleEnterNotify() +HandleEnterNotify(void) { MenuRoot *mr; XEnterWindowEvent *ewp = &Event.xcrossing; @@ -2171,7 +2172,7 @@ HLNQueueScanner(Display *dpy, XEvent *ev, char *args) * LeaveNotify event handler */ void -HandleLeaveNotify() +HandleLeaveNotify(void) { HLNScanArgs scanArgs; XEvent dummy; @@ -2246,7 +2247,7 @@ HandleLeaveNotify() * HandleConfigureRequest - ConfigureRequest event handler */ void -HandleConfigureRequest() +HandleConfigureRequest(void) { XWindowChanges xwc; unsigned long xwcm; @@ -2380,7 +2381,7 @@ HandleConfigureRequest() * shape notification event handler */ void -HandleShapeNotify () +HandleShapeNotify (void) { XShapeEvent *sev = (XShapeEvent *) &Event; @@ -2402,7 +2403,7 @@ HandleShapeNotify () * unknown event handler */ void -HandleUnknown() +HandleUnknown(void) { #ifdef DEBUG_EVENTS fprintf(stderr, "type = %d\n", Event.type); @@ -2434,8 +2435,7 @@ Transient(Window w, Window *propw) * \param w the window */ ScreenInfo * -FindScreenInfo(w) - Window w; +FindScreenInfo(Window w) { XWindowAttributes attr; int scrnum; @@ -2455,8 +2455,8 @@ FindScreenInfo(w) -static void flush_expose (w) - Window w; +static void +flush_expose (Window w) { XEvent dummy; @@ -2581,7 +2581,7 @@ InstallWindowColormaps (int type, TwmWindow *tmp) * other colormap list would potentially be loaded anyway. */ void -InstallRootColormap() +InstallRootColormap(void) { TwmWindow *tmp; if (Scr->cmapInfo.root_pushes == 0) { @@ -2617,7 +2617,7 @@ UninstallRootColormapQScanner(Display *dpy, XEvent *ev, char *args) void -UninstallRootColormap() +UninstallRootColormap(void) { char args; XEvent dummy; diff --git a/app/twm/src/events.h b/app/twm/src/events.h index 3ed340ba0..e6bcfc91c 100644 --- a/app/twm/src/events.h +++ b/app/twm/src/events.h @@ -82,7 +82,6 @@ extern void HandleVisibilityNotify ( void ); extern void HandleKeyPress ( void ); extern void free_cwins ( TwmWindow *tmp ); extern void HandlePropertyNotify ( void ); -extern void RedoIconName ( void ); extern void HandleClientMessage ( void ); extern void HandleExpose ( void ); extern void HandleDestroyNotify ( void ); diff --git a/app/twm/src/gc.c b/app/twm/src/gc.c index a1cb61385..11aca717f 100644 --- a/app/twm/src/gc.c +++ b/app/twm/src/gc.c @@ -69,7 +69,7 @@ in this Software without prior written authorization from The Open Group. * want to do this once, hence the first_time flag. */ void -CreateGCs() +CreateGCs(void) { static ScreenInfo *prevScr = NULL; XGCValues gcv; diff --git a/app/twm/src/gram.y b/app/twm/src/gram.y index fcfbf62ad..ca40d1c35 100644 --- a/app/twm/src/gram.y +++ b/app/twm/src/gram.y @@ -82,13 +82,14 @@ static char *Action = ""; static char *Name = ""; static MenuRoot *root, *pull = NULL; -static MenuRoot *GetRoot ( char *name, char *fore, char *back ); +static MenuRoot *GetRoot ( const char *name, const char *fore, const char *back ); static void GotButton ( int butt, int func ); static void GotKey ( char *key, int func ); static void GotTitleButton ( char *bitmapname, int func, Bool rightside ); static Bool CheckWarpScreenArg ( char *s ); static Bool CheckWarpRingArg ( char *s ); static Bool CheckColormapArg ( char *s ); +static void RemoveDQuote ( char *str ); static char *ptr; static name_list **list; @@ -98,6 +99,8 @@ int mods = 0; unsigned int mods_used = (ShiftMask | ControlMask | Mod1Mask); extern int yylineno; +static void yyerror ( const char *s ); + %} %union @@ -107,19 +110,19 @@ extern int yylineno; }; %token <num> LB RB LP RP MENUS MENU BUTTON DEFAULT_FUNCTION PLUS MINUS -%token <num> ALL OR CURSORS PIXMAPS ICONS COLOR SAVECOLOR MONOCHROME FUNCTION +%token <num> ALL OR CURSORS PIXMAPS ICONS COLOR SAVECOLOR MONOCHROME FUNCTION %token <num> ICONMGR_SHOW ICONMGR WINDOW_FUNCTION ZOOM ICONMGRS %token <num> ICONMGR_GEOMETRY ICONMGR_NOSHOW MAKE_TITLE GRAYSCALE -%token <num> ICONIFY_BY_UNMAPPING DONT_ICONIFY_BY_UNMAPPING -%token <num> NO_TITLE AUTO_RAISE NO_HILITE ICON_REGION -%token <num> META SHIFT LOCK CONTROL WINDOW TITLE ICON ROOT FRAME +%token <num> ICONIFY_BY_UNMAPPING DONT_ICONIFY_BY_UNMAPPING +%token <num> NO_TITLE AUTO_RAISE NO_HILITE ICON_REGION +%token <num> META SHIFT LOCK CONTROL WINDOW TITLE ICON ROOT FRAME %token <num> COLON EQUALS SQUEEZE_TITLE DONT_SQUEEZE_TITLE %token <num> START_ICONIFIED NO_TITLE_HILITE TITLE_HILITE -%token <num> MOVE RESIZE WAIT SELECT KILL LEFT_TITLEBUTTON RIGHT_TITLEBUTTON -%token <num> NUMBER KEYWORD NKEYWORD CKEYWORD CLKEYWORD FKEYWORD FSKEYWORD +%token <num> MOVE RESIZE WAIT SELECT KILL LEFT_TITLEBUTTON RIGHT_TITLEBUTTON +%token <num> NUMBER KEYWORD NKEYWORD CKEYWORD CLKEYWORD FKEYWORD FSKEYWORD %token <num> SKEYWORD DKEYWORD JKEYWORD WINDOW_RING WARP_CURSOR ERRORTOKEN %token <num> NO_STACKMODE -%token <ptr> STRING +%token <ptr> STRING %type <ptr> string %type <num> pixmap_list cursor_list color_list save_color_list stmt @@ -127,7 +130,7 @@ extern int yylineno; %type <num> noarg sarg error narg squeeze color_entry %type <num> action button number signed_number full fullkey -%start twmrc +%start twmrc %% twmrc : stmts @@ -159,18 +162,18 @@ stmt : error Scr->ZoomCount = $2; } } - | ZOOM { if (Scr->FirstTime) + | ZOOM { if (Scr->FirstTime) Scr->DoZoom = TRUE; } | PIXMAPS pixmap_list {} | CURSORS cursor_list {} | ICONIFY_BY_UNMAPPING { list = &Scr->IconifyByUn; } win_list - | ICONIFY_BY_UNMAPPING { if (Scr->FirstTime) + | ICONIFY_BY_UNMAPPING { if (Scr->FirstTime) Scr->IconifyByUnmapping = TRUE; } - | LEFT_TITLEBUTTON string EQUALS action { + | LEFT_TITLEBUTTON string EQUALS action { GotTitleButton ($2, $4, False); } - | RIGHT_TITLEBUTTON string EQUALS action { + | RIGHT_TITLEBUTTON string EQUALS action { GotTitleButton ($2, $4, True); } | button string { root = GetRoot($2, NULLSTR, NULLSTR); @@ -186,7 +189,7 @@ stmt : error else { root = GetRoot(TWM_ROOT,NULLSTR,NULLSTR); - Scr->Mouse[$1][C_ROOT][0].item = + Scr->Mouse[$1][C_ROOT][0].item = AddToMenu(root,"x",Action, NULL,$2,NULLSTR,NULLSTR); } @@ -239,7 +242,7 @@ stmt : error color_list | GRAYSCALE { color = GRAYSCALE; } color_list - | SAVECOLOR + | SAVECOLOR save_color_list | MONOCHROME { color = MONOCHROME; } color_list @@ -252,7 +255,7 @@ stmt : error else { root = GetRoot(TWM_ROOT,NULLSTR,NULLSTR); - Scr->DefaultFunction.item = + Scr->DefaultFunction.item = AddToMenu(root,"x",Action, NULL,$2, NULLSTR, NULLSTR); } @@ -261,7 +264,7 @@ stmt : error } | WINDOW_FUNCTION action { Scr->WindowFunction.func = $2; root = GetRoot(TWM_ROOT,NULLSTR,NULLSTR); - Scr->WindowFunction.item = + Scr->WindowFunction.item = AddToMenu(root,"x",Action, NULL,$2, NULLSTR, NULLSTR); Action = ""; @@ -269,7 +272,7 @@ stmt : error } | WARP_CURSOR { list = &Scr->WarpCursorL; } win_list - | WARP_CURSOR { if (Scr->FirstTime) + | WARP_CURSOR { if (Scr->FirstTime) Scr->WarpCursor = TRUE; } | WINDOW_RING { list = &Scr->WindowRingL; } win_list @@ -324,7 +327,7 @@ key : META { mods |= Mod1Mask; } | CONTROL { mods |= ControlMask; } | META number { if ($2 < 1 || $2 > 5) { twmrc_error_prefix(); - fprintf (stderr, + fprintf (stderr, "bad modifier number (%d), must be 1-5\n", $2); ParseError = 1; @@ -470,11 +473,11 @@ color_entry : CLKEYWORD string { if (!do_colorlist_keyword ($1, color, } ; -save_color_list : LB s_color_entries RB +save_color_list : LB s_color_entries RB ; s_color_entries : /* Empty */ - | s_color_entries s_color_entry + | s_color_entries s_color_entry ; s_color_entry : string { do_string_savecolor(color, $1); } @@ -493,10 +496,10 @@ win_color_entry : string string { if (Scr->FirstTime && AddToList(list, $1, $2); } ; -squeeze : SQUEEZE_TITLE { +squeeze : SQUEEZE_TITLE { if (HasShape) Scr->SqueezeTitle = TRUE; } - | SQUEEZE_TITLE { list = &Scr->SqueezeTitleL; + | SQUEEZE_TITLE { list = &Scr->SqueezeTitleL; if (HasShape && Scr->SqueezeTitle == -1) Scr->SqueezeTitle = TRUE; } @@ -610,8 +613,8 @@ action : FKEYWORD { $$ = $1; } case F_WARPTOSCREEN: if (!CheckWarpScreenArg (Action)) { twmrc_error_prefix(); - fprintf (stderr, - "ignoring invalid f.warptoscreen argument \"%s\"\n", + fprintf (stderr, + "ignoring invalid f.warptoscreen argument \"%s\"\n", Action); $$ = F_NOP; } @@ -622,7 +625,7 @@ action : FKEYWORD { $$ = $1; } } else { twmrc_error_prefix(); fprintf (stderr, - "ignoring invalid f.colormap argument \"%s\"\n", + "ignoring invalid f.colormap argument \"%s\"\n", Action); $$ = F_NOP; } @@ -658,15 +661,15 @@ number : NUMBER { $$ = $1; } ; %% -void -yyerror(char *s) +static void +yyerror(const char *s) { twmrc_error_prefix(); fprintf (stderr, "error in input file: %s\n", s ? s : ""); ParseError = 1; } -void +static void RemoveDQuote(char *str) { register char *i, *o; @@ -750,7 +753,7 @@ RemoveDQuote(char *str) *o = '\0'; } -static MenuRoot *GetRoot(char *name, char* fore, char *back) +static MenuRoot *GetRoot(const char *name, const char* fore, const char *back) { MenuRoot *tmp; @@ -807,9 +810,9 @@ static void GotKey(char *key, int func) for (i = 0; i < NUM_CONTEXTS; i++) { - if ((cont & (1 << i)) == 0) + if ((cont & (1 << i)) == 0) continue; - if (!AddFuncKey(key, i, mods, func, Name, Action)) + if (!AddFuncKey(key, i, mods, func, Name, Action)) break; } @@ -825,7 +828,7 @@ static void GotTitleButton (char *bitmapname, int func, Bool rightside) { if (!CreateTitleButton (bitmapname, func, Action, pull, rightside, True)) { twmrc_error_prefix(); - fprintf (stderr, + fprintf (stderr, "unable to create %s titlebutton \"%s\"\n", rightside ? "right" : "left", bitmapname); } @@ -873,7 +876,7 @@ static Bool CheckColormapArg (char *s) void -twmrc_error_prefix () +twmrc_error_prefix (void) { fprintf (stderr, "%s: line %d: ", ProgramName, yylineno); } diff --git a/app/twm/src/iconmgr.c b/app/twm/src/iconmgr.c index b4827ad1c..d9c4e76aa 100644 --- a/app/twm/src/iconmgr.c +++ b/app/twm/src/iconmgr.c @@ -41,12 +41,11 @@ in this Software without prior written authorization from The Open Group. #include "siconify.bm" #include <X11/Xos.h> #include <X11/Xmu/CharSet.h> -#ifdef macII -int strcmp(); /* missing from string.h in AUX 2.0 */ -#endif + +static void InsertInIconManager ( IconMgr *ip, WList *tmp, TwmWindow *tmp_win ); int iconmgr_textx = siconify_width+11; -WList *Active = NULL; +static WList *Active = NULL; WList *DownIconManager = NULL; int iconifybox_width = siconify_width; int iconifybox_height = siconify_height; @@ -54,7 +53,8 @@ int iconifybox_height = siconify_height; /** * create all the icon manager windows for this screen. */ -void CreateIconManagers() +void +CreateIconManagers(void) { IconMgr *p; int mask; @@ -133,7 +133,7 @@ IconMgr *AllocateIconManager(char *name, char *icon_name, char *geom, int column if (Scr->NoIconManagers) return NULL; - p = (IconMgr *)malloc(sizeof(IconMgr)); + p = malloc(sizeof(IconMgr)); p->name = name; p->icon_name = icon_name; p->geometry = geom; @@ -368,7 +368,7 @@ WList *AddIconManager(TwmWindow *tmp_win) &tmp_win->class)) == NULL) ip = &Scr->iconmgr; - tmp = (WList *) malloc(sizeof(WList)); + tmp = malloc(sizeof(WList)); tmp->iconmgr = ip; tmp->next = NULL; tmp->active = FALSE; @@ -453,7 +453,7 @@ WList *AddIconManager(TwmWindow *tmp_win) * \param ip the icon manager pointer * \param tmp the entry to insert */ -void InsertInIconManager(IconMgr *ip, WList *tmp, TwmWindow *tmp_win) +static void InsertInIconManager(IconMgr *ip, WList *tmp, TwmWindow *tmp_win) { WList *tmp1; int added; @@ -495,7 +495,7 @@ void InsertInIconManager(IconMgr *ip, WList *tmp, TwmWindow *tmp_win) } } -void RemoveFromIconManager(IconMgr *ip, WList *tmp) +static void RemoveFromIconManager(IconMgr *ip, WList *tmp) { if (tmp->prev == NULL) ip->first = tmp->next; @@ -534,7 +534,7 @@ void RemoveIconManager(TwmWindow *tmp_win) XDeleteContext(dpy, tmp->w, ScreenContext); XDestroyWindow(dpy, tmp->w); ip->count -= 1; - free((char *) tmp); + free(tmp); PackIconManager(ip); diff --git a/app/twm/src/iconmgr.h b/app/twm/src/iconmgr.h index 400c44eff..8d7c66f26 100644 --- a/app/twm/src/iconmgr.h +++ b/app/twm/src/iconmgr.h @@ -79,12 +79,10 @@ extern WList *AddIconManager ( TwmWindow *tmp_win ); extern IconMgr *AllocateIconManager ( char *name, char *icon_name, char *geom, int columns ); extern void CreateIconManagers ( void ); extern void DrawIconManagerBorder ( WList *tmp ); -extern void InsertInIconManager ( IconMgr *ip, WList *tmp, TwmWindow *tmp_win ); extern void JumpIconManager ( int dir ); extern void MoveIconManager ( int dir ); extern void NotActiveIconManager ( WList *active ); extern void PackIconManager ( IconMgr *ip ); -extern void RemoveFromIconManager ( IconMgr *ip, WList *tmp ); extern void RemoveIconManager ( TwmWindow *tmp_win ); extern void SortIconManager ( IconMgr *ip ); diff --git a/app/twm/src/icons.c b/app/twm/src/icons.c index 6ba8066ef..617a1f7e7 100644 --- a/app/twm/src/icons.c +++ b/app/twm/src/icons.c @@ -58,7 +58,7 @@ splitEntry (IconEntry *ie, int grav1, int grav2, int w, int h) if (w != ie->w) splitEntry (ie, grav2, grav1, w, ie->h); if (h != ie->h) { - new = (IconEntry *)malloc (sizeof (IconEntry)); + new = malloc (sizeof (IconEntry)); new->twm_win = 0; new->used = 0; new->next = ie->next; @@ -79,7 +79,7 @@ splitEntry (IconEntry *ie, int grav1, int grav2, int w, int h) if (h != ie->h) splitEntry (ie, grav2, grav1, ie->w, h); if (w != ie->w) { - new = (IconEntry *)malloc (sizeof (IconEntry)); + new = malloc (sizeof (IconEntry)); new->twm_win = 0; new->used = 0; new->next = ie->next; @@ -98,13 +98,13 @@ splitEntry (IconEntry *ie, int grav1, int grav2, int w, int h) } } -int +static inline int roundUp (int v, int multiple) { return ((v + multiple - 1) / multiple) * multiple; } -void +static void PlaceIcon(TwmWindow *tmp_win, int def_x, int def_y, int *final_x, int *final_y) { IconRegion *ir; @@ -243,7 +243,7 @@ IconDown (TwmWindow *tmp_win) { ip->next = ie->next; mergeEntries (ie, ip); - free ((char *) ie); + free (ie); ie = ip; ip = prevIconEntry (ip, ir); } else if (in && in->used == 0 && @@ -252,7 +252,7 @@ IconDown (TwmWindow *tmp_win) { ie->next = in->next; mergeEntries (in, ie); - free ((char *) in); + free (in); in = ie->next; } else break; @@ -266,7 +266,7 @@ AddIconRegion(char *geom, int grav1, int grav2, int stepx, int stepy) IconRegion *ir; int mask; - ir = (IconRegion *)malloc(sizeof(IconRegion)); + ir = malloc(sizeof(IconRegion)); ir->next = NULL; if (Scr->LastRegion) Scr->LastRegion->next = ir; @@ -292,7 +292,7 @@ AddIconRegion(char *geom, int grav1, int grav2, int stepx, int stepy) if (mask & YNegative) ir->y += Scr->MyDisplayHeight - ir->h; - ir->entries = (IconEntry *)malloc(sizeof(IconEntry)); + ir->entries = malloc(sizeof(IconEntry)); ir->entries->next = 0; ir->entries->x = ir->x; ir->entries->y = ir->y; @@ -311,12 +311,12 @@ FreeIconEntries (IconRegion *ir) for (ie = ir->entries; ie; ie=tmp) { tmp = ie->next; - free ((char *) ie); + free (ie); } } void -FreeIconRegions() +FreeIconRegions(void) { IconRegion *ir, *tmp; @@ -325,7 +325,7 @@ FreeIconRegions() tmp = ir; FreeIconEntries (ir); ir = ir->next; - free((char *) tmp); + free(tmp); } Scr->FirstRegion = NULL; Scr->LastRegion = NULL; diff --git a/app/twm/src/icons.h b/app/twm/src/icons.h index 6767459ee..f05e8ffa7 100644 --- a/app/twm/src/icons.h +++ b/app/twm/src/icons.h @@ -51,9 +51,6 @@ typedef struct IconEntry short used; }IconEntry; -extern int roundUp ( int v, int multiple ); -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, diff --git a/app/twm/src/lex.l b/app/twm/src/lex.l index 6f0f6277a..63232502f 100644 --- a/app/twm/src/lex.l +++ b/app/twm/src/lex.l @@ -72,7 +72,7 @@ int yylineno; #undef YY_INPUT #define YY_INPUT(buf,result,size) ((result) = doinput((buf),(size))) -int doinput (char *buf, int size) +static int doinput (char *buf, int size) { int c; @@ -103,15 +103,15 @@ number [0-9]+ "-" { return MINUS; } "|" { return OR; } -[a-zA-Z\.]+ { int token = parse_keyword ((char *)yytext, +[a-zA-Z\.]+ { int token = parse_keyword ((char *)yytext, &yylval.num); if (token == ERRORTOKEN) { twmrc_error_prefix(); fprintf (stderr, - "ignoring unknown keyword: %s\n", + "ignoring unknown keyword: %s\n", yytext); ParseError = 1; - } else + } else return token; } @@ -126,7 +126,7 @@ number [0-9]+ [\r\n\t ] {;} . { twmrc_error_prefix(); - fprintf (stderr, + fprintf (stderr, "ignoring character \"%s\"\n", yytext); ParseError = 1; diff --git a/app/twm/src/list.c b/app/twm/src/list.c index 134e44ff2..b43cd595b 100644 --- a/app/twm/src/list.c +++ b/app/twm/src/list.c @@ -91,7 +91,7 @@ AddToList(name_list **list_head, char *name, char *ptr) if (!list_head) return; /* ignore empty inserts */ - nptr = (name_list *)malloc(sizeof(name_list)); + nptr = malloc(sizeof(name_list)); if (nptr == NULL) { twmrc_error_prefix(); @@ -210,7 +210,7 @@ void FreeList(name_list **list) for (nptr = *list; nptr != NULL; ) { tmp = nptr->next; - free((char *) nptr); + free(nptr); nptr = tmp; } *list = NULL; diff --git a/app/twm/src/menus.c b/app/twm/src/menus.c index 449e81213..73d157867 100644 --- a/app/twm/src/menus.c +++ b/app/twm/src/menus.c @@ -114,6 +114,16 @@ static Cursor LastCursor; static Bool belongs_to_twm_window ( TwmWindow *t, Window w ); static void Identify ( TwmWindow *t ); static void send_clientmessage ( Window w, Atom a, Time timestamp ); +static void BumpWindowColormap ( TwmWindow *tmp, int inc ); +static int DeferExecution ( int context, int func, Cursor cursor ); +static Bool NeedToDefer ( MenuRoot *root ); +static void DestroyMenu ( MenuRoot *menu ); +static void MakeMenu ( MenuRoot *mr ); +static void Execute ( const char *s ); +static void HideIconManager ( void ); +static void WarpAlongRing ( XButtonEvent *ev, Bool forward ); +static int WarpThere ( TwmWindow * t ); +static void WarpToWindow ( TwmWindow *t ); #define SHADOWWIDTH 5 /* in pixels */ @@ -124,7 +134,7 @@ static void send_clientmessage ( Window w, Atom a, Time timestamp ); * initialize menu roots */ void -InitMenus() +InitMenus(void) { int i, j, k; FuncKey *key, *tmp; @@ -147,7 +157,7 @@ InitMenus() free(key->name); tmp = key; key = key->next; - free((char *) tmp); + free(tmp); } Scr->FuncKeyRoot.next = NULL; } @@ -194,7 +204,7 @@ Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name, if (tmp == NULL) { - tmp = (FuncKey *) malloc(sizeof(FuncKey)); + tmp = malloc(sizeof(FuncKey)); tmp->next = Scr->FuncKeyRoot.next; Scr->FuncKeyRoot.next = tmp; } @@ -213,10 +223,10 @@ Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name, -int CreateTitleButton (char *name, int func, char *action, MenuRoot *menuroot, - Bool rightside, Bool append) +int CreateTitleButton (const char *name, int func, const char *action, + MenuRoot *menuroot, Bool rightside, Bool append) { - TitleButton *tb = (TitleButton *) malloc (sizeof(TitleButton)); + TitleButton *tb = malloc (sizeof(TitleButton)); if (!tb) { fprintf (stderr, @@ -283,7 +293,7 @@ int CreateTitleButton (char *name, int func, char *action, MenuRoot *menuroot, * 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 () +void InitTitlebarButtons (void) { TitleButton *tb; int h; @@ -472,7 +482,7 @@ PaintMenu(MenuRoot *mr, XEvent *e) static Bool fromMenu; void -UpdateMenu() +UpdateMenu(void) { MenuItem *mi; int i, x, y, x_root, y_root, entry; @@ -617,13 +627,13 @@ UpdateMenu() * \param name the name of the menu root */ MenuRoot * -NewMenuRoot(char *name) +NewMenuRoot(const char *name) { MenuRoot *tmp; #define UNUSED_PIXEL ((unsigned long) (~0)) /* more than 24 bits */ - tmp = (MenuRoot *) malloc(sizeof(MenuRoot)); + tmp = malloc(sizeof(MenuRoot)); tmp->hi_fore = UNUSED_PIXEL; tmp->hi_back = UNUSED_PIXEL; tmp->name = name; @@ -676,8 +686,8 @@ NewMenuRoot(char *name) * \param back background color string */ MenuItem * -AddToMenu(MenuRoot *menu, char *item, char *action, MenuRoot *sub, int func, - char *fore, char *back) +AddToMenu(MenuRoot *menu, const char *item, const char *action, + MenuRoot *sub, int func, const char *fore, const char *back) { MenuItem *tmp; int width; @@ -687,7 +697,7 @@ AddToMenu(MenuRoot *menu, char *item, char *action, MenuRoot *sub, int func, item, action, sub, func); #endif - tmp = (MenuItem *) malloc(sizeof(MenuItem)); + tmp = malloc(sizeof(MenuItem)); tmp->root = menu; if (menu->first == NULL) @@ -741,7 +751,7 @@ AddToMenu(MenuRoot *menu, char *item, char *action, MenuRoot *sub, int func, void -MakeMenus() +MakeMenus(void) { MenuRoot *mr; @@ -755,7 +765,7 @@ MakeMenus() } -void +static void MakeMenu(MenuRoot *mr) { MenuItem *start, *end, *cur, *tmp; @@ -989,8 +999,7 @@ PopUpMenu (MenuRoot *menu, int x, int y, Bool center) WindowNameCount++; if (WindowNameCount != 0) { - WindowNames = - (TwmWindow **)malloc(sizeof(TwmWindow *)*WindowNameCount); + WindowNames = malloc(sizeof(TwmWindow *) * WindowNameCount); WindowNames[0] = Scr->TwmRoot.next; for(tmp_win = Scr->TwmRoot.next->next , WindowNameCount=1; tmp_win != NULL; @@ -1082,7 +1091,7 @@ PopUpMenu (MenuRoot *menu, int x, int y, Bool center) * unhighlight the current menu selection and take down the menus */ void -PopDownMenu() +PopDownMenu(void) { MenuRoot *tmp; @@ -1123,7 +1132,7 @@ PopDownMenu() * \param name the name of the menu root */ MenuRoot * -FindMenuRoot(char *name) +FindMenuRoot(const char *name) { MenuRoot *tmp; @@ -1157,7 +1166,7 @@ belongs_to_twm_window (TwmWindow *t, Window w) -void +static void resizeFromCenter(Window w, TwmWindow *tmp_win) { int lastx, lasty, bw2; @@ -1265,7 +1274,7 @@ resizeFromCenter(Window w, TwmWindow *tmp_win) * else FALSE to abort */ -int +static int WarpThere(TwmWindow *t) { if (Scr->WarpUnmapped || t->mapped) { @@ -1279,7 +1288,7 @@ WarpThere(TwmWindow *t) int -ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, +ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, XEvent *eventp, int context, int pulldown) { static Time last_time = 0; @@ -2250,7 +2259,7 @@ ExecuteFunction(int func, char *action, Window w, TwmWindow *tmp_win, * \param func the function to defer * \param cursor cursor the cursor to display while waiting */ -int +static int DeferExecution(int context, int func, Cursor cursor) { if (context == C_ROOT) @@ -2275,7 +2284,7 @@ DeferExecution(int context, int func, Cursor cursor) *regrab the pointer with the LastCursor; */ void -ReGrab() +ReGrab(void) { XGrabPointer(dpy, Scr->Root, True, ButtonPressMask | ButtonReleaseMask, @@ -2291,7 +2300,7 @@ ReGrab() * * \param root the menu root to check */ -Bool +static Bool NeedToDefer(MenuRoot *root) { MenuItem *mitem; @@ -2336,12 +2345,12 @@ NeedToDefer(MenuRoot *root) * \param s the string containing the command */ static int -System (char *s) +System (const char *s) { int pid, status; if ((pid = fork ()) == 0) { (void) setpgrp(); - execl ("/bin/sh", "sh", "-c", s, 0); + execl ("/bin/sh", "sh", "-c", s, NULL); } else waitpid (pid, &status, 0); return status; @@ -2350,8 +2359,8 @@ System (char *s) #endif -void -Execute(char *s) +static void +Execute(const char *s) { /* FIXME: is all this stuff needed? There could be security problems here. */ static char buf[256]; @@ -2402,7 +2411,7 @@ Execute(char *s) * put input focus on the root window. */ void -FocusOnRoot() +FocusOnRoot(void) { SetFocus ((TwmWindow *) NULL, LastTimestamp()); if (Scr->Focus != NULL) @@ -2743,7 +2752,7 @@ WarpToScreen (int n, int inc) /** * rotate our internal copy of WM_COLORMAP_WINDOWS */ -void +static void BumpWindowColormap (TwmWindow *tmp, int inc) { int i, j, previously_installed; @@ -2752,8 +2761,7 @@ BumpWindowColormap (TwmWindow *tmp, int inc) if (!tmp) return; if (inc && tmp->cmaps.number_cwins > 0) { - cwins = (ColormapWindow **) malloc(sizeof(ColormapWindow *)* - tmp->cmaps.number_cwins); + cwins = malloc(sizeof(ColormapWindow *) * tmp->cmaps.number_cwins); if (cwins) { if ((previously_installed = /* SUPPRESS 560 */(Scr->cmapInfo.cmaps == &tmp->cmaps && @@ -2771,7 +2779,7 @@ BumpWindowColormap (TwmWindow *tmp, int inc) cwins[j] = tmp->cmaps.cwins[i]; } - free((char *) tmp->cmaps.cwins); + free(tmp->cmaps.cwins); tmp->cmaps.cwins = cwins; @@ -2787,8 +2795,8 @@ BumpWindowColormap (TwmWindow *tmp, int inc) } -void -HideIconManager () +static void +HideIconManager (void) { SetMapStateProp (Scr->iconmgr.twm_win, WithdrawnState); XUnmapWindow(dpy, Scr->iconmgr.twm_win->frame); @@ -2817,7 +2825,7 @@ SetBorder (TwmWindow *tmp, Bool onoroff) } -void +static void DestroyMenu (MenuRoot *menu) { MenuItem *item; @@ -2832,7 +2840,7 @@ DestroyMenu (MenuRoot *menu) for (item = menu->first; item; ) { MenuItem *tmp = item; item = item->next; - free ((char *) tmp); + free (tmp); } } @@ -2842,7 +2850,7 @@ DestroyMenu (MenuRoot *menu) * warping routines */ -void +static void WarpAlongRing (XButtonEvent *ev, Bool forward) { TwmWindow *r, *head; @@ -2892,7 +2900,7 @@ WarpAlongRing (XButtonEvent *ev, Bool forward) -void +static void WarpToWindow (TwmWindow *t) { int x, y; diff --git a/app/twm/src/menus.h b/app/twm/src/menus.h index 0a75622aa..cadffaf99 100644 --- a/app/twm/src/menus.h +++ b/app/twm/src/menus.h @@ -72,8 +72,8 @@ typedef struct MenuItem struct MenuItem *prev; /* prev menu item */ struct MenuRoot *sub; /* MenuRoot of a pull right menu */ struct MenuRoot *root; /* back pointer to my MenuRoot */ - char *item; /* the character string displayed */ - char *action; /* action to be performed */ + const char *item; /* the character string displayed */ + const char *action; /* action to be performed */ Pixel fore; /* foreground color */ Pixel back; /* background color */ Pixel hi_fore; /* highlight foreground */ @@ -92,7 +92,7 @@ typedef struct MenuRoot struct MenuItem *last; /* last item in menu */ struct MenuRoot *prev; /* previous root menu if pull right */ struct MenuRoot *next; /* next in list of root menus */ - char *name; /* name of root */ + const char *name; /* name of root */ Window w; /* the window of the menu */ Window shadow; /* the shadow window */ Pixel hi_fore; /* highlight foreground */ @@ -166,36 +166,25 @@ extern int MenuDepth; extern void InitMenus ( void ); extern Bool AddFuncKey ( char *name, int cont, int mods, int func, char *win_name, char *action ); -extern int CreateTitleButton ( char *name, int func, char *action, MenuRoot *menuroot, Bool rightside, Bool append ); +extern int CreateTitleButton ( const char *name, int func, const char *action, MenuRoot *menuroot, Bool rightside, Bool append ); extern void InitTitlebarButtons ( void ); extern void PaintEntry ( MenuRoot *mr, MenuItem *mi, int exposure ); extern void PaintMenu ( MenuRoot *mr, XEvent *e ); extern void UpdateMenu ( void ); -extern MenuRoot * NewMenuRoot ( char *name ); -extern MenuItem * AddToMenu ( MenuRoot *menu, char *item, char *action, MenuRoot *sub, int func, char *fore, char *back ); +extern MenuRoot * NewMenuRoot ( const char *name ); +extern MenuItem * AddToMenu ( MenuRoot *menu, const char *item, const char *action, MenuRoot *sub, int func, const char *fore, const char *back ); extern void MakeMenus ( void ); -extern void MakeMenu ( MenuRoot *mr ); extern Bool PopUpMenu ( MenuRoot *menu, int x, int y, Bool center ); extern void PopDownMenu ( void ); -extern MenuRoot * FindMenuRoot ( char *name ); -extern void resizeFromCenter ( Window w, TwmWindow *tmp_win ); -extern int WarpThere ( TwmWindow * t ); -extern int ExecuteFunction ( int func, char *action, Window w, TwmWindow *tmp_win, XEvent *eventp, int context, int pulldown ); -extern int DeferExecution ( int context, int func, Cursor cursor ); +extern MenuRoot * FindMenuRoot ( const char *name ); +extern int ExecuteFunction ( int func, const char *action, Window w, TwmWindow *tmp_win, XEvent *eventp, int context, int pulldown ); extern void ReGrab ( void ); -extern Bool NeedToDefer ( MenuRoot *root ); -extern void Execute ( char *s ); extern void FocusOnRoot ( void ); extern void DeIconify ( TwmWindow *tmp_win ); extern void Iconify ( TwmWindow *tmp_win, int def_x, int def_y ); extern void SetMapStateProp ( TwmWindow *tmp_win, int state ); extern void WarpToScreen ( int n, int inc ); -extern void BumpWindowColormap ( TwmWindow *tmp, int inc ); -extern void HideIconManager ( void ); extern void SetBorder ( TwmWindow *tmp, Bool onoroff ); -extern void DestroyMenu ( MenuRoot *menu ); -extern void WarpAlongRing ( XButtonEvent *ev, Bool forward ); -extern void WarpToWindow ( TwmWindow *t ); extern void SendDeleteWindowMessage ( TwmWindow *tmp, Time timestamp ); extern void SendSaveYourselfMessage ( TwmWindow *tmp, Time timestamp ); extern void SendTakeFocusMessage ( TwmWindow *tmp, Time timestamp ); diff --git a/app/twm/src/parse.c b/app/twm/src/parse.c index 26f5ebd3f..6ae968511 100644 --- a/app/twm/src/parse.c +++ b/app/twm/src/parse.c @@ -83,10 +83,11 @@ static unsigned char overflowbuff[20]; /* really only need one */ static int overflowlen; static unsigned char **stringListSource, *currentString; -static int doparse ( int (*ifunc)(void), char *srctypename, char *srcname ); +static int doparse ( int (*ifunc)(void), const char *srctypename, const char *srcname ); static int twmFileInput ( void ); static int twmStringListInput ( void ); static int ParseUsePPosition ( char *s ); +static int ParseStringList ( unsigned char **sl ); extern int yylineno; @@ -99,7 +100,8 @@ int (*twmInputFunc)(void); * parse the .twmrc file * \param filename the filename to parse. NULL indicates $HOME/.twmrc */ -static int doparse (int (*ifunc)(void), char *srctypename, char*srcname) +static int doparse (int (*ifunc)(void), + const char *srctypename, const char *srcname) { mods = 0; ptr = 0; @@ -160,7 +162,7 @@ int ParseTwmrc (char *filename) int i; char *home = NULL; int homelen = 0; - char *cp = NULL; + const char *cp = NULL; char tmpfilename[257]; /* @@ -221,7 +223,7 @@ int ParseTwmrc (char *filename) } } -int ParseStringList (unsigned char **sl) +static int ParseStringList (unsigned char **sl) { stringListSource = sl; currentString = *sl; @@ -234,7 +236,7 @@ int ParseStringList (unsigned char **sl) * * \return the next input character */ -static int twmFileInput() +static int twmFileInput(void) { if (overflowlen) return (int) overflowbuff[--overflowlen]; @@ -249,7 +251,7 @@ static int twmFileInput() return ((int)buff[ptr++]); } -static int twmStringListInput() +static int twmStringListInput(void) { if (overflowlen) return (int) overflowbuff[--overflowlen]; @@ -302,7 +304,7 @@ TwmOutput(int c) ***********************************************************************/ typedef struct _TwmKeyword { - char *name; + const char *name; int value; int subnum; } TwmKeyword; @@ -942,7 +944,7 @@ int do_color_keyword (int keyword, int colormode, char *s) /** * Save a pixel value in twm root window color property. */ -void +static void put_pixel_on_root(Pixel pixel) { int i, addPixel = 1; @@ -980,7 +982,7 @@ do_string_savecolor(int colormode, char *s) } typedef struct _cnode {int i; struct _cnode *next;} Cnode, *Cptr; -Cptr chead = NULL; +static Cptr chead = NULL; /** * save a color from a var in the twmrc file @@ -990,13 +992,13 @@ do_var_savecolor(int key) { Cptr cptrav, cpnew; if (!chead) { - chead = (Cptr)malloc(sizeof(Cnode)); + chead = malloc(sizeof(Cnode)); chead->i = key; chead->next = NULL; } else { cptrav = chead; while (cptrav->next != NULL) { cptrav = cptrav->next; } - cpnew = (Cptr)malloc(sizeof(Cnode)); + cpnew = malloc(sizeof(Cnode)); cpnew->i = key; cpnew->next = NULL; cptrav->next = cpnew; } } @@ -1006,7 +1008,7 @@ do_var_savecolor(int key) * in the root window property. */ void -assign_var_savecolor() +assign_var_savecolor(void) { Cptr cp = chead; while (cp != NULL) { @@ -1105,7 +1107,7 @@ do_squeeze_entry (name_list **list, char *name, int justify, int num, int denom) if (HasShape) { SqueezeInfo *sinfo; - sinfo = (SqueezeInfo *) malloc (sizeof(SqueezeInfo)); + sinfo = malloc (sizeof(SqueezeInfo)); if (!sinfo) { twmrc_error_prefix(); diff --git a/app/twm/src/parse.h b/app/twm/src/parse.h index 977a3e9ad..e461e1950 100644 --- a/app/twm/src/parse.h +++ b/app/twm/src/parse.h @@ -70,10 +70,8 @@ extern int do_number_keyword ( int keyword, int num ); 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 ); extern void do_string_savecolor ( int colormode, char *s ); extern void do_var_savecolor ( int key ); -extern int ParseStringList ( unsigned char **sl ); extern int ParseTwmrc ( char *filename ); extern int parse_keyword ( char *s, int *nump ); extern void TwmOutput ( int c ); diff --git a/app/twm/src/resize.c b/app/twm/src/resize.c index 4ca5eea7a..7cb4aa632 100644 --- a/app/twm/src/resize.c +++ b/app/twm/src/resize.c @@ -68,6 +68,8 @@ in this Software without prior written authorization from The Open Group. #include "screen.h" #include "events.h" +static void DisplaySize ( TwmWindow *tmp_win, int width, int height ); + #define MINHEIGHT 0 /* had been 32 */ #define MINWIDTH 0 /* had been 60 */ @@ -473,7 +475,7 @@ DoResize(int x_root, int y_root, TwmWindow *tmp_win) * \param width the width of the rubber band * \param height the height of the rubber band */ -void +static void DisplaySize(TwmWindow *tmp_win, int width, int height) { char str[100]; @@ -523,7 +525,7 @@ DisplaySize(TwmWindow *tmp_win, int width, int height) * finish the resize operation */ void -EndResize() +EndResize(void) { TwmWindow *tmp_win; diff --git a/app/twm/src/resize.h b/app/twm/src/resize.h index 0f4b675e6..e227ed6c2 100644 --- a/app/twm/src/resize.h +++ b/app/twm/src/resize.h @@ -64,7 +64,6 @@ in this Software without prior written authorization from The Open Group. extern void AddEndResize ( TwmWindow *tmp_win ); extern void AddStartResize ( TwmWindow *tmp_win, int x, int y, int w, int h ); extern void ConstrainSize ( TwmWindow *tmp_win, int *widthp, int *heightp ); -extern void DisplaySize ( TwmWindow *tmp_win, int width, int height ); extern void DoResize ( int x_root, int y_root, TwmWindow *tmp_win ); extern void EndResize ( void ); extern void fullzoom ( TwmWindow *tmp_win, int flag ); diff --git a/app/twm/src/session.c b/app/twm/src/session.c index fd91942bf..e12a6c056 100644 --- a/app/twm/src/session.c +++ b/app/twm/src/session.c @@ -63,26 +63,22 @@ Author: Ralph Mor, X Consortium #include "session.h" SmcConn smcConn = NULL; -XtInputId iceInputId; -char *twm_clientId; -TWMWinConfigEntry *winConfigHead = NULL; -Bool gotFirstSave = 0; -Bool sent_save_done = 0; +static XtInputId iceInputId; +static char *twm_clientId; +static TWMWinConfigEntry *winConfigHead = NULL; +static Bool sent_save_done = 0; #define SAVEFILE_VERSION 2 #ifndef HAVE_MKSTEMP -static char *unique_filename ( char *path, char *prefix ); +static char *unique_filename ( const char *path, const char *prefix ); #else -static char *unique_filename ( char *path, char *prefix, int *pFd ); +static char *unique_filename ( const char *path, const char *prefix, int *pFd ); #endif -char * -GetClientID (window) - -Window window; - +static char * +GetClientID (Window window) { char *client_id = NULL; Window client_leader; @@ -119,11 +115,8 @@ Window window; -char * -GetWindowRole (window) - -Window window; - +static char * +GetWindowRole (Window window) { XTextProperty tp; @@ -138,7 +131,7 @@ Window window; -int +static int write_byte (FILE *file, unsigned char b) { if (fwrite ((char *) &b, 1, 1, file) != 1) @@ -147,7 +140,7 @@ write_byte (FILE *file, unsigned char b) } -int +static int write_ushort (FILE *file, unsigned short s) { unsigned char file_short[2]; @@ -160,7 +153,7 @@ write_ushort (FILE *file, unsigned short s) } -int +static int write_short (FILE *file, short s) { unsigned char file_short[2]; @@ -173,12 +166,8 @@ write_short (FILE *file, short s) } -int -write_counted_string (file, string) - -FILE *file; -char *string; - +static int +write_counted_string (FILE *file, char *string) { if (string) { @@ -200,12 +189,8 @@ char *string; -int -read_byte (file, bp) - -FILE *file; -unsigned char *bp; - +static int +read_byte (FILE *file, unsigned char *bp) { if (fread ((char *) bp, 1, 1, file) != 1) return 0; @@ -213,12 +198,8 @@ unsigned char *bp; } -int -read_ushort (file, shortp) - -FILE *file; -unsigned short *shortp; - +static int +read_ushort (FILE *file, unsigned short *shortp) { unsigned char file_short[2]; @@ -229,12 +210,8 @@ unsigned short *shortp; } -int -read_short (file, shortp) - -FILE *file; -short *shortp; - +static int +read_short (FILE *file, short *shortp) { unsigned char file_short[2]; @@ -245,12 +222,8 @@ short *shortp; } -int -read_counted_string (file, stringp) - -FILE *file; -char **stringp; - +static int +read_counted_string (FILE *file, char **stringp) { unsigned char len; char *data; @@ -315,14 +288,9 @@ char **stringp; * Height ever changed by user 1 */ -int -WriteWinConfigEntry (configFile, theWindow, clientId, windowRole) - -FILE *configFile; -TwmWindow *theWindow; -char *clientId; -char *windowRole; - +static int +WriteWinConfigEntry (FILE *configFile, TwmWindow *theWindow, + char *clientId, char *windowRole) { char **wm_command; int wm_command_count, i; @@ -414,7 +382,7 @@ char *windowRole; } -int +static int ReadWinConfigEntry (FILE *configFile, unsigned short version, TWMWinConfigEntry **pentry) { @@ -422,8 +390,7 @@ ReadWinConfigEntry (FILE *configFile, unsigned short version, unsigned char byte; int i; - *pentry = entry = (TWMWinConfigEntry *) malloc ( - sizeof (TWMWinConfigEntry)); + *pentry = entry = malloc (sizeof (TWMWinConfigEntry)); if (!*pentry) return 0; @@ -459,7 +426,7 @@ ReadWinConfigEntry (FILE *configFile, unsigned short version, entry->wm_command = NULL; else { - entry->wm_command = (char **) malloc (entry->wm_command_count * + entry->wm_command = malloc (entry->wm_command_count * sizeof (char *)); if (!entry->wm_command) @@ -533,9 +500,9 @@ give_up: free (entry->wm_command[i]); } if (entry->wm_command) - free ((char *) entry->wm_command); + free (entry->wm_command); - free ((char *) entry); + free (entry); *pentry = NULL; return 0; @@ -543,10 +510,7 @@ give_up: void -ReadWinConfigFile (filename) - -char *filename; - +ReadWinConfigFile (char *filename) { FILE *configFile; TWMWinConfigEntry *entry; @@ -580,19 +544,15 @@ char *filename; int -GetWindowConfig (theWindow, x, y, width, height, - iconified, icon_info_present, icon_x, icon_y, - width_ever_changed_by_user, height_ever_changed_by_user) - -TwmWindow *theWindow; -short *x, *y; -unsigned short *width, *height; -Bool *iconified; -Bool *icon_info_present; -short *icon_x, *icon_y; -Bool *width_ever_changed_by_user; -Bool *height_ever_changed_by_user; - +GetWindowConfig ( + TwmWindow *theWindow, + short *x, short *y, + unsigned short *width, unsigned short *height, + Bool *iconified, + Bool *icon_info_present, + short *icon_x, short *icon_y, + Bool *width_ever_changed_by_user, + Bool *height_ever_changed_by_user) { char *clientId, *windowRole; TWMWinConfigEntry *ptr; @@ -719,15 +679,15 @@ Bool *height_ever_changed_by_user; #ifndef HAVE_MKSTEMP static char * -unique_filename (path, prefix) -char *path; -char *prefix; +unique_filename ( + const char *path, + const char *prefix) #else static char * -unique_filename (path, prefix, pFd) -char *path; -char *prefix; -int *pFd; +unique_filename ( + const char *path, + const char *prefix, + int *pFd) #endif { @@ -741,11 +701,7 @@ int *pFd; snprintf (tempFile, sizeof(tempFile), "%s/%sXXXXXX", path, prefix); tmp = (char *) mktemp (tempFile); if (tmp) - { - char *ptr = (char *) malloc (strlen (tmp) + 1); - strcpy (ptr, tmp); - return (ptr); - } + return strdup (tmp); else return (NULL); #endif @@ -754,31 +710,24 @@ int *pFd; char *ptr; snprintf (tempFile, sizeof(tempFile), "%s/%sXXXXXX", path, prefix); - ptr = (char *)malloc(strlen(tempFile) + 1); + ptr = strdup (tempFile); if (ptr != NULL) - { - strcpy(ptr, tempFile); - *pFd = mkstemp(ptr); - } + *pFd = mkstemp (ptr); return ptr; #endif } -void -SaveYourselfPhase2CB (smcConn, clientData) - -SmcConn smcConn; -SmPointer clientData; - +static void +SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData) { int scrnum; ScreenInfo *theScreen; TwmWindow *theWindow; char *clientId, *windowRole; FILE *configFile = NULL; - char *path; + const char *path; char *filename = NULL; Bool success = False; SmProp prop1, prop2, prop3, *props[3]; @@ -882,8 +831,7 @@ SmPointer clientData; prop1.name = SmRestartCommand; prop1.type = SmLISTofARRAY8; - prop1.vals = (SmPropValue *) malloc ( - (Argc + 4) * sizeof (SmPropValue)); + prop1.vals = malloc ((Argc + 4) * sizeof (SmPropValue)); if (!prop1.vals) { @@ -933,7 +881,7 @@ SmPointer clientData; props[1] = &prop2; SmcSetProperties (smcConn, 2, props); - free ((char *) prop1.vals); + free (prop1.vals); bad: SmcSaveYourselfDone (smcConn, success); @@ -948,16 +896,14 @@ SmPointer clientData; -void -SaveYourselfCB (smcConn, clientData, saveType, shutdown, interactStyle, fast) - -SmcConn smcConn; -SmPointer clientData; -int saveType; -Bool shutdown; -int interactStyle; -Bool fast; - +static void +SaveYourselfCB ( + SmcConn smcConn, + SmPointer clientData, + int saveType, + Bool shutdown, + int interactStyle, + Bool fast) { if (!SmcRequestSaveYourselfPhase2 (smcConn, SaveYourselfPhase2CB, NULL)) { @@ -970,12 +916,8 @@ Bool fast; -void -DieCB (smcConn, clientData) - -SmcConn smcConn; -SmPointer clientData; - +static void +DieCB (SmcConn smcConn, SmPointer clientData) { SmcCloseConnection (smcConn, 0, NULL); XtRemoveInput (iceInputId); @@ -984,24 +926,16 @@ SmPointer clientData; -void -SaveCompleteCB (smcConn, clientData) - -SmcConn smcConn; -SmPointer clientData; - +static void +SaveCompleteCB (SmcConn smcConnm, SmPointer clientData) { ; } -void -ShutdownCancelledCB (smcConn, clientData) - -SmcConn smcConn; -SmPointer clientData; - +static void +ShutdownCancelledCB (SmcConn smcConn, SmPointer clientData) { if (!sent_save_done) { @@ -1012,13 +946,8 @@ SmPointer clientData; -void -ProcessIceMsgProc (client_data, source, id) - -XtPointer client_data; -int *source; -XtInputId *id; - +static void +ProcessIceMsgProc (XtPointer client_data, int *source, XtInputId *id) { IceConn ice_conn = (IceConn) client_data; @@ -1028,10 +957,7 @@ XtInputId *id; void -ConnectToSessionManager (previous_id) - -char *previous_id; - +ConnectToSessionManager (char *previous_id) { char errorMsg[256]; unsigned long mask; diff --git a/app/twm/src/session.h b/app/twm/src/session.h index e8c2c1cf4..05b51fe94 100644 --- a/app/twm/src/session.h +++ b/app/twm/src/session.h @@ -28,26 +28,8 @@ #include <X11/SM/SMlib.h> extern void ConnectToSessionManager ( char *previous_id ); -extern void DieCB ( SmcConn smcConn, SmPointer clientData ); -extern char * GetClientID ( Window window ); extern int GetWindowConfig ( TwmWindow *theWindow, short *x, short *y, unsigned short *width, unsigned short *height, Bool *iconified, Bool *icon_info_present, short *icon_x, short *icon_y, Bool *width_ever_changed_by_user, Bool *height_ever_changed_by_user ); -extern char * GetWindowRole ( Window window ); -extern void ProcessIceMsgProc ( XtPointer client_data, int *source, XtInputId *id ); -extern int ReadWinConfigEntry ( FILE *configFile, unsigned short version, TWMWinConfigEntry **pentry ); extern void ReadWinConfigFile ( char *filename ); -extern int read_byte ( FILE *file, unsigned char *bp ); -extern int read_counted_string ( FILE *file, char **stringp ); -extern int read_short ( FILE *file, short *shortp ); -extern int read_ushort ( FILE *file, unsigned short *shortp ); -extern void SaveCompleteCB ( SmcConn smcConn, SmPointer clientData ); -extern void SaveYourselfCB ( SmcConn smcConn, SmPointer clientData, int saveType, Bool shutdown, int interactStyle, Bool fast ); -extern void SaveYourselfPhase2CB ( SmcConn smcConn, SmPointer clientData ); -extern void ShutdownCancelledCB ( SmcConn smcConn, SmPointer clientData ); -extern int WriteWinConfigEntry ( FILE *configFile, TwmWindow *theWindow, char *clientId, char *windowRole ); -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; diff --git a/app/twm/src/twm.c b/app/twm/src/twm.c index df441b2b2..1a6ae95ea 100644 --- a/app/twm/src/twm.c +++ b/app/twm/src/twm.c @@ -86,6 +86,8 @@ in this Software without prior written authorization from The Open Group. #include <X11/extensions/Print.h> #endif /* XPRINT */ +static void InitVariables ( void ); + XtAppContext appContext; /* Xt application context */ XtSignalId si; @@ -103,14 +105,14 @@ ScreenInfo **ScreenList; /* structures for each screen */ ScreenInfo *Scr = NULL; /* the cur and prev screens */ int PreviousScreen; /* last screen that we were on */ int FirstScreen; /* TRUE ==> first screen of display */ -Bool PrintErrorMessages = False; /* controls error messages */ +static Bool PrintErrorMessages = False; /* controls error messages */ static int RedirectError; /* TRUE ==> another window manager running */ static int TwmErrorHandler ( Display *dpy, XErrorEvent *event ); /* for settting RedirectError */ static int CatchRedirectError ( Display *dpy, XErrorEvent *event ); /* for everything else */ -static SIGNAL_T sigHandler(int); +static void sigHandler(int); char Info[INFO_LINES][INFO_SIZE]; /* info strings to print */ int InfoLines; -char *InitFile = NULL; +static char *InitFile = NULL; Cursor UpperLeftCursor; /* upper Left corner cursor */ Cursor RightButt; @@ -127,7 +129,7 @@ XClassHint NoClass; /* for applications with no class */ XGCValues Gcv; -char *Home; /* the HOME environment variable */ +const char *Home; /* the HOME environment variable */ int HomeLen; /* length of Home */ int ParseError; /* error parsing the .twmrc file */ @@ -145,7 +147,7 @@ char **Argv; Bool RestartPreviousState = False; /* try to restart in previous state */ -unsigned long black, white; +static unsigned long black, white; Atom TwmAtoms[11]; @@ -373,7 +375,7 @@ main(int argc, char *argv[]) InfoLines = 0; /* for simplicity, always allocate NumScreens ScreenInfo struct pointers */ - ScreenList = (ScreenInfo **) calloc (NumScreens, sizeof (ScreenInfo *)); + ScreenList = calloc (NumScreens, sizeof (ScreenInfo *)); if (ScreenList == NULL) { fprintf (stderr, "%s: Unable to allocate memory for screen list, exiting.\n", @@ -422,8 +424,7 @@ main(int argc, char *argv[]) numManaged ++; /* Note: ScreenInfo struct is calloc'ed to initialize to zero. */ - Scr = ScreenList[scrnum] = - (ScreenInfo *) calloc(1, sizeof(ScreenInfo)); + Scr = ScreenList[scrnum] = calloc(1, sizeof(ScreenInfo)); if (Scr == NULL) { fprintf (stderr, "%s: unable to allocate memory for ScreenInfo structure for screen %d.\n", @@ -471,8 +472,7 @@ main(int argc, char *argv[]) XSaveContext (dpy, Scr->Root, ScreenContext, (caddr_t) Scr); Scr->TwmRoot.cmaps.number_cwins = 1; - Scr->TwmRoot.cmaps.cwins = - (ColormapWindow **) malloc(sizeof(ColormapWindow *)); + Scr->TwmRoot.cmaps.cwins = malloc(sizeof(ColormapWindow *)); Scr->TwmRoot.cmaps.cwins[0] = CreateColormapWindow(Scr->Root, True, False); Scr->TwmRoot.cmaps.cwins[0]->visibility = VisibilityPartiallyObscured; @@ -600,7 +600,7 @@ main(int argc, char *argv[]) } } } - XFree ((char *) wmhintsp); + XFree (wmhintsp); } } } @@ -682,8 +682,8 @@ main(int argc, char *argv[]) /** * initialize twm variables */ -void -InitVariables() +static void +InitVariables(void) { FreeList(&Scr->BorderColorL); FreeList(&Scr->IconBorderColorL); @@ -832,7 +832,7 @@ InitVariables() } void -CreateFonts () +CreateFonts (void) { GetFont(&Scr->TitleBarFont); GetFont(&Scr->MenuFont); @@ -917,11 +917,10 @@ Reborder (Time time) SetFocus ((TwmWindow*)NULL, time); } -static SIGNAL_T +static void sigHandler(int sig) { XtNoticeSignal(si); - SIGNAL_RETURN; } /** diff --git a/app/twm/src/twm.h b/app/twm/src/twm.h index ec3ca98fd..8fe255506 100644 --- a/app/twm/src/twm.h +++ b/app/twm/src/twm.h @@ -80,15 +80,7 @@ from The Open Group. #define PIXEL_ALREADY_TYPEDEFED /* for Xmu/Drawing.h */ -#ifdef SIGNALRETURNSINT -#define SIGNAL_T int -#define SIGNAL_RETURN return 0 -#else -#define SIGNAL_T void -#define SIGNAL_RETURN return -#endif - -typedef SIGNAL_T (*SigProc)(int); /* type of function returned by signal() */ +typedef void (*SigProc)(int); /* type of function returned by signal() */ #define BW 2 /* border width */ #define BW2 4 /* border width * 2 */ @@ -147,7 +139,7 @@ typedef SIGNAL_T (*SigProc)(int); /* type of function returned by signal() */ typedef struct MyFont { - char *name; /* name of the font */ + const char *name; /* name of the font */ XFontStruct *font; /* font structure */ XFontSet fontset; /* fontset structure */ int height; /* height of the font */ @@ -163,13 +155,13 @@ typedef struct ColorPair typedef struct _TitleButton { struct _TitleButton *next; /* next link in chain */ - char *name; /* bitmap name in case of deferal */ + const char *name; /* bitmap name in case of deferal */ Pixmap bitmap; /* image to display in button */ int srcx, srcy; /* from where to start copying */ unsigned int width, height; /* size of pixmap */ int dstx, dsty; /* to where to start copying */ int func; /* function to execute */ - char *action; /* optional action arg */ + const char *action; /* optional action arg */ struct MenuRoot *menuroot; /* menu to pop on F_MENU */ Bool rightside; /* t: on right, f: on left */ } TitleButton; @@ -349,7 +341,6 @@ typedef struct TWMWinConfigEntry #include <X11/Xosdefs.h> #include <stdlib.h> -extern void InitVariables ( void ); extern void CreateFonts ( void ); extern void RestoreWithdrawnLocation ( TwmWindow *tmp ); extern void Reborder( Time time); @@ -379,7 +370,7 @@ extern XContext IconManagerContext; extern XContext ScreenContext; extern XContext ColormapContext; -extern char *Home; +extern const char *Home; extern int HomeLen; extern int ParseError; @@ -395,7 +386,7 @@ extern int InfoLines; extern char Info[][INFO_SIZE]; extern int Argc; extern char **Argv; -extern void NewFontCursor ( Cursor *cp, char *str ); +extern void NewFontCursor ( Cursor *cp, const char *str ); extern void NewBitmapCursor ( Cursor *cp, char *source, char *mask ); extern Pixmap CreateMenuIcon ( int height, unsigned int *widthp, unsigned int *heightp ); @@ -411,9 +402,6 @@ extern void twmrc_error_prefix ( void ); extern int yyparse ( void ); extern int yylex ( void ); -extern void yyerror ( char *s ); -extern int doinput ( char *buf, int size ); -extern void RemoveDQuote ( char *str ); extern Atom TwmAtoms[]; diff --git a/app/twm/src/util.c b/app/twm/src/util.c index cba6a3ed0..e54eca850 100644 --- a/app/twm/src/util.c +++ b/app/twm/src/util.c @@ -279,7 +279,7 @@ ExpandFilename(char *name) * \param name the filename to read */ void -GetUnknownIcon(char *name) +GetUnknownIcon(const char *name) { if ((Scr->UnknownPm = GetBitmap(name)) != None) { @@ -298,7 +298,7 @@ GetUnknownIcon(char *name) * \param[out] heightp pointer to height of bitmap */ Pixmap -FindBitmap (char *name, unsigned *widthp, unsigned *heightp) +FindBitmap (const char *name, unsigned *widthp, unsigned *heightp) { char *bigname; Pixmap pm; @@ -313,7 +313,7 @@ FindBitmap (char *name, unsigned *widthp, unsigned *heightp) if (name[0] == ':') { int i; static struct { - char *name; + const char *name; Pixmap (*proc)(unsigned int *, unsigned int *); } pmtab[] = { { TBPM_DOT, CreateDotPixmap }, @@ -374,7 +374,7 @@ FindBitmap (char *name, unsigned *widthp, unsigned *heightp) } Pixmap -GetBitmap (char *name) +GetBitmap (const char *name) { return FindBitmap (name, &JunkWidth, &JunkHeight); } @@ -391,7 +391,7 @@ InsertRGBColormap (Atom a, XStandardColormap *maps, int nmaps, Bool replace) } if (!sc) { /* no existing, allocate new */ - sc = (StdCmap *) malloc (sizeof (StdCmap)); + sc = malloc (sizeof (StdCmap)); if (!sc) { fprintf (stderr, "%s: unable to allocate %ld bytes for StdCmap\n", ProgramName, (unsigned long)sizeof (StdCmap)); @@ -400,7 +400,7 @@ InsertRGBColormap (Atom a, XStandardColormap *maps, int nmaps, Bool replace) } if (replace) { /* just update contents */ - if (sc->maps) XFree ((char *) maps); + if (sc->maps) XFree (maps); if (sc == Scr->StdCmapInfo.mru) Scr->StdCmapInfo.mru = NULL; } else { /* else appending */ sc->next = NULL; @@ -429,7 +429,7 @@ RemoveRGBColormap (Atom a) prev = sc; } if (sc) { /* found one */ - if (sc->maps) XFree ((char *) sc->maps); + if (sc->maps) XFree (sc->maps); if (prev) prev->next = sc->next; if (Scr->StdCmapInfo.head == sc) Scr->StdCmapInfo.head = sc->next; if (Scr->StdCmapInfo.tail == sc) Scr->StdCmapInfo.tail = prev; @@ -439,7 +439,7 @@ RemoveRGBColormap (Atom a) } void -LocateStandardColormaps() +LocateStandardColormaps(void) { Atom *atoms; int natoms; @@ -455,12 +455,12 @@ LocateStandardColormaps() InsertRGBColormap (atoms[i], maps, nmaps, False); } } - if (atoms) XFree ((char *) atoms); + if (atoms) XFree (atoms); return; } void -GetColor(int kind, Pixel *what, char *name) +GetColor(int kind, Pixel *what, const char *name) { XColor color, junkcolor; Status stat = 0; @@ -538,7 +538,7 @@ GetColor(int kind, Pixel *what, char *name) } void -GetColorValue(int kind, XColor *what, char *name) +GetColorValue(int kind, XColor *what, const char *name) { XColor junkcolor; Colormap cmap = Scr->TwmRoot.cmaps.cwins[0]->colormap->c; @@ -575,7 +575,7 @@ GetColorValue(int kind, XColor *what, char *name) void GetFont(MyFont *font) { - char *deffontname = "fixed"; + const char *deffontname = "fixed"; char **missing_charset_list_return; int missing_charset_count_return; char *def_string_return; @@ -647,7 +647,7 @@ GetFont(MyFont *font) } int -MyFont_TextWidth(MyFont *font, char *string, int len) +MyFont_TextWidth(MyFont *font, const char *string, int len) { XRectangle ink_rect; XRectangle logical_rect; @@ -662,7 +662,7 @@ MyFont_TextWidth(MyFont *font, char *string, int len) void MyFont_DrawImageString(Display *dpy, Drawable d, MyFont *font, GC gc, - int x, int y, char *string, int len) + int x, int y, const char *string, int len) { if (use_fontset) { XmbDrawImageString(dpy, d, font->fontset, gc, x, y, string, len); @@ -673,7 +673,7 @@ MyFont_DrawImageString(Display *dpy, Drawable d, MyFont *font, GC gc, void MyFont_DrawString(Display *dpy, Drawable d, MyFont *font, GC gc, - int x, int y, char *string, int len) + int x, int y, const char *string, int len) { if (use_fontset) { XmbDrawString(dpy, d, font->fontset, gc, x, y, string, len); diff --git a/app/twm/src/util.h b/app/twm/src/util.h index 47b6bf296..7f4527cd6 100644 --- a/app/twm/src/util.h +++ b/app/twm/src/util.h @@ -65,23 +65,23 @@ 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 void GetUnknownIcon ( const char *name ); +extern Pixmap FindBitmap ( const char *name, unsigned int *widthp, unsigned int *heightp ); -extern Pixmap GetBitmap ( char *name ); +extern Pixmap GetBitmap ( const char *name ); extern void InsertRGBColormap ( Atom a, XStandardColormap *maps, int nmaps, Bool replace ); extern void RemoveRGBColormap ( Atom a ); extern void LocateStandardColormaps ( void ); -extern void GetColor ( int kind, Pixel *what, char *name ); -extern void GetColorValue ( int kind, XColor *what, char *name ); +extern void GetColor ( int kind, Pixel *what, const char *name ); +extern void GetColorValue ( int kind, XColor *what, const char *name ); extern void GetFont ( MyFont *font ); -extern int MyFont_TextWidth( MyFont *font, char *string, int len); +extern int MyFont_TextWidth( MyFont *font, const char *string, int len); extern void MyFont_DrawImageString( Display *dpy, Drawable d, MyFont *font, - GC gc, int x, int y, char * string, + GC gc, int x, int y, const char * string, int len); -extern void MyFont_DrawString( 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, GC gc, + int x, int y, const char * string, int len); 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); diff --git a/app/twm/src/version.c b/app/twm/src/version.c index b50a12916..cf060769b 100644 --- a/app/twm/src/version.c +++ b/app/twm/src/version.c @@ -49,5 +49,5 @@ in this Software without prior written authorization from The Open Group. /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -char *Version = XVENDORNAME", "XORG_RELEASE; +const char *Version = XVENDORNAME", "XORG_RELEASE; diff --git a/app/twm/src/version.h b/app/twm/src/version.h index 0239c2bcf..24ed8bd4b 100644 --- a/app/twm/src/version.h +++ b/app/twm/src/version.h @@ -60,6 +60,6 @@ in this Software without prior written authorization from The Open Group. #ifndef _VERSION_ #define _VERSION_ -extern char *Version; +extern const char *Version; #endif /* _VERSION_ */ |