From f320e1bb447c01fc3e42ae3e350c69862b8795b8 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Sun, 14 Jun 2020 16:54:42 -0700 Subject: Build xz tarballs instead of bzip2 Signed-off-by: Matt Turner --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index ef7e482..4faabe4 100644 --- a/configure.ac +++ b/configure.ac @@ -29,7 +29,7 @@ AC_CONFIG_HEADERS([config.h]) AC_USE_SYSTEM_EXTENSIONS # Initialize Automake -AM_INIT_AUTOMAKE([foreign dist-bzip2]) +AM_INIT_AUTOMAKE([foreign dist-xz]) # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], -- cgit v1.2.3 From c2859ef3eb3b9ab2747d74c7a5d0235f8622d23e Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Sun, 14 Jun 2020 16:54:53 -0700 Subject: twm 1.0.11 Signed-off-by: Matt Turner --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 4faabe4..519f5cb 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT([twm], [1.0.10.2], +AC_INIT([twm], [1.0.11], [https://gitlab.freedesktop.org/xorg/app/twm/issues], [twm]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) -- cgit v1.2.3 From ac802fe10221ef3c6426ac1ebf4a250f189d1228 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Mon, 15 Jun 2020 20:05:53 -0400 Subject: issue #1: twm random window placement handles large windows poorly report/patch by Preston Crow for improved window placement (reindented to fit with current sources) Signed-off-by: Thomas E. Dickey --- src/add_window.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/add_window.c b/src/add_window.c index 154a369..f919b77 100644 --- a/src/add_window.c +++ b/src/add_window.c @@ -402,10 +402,21 @@ AddWindow(Window w, int iconm, IconMgr *iconp) */ if (HandlingEvents && ask_user && !restoredFromPrevSession) { if (Scr->RandomPlacement) { /* just stick it somewhere */ - if ((PlaceX + tmp_win->attr.width) > Scr->MyDisplayWidth) - PlaceX = 50; - if ((PlaceY + tmp_win->attr.height) > Scr->MyDisplayHeight) - PlaceY = 50; + /* Avoid putting the new window off-screen */ + if ((PlaceX + tmp_win->attr.width) > Scr->MyDisplayWidth) { + PlaceX = Scr->MyDisplayWidth - tmp_win->attr.width; + if (PlaceX < 0) + PlaceX = 0; + if (PlaceX > 50) + PlaceX = 50; + } + if ((PlaceY + tmp_win->attr.height) > Scr->MyDisplayHeight) { + PlaceY = Scr->MyDisplayHeight - tmp_win->attr.height; + if (PlaceY < 0) + PlaceY = 0; + if (PlaceY > 50) + PlaceY = 50; + } tmp_win->attr.x = PlaceX; tmp_win->attr.y = PlaceY; @@ -1521,10 +1532,11 @@ FetchWmColormapWindows(TwmWindow *tmp) if (j == tmp->cmaps.number_cwins) { if (XFindContext(dpy, cmap_windows[i], ColormapContext, (XPointer *) &cwins[i]) == XCNOENT) { - if ((cwins[i] = CreateColormapWindow(cmap_windows[i], - (Bool) tmp->cmaps. - number_cwins == 0, - True)) == NULL) { + if ((cwins[i] = + CreateColormapWindow(cmap_windows[i], + (tmp->cmaps.number_cwins == 0 + ? True + : False), True)) == NULL) { int k; for (k = i + 1; k < number_cmap_windows; k++) -- cgit v1.2.3 From 08f44086320c6bc5f2c7eb6457a0d53192832805 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Tue, 16 Jun 2020 18:36:50 -0400 Subject: eliminate a fixed-size buffer in Execute() function. Signed-off-by: Thomas E. Dickey --- src/menus.c | 71 ++++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 22 deletions(-) diff --git a/src/menus.c b/src/menus.c index 7ce0e49..8b1cb00 100644 --- a/src/menus.c +++ b/src/menus.c @@ -919,7 +919,7 @@ PopUpMenu(MenuRoot *menu, int x, int y, Bool center) TwmWindow **WindowNames; TwmWindow *tmp_win2, *tmp_win3; int i; - int (*compar) (const char *, const char *) = + int (*compar)(const char *, const char *) = (Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1); if (!menu) @@ -2281,21 +2281,33 @@ NeedToDefer(MenuRoot *root) return FALSE; } +/* + * We cannot safely free a value passed to putenv, but we can cache the most + * recent value, reducing the memory leaks. + */ +#define cache_env(saved) \ + if (saved == NULL || strcmp(saved, update)) { \ + saved = update; \ + } else { \ + free(update); \ + update = saved; \ + } + static void Execute(const char *s) { - /* FIXME: is all this stuff needed? There could be security problems here. */ - static char buf[256]; + static const char display_eqls[] = "DISPLAY="; + static char *main_display; + static char *exec_display; + char *ds = DisplayString(dpy); char *colon, *dot1; - char oldDisplay[256]; - char *doisplay; - int restorevar = 0; + char *oldDisplay = NULL; + char *value; + Bool restorevar = False; - oldDisplay[0] = '\0'; - doisplay = getenv("DISPLAY"); - if (doisplay) - strcpy(oldDisplay, doisplay); + value = getenv("DISPLAY"); + oldDisplay = strdup(value ? value : ""); /* * Build a display string using the current screen number, so that @@ -2305,23 +2317,38 @@ Execute(const char *s) */ colon = strrchr(ds, ':'); if (colon) { /* if host[:]:dpy */ - strcpy(buf, "DISPLAY="); - strcat(buf, ds); - colon = buf + 8 + (colon - ds); /* use version in buf */ - dot1 = strchr(colon, '.'); /* first period after colon */ - if (!dot1) - dot1 = colon + strlen(colon); /* if not there, append */ - (void) sprintf(dot1, ".%d", Scr->screen); - putenv(buf); - restorevar = 1; + size_t need = sizeof(display_eqls) + strlen(ds) + 10; + char *update = malloc(need); + + if (update != NULL) { + strcpy(update, display_eqls); + strcat(update, ds); + colon = strrchr(update, ':'); + dot1 = strchr(colon, '.'); /* first period after colon */ + if (dot1 == NULL) + dot1 = colon + strlen(colon); /* if not there, append */ + (void) sprintf(dot1, ".%d", Scr->screen); + cache_env(exec_display); + if (strcmp(update, oldDisplay)) { + putenv(update); + restorevar = True; + } + } } (void) system(s); - if (restorevar) { /* why bother? */ - (void) snprintf(buf, sizeof(buf), "DISPLAY=%s", oldDisplay); - putenv(buf); + if (restorevar) { + size_t need = sizeof(display_eqls) + strlen(oldDisplay); + char *update = malloc(need); + + if (update != NULL) { + (void) snprintf(update, need, "%s%s", display_eqls, oldDisplay); + cache_env(main_display); + putenv(update); + } } + free(oldDisplay); } /** -- cgit v1.2.3 From 60bbd1b24a640e26a3f71f8eb35b5c031642a5e5 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Tue, 16 Jun 2020 20:25:31 -0400 Subject: use Debian's package-files as starting point for test-packages Signed-off-by: Thomas E. Dickey --- package/debian/README.source | 49 +++++++ package/debian/changelog | 149 +++++++++++++++++++++ package/debian/compat | 1 + package/debian/control | 30 +++++ package/debian/copyright | 77 +++++++++++ package/debian/patches/01_debian_system_twmrc.diff | 99 ++++++++++++++ package/debian/patches/series | 1 + package/debian/rules | 24 ++++ package/debian/twm.README.Debian | 20 +++ package/debian/twm.desktop | 69 ++++++++++ package/debian/twm.examples | 3 + package/debian/twm.install | 4 + package/debian/twm.links | 1 + package/debian/twm.menu | 6 + package/debian/twm.menu-method | 37 +++++ package/debian/twm.postinst | 18 +++ package/debian/twm.postrm | 20 +++ package/debian/twm.prerm | 18 +++ package/debian/upstream/signing-key.asc | 60 +++++++++ package/debian/watch | 4 + 20 files changed, 690 insertions(+) create mode 100644 package/debian/README.source create mode 100644 package/debian/changelog create mode 100644 package/debian/compat create mode 100644 package/debian/control create mode 100644 package/debian/copyright create mode 100644 package/debian/patches/01_debian_system_twmrc.diff create mode 100644 package/debian/patches/series create mode 100755 package/debian/rules create mode 100644 package/debian/twm.README.Debian create mode 100644 package/debian/twm.desktop create mode 100644 package/debian/twm.examples create mode 100644 package/debian/twm.install create mode 100644 package/debian/twm.links create mode 100644 package/debian/twm.menu create mode 100644 package/debian/twm.menu-method create mode 100644 package/debian/twm.postinst create mode 100644 package/debian/twm.postrm create mode 100644 package/debian/twm.prerm create mode 100644 package/debian/upstream/signing-key.asc create mode 100644 package/debian/watch diff --git a/package/debian/README.source b/package/debian/README.source new file mode 100644 index 0000000..4ecd5e6 --- /dev/null +++ b/package/debian/README.source @@ -0,0 +1,49 @@ +------------------------------------------------------ +Quick Guide To Patching This Package For The Impatient +------------------------------------------------------ + +1. Make sure you have quilt installed +2. Unpack the package as usual with "dpkg-source -x" +3. Run the "patch" target in debian/rules +4. Create a new patch with "quilt new" (see quilt(1)) +5. Edit all the files you want to include in the patch with "quilt edit" + (see quilt(1)). +6. Write the patch with "quilt refresh" (see quilt(1)) +7. Run the "clean" target in debian/rules + +Alternatively, instead of using quilt directly, you can drop the patch in to +debian/patches and add the name of the patch to debian/patches/series. + +------------------------------------ +Guide To The X Strike Force Packages +------------------------------------ + +The X Strike Force team maintains X packages in git repositories on +git.debian.org in the pkg-xorg subdirectory. Most upstream packages +are actually maintained in git repositories as well, so they often +just need to be pulled into git.debian.org in a "upstream-*" branch. +Otherwise, the upstream sources are manually installed in the Debian +git repository. + +The .orig.tar.gz upstream source file could be generated using this +"upstream-*" branch in the Debian git repository but it is actually +copied from upstream tarballs directly. + +Due to X.org being highly modular, packaging all X.org applications +as their own independent packages would have created too many Debian +packages. For this reason, some X.org applications have been grouped +into larger packages: xutils, xutils-dev, x11-apps, x11-session-utils, +x11-utils, x11-xfs-utils, x11-xkb-utils, x11-xserver-utils. +Most packages, including the X.org server itself and all libraries +and drivers are, however maintained independently. + +The Debian packaging is added by creating the "debian-*" git branch +which contains the aforementioned "upstream-*" branch plus the debian/ +repository files. +When a patch has to be applied to the Debian package, two solutions +are involved: +* If the patch is available in one of the upstream branches, it + may be git'cherry-picked into the Debian repository. In this + case, it appears directly in the .diff.gz. +* Otherwise, the patch is added to debian/patches/ which is managed + with quilt as documented in /usr/share/doc/quilt/README.source. diff --git a/package/debian/changelog b/package/debian/changelog new file mode 100644 index 0000000..46efb45 --- /dev/null +++ b/package/debian/changelog @@ -0,0 +1,149 @@ +twm (1:1.0.10-1) unstable; urgency=medium + + * Team upload. + * Update Vcs-* control fields to point at salsa. + * Update www.gnu.org and xorg.freedesktop.org URLs in packaging to https. + * Delete XSFBS-related cruft from README.source. + * Update upstream git URL to point at gitlab.fdo. + * New upstream release + + -- Julien Cristau Thu, 06 Sep 2018 15:16:24 +0200 + +twm (1:1.0.9-1) unstable; urgency=medium + + * Let uscan verify tarball signatures. + * New upstream release. + + -- Julien Cristau Sun, 03 May 2015 15:48:37 +0200 + +twm (1:1.0.8-1) unstable; urgency=medium + + * New upstream release. + * Fix Vcs-Browser control field (closes: #736408). Thanks, Mateusz Łukasik! + * Rewrite debian/rules using dh, bump compat to 9, drop xsfbs. + * Update 01_debian_system_twmrc.diff. + * Disable silent build rules. + + -- Julien Cristau Sun, 13 Jul 2014 11:13:12 +0200 + +twm (1:1.0.6-1) unstable; urgency=low + + * Kill obsolete svn $Id$ tags from packaging. + * postinst: drop obsolete cleanup for /usr/bin/X11/twm x-window-manager + alternative. + * Remove myself from Uploaders. + * Rename the build directory to not include DEB_BUILD_GNU_TYPE for no + good reason. Thanks, Colin Watson! + * New upstream release. + * Update debian/copyright from COPYING. + * Various debian/rules updates: + - use $(filter) instead of $(findstring) to parse DEB_BUILD_OPTIONS + - enable parallel builds + - fix rules dependencies + - drop useless --enable-man-pages=3 configure flag + * Add build-arch and (empty) build-indep targets. + * Drop Pre-Depends on x11-common. + * Remove David Nusinow and Brice Goglin from Uploaders. Thanks for your + work! + * Bump Standards-Version to 3.9.1. + * Run autoreconf at build time. Delete generated files on clean. + Build-depend on xutils-dev and automake. + * Refresh 01_debian_system_twmrc.diff. + * Don't call dh_makeshlibs [lintian]. + + -- Julien Cristau Wed, 09 Feb 2011 17:42:27 +0100 + +twm (1:1.0.4-2) unstable; urgency=low + + * Update patches to not require -p0 and pull newest xsfbs, closes: #485267. + * Add myself to Uploaders. + + -- Brice Goglin Sat, 14 Jun 2008 16:08:36 +0200 + +twm (1:1.0.4-1) unstable; urgency=low + + * New upstream release + * Fixup patch 01_debian_system_twmrc.diff + * Remove -1 debian revisions from build-deps to please lintian. + * Add Vcs-* control fields. + + -- Julien Cristau Sat, 08 Mar 2008 03:59:33 +0100 + +twm (1:1.0.3-3) unstable; urgency=low + + [ Julien Cristau ] + * debian/twm.menu-method: add a "supported" entry for the wm menu, to make + it possible to switch to another window manager from twm, closes: #409111. + * Menu transition: "WindowManagers" renamed to "Window Managers". + * Add myself to Uploaders. + * Bump Standards-Version to 3.7.3. + + [ Brice Goglin ] + * Add a /usr/share/xsessions/twm.desktop (stolen from kdm's private + database) so that twm appears in the list of possible sessions in + all *dm that support it, thanks Christopher Martin, closes: #335071. + + -- Julien Cristau Sat, 12 Jan 2008 17:31:20 +0100 + +twm (1:1.0.3-2) unstable; urgency=low + + * Generate the maintainer scripts properly (so the x-window-manager + alternative is installed), and remove old transition code from + the XFree86 4.x days. + + -- Julien Cristau Fri, 08 Jun 2007 14:35:30 +0200 + +twm (1:1.0.3-1) unstable; urgency=low + + [ Julien Cristau ] + * New upstream release. + * Install the manpage as twm.1 instead of twm.1x and update + update-alternatives parameters (closes: #396940). + * Use dh_install --list-missing. + * Make sure twm looks for system.twmrc in /etc/X11/twm, not + /usr/share/X11/twm. + + [ Brice Goglin ] + * Drop useless -DLIBXCURSOR from debian/rules (closes: #384073). + + -- Julien Cristau Fri, 08 Jun 2007 01:03:48 +0200 + +twm (1:1.0.1-4) unstable; urgency=low + + * Run dh_install menu so that we actually install the menu method. Thanks + giacomo boffi for the report and Bill Allombert for the fix. + (closes: #364255) + * Add a pre-depends on x11-common so the upgrade from X11R6 goes smoothly. + Thanks Vasilis Vasaitis. (closes: #365913) + * Add outputencoding="ASCII"; to the menu-method the facilitate translations + of menus. Thanks Bill Allombert. + * Add quilt to build-depends + * Bump standards version to 3.7.2.0 + * Bump debhelper compat to version 5 + * Point the menu method at /usr/bin/install-menu rather than /usr/sbin. Also + bump the version of menu we depend on to >= 2.1.26, which implements this + change + + -- David Nusinow Sun, 21 May 2006 19:14:42 -0400 + +twm (1:1.0.1-3) unstable; urgency=low + + * Upload to unstable + + -- David Nusinow Tue, 4 Apr 2006 18:44:37 -0400 + +twm (1:1.0.1-2) experimental; urgency=low + + [ David Nusinow ] + * Add versioned build-depends on the modular X libs. Thanks Frank + Lichtenheld. (closes: #354098) + * Port patches from trunk + + debian/903_debian_system.twmrc.diff + + -- David Nusinow Sun, 26 Feb 2006 22:55:58 -0500 + +twm (1:1.0.1-1) experimental; urgency=low + + * First modular upload to Debian + + -- David Nusinow Sun, 19 Feb 2006 19:58:38 -0500 diff --git a/package/debian/compat b/package/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/package/debian/compat @@ -0,0 +1 @@ +9 diff --git a/package/debian/control b/package/debian/control new file mode 100644 index 0000000..9c51437 --- /dev/null +++ b/package/debian/control @@ -0,0 +1,30 @@ +Source: twm +Section: x11 +Priority: optional +Maintainer: Debian X Strike Force +Build-Depends: + debhelper (>= 9), + dh-autoreconf, + pkg-config, + libx11-dev (>= 2:1.0.0-2), + libxext-dev (>= 1:1.0.0), + libxt-dev (>= 1:1.0.0), + libxmu-dev (>= 1:1.0.1), + bison, + flex, + quilt, + xutils-dev (>= 1:7.5+4), + automake, +Standards-Version: 3.9.1 +Vcs-Git: https://salsa.debian.org/xorg-team/app/twm.git +Vcs-Browser: https://salsa.debian.org/xorg-team/app/twm + +Package: twm +Architecture: any +Depends: menu (>= 2.1.26), ${shlibs:Depends}, ${misc:Depends} +Provides: x-window-manager +Description: Tab window manager + twm is a window manager for the X Window System. It provides title bars, + shaped windows, several forms of icon management, user-defined macro + functions, click-to-type and pointer-driven keyboard focus, and + user-specified key and pointer button bindings. diff --git a/package/debian/copyright b/package/debian/copyright new file mode 100644 index 0000000..8055d76 --- /dev/null +++ b/package/debian/copyright @@ -0,0 +1,77 @@ +This package was downloaded from +https://xorg.freedesktop.org/releases/individual/app/ + + +Copyright 1989, 1994, 1998 The Open Group +Copyright 2005 Hitachi, Ltd. + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + + Copyright 1988 by Evans & Sutherland Computer Corporation, + Salt Lake City, Utah + Cambridge, Massachusetts + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that copyright notice and this permis- +sion notice appear in supporting documentation, and that the +name of Evans & Sutherland not be used in advertising +in publicity pertaining to distribution of the software without +specific, written prior permission. + +EVANS & SUTHERLAND DISCLAIMs ALL WARRANTIES WITH REGARD +TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- +ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND +BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- +AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA +OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE +OR PERFORMANCE OF THIS SOFTWARE. + + + +Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the XFree86 Project shall +not be used in advertising or otherwise to promote the sale, use or other +dealings in this Software without prior written authorization from the +XFree86 Project. diff --git a/package/debian/patches/01_debian_system_twmrc.diff b/package/debian/patches/01_debian_system_twmrc.diff new file mode 100644 index 0000000..b7e3330 --- /dev/null +++ b/package/debian/patches/01_debian_system_twmrc.diff @@ -0,0 +1,99 @@ +From: Branden Robinson + +Fix system.twmrc to actually be useful and tabbed right, as well as add +the Debian menu. + +Index: twm/src/system.twmrc +=================================================================== +--- twm.orig/src/system.twmrc ++++ twm/src/system.twmrc +@@ -48,7 +48,8 @@ Function "move-or-iconify" { f.move f.de + # + # Set some useful bindings. Sort of uwm-ish, sort of simple-button-ish + # +-Button1 = : root : f.menu "defops" ++Button1 = : root : f.menu "main" ++Button2 = : root : f.menu "windowops" + + Button1 = m : window|icon : f.function "move-or-lower" + Button2 = m : window|icon : f.iconify +@@ -66,25 +67,39 @@ Button2 = : iconmgr : f.iconify + # + # And a menus with the usual things + # +-menu "defops" ++menu "main" + { +-"Twm" f.title +-"Iconify" f.iconify +-"Resize" f.resize +-"Move" f.move +-"Raise" f.raise +-"Lower" f.lower +-"" f.nop +-"Focus" f.focus +-"Unfocus" f.unfocus +-"Show Iconmgr" f.showiconmgr +-"Hide Iconmgr" f.hideiconmgr +-"" f.nop +-"Xterm" f.exec "exec xterm &" +-"" f.nop +-"Kill" f.destroy +-"Delete" f.delete +-"" f.nop +-"Restart" f.restart +-"Exit" f.quit ++ "Main Menu" f.title ++ "Debian" f.menu "/Debian" ++ "" f.nop ++ "Show Icon Manager" f.showiconmgr ++ "Hide Icon Manager" f.hideiconmgr ++ "" f.nop ++ "Exit" f.menu "Quit-Verify" + } ++ ++menu "Quit-Verify" ++{ ++ "Really quit twm?" f.title ++ "No, restart twm" f.restart ++ "Yes, really quit" f.quit ++} ++ ++menu "windowops" ++{ ++ "Window Ops" f.title ++ "" f.nop ++ "Iconify" f.iconify ++ "Resize" f.resize ++ "Move" f.move ++ "Raise" f.raise ++ "Lower" f.lower ++ "" f.nop ++ "Focus" f.focus ++ "Unfocus" f.unfocus ++ "" f.nop ++ "Delete" f.delete ++ "Destroy" f.destroy ++} ++ ++include-menu-defs +Index: twm/src/Makefile.am +=================================================================== +--- twm.orig/src/Makefile.am ++++ twm/src/Makefile.am +@@ -24,13 +24,13 @@ AM_YFLAGS = -d + + bin_PROGRAMS = twm + +-rcdir = ${datadir}/X11/twm ++rcdir = ${sysconfdir}/X11/twm + dist_rc_DATA = system.twmrc + + AM_CPPFLAGS = \ + -DXVENDORNAME=\"The\ X.Org\ Foundation\" \ + -DXORG_RELEASE=\"Release\ $(VERSION)\" \ +- -DSYSTEM_INIT_FILE=\"${datadir}/X11/twm/system.twmrc\" ++ -DSYSTEM_INIT_FILE=\"$(rcdir)/system.twmrc\" + + AM_CFLAGS = $(TWM_CFLAGS) + twm_LDADD = $(TWM_LIBS) diff --git a/package/debian/patches/series b/package/debian/patches/series new file mode 100644 index 0000000..dfa3912 --- /dev/null +++ b/package/debian/patches/series @@ -0,0 +1 @@ +01_debian_system_twmrc.diff diff --git a/package/debian/rules b/package/debian/rules new file mode 100755 index 0000000..d755cc1 --- /dev/null +++ b/package/debian/rules @@ -0,0 +1,24 @@ +#!/usr/bin/make -f +# debian/rules for the Debian twm package. +# Copyright © 2004 Scott James Remnant +# Copyright © 2005 Daniel Stone +# Copyright © 2005 David Nusinow + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +%: + dh $@ --with quilt,autoreconf --builddirectory=build/ --parallel + +override_dh_auto_configure: + dh_auto_configure -- --disable-silent-rules + +override_dh_auto_install: + dh_auto_install --destdir=debian/tmp + install -d debian/tmp/etc/X11/twm + install -m 644 src/system.twmrc debian/tmp/etc/X11/twm/system.twmrc-menu + install -d debian/tmp/usr/share/xsessions + install -m 644 debian/twm.desktop debian/tmp/usr/share/xsessions/twm.desktop + +override_dh_install: + dh_install --list-missing diff --git a/package/debian/twm.README.Debian b/package/debian/twm.README.Debian new file mode 100644 index 0000000..df1bc30 --- /dev/null +++ b/package/debian/twm.README.Debian @@ -0,0 +1,20 @@ +Debian README for twm package +============================= + +Newcomers to the X Window System should first read the Debian X FAQ +(Frequently Asked Questions list): /usr/share/doc/x11-common/FAQ.gz. +You can view this file with your favorite pager program after decompressing +it. For example: + $ zcat /usr/share/doc/x11-common/FAQ.gz | pager + +For information on the /etc/X11/twm/system.twmrc file, see the twm(1) +manual page. Note that /etc/X11/twm/system.twmrc is auto-generated from +the /etc/X11/twm/system.twmrc-menu file, so as to be able to support the +Debian menu system. You should therefore make your customizations to +/etc/X11/twm/system.twmrc-menu. After the update-menu command is run, they +will appear in /etc/X11/twm/system.twmrc and be used by the twm binary. + +Some examples of .twmrc files from days of yore are available in +/usr/share/doc/twm/examples. + +vim:set ai et sts=4 sw=4 tw=80: diff --git a/package/debian/twm.desktop b/package/debian/twm.desktop new file mode 100644 index 0000000..6185545 --- /dev/null +++ b/package/debian/twm.desktop @@ -0,0 +1,69 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=XSession +Exec=twm +TryExec=twm +Name=TWM +Name[eo]=TFA +Name[hi]=टीडबल्यूएम +Name[te]=టి డబ్ల్యు ఎం +Comment=The Tab Window Manager +Comment[af]=Die Tab venster bestuurder +Comment[ar]=مدير النوافذ Tab +Comment[be]=Кіраўнік вокнаў з укладкамі Tab Window Manager +Comment[bn]=দি ট্যাব উইণ্ডো ম্যানেজার +Comment[bs]=Tab Window Manager +Comment[ca]=El gestor de finestres Tab +Comment[csb]=Tab Window Manager +Comment[cy]=Y Trefnydd Ffenestri Tab +Comment[da]=Tab-vindueshåndtering +Comment[de]=Der Tab-Fenstermanager +Comment[el]=Ο διαχειριστής παραθύρων Tab +Comment[eo]=Taba fenestroadministrilo +Comment[es]=El Tab Window Manager +Comment[et]=Kaartidega aknahaldur +Comment[eu]=Tab leiho kudeatzailea +Comment[fa]=مدیر پنجرۀ تب +Comment[fi]=Välilehtiä tukeva ikkunaohjelma +Comment[fy]=De Ljepper Finster Behearder +Comment[gl]=O Xestor de Fiestras Tab +Comment[hi]=टैब विंडो प्रबंधक +Comment[hr]=Tab upravitelj prozora +Comment[hu]=Tab Window Manager ablakkezelő +Comment[is]=Tab gluggastjórinn +Comment[it]=Il Tab Window Manager +Comment[ja]=Tab 化ウィンドウマネージャ +Comment[kk]=Tab терезе менеджері +Comment[km]=កម្មវិធី​គ្រប់គ្រង​បង្អួច​ជា​ផ្ទាំង +Comment[lt]=Kortelių langų tvarkyklė +Comment[lv]=Tabu logu menedžeris +Comment[mk]=Tab Window Manager +Comment[mn]=Tab Цонхны удирдагч +Comment[ms]=Pengurus Tetingkap Tab +Comment[mt]=Tab Window Manager +Comment[nb]=Tab Vindusbehandler +Comment[nds]=De Tab-Finsterpleger +Comment[ne]=ट्याब सञ्झ्याल प्रबन्धक +Comment[nl]=De Tab Window Manager +Comment[nn]=Tab Window Manager +Comment[pa]=ਟੈਬ ਝਰੋਖਾ ਮੈਨੇਜਰ +Comment[pl]=Tab Window Manager +Comment[pt]=O Tab Window Manager +Comment[pt_BR]=O Gerenciador de Janelas de Abas +Comment[ro]=Tab Window Manager +Comment[ru]=Традиционный оконный менеджер системы X11 +Comment[rw]=Mugenga Dirishya Agafishi +Comment[se]=Tab-láse lásegieđahalli +Comment[sk]=Správca okien s kartami +Comment[sl]=Tab Window Manager, okenski upravitelj z zavihki +Comment[sv]=Flikfönsterhanteraren +Comment[ta]=டாப் சாளர மேலாளர் +Comment[te]=టాబ్ విండొ అభికర్త +Comment[tg]=Tab-и мудири тиреза +Comment[th]=Tab Window Manager +Comment[tr]=Tab Pencere Yöneticisi +Comment[tt]=X11 sistemendäge kebek tabaqlı täräzä-idäräçe +Comment[uk]=Tab Window Manager +Comment[vi]=Trình Quản lý Cửa sổ Thẻ +Comment[zh_CN]=标签式窗口管理器 +Comment[zh_TW]=Tab 視窗管理程式 diff --git a/package/debian/twm.examples b/package/debian/twm.examples new file mode 100644 index 0000000..8a0d993 --- /dev/null +++ b/package/debian/twm.examples @@ -0,0 +1,3 @@ +sample-twmrc/jim.twmrc +sample-twmrc/keith.twmrc +sample-twmrc/lemke.twmrc diff --git a/package/debian/twm.install b/package/debian/twm.install new file mode 100644 index 0000000..cb49f98 --- /dev/null +++ b/package/debian/twm.install @@ -0,0 +1,4 @@ +etc/X11/twm/system.twmrc-menu +usr/bin/twm +usr/share/man/man1/twm.1 +usr/share/xsessions/twm.desktop diff --git a/package/debian/twm.links b/package/debian/twm.links new file mode 100644 index 0000000..26a7121 --- /dev/null +++ b/package/debian/twm.links @@ -0,0 +1 @@ +etc/X11/twm usr/lib/X11/twm diff --git a/package/debian/twm.menu b/package/debian/twm.menu new file mode 100644 index 0000000..8016dd5 --- /dev/null +++ b/package/debian/twm.menu @@ -0,0 +1,6 @@ +?package(twm):\ + needs="wm"\ + section="Window Managers"\ + longtitle="Twm: Tab Window Manager"\ + title="Twm"\ + command="twm" diff --git a/package/debian/twm.menu-method b/package/debian/twm.menu-method new file mode 100644 index 0000000..d3dbaae --- /dev/null +++ b/package/debian/twm.menu-method @@ -0,0 +1,37 @@ +#!/usr/bin/install-menu + +# -*- mode: shell-script; -*- +#I need menu-1! +# +#NOTE: the first line of this script _must_ be +# equal to "#!/usr/sbin/install-menu", otherwise update-menus +# will feed this script old-compat-mode data. +# +#More info: /usr/doc/menu/html. +# +compat="menu-1" + +!include menu.h + +compat="menu-2" +outputencoding="ASCII"; + +function q($com)=esc($com,"\""); +function f($com)=" \"" q(title()) "\" f.exec \"" q($com) " &\"\n"; + +supported; + x11= f($command); + text=f(term()); + wm=" \"" q(title()) "\" f.startwm \"" q($command) "\"\n"; +# x11 = " \"" $title "\" f.exec \""$command " &\"\n"; +# text= " \"" $title "\" f.exec \"xterm -title \\\"" +# $title "\\\" -e " esc($command,"\"") " &\"\n"; +endsupported; +startmenu= "menu \"" q($section) "\"\n{\n"; +endmenu= "}\n"; +submenutitle=" \"" q(title()) "\" f.menu \"" q($section) "\"\n"; +genmenu= "menudefs.hook"; +rcfile= "system.twmrc"; +examplercfile="system.twmrc-menu"; +rootprefix= "/etc/X11/twm/"; +userprefix= "/.twm/"; diff --git a/package/debian/twm.postinst b/package/debian/twm.postinst new file mode 100644 index 0000000..b0f51ec --- /dev/null +++ b/package/debian/twm.postinst @@ -0,0 +1,18 @@ +#!/bin/sh +# Debian twm package post-installation script +# Copyright 1998-2001, 2004 Branden Robinson. +# Licensed under the GNU General Public License, version 2. See the file +# /usr/share/common-licenses/GPL or . +# Acknowledgements to Stephen Early, Mark Eichin, and Manoj Srivastava. + +set -e + +#DEBHELPER# + +update-alternatives --install /usr/bin/x-window-manager x-window-manager \ + /usr/bin/twm 40 --slave /usr/share/man/man1/x-window-manager.1.gz \ + x-window-manager.1.gz /usr/share/man/man1/twm.1.gz + +exit 0 + +# vim:set ai et sts=2 sw=2 tw=0: diff --git a/package/debian/twm.postrm b/package/debian/twm.postrm new file mode 100644 index 0000000..98aa2aa --- /dev/null +++ b/package/debian/twm.postrm @@ -0,0 +1,20 @@ +#!/bin/sh +# Debian twm package post-removal script +# Copyright 1998-2001, 2004 Branden Robinson. +# Licensed under the GNU General Public License, version 2. See the file +# /usr/share/common-licenses/GPL or . +# Acknowledgements to Stephen Early, Mark Eichin, and Manoj Srivastava. + +set -e + +#DEBHELPER# + +if [ "$1" = "purge" ]; then + if [ -d /etc/X11/twm ]; then + rm -r /etc/X11/twm + fi +fi + +exit 0 + +# vim:set ai et sts=2 sw=2 tw=0: diff --git a/package/debian/twm.prerm b/package/debian/twm.prerm new file mode 100644 index 0000000..a92122a --- /dev/null +++ b/package/debian/twm.prerm @@ -0,0 +1,18 @@ +#!/bin/sh +# Debian twm package pre-removal script +# Copyright 1998-2001, 2004 Branden Robinson. +# Licensed under the GNU General Public License, version 2. See the file +# /usr/share/common-licenses/GPL or . +# Acknowledgements to Stephen Early, Mark Eichin, and Manoj Srivastava. + +set -e + +#DEBHELPER# + +if [ "$1" = "remove" ] || [ "$1" = "deconfigure" ]; then + update-alternatives --remove x-window-manager /usr/bin/twm +fi + +exit 0 + +# vim:set ai et sts=2 sw=2 tw=0: diff --git a/package/debian/upstream/signing-key.asc b/package/debian/upstream/signing-key.asc new file mode 100644 index 0000000..863981f --- /dev/null +++ b/package/debian/upstream/signing-key.asc @@ -0,0 +1,60 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1 + +mQGiBEab+moRBACDH5yKqS3wcc5bdxY7PBNuwKvF5TKMfagmSvuRDtZjjIIWaA/n +Z1KboV9Gq5g7kP7+Kfu+Qgd8u65eVsWwmPW10fXvj3aCU53glx2EdGdrHcgiyH2g +EQfPiyBw+trIppWFRV0IDXSLMA1FNC92t2nSG/VFHaPTVwcgkIRSfcXDvwCglGdE +a6f4uLqoNHP+m4yYnzapFuMD/R4+2AJDAvEWKDdYCGZzlawjAmmWyXrmT7/C/mx9 +8qUR473l4buXjHgDkkXXlHqdzil1vK85PhrKzNJDCCmlHUJNz+QwiAMOLwpD+kwV +Pb57RG7y+a5JQ5+jtVw4RlUxZIk/wj2An9YBO3A5vR7PdjM32ZJCN2+aM4dYfNzQ +xQKTA/47icvBaBVTl9rztjg2pd2Aqpc1P/GsIYLGj7XjnnJvGAENBHSH1QjpZMJG +CTS9oJ+B0/wrIr+pA+MdFgYAb6ojMQJOO6UChjWWSGjMFcs/CeXhxlLBido3DtAE +TbNTwO6OEfAvdosvTdhJFnwvZlJ+zZGGy5CrF2Fd9PUe9tmASbQoQWxhbiBDb29w +ZXJzbWl0aCA8YWxhbmNAZnJlZWRlc2t0b3Aub3JnPohoBBMRAgAoAhsDBgsJCAcD +AgYVCAIJCgsEFgIDAQIeAQIXgAUCUXnRYgUJFEPYeAAKCRCi+54IHy0TDonxAKCP +cAgXNojuujUg5Wqi6v0RBFVSUgCggq1SsVEdq9NDWvXvkeGyNaBivSK0K0FsYW4g +Q29vcGVyc21pdGggPGFsYW4uY29vcGVyc21pdGhAc3VuLmNvbT6IZgQTEQIAJgIb +AwYLCQgHAwIEFQIIAwQWAgMBAh4BAheABQJRedFiBQkUQ9h4AAoJEKL7nggfLRMO +6sUAn0jl3h9rY4OJ13Lu7nsKclyhDpOqAKCFgTmaDGRuDRxloLg9jftrn7a7vrQu +QWxhbiBDb29wZXJzbWl0aCA8YWxhbi5jb29wZXJzbWl0aEBvcmFjbGUuY29tPohr +BBMRAgArAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAIZAQUCUXnRYgUJFEPY +eAAKCRCi+54IHy0TDtBZAJ9IgVVNoFIPRjTsNjcSFaLznuDRJgCcC/WgV312IrxS +Q8PRAyEgozSB9Ke5Ag0ERpv6bxAIAJp5aUlho5rUhpS6ik7spsAQFPRuycPKMNu0 +J4F0v/OoPz085soV8ytLj4HqCGk2Zamh1jSgliZwuk9m7V7Wgxx+nBJawpWDX/eK +LObErfDwQ4dfOFvjbXLQMmNnQNaUGIWLPP3l8GuBOHMq60Bu+TPgh627vUntL5RE +QEQqTXIzWC6U10QsDblLwIvdOVSdGF5xl/N1myXzSKvrsZwWtoFc8G9v9hcCjhtN +1sm9b7Ojc51iZXvcetcvPy5RA6AUW3yEExaedUdLnvIF9sjFYIfJWFVYh2AgavnG +re6fF+NV2v3zfx3wRT7H9//m4YIDYJmgZgyQccXegTwfGBIq3osAAwYH/1FiMUMM +ES5Ilz2nDqId+DCWECAU6wgvIFRcXrZWxDxB+ZrnmTCXoAD0xedpfOkRHp8XTVc/ +9MU+wQ+lZRx2OQ6MJW0XGuFvHm94KZF/8HzWA2Ah7U4n0+3sLpk6zWceZq2zZNF0 +yVTjwD98+xNK1Q9sP8aOKdtg8yMH3hisKR6rdW+mfX5q0Q8Gol2hZsFH/qyIhnPz +hXDknuOh8E5iMkzrejVXUEn++Yzj23XjP59SObLznVkyxI+kBI9qvVEPfFBDybjH +WqLcgRcCpXAzjizEi+/d31iDa2ErJHV4R42obecFqiPnoDtiX3IiP7z9fmxM4aWP +ZZRqvq+1ht5wkn+ISQQYEQIACQUCRpv6bwIbDAAKCRCi+54IHy0TDoLoAKCHYRpw +/XfyEunw1YL/uMZzl78qIQCdFVcXNbqD83qVhW4Ly7hyDL8o0aK5Ag0EUXnVIQEQ +AKHpjOmY056n0tsZoW9q5egsMcl5tKC8uimrhO05nnq+5/60/YedC++V9c9b/3/X +7O28LyBkAtBgD0xJZSDQ0DhTzKAp6AzjQtBvI68uinGwxSjT+oQpPMxqhA1I0kzo +EDCdEqV+HsVOAEdbAi/tP9bbdTDzwVc8MWDriamBUqc53Rb00Mffy9435UgTS4gA +hMwANhy6XZmOMBhITOzxFJUEDTDJtLbE0b1jPRQS7NHQgak1inmuvPMc3wAuoEcS +CSt1xupbYsBoXOjK5wC/eE1LIdZoRyW2OkT140DqDZ8zfRID860hnirnYgb09TPN +tj93pudUAUt6T9+tcLN4/rxhxHOwse66KGHO4bQ1rZ6mfco6SYd9V60cL6hC2eMe +cyxZliMu17lj7EX8lxUH+omIgHc7HGoyUR6V+WB60cxWj5v05zdeLeZ2aLBcPFhx +lfDESm8f4ezdJSDS1QZmC0P5h3RJfhhfmdBr8kHzr7111D1/O71Av1VV5FyJ9YxU +Sxp4IPuzK7JbbgVHcA6PvXrDzWUslmZgPADpKH4hTmG/NdCqhEXcufvY6s5yNksB +8X3ReNvuSSyfGnRz3kvtyK0XzC7KRX2PquLI6A8KJprHwZGqEB1NDG8b2iaYnghO +jyfIYEVQF3nGfaBwv4lrCPEoZSUaK8f/NQZjNU8NQyTnABEBAAGJAm0EGBEKAA8F +AlF51SECGwIFCQlmAYACKQkQovueCB8tEw7BXSAEGQEKAAYFAlF51SEACgkQz98U +iCjGQqfW5g//dOdJHt23cdMyz5VADaE7u+L0E+eX9GtHF4J649eXsui59EtbHh2n +XdGhd5SqQ8FDi9GCEKaQ4S31n/YBLEBCkj7R0IMikW2o78/JxDovB8+aL606hgma +fNVx1aIshIglrl8Xlu3sjeAvG48W6YjdL2mfrIDHjIVwOZsMihbOJvST6Q3upHdn +mjDtM5HCQmI5NEXDWYj6IZuhJnnrDWwNsyYV4KPoUBxAcqIyCeZbVssuWWnHPXX8 +VavVq98vpVynfGzGYpJbDj19C/utMjKGI5dcvbVaucA7X/oktxrxS6SBDhuIaAE9 +4ZHlbxqfyHfETI/La2Z/ALDAtYdhJR2gSkTHyKSW1QqYlulSfB//lnna44mmTuRO +NbDNgb0FGSvtsBMZ80iHDqPgUfS60kxCfFrsSGfTFU+X4QAzpTtUJEcr+J4HULDe +MfwOgghVfmKxFXWfud8xDaCXuywLTtVgMCZp4P7MAyuJlaxsFTu+c1Vly94grk4U +MtALLMqCXSosA490gLTSdg3HSwxt2Q/LJdy427ZIMvjGXIruns8U/OmL9dVgWu3b +JHsL68Skx8Ts63qTN9QXM/PB+8VwOaC7PJ+g6t40DleOmdsS8cN31yf5KB8rsL4u +n4u1yrMJfpnSblPMu5wJi3kjoA+Dd5ZFqx9nTi4wBjfVYGCPsleq59K8kQCYx1Cn +lZcq630ITy9dB/aHCQry2gCbBwZ2Rsf9kr05S8uLhlwW3vRSvRs= +=tc6G +-----END PGP PUBLIC KEY BLOCK----- diff --git a/package/debian/watch b/package/debian/watch new file mode 100644 index 0000000..251869c --- /dev/null +++ b/package/debian/watch @@ -0,0 +1,4 @@ +#git=https://gitlab.freedesktop.org/xorg/app/twm +version=3 +opts="pgpsigurlmangle=s/$/.sig/" \ +https://xorg.freedesktop.org/releases/individual/app/ twm-(.*)\.tar\.gz -- cgit v1.2.3 From b6311b0699992036e81a1ed58906114fc517ae7d Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Tue, 16 Jun 2020 20:42:13 -0400 Subject: updated patch to work with code, reflect a change made in 2016... Signed-off-by: Thomas E. Dickey --- package/debian/patches/01_debian_system_twmrc.diff | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/debian/patches/01_debian_system_twmrc.diff b/package/debian/patches/01_debian_system_twmrc.diff index b7e3330..c07b2d6 100644 --- a/package/debian/patches/01_debian_system_twmrc.diff +++ b/package/debian/patches/01_debian_system_twmrc.diff @@ -92,7 +92,7 @@ Index: twm/src/Makefile.am AM_CPPFLAGS = \ -DXVENDORNAME=\"The\ X.Org\ Foundation\" \ -DXORG_RELEASE=\"Release\ $(VERSION)\" \ -- -DSYSTEM_INIT_FILE=\"${datadir}/X11/twm/system.twmrc\" +- -DSYSTEM_INIT_FILE=\"${rcdir}/system.twmrc\" + -DSYSTEM_INIT_FILE=\"$(rcdir)/system.twmrc\" AM_CFLAGS = $(TWM_CFLAGS) -- cgit v1.2.3 From b356cd5684a2e6a3a8987390ceb99c67c2a91b5e Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Wed, 17 Jun 2020 15:07:37 -0400 Subject: adapted/updated patch from Debian #956434 Signed-off-by: Thomas E. Dickey --- man/twm.man | 66 ++++++++++++++++++++++++++++--------------------------------- 1 file changed, 30 insertions(+), 36 deletions(-) diff --git a/man/twm.man b/man/twm.man index 6926abf..35ea30f 100644 --- a/man/twm.man +++ b/man/twm.man @@ -56,8 +56,8 @@ key and pointer button bindings. This program is usually started by the user's session manager or startup script. When used -from \fIxdm(__appmansuffix__)\fP -or \fIxinit(__appmansuffix__)\fP without a session manager, +from \fBxdm\fP(__appmansuffix__) +or \fBxinit\fP(__appmansuffix__) without a session manager, \fItwm\fP is frequently executed in the foreground as the last client. When run this way, exiting \fItwm\fP causes the @@ -92,7 +92,7 @@ Just clicking in the title or highlight region raises the window without moving it. .PP When new windows are created, \fItwm\fP will honor any size and location -information requested by the user (usually through \fI-geometry\fP +information requested by the user (usually through \fI\-geometry\fP command line argument or resources for the individual applications). Otherwise, an outline of the window's default size, its titlebar, and lines dividing the @@ -109,7 +109,6 @@ will give the window its current position but attempt to make it long enough to touch the bottom the screen. .SH OPTIONS \fITwm\fP accepts the following command line options: -.PP .TP 8 .B \-display \fIdpy\fP This option specifies the X server to use. @@ -133,21 +132,20 @@ an unexpected X Error event is received. This can be useful when debugging applications but can be distracting in regular use. .SH CUSTOMIZATION -.PP Much of \fItwm\fP's appearance and behavior can be controlled by providing a startup file in one of the following locations (searched in order for each screen being managed when \fItwm\fP begins): .TP 8 -.B "$HOME/.twmrc.\fIscreennumber\fP" -The \fIscreennumber\fP is a small positive number (e.g. -0, 1, etc.) -representing the screen number (e.g., the last number in the DISPLAY environment +.B $HOME/.twmrc.\fIscreennumber\fP +The \fIscreennumber\fP is a small positive number (e.g., 0, 1, etc.) +representing the screen number +(e.g., the last number in the DISPLAY environment variable \fIhost:displaynum.screennum\fP) that would be used to contact that screen of the display. This is intended for displays with multiple screens of differing visual types. .TP 8 -.B "$HOME/.twmrc" +.B $HOME/.twmrc This is the usual name for an individual user's startup file. .TP 8 .B __datadir__/X11/twm/system.twmrc @@ -161,11 +159,11 @@ If no startup files are found, \fItwm\fP will use the built-in defaults described above. The only resource used by \fItwm\fP is \fIbitmapFilePath\fP for a colon-separated list of directories to search -when looking for bitmap files (for more information, see the \fIAthena -Widgets\fP manual and \fIxrdb(__appmansuffix__)\fP). +when looking for bitmap files (for more information, +see the \fIAthena Widgets\fP manual and \fBxrdb\fP(__appmansuffix__)). .PP \fITwm\fP startup files are logically broken up into three types of -specifications: \fIVariables\fP, \fIBindings\fP, \fIMenus\fP. +specifications: \fIVariables\fP, \fIBindings\fP, \fIMenus\fP. The \fIVariables\fP section must come first and is used to describe the fonts, colors, cursors, border widths, icon and window placement, highlighting, @@ -185,7 +183,6 @@ A pound sign (#) outside of a string causes the remainder of the line in which the character appears to be treated as a comment. .SH VARIABLES -.PP Many of the aspects of \fItwm\fP's user interface are controlled by variables that may be set in the user's startup file. Some of the options are @@ -227,7 +224,7 @@ prepend the user's directory tilde (~). If, instead, the first character is a colon (:), the name is assumed to refer to one of the internal bitmaps that are used to -create the default titlebars symbols: \fB:xlogo\fP +create the default titlebars symbols: \fB:xlogo\fP or \fB:delete\fP (both refer to the X logo), \fB:dot\fP or \fB:iconify\fP (both refer to the dot), \fB:resize\fP (the nested squares used by the resize button), @@ -290,7 +287,7 @@ and may only be given within a \fBGrayscale\fP or \fBMonochrome\fP list. The optional \fIwincolorlist\fP allows per-window colors to be specified. -The default is "white". +The default is "white". .IP "\fBBorderTileForeground\fP \fIstring\fP [{ \fIwincolorlist\fP }]" 8 This variable specifies the default foreground color in the gray pattern used in unhighlighted borders (only @@ -395,7 +392,7 @@ from bitmap files, the following syntax is used instead: .Ee .IP The \fIimage\fP and \fImask\fP strings specify the names of files containing -the glyph image and mask in \fIbitmap(__appmansuffix__)\fP form. +the glyph image and mask in \fBbitmap\fP(__appmansuffix__) form. The bitmap files are located in the same manner as icon bitmap files. The following example shows the default cursor definitions: .RS 5 @@ -439,7 +436,7 @@ as icons while other windows are handled by the icon manager. This variable indicates that windows should not be allowed to be moved off the screen. It can be overridden by the \fBf.forcemove\fP function. -.IP "\fBDontSqueezeTitle\fP [{ \fIwin-list\fP }] " 8 +.IP "\fBDontSqueezeTitle\fP [{ \fIwin-list\fP }]" 8 This variable indicates that titlebars should not be squeezed to their minimum size as described under \fBSqueezeTitle\fP below. If the optional window list is supplied, only those windows will be @@ -483,7 +480,7 @@ icon windows. The default is 2. .IP "\fBIconDirectory\fP \fIstring\fP" 8 This variable specifies the directory that should be searched if -if a bitmap file cannot be found in any of the directories +a bitmap file cannot be found in any of the directories in the \fBbitmapFilePath\fP resource. .IP "\fBIconFont\fP \fIstring\fP" 8 This variable specifies the font to be used to display icon names within @@ -782,7 +779,7 @@ If the optional \fIwin-list\fP is given, only requests on those windows will be ignored. This is typically used to prevent applications from relentlessly popping themselves to the front of the window stack. -.IP "\fBNoTitle\fP [{ \fIwin-list\fP }] " 8 +.IP "\fBNoTitle\fP [{ \fIwin-list\fP }]" 8 This variable indicates that windows should not have titlebars. If the optional \fIwin-list\fP is given, only those windows will not have titlebars. @@ -888,7 +885,7 @@ It can always be brought up using the This variable indicates that entries in the icon manager should be sorted alphabetically rather than by simply appending new windows to the end. -.IP "\fBSqueezeTitle\fP [{ \fIsqueeze-list\fP }] " 8 +.IP "\fBSqueezeTitle\fP [{ \fIsqueeze-list\fP }]" 8 This variable indicates that \fItwm\fP should attempt to use the SHAPE extension to make titlebars occupy only as much screen space as they need, rather than extending all the way across the top of the window. @@ -909,7 +906,7 @@ the numerator is positive, and right to left if negative. A denominator of 0 indicates that the numerator should be measured in pixels. For -convenience, the ratio 0/0 is the same as 1/2 for \fBcenter\fP and -1/1 +convenience, the ratio 0/0 is the same as 1/2 for \fBcenter\fP and \-1/1 for \fBright\fP. For example: .RS 5 @@ -927,13 +924,13 @@ For example: .IP The \fBDontSqueezeTitle\fP list can be used to turn off squeezing on certain titles. -.IP "\fBStartIconified\fP [{ \fIwin-list\fP }] " 8 +.IP "\fBStartIconified\fP [{ \fIwin-list\fP }]" 8 This variable indicates that client windows should initially be left as icons until explicitly deiconified by the user. If the optional \fIwin-list\fP is given, only those windows will be started iconic. This is useful for -programs that do not support an \fI-iconic\fP command line option or +programs that do not support an \fI\-iconic\fP command line option or resource. .IP "\fBTitleBackground\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 This variable specifies the background color used in titlebars, @@ -973,7 +970,7 @@ in the \fBIcons\fP list. This variable specifies whether or not \fItwm\fP should honor program-requested locations (given by the \fBPPosition\fP flag in the WM_NORMAL_HINTS property) in the absence of a user-specified position. -The argument \fIstring\fP may have one of three values: \fB"off"\fP +The argument \fIstring\fP may have one of three values: \fB"off"\fP (the default) indicating that \fItwm\fP should ignore the program-supplied position, @@ -1003,7 +1000,7 @@ This variable specifies the value to use when drawing window outlines for moving and resizing. This should be set to a value that will result in a variety of -of distinguishable colors when exclusive-or'ed with the contents of the +distinguishable colors when exclusive-or'ed with the contents of the user's typical screen. Setting this variable to 1 often gives nice results if adjacent colors in the default colormap are distinct. @@ -1032,7 +1029,6 @@ from the \fBTwmWindows\fP menu. If this variable is not set, the window will be deiconified and raised. .SH BINDINGS -.PP After the desired variables have been set, functions may be attached titlebuttons and key and pointer buttons. Titlebuttons may be added @@ -1054,7 +1050,7 @@ or \fBRightTitleButton\fP "\fIbitmapname\fP" = \fIfunction\fP .Ee .LP -The \fIbitmapname\fP may refer to one of the built-in bitmaps +The \fIbitmapname\fP may refer to one of the built-in bitmaps (which are scaled to match \fBTitleFont\fP) by using the appropriate colon-prefixed name described above. .PP @@ -1202,7 +1198,7 @@ WM_DELETE_WINDOW messages, the keyboard bell will be rung indicating that the user should choose an alternative method. Note this is very different from \fBf.destroy\fP. -The intent here is to delete a single window, not +The intent here is to delete a single window, not necessarily the entire application. .IP "\fBf.deltastop\fP" 8 This function allows a user-defined function to be aborted if the pointer has @@ -1408,7 +1404,6 @@ selected window is refreshed. This function is similar to the \fBf.fullzoom\fP function, except that the only the height of the selected window is changed. .SH MENUS -.PP Functions may be grouped and interactively selected using pop-up (when bound to a pointer button) or pull-down (when associated with a titlebutton) menus. @@ -1469,7 +1464,7 @@ left of the name when the window is iconified. By default, clicking on an entry in the icon manager performs \fBf.iconify\fP. To change the actions taken in the icon manager, use the -the \fBiconmgr\fP context when specifying button and keyboard bindings. +\fBiconmgr\fP context when specifying button and keyboard bindings. .PP Moving the pointer into the icon manager also directs keyboard focus to the indicated window (setting the focus explicitly or else sending synthetic @@ -1492,7 +1487,6 @@ If \fBIconifyByUnmapping\fP is on and windows are listed in they may be lost if they are iconified and no bindings to \fBf.menu "TwmWindows"\fP or \fBf.warpto\fP are setup. .SH FILES -.PP .nf .I $HOME/.twmrc. .I $HOME/.twmrc @@ -1508,10 +1502,10 @@ This variable is used as the prefix for files that begin with a tilde and for locating the \fItwm\fP startup file. .SH "SEE ALSO" .PP -X(__miscmansuffix__), -Xserver(__appmansuffix__), -xdm(__appmansuffix__), -xrdb(__appmansuffix__) +\fBX\fP(__miscmansuffix__), +\fBXserver\fP(__appmansuffix__), +\fBxdm\fP(__appmansuffix__), +\fBxrdb\fP(__appmansuffix__) .SH AUTHORS Tom LaStrange, Solbourne Computer; Jim Fulton, MIT X Consortium; Steve Pitschke, Stardent Computer; Keith Packard, MIT X Consortium; -- cgit v1.2.3 From 49e2c2127743e702154bc4efc040be7bfaaf6433 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Wed, 17 Jun 2020 15:07:37 -0400 Subject: adapted/updated patch from Debian #956434 Signed-off-by: Thomas E. Dickey --- man/twm.man | 66 ++++++++++++++++++++++++++++--------------------------------- 1 file changed, 30 insertions(+), 36 deletions(-) diff --git a/man/twm.man b/man/twm.man index 6926abf..35ea30f 100644 --- a/man/twm.man +++ b/man/twm.man @@ -56,8 +56,8 @@ key and pointer button bindings. This program is usually started by the user's session manager or startup script. When used -from \fIxdm(__appmansuffix__)\fP -or \fIxinit(__appmansuffix__)\fP without a session manager, +from \fBxdm\fP(__appmansuffix__) +or \fBxinit\fP(__appmansuffix__) without a session manager, \fItwm\fP is frequently executed in the foreground as the last client. When run this way, exiting \fItwm\fP causes the @@ -92,7 +92,7 @@ Just clicking in the title or highlight region raises the window without moving it. .PP When new windows are created, \fItwm\fP will honor any size and location -information requested by the user (usually through \fI-geometry\fP +information requested by the user (usually through \fI\-geometry\fP command line argument or resources for the individual applications). Otherwise, an outline of the window's default size, its titlebar, and lines dividing the @@ -109,7 +109,6 @@ will give the window its current position but attempt to make it long enough to touch the bottom the screen. .SH OPTIONS \fITwm\fP accepts the following command line options: -.PP .TP 8 .B \-display \fIdpy\fP This option specifies the X server to use. @@ -133,21 +132,20 @@ an unexpected X Error event is received. This can be useful when debugging applications but can be distracting in regular use. .SH CUSTOMIZATION -.PP Much of \fItwm\fP's appearance and behavior can be controlled by providing a startup file in one of the following locations (searched in order for each screen being managed when \fItwm\fP begins): .TP 8 -.B "$HOME/.twmrc.\fIscreennumber\fP" -The \fIscreennumber\fP is a small positive number (e.g. -0, 1, etc.) -representing the screen number (e.g., the last number in the DISPLAY environment +.B $HOME/.twmrc.\fIscreennumber\fP +The \fIscreennumber\fP is a small positive number (e.g., 0, 1, etc.) +representing the screen number +(e.g., the last number in the DISPLAY environment variable \fIhost:displaynum.screennum\fP) that would be used to contact that screen of the display. This is intended for displays with multiple screens of differing visual types. .TP 8 -.B "$HOME/.twmrc" +.B $HOME/.twmrc This is the usual name for an individual user's startup file. .TP 8 .B __datadir__/X11/twm/system.twmrc @@ -161,11 +159,11 @@ If no startup files are found, \fItwm\fP will use the built-in defaults described above. The only resource used by \fItwm\fP is \fIbitmapFilePath\fP for a colon-separated list of directories to search -when looking for bitmap files (for more information, see the \fIAthena -Widgets\fP manual and \fIxrdb(__appmansuffix__)\fP). +when looking for bitmap files (for more information, +see the \fIAthena Widgets\fP manual and \fBxrdb\fP(__appmansuffix__)). .PP \fITwm\fP startup files are logically broken up into three types of -specifications: \fIVariables\fP, \fIBindings\fP, \fIMenus\fP. +specifications: \fIVariables\fP, \fIBindings\fP, \fIMenus\fP. The \fIVariables\fP section must come first and is used to describe the fonts, colors, cursors, border widths, icon and window placement, highlighting, @@ -185,7 +183,6 @@ A pound sign (#) outside of a string causes the remainder of the line in which the character appears to be treated as a comment. .SH VARIABLES -.PP Many of the aspects of \fItwm\fP's user interface are controlled by variables that may be set in the user's startup file. Some of the options are @@ -227,7 +224,7 @@ prepend the user's directory tilde (~). If, instead, the first character is a colon (:), the name is assumed to refer to one of the internal bitmaps that are used to -create the default titlebars symbols: \fB:xlogo\fP +create the default titlebars symbols: \fB:xlogo\fP or \fB:delete\fP (both refer to the X logo), \fB:dot\fP or \fB:iconify\fP (both refer to the dot), \fB:resize\fP (the nested squares used by the resize button), @@ -290,7 +287,7 @@ and may only be given within a \fBGrayscale\fP or \fBMonochrome\fP list. The optional \fIwincolorlist\fP allows per-window colors to be specified. -The default is "white". +The default is "white". .IP "\fBBorderTileForeground\fP \fIstring\fP [{ \fIwincolorlist\fP }]" 8 This variable specifies the default foreground color in the gray pattern used in unhighlighted borders (only @@ -395,7 +392,7 @@ from bitmap files, the following syntax is used instead: .Ee .IP The \fIimage\fP and \fImask\fP strings specify the names of files containing -the glyph image and mask in \fIbitmap(__appmansuffix__)\fP form. +the glyph image and mask in \fBbitmap\fP(__appmansuffix__) form. The bitmap files are located in the same manner as icon bitmap files. The following example shows the default cursor definitions: .RS 5 @@ -439,7 +436,7 @@ as icons while other windows are handled by the icon manager. This variable indicates that windows should not be allowed to be moved off the screen. It can be overridden by the \fBf.forcemove\fP function. -.IP "\fBDontSqueezeTitle\fP [{ \fIwin-list\fP }] " 8 +.IP "\fBDontSqueezeTitle\fP [{ \fIwin-list\fP }]" 8 This variable indicates that titlebars should not be squeezed to their minimum size as described under \fBSqueezeTitle\fP below. If the optional window list is supplied, only those windows will be @@ -483,7 +480,7 @@ icon windows. The default is 2. .IP "\fBIconDirectory\fP \fIstring\fP" 8 This variable specifies the directory that should be searched if -if a bitmap file cannot be found in any of the directories +a bitmap file cannot be found in any of the directories in the \fBbitmapFilePath\fP resource. .IP "\fBIconFont\fP \fIstring\fP" 8 This variable specifies the font to be used to display icon names within @@ -782,7 +779,7 @@ If the optional \fIwin-list\fP is given, only requests on those windows will be ignored. This is typically used to prevent applications from relentlessly popping themselves to the front of the window stack. -.IP "\fBNoTitle\fP [{ \fIwin-list\fP }] " 8 +.IP "\fBNoTitle\fP [{ \fIwin-list\fP }]" 8 This variable indicates that windows should not have titlebars. If the optional \fIwin-list\fP is given, only those windows will not have titlebars. @@ -888,7 +885,7 @@ It can always be brought up using the This variable indicates that entries in the icon manager should be sorted alphabetically rather than by simply appending new windows to the end. -.IP "\fBSqueezeTitle\fP [{ \fIsqueeze-list\fP }] " 8 +.IP "\fBSqueezeTitle\fP [{ \fIsqueeze-list\fP }]" 8 This variable indicates that \fItwm\fP should attempt to use the SHAPE extension to make titlebars occupy only as much screen space as they need, rather than extending all the way across the top of the window. @@ -909,7 +906,7 @@ the numerator is positive, and right to left if negative. A denominator of 0 indicates that the numerator should be measured in pixels. For -convenience, the ratio 0/0 is the same as 1/2 for \fBcenter\fP and -1/1 +convenience, the ratio 0/0 is the same as 1/2 for \fBcenter\fP and \-1/1 for \fBright\fP. For example: .RS 5 @@ -927,13 +924,13 @@ For example: .IP The \fBDontSqueezeTitle\fP list can be used to turn off squeezing on certain titles. -.IP "\fBStartIconified\fP [{ \fIwin-list\fP }] " 8 +.IP "\fBStartIconified\fP [{ \fIwin-list\fP }]" 8 This variable indicates that client windows should initially be left as icons until explicitly deiconified by the user. If the optional \fIwin-list\fP is given, only those windows will be started iconic. This is useful for -programs that do not support an \fI-iconic\fP command line option or +programs that do not support an \fI\-iconic\fP command line option or resource. .IP "\fBTitleBackground\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 This variable specifies the background color used in titlebars, @@ -973,7 +970,7 @@ in the \fBIcons\fP list. This variable specifies whether or not \fItwm\fP should honor program-requested locations (given by the \fBPPosition\fP flag in the WM_NORMAL_HINTS property) in the absence of a user-specified position. -The argument \fIstring\fP may have one of three values: \fB"off"\fP +The argument \fIstring\fP may have one of three values: \fB"off"\fP (the default) indicating that \fItwm\fP should ignore the program-supplied position, @@ -1003,7 +1000,7 @@ This variable specifies the value to use when drawing window outlines for moving and resizing. This should be set to a value that will result in a variety of -of distinguishable colors when exclusive-or'ed with the contents of the +distinguishable colors when exclusive-or'ed with the contents of the user's typical screen. Setting this variable to 1 often gives nice results if adjacent colors in the default colormap are distinct. @@ -1032,7 +1029,6 @@ from the \fBTwmWindows\fP menu. If this variable is not set, the window will be deiconified and raised. .SH BINDINGS -.PP After the desired variables have been set, functions may be attached titlebuttons and key and pointer buttons. Titlebuttons may be added @@ -1054,7 +1050,7 @@ or \fBRightTitleButton\fP "\fIbitmapname\fP" = \fIfunction\fP .Ee .LP -The \fIbitmapname\fP may refer to one of the built-in bitmaps +The \fIbitmapname\fP may refer to one of the built-in bitmaps (which are scaled to match \fBTitleFont\fP) by using the appropriate colon-prefixed name described above. .PP @@ -1202,7 +1198,7 @@ WM_DELETE_WINDOW messages, the keyboard bell will be rung indicating that the user should choose an alternative method. Note this is very different from \fBf.destroy\fP. -The intent here is to delete a single window, not +The intent here is to delete a single window, not necessarily the entire application. .IP "\fBf.deltastop\fP" 8 This function allows a user-defined function to be aborted if the pointer has @@ -1408,7 +1404,6 @@ selected window is refreshed. This function is similar to the \fBf.fullzoom\fP function, except that the only the height of the selected window is changed. .SH MENUS -.PP Functions may be grouped and interactively selected using pop-up (when bound to a pointer button) or pull-down (when associated with a titlebutton) menus. @@ -1469,7 +1464,7 @@ left of the name when the window is iconified. By default, clicking on an entry in the icon manager performs \fBf.iconify\fP. To change the actions taken in the icon manager, use the -the \fBiconmgr\fP context when specifying button and keyboard bindings. +\fBiconmgr\fP context when specifying button and keyboard bindings. .PP Moving the pointer into the icon manager also directs keyboard focus to the indicated window (setting the focus explicitly or else sending synthetic @@ -1492,7 +1487,6 @@ If \fBIconifyByUnmapping\fP is on and windows are listed in they may be lost if they are iconified and no bindings to \fBf.menu "TwmWindows"\fP or \fBf.warpto\fP are setup. .SH FILES -.PP .nf .I $HOME/.twmrc. .I $HOME/.twmrc @@ -1508,10 +1502,10 @@ This variable is used as the prefix for files that begin with a tilde and for locating the \fItwm\fP startup file. .SH "SEE ALSO" .PP -X(__miscmansuffix__), -Xserver(__appmansuffix__), -xdm(__appmansuffix__), -xrdb(__appmansuffix__) +\fBX\fP(__miscmansuffix__), +\fBXserver\fP(__appmansuffix__), +\fBxdm\fP(__appmansuffix__), +\fBxrdb\fP(__appmansuffix__) .SH AUTHORS Tom LaStrange, Solbourne Computer; Jim Fulton, MIT X Consortium; Steve Pitschke, Stardent Computer; Keith Packard, MIT X Consortium; -- cgit v1.2.3 From 2741e9b381570f362732061dbca7835c8c185e9b Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Wed, 17 Jun 2020 15:27:52 -0400 Subject: eliminate some unnecessary(?) goto statements Signed-off-by: Thomas E. Dickey --- src/twm.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/twm.c b/src/twm.c index d9a8f6c..a8d1c2f 100644 --- a/src/twm.c +++ b/src/twm.c @@ -181,8 +181,7 @@ static char *atom_names[11] = { #ifdef XPRINT /* |hasExtension()| and |IsPrintScreen()| have been stolen from * xc/programs/xdpyinfo/xdpyinfo.c */ -static - Bool +static Bool hasExtension(Display *dpy, char *extname) { int num_extensions, i; @@ -195,8 +194,7 @@ hasExtension(Display *dpy, char *extname) return i != num_extensions; } -static - Bool +static Bool IsPrintScreen(Screen *s) { Display *dpy = XDisplayOfScreen(s); @@ -219,6 +217,17 @@ IsPrintScreen(Screen *s) } #endif /* XPRINT */ +static void +usage(void) +{ + fprintf(stderr, "usage: %s [-display dpy] [-f file] [-s] [-q] [-v]" +#ifdef XPRINT + " [-noprint]" +#endif /* XPRINT */ + " [-clientId id] [-restore file]\n", ProgramName); + exit(1); +} + /*********************************************************************** * * Procedure: @@ -251,9 +260,9 @@ main(int argc, char *argv[]) switch (argv[i][1]) { case 'd': /* -display dpy */ if (strcmp(&argv[i][1], "display")) - goto usage; + usage(); if (++i >= argc) - goto usage; + usage(); display_name = argv[i]; continue; case 's': /* -single */ @@ -262,13 +271,13 @@ main(int argc, char *argv[]) #ifdef XPRINT case 'n': /* -noprint */ if (strcmp(&argv[i][1], "noprint")) - goto usage; + usage(); NoPrintscreens = True; continue; #endif /* XPRINT */ case 'f': /* -file twmrcfilename */ if (++i >= argc) - goto usage; + usage(); InitFile = argv[i]; continue; case 'v': /* -verbose */ @@ -276,16 +285,16 @@ main(int argc, char *argv[]) continue; case 'c': /* -clientId */ if (strcmp(&argv[i][1], "clientId")) - goto usage; + usage(); if (++i >= argc) - goto usage; + usage(); client_id = argv[i]; continue; case 'r': /* -restore */ if (strcmp(&argv[i][1], "restore")) - goto usage; + usage(); if (++i >= argc) - goto usage; + usage(); restore_filename = argv[i]; continue; case 'q': /* -quiet */ @@ -293,13 +302,7 @@ main(int argc, char *argv[]) continue; } } - usage: - fprintf(stderr, "usage: %s [-display dpy] [-f file] [-s] [-q] [-v]" -#ifdef XPRINT - " [-noprint]" -#endif /* XPRINT */ - " [-clientId id] [-restore file]\n", ProgramName); - exit(1); + usage(); } loc = setlocale(LC_ALL, ""); -- cgit v1.2.3 From 8f1b54ee608af86d448a9981257fa58727dfe6fc Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Wed, 17 Jun 2020 15:56:04 -0400 Subject: add "-V" version-message Signed-off-by: Thomas E. Dickey --- man/twm.man | 10 ++++++++-- src/twm.c | 20 ++++++++++++-------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/man/twm.man b/man/twm.man index 35ea30f..619ddaa 100644 --- a/man/twm.man +++ b/man/twm.man @@ -43,8 +43,11 @@ .SH NAME twm \- Tab Window Manager for the X Window System .SH SYNTAX -\fBtwm \fP[ \fB\-display\fP \fIdpy\fP ] [ \fB\-s\fP ] -[ \fB\-f\fP \fIinitfile\fP ] [ \fB\-v\fP ] +\fBtwm \fP[ \fB\-display\fP \fIdpy\fP ] +[ \fB\-s\fP ] +[ \fB\-f\fP \fIinitfile\fP ] +[ \fB\-v\fP ] +[ \fB\-V\fP ] .SH DESCRIPTION \fITwm\fP is a window manager for the X Window System. It provides @@ -131,6 +134,9 @@ This option indicates that \fItwm\fP should print error messages whenever an unexpected X Error event is received. This can be useful when debugging applications but can be distracting in regular use. +.TP 8 +.B \-V +Tell \fItwm\fP to print its version to the standard output, and exit. .SH CUSTOMIZATION Much of \fItwm\fP's appearance and behavior can be controlled by providing a startup file in one of the following locations (searched in order for diff --git a/src/twm.c b/src/twm.c index a8d1c2f..a981ac4 100644 --- a/src/twm.c +++ b/src/twm.c @@ -75,6 +75,7 @@ in this Software without prior written authorization from The Open Group. #include "screen.h" #include "parse.h" #include "session.h" +#include "version.h" #include #include #include @@ -220,12 +221,12 @@ IsPrintScreen(Screen *s) static void usage(void) { - fprintf(stderr, "usage: %s [-display dpy] [-f file] [-s] [-q] [-v]" + fprintf(stderr, "usage: %s [-display dpy] [-f file] [-s] [-q] [-v] [-V]" #ifdef XPRINT " [-noprint]" #endif /* XPRINT */ " [-clientId id] [-restore file]\n", ProgramName); - exit(1); + exit(EXIT_FAILURE); } /*********************************************************************** @@ -258,6 +259,9 @@ main(int argc, char *argv[]) for (i = 1; i < argc; i++) { if (argv[i][0] == '-') { switch (argv[i][1]) { + case 'V': + printf("%s %s\n", ProgramName, Version); + exit(EXIT_SUCCESS); case 'd': /* -display dpy */ if (strcmp(&argv[i][1], "display")) usage(); @@ -355,14 +359,14 @@ main(int argc, char *argv[]) NULL, 0, &zero, NULL))) { fprintf(stderr, "%s: unable to open display \"%s\"\n", ProgramName, XDisplayName(display_name)); - exit(1); + exit(EXIT_FAILURE); } if (fcntl(ConnectionNumber(dpy), F_SETFD, 1) == -1) { fprintf(stderr, "%s: unable to mark display connection as close-on-exec\n", ProgramName); - exit(1); + exit(EXIT_FAILURE); } if (restore_filename) @@ -402,7 +406,7 @@ main(int argc, char *argv[]) fprintf(stderr, "%s: Unable to allocate memory for screen list, exiting.\n", ProgramName); - exit(1); + exit(EXIT_FAILURE); } numManaged = 0; PreviousScreen = DefaultScreen(dpy); @@ -683,7 +687,7 @@ main(int argc, char *argv[]) if (MultiScreen && NumScreens > 0) fprintf(stderr, "%s: unable to find any unmanaged %sscreens.\n", ProgramName, NoPrintscreens ? "" : "video "); - exit(1); + exit(EXIT_FAILURE); } (void) ConnectToSessionManager(client_id); @@ -692,7 +696,7 @@ main(int argc, char *argv[]) HandlingEvents = TRUE; InitEvents(); HandleEvents(); - exit(0); + exit(EXIT_SUCCESS); } /** @@ -948,7 +952,7 @@ Done(XtPointer client_data _X_UNUSED, XtSignalId *si2 _X_UNUSED) Reborder(CurrentTime); XCloseDisplay(dpy); } - exit(0); + exit(EXIT_SUCCESS); } /* -- cgit v1.2.3 From 46e7ae05d6fdd700364cb48e27f57e249e958f95 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Wed, 17 Jun 2020 16:50:52 -0400 Subject: allow most options to be long/abbreviatable for consistency, and document (except for the print-extension) all of the options Signed-off-by: Thomas E. Dickey --- man/twm.man | 53 +++++++++++++++++++++++++++++++++++------------------ src/twm.c | 30 ++++++++++++++++++++++++++---- 2 files changed, 61 insertions(+), 22 deletions(-) diff --git a/man/twm.man b/man/twm.man index 619ddaa..c54e38e 100644 --- a/man/twm.man +++ b/man/twm.man @@ -43,11 +43,7 @@ .SH NAME twm \- Tab Window Manager for the X Window System .SH SYNTAX -\fBtwm \fP[ \fB\-display\fP \fIdpy\fP ] -[ \fB\-s\fP ] -[ \fB\-f\fP \fIinitfile\fP ] -[ \fB\-v\fP ] -[ \fB\-V\fP ] +\fBtwm \fP[ \fIoptions\fP ] .SH DESCRIPTION \fITwm\fP is a window manager for the X Window System. It provides @@ -111,27 +107,48 @@ Clicking pointer Button3 (usually the right pointer button) will give the window its current position but attempt to make it long enough to touch the bottom the screen. .SH OPTIONS -\fITwm\fP accepts the following command line options: +\fITwm\fP accepts several command line options, +which may be abbreviated, e.g., +\*(``\fB\-d\fP\*('' for +\*(``\fB\-display\fP\*('' +(but upper/lower-case are different): +.TP 8 +.B \-clientId \fIID\fP +Each time \fItwm\fP starts, it calls +\fBSmcOpenConnection\fP +to establish a new session. +It can be told to restart from a previous session by giving the previous +session's client-identifier. .TP 8 .B \-display \fIdpy\fP -This option specifies the X server to use. +Specify the X server to use. +.TP 8 +.B \-file \fIfilename\fP +Specify the name of the startup file to use. +By default, +\fItwm\fP will look in the user's home directory for files +named \fI.twmrc.num\fP (where \fInum\fP is a screen number) or \fI.twmrc\fP. +.TP 8 +.B \-quiet +Tells \fItwm\fP that it should not print error messages when +it receives unexpected X Error events. .TP 8 -.B \-s -This option indicates that only the default screen (as specified by +.B \-restore \fIfilename\fP +When \fItwm\fP's session is stopped, it attempts to save the current +window configuration. +Use this option to tell \fItwm\fP to read this file for that information +when starting (or restarting) a session. +.TP 8 +.B \-single +Tells \fItwm\fP that only the default screen (as specified by \fB\-display\fP or by the \fBDISPLAY\fP environment variable) should be managed. By default, \fItwm\fP will attempt to manage all screens on the display. .TP 8 -.B \-f \fIfilename\fP -This option specifies the name of the startup file to use. -By default, -\fItwm\fP will look in the user's home directory for files -named \fI.twmrc.num\fP (where \fInum\fP is a screen number) or \fI.twmrc\fP. -.TP 8 -.B \-v -This option indicates that \fItwm\fP should print error messages whenever -an unexpected X Error event is received. +.B \-verbose +Tells \fItwm\fP that it should print error messages whenever +it receives an unexpected X Error event. This can be useful when debugging applications but can be distracting in regular use. .TP 8 diff --git a/src/twm.c b/src/twm.c index a981ac4..ce67806 100644 --- a/src/twm.c +++ b/src/twm.c @@ -229,6 +229,20 @@ usage(void) exit(EXIT_FAILURE); } +static Bool +brief_opt(const char *param, const char *option) +{ + size_t have = strlen(++param); + size_t want = strlen(option); + Bool result = False; + + if (have <= want) { + if (!strncmp(param, option, have)) + result = True; + } + return result; +} + /*********************************************************************** * * Procedure: @@ -263,45 +277,53 @@ main(int argc, char *argv[]) printf("%s %s\n", ProgramName, Version); exit(EXIT_SUCCESS); case 'd': /* -display dpy */ - if (strcmp(&argv[i][1], "display")) + if (!brief_opt(argv[i], "display")) usage(); if (++i >= argc) usage(); display_name = argv[i]; continue; case 's': /* -single */ + if (!brief_opt(argv[i], "single")) + usage(); MultiScreen = FALSE; continue; #ifdef XPRINT case 'n': /* -noprint */ - if (strcmp(&argv[i][1], "noprint")) + if (!brief_opt(argv[i], "noprint")) usage(); NoPrintscreens = True; continue; #endif /* XPRINT */ case 'f': /* -file twmrcfilename */ + if (!brief_opt(argv[i], "file")) + usage(); if (++i >= argc) usage(); InitFile = argv[i]; continue; case 'v': /* -verbose */ + if (!brief_opt(argv[i], "verbose")) + usage(); PrintErrorMessages = True; continue; case 'c': /* -clientId */ - if (strcmp(&argv[i][1], "clientId")) + if (!brief_opt(argv[i], "clientId")) usage(); if (++i >= argc) usage(); client_id = argv[i]; continue; case 'r': /* -restore */ - if (strcmp(&argv[i][1], "restore")) + if (!brief_opt(argv[i], "restore")) usage(); if (++i >= argc) usage(); restore_filename = argv[i]; continue; case 'q': /* -quiet */ + if (!brief_opt(argv[i], "quiet")) + usage(); PrintErrorMessages = False; continue; } -- cgit v1.2.3 From d2b4f0598086d4dd5caf3cdc218d0f97c37229ac Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Thu, 18 Jun 2020 04:22:11 -0400 Subject: remove clutter not needed with Xorg --- package/debian/README.source | 49 ------- package/debian/changelog | 149 --------------------- package/debian/compat | 1 - package/debian/control | 30 ----- package/debian/copyright | 77 ----------- package/debian/patches/01_debian_system_twmrc.diff | 99 -------------- package/debian/patches/series | 1 - package/debian/rules | 24 ---- package/debian/twm.README.Debian | 20 --- package/debian/twm.desktop | 69 ---------- package/debian/twm.examples | 3 - package/debian/twm.install | 4 - package/debian/twm.links | 1 - package/debian/twm.menu | 6 - package/debian/twm.menu-method | 37 ----- package/debian/twm.postinst | 18 --- package/debian/twm.postrm | 20 --- package/debian/twm.prerm | 18 --- package/debian/upstream/signing-key.asc | 60 --------- package/debian/watch | 4 - 20 files changed, 690 deletions(-) delete mode 100644 package/debian/README.source delete mode 100644 package/debian/changelog delete mode 100644 package/debian/compat delete mode 100644 package/debian/control delete mode 100644 package/debian/copyright delete mode 100644 package/debian/patches/01_debian_system_twmrc.diff delete mode 100644 package/debian/patches/series delete mode 100755 package/debian/rules delete mode 100644 package/debian/twm.README.Debian delete mode 100644 package/debian/twm.desktop delete mode 100644 package/debian/twm.examples delete mode 100644 package/debian/twm.install delete mode 100644 package/debian/twm.links delete mode 100644 package/debian/twm.menu delete mode 100644 package/debian/twm.menu-method delete mode 100644 package/debian/twm.postinst delete mode 100644 package/debian/twm.postrm delete mode 100644 package/debian/twm.prerm delete mode 100644 package/debian/upstream/signing-key.asc delete mode 100644 package/debian/watch diff --git a/package/debian/README.source b/package/debian/README.source deleted file mode 100644 index 4ecd5e6..0000000 --- a/package/debian/README.source +++ /dev/null @@ -1,49 +0,0 @@ ------------------------------------------------------- -Quick Guide To Patching This Package For The Impatient ------------------------------------------------------- - -1. Make sure you have quilt installed -2. Unpack the package as usual with "dpkg-source -x" -3. Run the "patch" target in debian/rules -4. Create a new patch with "quilt new" (see quilt(1)) -5. Edit all the files you want to include in the patch with "quilt edit" - (see quilt(1)). -6. Write the patch with "quilt refresh" (see quilt(1)) -7. Run the "clean" target in debian/rules - -Alternatively, instead of using quilt directly, you can drop the patch in to -debian/patches and add the name of the patch to debian/patches/series. - ------------------------------------- -Guide To The X Strike Force Packages ------------------------------------- - -The X Strike Force team maintains X packages in git repositories on -git.debian.org in the pkg-xorg subdirectory. Most upstream packages -are actually maintained in git repositories as well, so they often -just need to be pulled into git.debian.org in a "upstream-*" branch. -Otherwise, the upstream sources are manually installed in the Debian -git repository. - -The .orig.tar.gz upstream source file could be generated using this -"upstream-*" branch in the Debian git repository but it is actually -copied from upstream tarballs directly. - -Due to X.org being highly modular, packaging all X.org applications -as their own independent packages would have created too many Debian -packages. For this reason, some X.org applications have been grouped -into larger packages: xutils, xutils-dev, x11-apps, x11-session-utils, -x11-utils, x11-xfs-utils, x11-xkb-utils, x11-xserver-utils. -Most packages, including the X.org server itself and all libraries -and drivers are, however maintained independently. - -The Debian packaging is added by creating the "debian-*" git branch -which contains the aforementioned "upstream-*" branch plus the debian/ -repository files. -When a patch has to be applied to the Debian package, two solutions -are involved: -* If the patch is available in one of the upstream branches, it - may be git'cherry-picked into the Debian repository. In this - case, it appears directly in the .diff.gz. -* Otherwise, the patch is added to debian/patches/ which is managed - with quilt as documented in /usr/share/doc/quilt/README.source. diff --git a/package/debian/changelog b/package/debian/changelog deleted file mode 100644 index 46efb45..0000000 --- a/package/debian/changelog +++ /dev/null @@ -1,149 +0,0 @@ -twm (1:1.0.10-1) unstable; urgency=medium - - * Team upload. - * Update Vcs-* control fields to point at salsa. - * Update www.gnu.org and xorg.freedesktop.org URLs in packaging to https. - * Delete XSFBS-related cruft from README.source. - * Update upstream git URL to point at gitlab.fdo. - * New upstream release - - -- Julien Cristau Thu, 06 Sep 2018 15:16:24 +0200 - -twm (1:1.0.9-1) unstable; urgency=medium - - * Let uscan verify tarball signatures. - * New upstream release. - - -- Julien Cristau Sun, 03 May 2015 15:48:37 +0200 - -twm (1:1.0.8-1) unstable; urgency=medium - - * New upstream release. - * Fix Vcs-Browser control field (closes: #736408). Thanks, Mateusz Łukasik! - * Rewrite debian/rules using dh, bump compat to 9, drop xsfbs. - * Update 01_debian_system_twmrc.diff. - * Disable silent build rules. - - -- Julien Cristau Sun, 13 Jul 2014 11:13:12 +0200 - -twm (1:1.0.6-1) unstable; urgency=low - - * Kill obsolete svn $Id$ tags from packaging. - * postinst: drop obsolete cleanup for /usr/bin/X11/twm x-window-manager - alternative. - * Remove myself from Uploaders. - * Rename the build directory to not include DEB_BUILD_GNU_TYPE for no - good reason. Thanks, Colin Watson! - * New upstream release. - * Update debian/copyright from COPYING. - * Various debian/rules updates: - - use $(filter) instead of $(findstring) to parse DEB_BUILD_OPTIONS - - enable parallel builds - - fix rules dependencies - - drop useless --enable-man-pages=3 configure flag - * Add build-arch and (empty) build-indep targets. - * Drop Pre-Depends on x11-common. - * Remove David Nusinow and Brice Goglin from Uploaders. Thanks for your - work! - * Bump Standards-Version to 3.9.1. - * Run autoreconf at build time. Delete generated files on clean. - Build-depend on xutils-dev and automake. - * Refresh 01_debian_system_twmrc.diff. - * Don't call dh_makeshlibs [lintian]. - - -- Julien Cristau Wed, 09 Feb 2011 17:42:27 +0100 - -twm (1:1.0.4-2) unstable; urgency=low - - * Update patches to not require -p0 and pull newest xsfbs, closes: #485267. - * Add myself to Uploaders. - - -- Brice Goglin Sat, 14 Jun 2008 16:08:36 +0200 - -twm (1:1.0.4-1) unstable; urgency=low - - * New upstream release - * Fixup patch 01_debian_system_twmrc.diff - * Remove -1 debian revisions from build-deps to please lintian. - * Add Vcs-* control fields. - - -- Julien Cristau Sat, 08 Mar 2008 03:59:33 +0100 - -twm (1:1.0.3-3) unstable; urgency=low - - [ Julien Cristau ] - * debian/twm.menu-method: add a "supported" entry for the wm menu, to make - it possible to switch to another window manager from twm, closes: #409111. - * Menu transition: "WindowManagers" renamed to "Window Managers". - * Add myself to Uploaders. - * Bump Standards-Version to 3.7.3. - - [ Brice Goglin ] - * Add a /usr/share/xsessions/twm.desktop (stolen from kdm's private - database) so that twm appears in the list of possible sessions in - all *dm that support it, thanks Christopher Martin, closes: #335071. - - -- Julien Cristau Sat, 12 Jan 2008 17:31:20 +0100 - -twm (1:1.0.3-2) unstable; urgency=low - - * Generate the maintainer scripts properly (so the x-window-manager - alternative is installed), and remove old transition code from - the XFree86 4.x days. - - -- Julien Cristau Fri, 08 Jun 2007 14:35:30 +0200 - -twm (1:1.0.3-1) unstable; urgency=low - - [ Julien Cristau ] - * New upstream release. - * Install the manpage as twm.1 instead of twm.1x and update - update-alternatives parameters (closes: #396940). - * Use dh_install --list-missing. - * Make sure twm looks for system.twmrc in /etc/X11/twm, not - /usr/share/X11/twm. - - [ Brice Goglin ] - * Drop useless -DLIBXCURSOR from debian/rules (closes: #384073). - - -- Julien Cristau Fri, 08 Jun 2007 01:03:48 +0200 - -twm (1:1.0.1-4) unstable; urgency=low - - * Run dh_install menu so that we actually install the menu method. Thanks - giacomo boffi for the report and Bill Allombert for the fix. - (closes: #364255) - * Add a pre-depends on x11-common so the upgrade from X11R6 goes smoothly. - Thanks Vasilis Vasaitis. (closes: #365913) - * Add outputencoding="ASCII"; to the menu-method the facilitate translations - of menus. Thanks Bill Allombert. - * Add quilt to build-depends - * Bump standards version to 3.7.2.0 - * Bump debhelper compat to version 5 - * Point the menu method at /usr/bin/install-menu rather than /usr/sbin. Also - bump the version of menu we depend on to >= 2.1.26, which implements this - change - - -- David Nusinow Sun, 21 May 2006 19:14:42 -0400 - -twm (1:1.0.1-3) unstable; urgency=low - - * Upload to unstable - - -- David Nusinow Tue, 4 Apr 2006 18:44:37 -0400 - -twm (1:1.0.1-2) experimental; urgency=low - - [ David Nusinow ] - * Add versioned build-depends on the modular X libs. Thanks Frank - Lichtenheld. (closes: #354098) - * Port patches from trunk - + debian/903_debian_system.twmrc.diff - - -- David Nusinow Sun, 26 Feb 2006 22:55:58 -0500 - -twm (1:1.0.1-1) experimental; urgency=low - - * First modular upload to Debian - - -- David Nusinow Sun, 19 Feb 2006 19:58:38 -0500 diff --git a/package/debian/compat b/package/debian/compat deleted file mode 100644 index ec63514..0000000 --- a/package/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/package/debian/control b/package/debian/control deleted file mode 100644 index 9c51437..0000000 --- a/package/debian/control +++ /dev/null @@ -1,30 +0,0 @@ -Source: twm -Section: x11 -Priority: optional -Maintainer: Debian X Strike Force -Build-Depends: - debhelper (>= 9), - dh-autoreconf, - pkg-config, - libx11-dev (>= 2:1.0.0-2), - libxext-dev (>= 1:1.0.0), - libxt-dev (>= 1:1.0.0), - libxmu-dev (>= 1:1.0.1), - bison, - flex, - quilt, - xutils-dev (>= 1:7.5+4), - automake, -Standards-Version: 3.9.1 -Vcs-Git: https://salsa.debian.org/xorg-team/app/twm.git -Vcs-Browser: https://salsa.debian.org/xorg-team/app/twm - -Package: twm -Architecture: any -Depends: menu (>= 2.1.26), ${shlibs:Depends}, ${misc:Depends} -Provides: x-window-manager -Description: Tab window manager - twm is a window manager for the X Window System. It provides title bars, - shaped windows, several forms of icon management, user-defined macro - functions, click-to-type and pointer-driven keyboard focus, and - user-specified key and pointer button bindings. diff --git a/package/debian/copyright b/package/debian/copyright deleted file mode 100644 index 8055d76..0000000 --- a/package/debian/copyright +++ /dev/null @@ -1,77 +0,0 @@ -This package was downloaded from -https://xorg.freedesktop.org/releases/individual/app/ - - -Copyright 1989, 1994, 1998 The Open Group -Copyright 2005 Hitachi, Ltd. - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - - Copyright 1988 by Evans & Sutherland Computer Corporation, - Salt Lake City, Utah - Cambridge, Massachusetts - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that copyright notice and this permis- -sion notice appear in supporting documentation, and that the -name of Evans & Sutherland not be used in advertising -in publicity pertaining to distribution of the software without -specific, written prior permission. - -EVANS & SUTHERLAND DISCLAIMs ALL WARRANTIES WITH REGARD -TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- -ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND -BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- -AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA -OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE -OR PERFORMANCE OF THIS SOFTWARE. - - - -Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the XFree86 Project shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from the -XFree86 Project. diff --git a/package/debian/patches/01_debian_system_twmrc.diff b/package/debian/patches/01_debian_system_twmrc.diff deleted file mode 100644 index c07b2d6..0000000 --- a/package/debian/patches/01_debian_system_twmrc.diff +++ /dev/null @@ -1,99 +0,0 @@ -From: Branden Robinson - -Fix system.twmrc to actually be useful and tabbed right, as well as add -the Debian menu. - -Index: twm/src/system.twmrc -=================================================================== ---- twm.orig/src/system.twmrc -+++ twm/src/system.twmrc -@@ -48,7 +48,8 @@ Function "move-or-iconify" { f.move f.de - # - # Set some useful bindings. Sort of uwm-ish, sort of simple-button-ish - # --Button1 = : root : f.menu "defops" -+Button1 = : root : f.menu "main" -+Button2 = : root : f.menu "windowops" - - Button1 = m : window|icon : f.function "move-or-lower" - Button2 = m : window|icon : f.iconify -@@ -66,25 +67,39 @@ Button2 = : iconmgr : f.iconify - # - # And a menus with the usual things - # --menu "defops" -+menu "main" - { --"Twm" f.title --"Iconify" f.iconify --"Resize" f.resize --"Move" f.move --"Raise" f.raise --"Lower" f.lower --"" f.nop --"Focus" f.focus --"Unfocus" f.unfocus --"Show Iconmgr" f.showiconmgr --"Hide Iconmgr" f.hideiconmgr --"" f.nop --"Xterm" f.exec "exec xterm &" --"" f.nop --"Kill" f.destroy --"Delete" f.delete --"" f.nop --"Restart" f.restart --"Exit" f.quit -+ "Main Menu" f.title -+ "Debian" f.menu "/Debian" -+ "" f.nop -+ "Show Icon Manager" f.showiconmgr -+ "Hide Icon Manager" f.hideiconmgr -+ "" f.nop -+ "Exit" f.menu "Quit-Verify" - } -+ -+menu "Quit-Verify" -+{ -+ "Really quit twm?" f.title -+ "No, restart twm" f.restart -+ "Yes, really quit" f.quit -+} -+ -+menu "windowops" -+{ -+ "Window Ops" f.title -+ "" f.nop -+ "Iconify" f.iconify -+ "Resize" f.resize -+ "Move" f.move -+ "Raise" f.raise -+ "Lower" f.lower -+ "" f.nop -+ "Focus" f.focus -+ "Unfocus" f.unfocus -+ "" f.nop -+ "Delete" f.delete -+ "Destroy" f.destroy -+} -+ -+include-menu-defs -Index: twm/src/Makefile.am -=================================================================== ---- twm.orig/src/Makefile.am -+++ twm/src/Makefile.am -@@ -24,13 +24,13 @@ AM_YFLAGS = -d - - bin_PROGRAMS = twm - --rcdir = ${datadir}/X11/twm -+rcdir = ${sysconfdir}/X11/twm - dist_rc_DATA = system.twmrc - - AM_CPPFLAGS = \ - -DXVENDORNAME=\"The\ X.Org\ Foundation\" \ - -DXORG_RELEASE=\"Release\ $(VERSION)\" \ -- -DSYSTEM_INIT_FILE=\"${rcdir}/system.twmrc\" -+ -DSYSTEM_INIT_FILE=\"$(rcdir)/system.twmrc\" - - AM_CFLAGS = $(TWM_CFLAGS) - twm_LDADD = $(TWM_LIBS) diff --git a/package/debian/patches/series b/package/debian/patches/series deleted file mode 100644 index dfa3912..0000000 --- a/package/debian/patches/series +++ /dev/null @@ -1 +0,0 @@ -01_debian_system_twmrc.diff diff --git a/package/debian/rules b/package/debian/rules deleted file mode 100755 index d755cc1..0000000 --- a/package/debian/rules +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/make -f -# debian/rules for the Debian twm package. -# Copyright © 2004 Scott James Remnant -# Copyright © 2005 Daniel Stone -# Copyright © 2005 David Nusinow - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -%: - dh $@ --with quilt,autoreconf --builddirectory=build/ --parallel - -override_dh_auto_configure: - dh_auto_configure -- --disable-silent-rules - -override_dh_auto_install: - dh_auto_install --destdir=debian/tmp - install -d debian/tmp/etc/X11/twm - install -m 644 src/system.twmrc debian/tmp/etc/X11/twm/system.twmrc-menu - install -d debian/tmp/usr/share/xsessions - install -m 644 debian/twm.desktop debian/tmp/usr/share/xsessions/twm.desktop - -override_dh_install: - dh_install --list-missing diff --git a/package/debian/twm.README.Debian b/package/debian/twm.README.Debian deleted file mode 100644 index df1bc30..0000000 --- a/package/debian/twm.README.Debian +++ /dev/null @@ -1,20 +0,0 @@ -Debian README for twm package -============================= - -Newcomers to the X Window System should first read the Debian X FAQ -(Frequently Asked Questions list): /usr/share/doc/x11-common/FAQ.gz. -You can view this file with your favorite pager program after decompressing -it. For example: - $ zcat /usr/share/doc/x11-common/FAQ.gz | pager - -For information on the /etc/X11/twm/system.twmrc file, see the twm(1) -manual page. Note that /etc/X11/twm/system.twmrc is auto-generated from -the /etc/X11/twm/system.twmrc-menu file, so as to be able to support the -Debian menu system. You should therefore make your customizations to -/etc/X11/twm/system.twmrc-menu. After the update-menu command is run, they -will appear in /etc/X11/twm/system.twmrc and be used by the twm binary. - -Some examples of .twmrc files from days of yore are available in -/usr/share/doc/twm/examples. - -vim:set ai et sts=4 sw=4 tw=80: diff --git a/package/debian/twm.desktop b/package/debian/twm.desktop deleted file mode 100644 index 6185545..0000000 --- a/package/debian/twm.desktop +++ /dev/null @@ -1,69 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Type=XSession -Exec=twm -TryExec=twm -Name=TWM -Name[eo]=TFA -Name[hi]=टीडबल्यूएम -Name[te]=టి డబ్ల్యు ఎం -Comment=The Tab Window Manager -Comment[af]=Die Tab venster bestuurder -Comment[ar]=مدير النوافذ Tab -Comment[be]=Кіраўнік вокнаў з укладкамі Tab Window Manager -Comment[bn]=দি ট্যাব উইণ্ডো ম্যানেজার -Comment[bs]=Tab Window Manager -Comment[ca]=El gestor de finestres Tab -Comment[csb]=Tab Window Manager -Comment[cy]=Y Trefnydd Ffenestri Tab -Comment[da]=Tab-vindueshåndtering -Comment[de]=Der Tab-Fenstermanager -Comment[el]=Ο διαχειριστής παραθύρων Tab -Comment[eo]=Taba fenestroadministrilo -Comment[es]=El Tab Window Manager -Comment[et]=Kaartidega aknahaldur -Comment[eu]=Tab leiho kudeatzailea -Comment[fa]=مدیر پنجرۀ تب -Comment[fi]=Välilehtiä tukeva ikkunaohjelma -Comment[fy]=De Ljepper Finster Behearder -Comment[gl]=O Xestor de Fiestras Tab -Comment[hi]=टैब विंडो प्रबंधक -Comment[hr]=Tab upravitelj prozora -Comment[hu]=Tab Window Manager ablakkezelő -Comment[is]=Tab gluggastjórinn -Comment[it]=Il Tab Window Manager -Comment[ja]=Tab 化ウィンドウマネージャ -Comment[kk]=Tab терезе менеджері -Comment[km]=កម្មវិធី​គ្រប់គ្រង​បង្អួច​ជា​ផ្ទាំង -Comment[lt]=Kortelių langų tvarkyklė -Comment[lv]=Tabu logu menedžeris -Comment[mk]=Tab Window Manager -Comment[mn]=Tab Цонхны удирдагч -Comment[ms]=Pengurus Tetingkap Tab -Comment[mt]=Tab Window Manager -Comment[nb]=Tab Vindusbehandler -Comment[nds]=De Tab-Finsterpleger -Comment[ne]=ट्याब सञ्झ्याल प्रबन्धक -Comment[nl]=De Tab Window Manager -Comment[nn]=Tab Window Manager -Comment[pa]=ਟੈਬ ਝਰੋਖਾ ਮੈਨੇਜਰ -Comment[pl]=Tab Window Manager -Comment[pt]=O Tab Window Manager -Comment[pt_BR]=O Gerenciador de Janelas de Abas -Comment[ro]=Tab Window Manager -Comment[ru]=Традиционный оконный менеджер системы X11 -Comment[rw]=Mugenga Dirishya Agafishi -Comment[se]=Tab-láse lásegieđahalli -Comment[sk]=Správca okien s kartami -Comment[sl]=Tab Window Manager, okenski upravitelj z zavihki -Comment[sv]=Flikfönsterhanteraren -Comment[ta]=டாப் சாளர மேலாளர் -Comment[te]=టాబ్ విండొ అభికర్త -Comment[tg]=Tab-и мудири тиреза -Comment[th]=Tab Window Manager -Comment[tr]=Tab Pencere Yöneticisi -Comment[tt]=X11 sistemendäge kebek tabaqlı täräzä-idäräçe -Comment[uk]=Tab Window Manager -Comment[vi]=Trình Quản lý Cửa sổ Thẻ -Comment[zh_CN]=标签式窗口管理器 -Comment[zh_TW]=Tab 視窗管理程式 diff --git a/package/debian/twm.examples b/package/debian/twm.examples deleted file mode 100644 index 8a0d993..0000000 --- a/package/debian/twm.examples +++ /dev/null @@ -1,3 +0,0 @@ -sample-twmrc/jim.twmrc -sample-twmrc/keith.twmrc -sample-twmrc/lemke.twmrc diff --git a/package/debian/twm.install b/package/debian/twm.install deleted file mode 100644 index cb49f98..0000000 --- a/package/debian/twm.install +++ /dev/null @@ -1,4 +0,0 @@ -etc/X11/twm/system.twmrc-menu -usr/bin/twm -usr/share/man/man1/twm.1 -usr/share/xsessions/twm.desktop diff --git a/package/debian/twm.links b/package/debian/twm.links deleted file mode 100644 index 26a7121..0000000 --- a/package/debian/twm.links +++ /dev/null @@ -1 +0,0 @@ -etc/X11/twm usr/lib/X11/twm diff --git a/package/debian/twm.menu b/package/debian/twm.menu deleted file mode 100644 index 8016dd5..0000000 --- a/package/debian/twm.menu +++ /dev/null @@ -1,6 +0,0 @@ -?package(twm):\ - needs="wm"\ - section="Window Managers"\ - longtitle="Twm: Tab Window Manager"\ - title="Twm"\ - command="twm" diff --git a/package/debian/twm.menu-method b/package/debian/twm.menu-method deleted file mode 100644 index d3dbaae..0000000 --- a/package/debian/twm.menu-method +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/install-menu - -# -*- mode: shell-script; -*- -#I need menu-1! -# -#NOTE: the first line of this script _must_ be -# equal to "#!/usr/sbin/install-menu", otherwise update-menus -# will feed this script old-compat-mode data. -# -#More info: /usr/doc/menu/html. -# -compat="menu-1" - -!include menu.h - -compat="menu-2" -outputencoding="ASCII"; - -function q($com)=esc($com,"\""); -function f($com)=" \"" q(title()) "\" f.exec \"" q($com) " &\"\n"; - -supported; - x11= f($command); - text=f(term()); - wm=" \"" q(title()) "\" f.startwm \"" q($command) "\"\n"; -# x11 = " \"" $title "\" f.exec \""$command " &\"\n"; -# text= " \"" $title "\" f.exec \"xterm -title \\\"" -# $title "\\\" -e " esc($command,"\"") " &\"\n"; -endsupported; -startmenu= "menu \"" q($section) "\"\n{\n"; -endmenu= "}\n"; -submenutitle=" \"" q(title()) "\" f.menu \"" q($section) "\"\n"; -genmenu= "menudefs.hook"; -rcfile= "system.twmrc"; -examplercfile="system.twmrc-menu"; -rootprefix= "/etc/X11/twm/"; -userprefix= "/.twm/"; diff --git a/package/debian/twm.postinst b/package/debian/twm.postinst deleted file mode 100644 index b0f51ec..0000000 --- a/package/debian/twm.postinst +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# Debian twm package post-installation script -# Copyright 1998-2001, 2004 Branden Robinson. -# Licensed under the GNU General Public License, version 2. See the file -# /usr/share/common-licenses/GPL or . -# Acknowledgements to Stephen Early, Mark Eichin, and Manoj Srivastava. - -set -e - -#DEBHELPER# - -update-alternatives --install /usr/bin/x-window-manager x-window-manager \ - /usr/bin/twm 40 --slave /usr/share/man/man1/x-window-manager.1.gz \ - x-window-manager.1.gz /usr/share/man/man1/twm.1.gz - -exit 0 - -# vim:set ai et sts=2 sw=2 tw=0: diff --git a/package/debian/twm.postrm b/package/debian/twm.postrm deleted file mode 100644 index 98aa2aa..0000000 --- a/package/debian/twm.postrm +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# Debian twm package post-removal script -# Copyright 1998-2001, 2004 Branden Robinson. -# Licensed under the GNU General Public License, version 2. See the file -# /usr/share/common-licenses/GPL or . -# Acknowledgements to Stephen Early, Mark Eichin, and Manoj Srivastava. - -set -e - -#DEBHELPER# - -if [ "$1" = "purge" ]; then - if [ -d /etc/X11/twm ]; then - rm -r /etc/X11/twm - fi -fi - -exit 0 - -# vim:set ai et sts=2 sw=2 tw=0: diff --git a/package/debian/twm.prerm b/package/debian/twm.prerm deleted file mode 100644 index a92122a..0000000 --- a/package/debian/twm.prerm +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# Debian twm package pre-removal script -# Copyright 1998-2001, 2004 Branden Robinson. -# Licensed under the GNU General Public License, version 2. See the file -# /usr/share/common-licenses/GPL or . -# Acknowledgements to Stephen Early, Mark Eichin, and Manoj Srivastava. - -set -e - -#DEBHELPER# - -if [ "$1" = "remove" ] || [ "$1" = "deconfigure" ]; then - update-alternatives --remove x-window-manager /usr/bin/twm -fi - -exit 0 - -# vim:set ai et sts=2 sw=2 tw=0: diff --git a/package/debian/upstream/signing-key.asc b/package/debian/upstream/signing-key.asc deleted file mode 100644 index 863981f..0000000 --- a/package/debian/upstream/signing-key.asc +++ /dev/null @@ -1,60 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1 - -mQGiBEab+moRBACDH5yKqS3wcc5bdxY7PBNuwKvF5TKMfagmSvuRDtZjjIIWaA/n -Z1KboV9Gq5g7kP7+Kfu+Qgd8u65eVsWwmPW10fXvj3aCU53glx2EdGdrHcgiyH2g -EQfPiyBw+trIppWFRV0IDXSLMA1FNC92t2nSG/VFHaPTVwcgkIRSfcXDvwCglGdE -a6f4uLqoNHP+m4yYnzapFuMD/R4+2AJDAvEWKDdYCGZzlawjAmmWyXrmT7/C/mx9 -8qUR473l4buXjHgDkkXXlHqdzil1vK85PhrKzNJDCCmlHUJNz+QwiAMOLwpD+kwV -Pb57RG7y+a5JQ5+jtVw4RlUxZIk/wj2An9YBO3A5vR7PdjM32ZJCN2+aM4dYfNzQ -xQKTA/47icvBaBVTl9rztjg2pd2Aqpc1P/GsIYLGj7XjnnJvGAENBHSH1QjpZMJG -CTS9oJ+B0/wrIr+pA+MdFgYAb6ojMQJOO6UChjWWSGjMFcs/CeXhxlLBido3DtAE -TbNTwO6OEfAvdosvTdhJFnwvZlJ+zZGGy5CrF2Fd9PUe9tmASbQoQWxhbiBDb29w -ZXJzbWl0aCA8YWxhbmNAZnJlZWRlc2t0b3Aub3JnPohoBBMRAgAoAhsDBgsJCAcD -AgYVCAIJCgsEFgIDAQIeAQIXgAUCUXnRYgUJFEPYeAAKCRCi+54IHy0TDonxAKCP -cAgXNojuujUg5Wqi6v0RBFVSUgCggq1SsVEdq9NDWvXvkeGyNaBivSK0K0FsYW4g -Q29vcGVyc21pdGggPGFsYW4uY29vcGVyc21pdGhAc3VuLmNvbT6IZgQTEQIAJgIb -AwYLCQgHAwIEFQIIAwQWAgMBAh4BAheABQJRedFiBQkUQ9h4AAoJEKL7nggfLRMO -6sUAn0jl3h9rY4OJ13Lu7nsKclyhDpOqAKCFgTmaDGRuDRxloLg9jftrn7a7vrQu -QWxhbiBDb29wZXJzbWl0aCA8YWxhbi5jb29wZXJzbWl0aEBvcmFjbGUuY29tPohr -BBMRAgArAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAIZAQUCUXnRYgUJFEPY -eAAKCRCi+54IHy0TDtBZAJ9IgVVNoFIPRjTsNjcSFaLznuDRJgCcC/WgV312IrxS -Q8PRAyEgozSB9Ke5Ag0ERpv6bxAIAJp5aUlho5rUhpS6ik7spsAQFPRuycPKMNu0 -J4F0v/OoPz085soV8ytLj4HqCGk2Zamh1jSgliZwuk9m7V7Wgxx+nBJawpWDX/eK -LObErfDwQ4dfOFvjbXLQMmNnQNaUGIWLPP3l8GuBOHMq60Bu+TPgh627vUntL5RE -QEQqTXIzWC6U10QsDblLwIvdOVSdGF5xl/N1myXzSKvrsZwWtoFc8G9v9hcCjhtN -1sm9b7Ojc51iZXvcetcvPy5RA6AUW3yEExaedUdLnvIF9sjFYIfJWFVYh2AgavnG -re6fF+NV2v3zfx3wRT7H9//m4YIDYJmgZgyQccXegTwfGBIq3osAAwYH/1FiMUMM -ES5Ilz2nDqId+DCWECAU6wgvIFRcXrZWxDxB+ZrnmTCXoAD0xedpfOkRHp8XTVc/ -9MU+wQ+lZRx2OQ6MJW0XGuFvHm94KZF/8HzWA2Ah7U4n0+3sLpk6zWceZq2zZNF0 -yVTjwD98+xNK1Q9sP8aOKdtg8yMH3hisKR6rdW+mfX5q0Q8Gol2hZsFH/qyIhnPz -hXDknuOh8E5iMkzrejVXUEn++Yzj23XjP59SObLznVkyxI+kBI9qvVEPfFBDybjH -WqLcgRcCpXAzjizEi+/d31iDa2ErJHV4R42obecFqiPnoDtiX3IiP7z9fmxM4aWP -ZZRqvq+1ht5wkn+ISQQYEQIACQUCRpv6bwIbDAAKCRCi+54IHy0TDoLoAKCHYRpw -/XfyEunw1YL/uMZzl78qIQCdFVcXNbqD83qVhW4Ly7hyDL8o0aK5Ag0EUXnVIQEQ -AKHpjOmY056n0tsZoW9q5egsMcl5tKC8uimrhO05nnq+5/60/YedC++V9c9b/3/X -7O28LyBkAtBgD0xJZSDQ0DhTzKAp6AzjQtBvI68uinGwxSjT+oQpPMxqhA1I0kzo -EDCdEqV+HsVOAEdbAi/tP9bbdTDzwVc8MWDriamBUqc53Rb00Mffy9435UgTS4gA -hMwANhy6XZmOMBhITOzxFJUEDTDJtLbE0b1jPRQS7NHQgak1inmuvPMc3wAuoEcS -CSt1xupbYsBoXOjK5wC/eE1LIdZoRyW2OkT140DqDZ8zfRID860hnirnYgb09TPN -tj93pudUAUt6T9+tcLN4/rxhxHOwse66KGHO4bQ1rZ6mfco6SYd9V60cL6hC2eMe -cyxZliMu17lj7EX8lxUH+omIgHc7HGoyUR6V+WB60cxWj5v05zdeLeZ2aLBcPFhx -lfDESm8f4ezdJSDS1QZmC0P5h3RJfhhfmdBr8kHzr7111D1/O71Av1VV5FyJ9YxU -Sxp4IPuzK7JbbgVHcA6PvXrDzWUslmZgPADpKH4hTmG/NdCqhEXcufvY6s5yNksB -8X3ReNvuSSyfGnRz3kvtyK0XzC7KRX2PquLI6A8KJprHwZGqEB1NDG8b2iaYnghO -jyfIYEVQF3nGfaBwv4lrCPEoZSUaK8f/NQZjNU8NQyTnABEBAAGJAm0EGBEKAA8F -AlF51SECGwIFCQlmAYACKQkQovueCB8tEw7BXSAEGQEKAAYFAlF51SEACgkQz98U -iCjGQqfW5g//dOdJHt23cdMyz5VADaE7u+L0E+eX9GtHF4J649eXsui59EtbHh2n -XdGhd5SqQ8FDi9GCEKaQ4S31n/YBLEBCkj7R0IMikW2o78/JxDovB8+aL606hgma -fNVx1aIshIglrl8Xlu3sjeAvG48W6YjdL2mfrIDHjIVwOZsMihbOJvST6Q3upHdn -mjDtM5HCQmI5NEXDWYj6IZuhJnnrDWwNsyYV4KPoUBxAcqIyCeZbVssuWWnHPXX8 -VavVq98vpVynfGzGYpJbDj19C/utMjKGI5dcvbVaucA7X/oktxrxS6SBDhuIaAE9 -4ZHlbxqfyHfETI/La2Z/ALDAtYdhJR2gSkTHyKSW1QqYlulSfB//lnna44mmTuRO -NbDNgb0FGSvtsBMZ80iHDqPgUfS60kxCfFrsSGfTFU+X4QAzpTtUJEcr+J4HULDe -MfwOgghVfmKxFXWfud8xDaCXuywLTtVgMCZp4P7MAyuJlaxsFTu+c1Vly94grk4U -MtALLMqCXSosA490gLTSdg3HSwxt2Q/LJdy427ZIMvjGXIruns8U/OmL9dVgWu3b -JHsL68Skx8Ts63qTN9QXM/PB+8VwOaC7PJ+g6t40DleOmdsS8cN31yf5KB8rsL4u -n4u1yrMJfpnSblPMu5wJi3kjoA+Dd5ZFqx9nTi4wBjfVYGCPsleq59K8kQCYx1Cn -lZcq630ITy9dB/aHCQry2gCbBwZ2Rsf9kr05S8uLhlwW3vRSvRs= -=tc6G ------END PGP PUBLIC KEY BLOCK----- diff --git a/package/debian/watch b/package/debian/watch deleted file mode 100644 index 251869c..0000000 --- a/package/debian/watch +++ /dev/null @@ -1,4 +0,0 @@ -#git=https://gitlab.freedesktop.org/xorg/app/twm -version=3 -opts="pgpsigurlmangle=s/$/.sig/" \ -https://xorg.freedesktop.org/releases/individual/app/ twm-(.*)\.tar\.gz -- cgit v1.2.3 From a9d6701d977700b18e31a70cc7982431bc702095 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Thu, 18 Jun 2020 18:34:59 -0400 Subject: fix the cppcheck style- and format-warnings also bump version to 1.0.11.1, reflecting ongoing work since release Signed-off-by: Thomas E. Dickey --- configure.ac | 2 +- src/add_window.c | 9 ++++-- src/events.c | 40 +++++++++++++++++---------- src/iconmgr.c | 26 ++++++++++-------- src/icons.c | 7 +++-- src/list.c | 2 +- src/menus.c | 83 ++++++++++++++++++++++++++++++++++---------------------- src/parse.c | 15 +++++----- src/resize.c | 7 +++-- src/session.c | 8 ++++-- src/twm.c | 15 +++++----- src/util.c | 33 +++++++++++----------- 12 files changed, 146 insertions(+), 101 deletions(-) diff --git a/configure.ac b/configure.ac index 519f5cb..db01b62 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT([twm], [1.0.11], +AC_INIT([twm], [1.0.11.1], [https://gitlab.freedesktop.org/xorg/app/twm/issues], [twm]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) diff --git a/src/add_window.c b/src/add_window.c index f919b77..e6bde43 100644 --- a/src/add_window.c +++ b/src/add_window.c @@ -147,11 +147,9 @@ TwmWindow * AddWindow(Window w, int iconm, IconMgr *iconp) { TwmWindow *tmp_win; /* new twm window structure */ - int stat; XEvent event; unsigned long valuemask; /* mask for create windows */ XSetWindowAttributes attributes; /* attributes for create windows */ - int width, height; /* tmp variable */ int ask_user; /* don't know where to put the window */ int gravx, gravy; /* gravity signs for positioning */ int namelen; @@ -289,12 +287,14 @@ AddWindow(Window w, int iconm, IconMgr *iconp) &tmp_win->class); if (tmp_win->auto_raise) Scr->NumAutoRaises++; - tmp_win->iconify_by_unmapping = Scr->IconifyByUnmapping; if (Scr->IconifyByUnmapping) { tmp_win->iconify_by_unmapping = iconm ? FALSE : !short_lookup LookInList(Scr->DontIconify, tmp_win->full_name, &tmp_win->class); } + else { + tmp_win->iconify_by_unmapping = Scr->IconifyByUnmapping; + } tmp_win->iconify_by_unmapping |= short_lookup LookInList(Scr->IconifyByUn, tmp_win->full_name, &tmp_win->class); @@ -427,11 +427,14 @@ AddWindow(Window w, int iconm, IconMgr *iconp) if (!(tmp_win->wmhints && tmp_win->wmhints->flags & StateHint && tmp_win->wmhints->initial_state == IconicState)) { Bool firsttime = True; + int height, width; /* better wait until all the mouse buttons have been * released. */ while (TRUE) { + int stat; + XUngrabServer(dpy); XSync(dpy, 0); XGrabServer(dpy); diff --git a/src/events.c b/src/events.c index 6c34261..9d92322 100644 --- a/src/events.c +++ b/src/events.c @@ -380,9 +380,8 @@ void HandleColormapNotify(void) { XColormapEvent *cevent = (XColormapEvent *) &Event; - ColormapWindow *cwin, **cwins; + ColormapWindow *cwin; TwmColormap *cmap; - int lost, won, n, number_cwins; XPointer context_data; if (XFindContext(dpy, cevent->window, ColormapContext, &context_data) == 0) @@ -430,6 +429,9 @@ HandleColormapNotify(void) } if (cevent->serial >= Scr->cmapInfo.first_req) { + ColormapWindow **cwins; + int lost, won, n, number_cwins; + number_cwins = Scr->cmapInfo.cmaps->number_cwins; /* @@ -698,13 +700,14 @@ free_window_names(TwmWindow *tmp, Bool nukefull, Bool nukename, Bool nukeicon) void free_cwins(TwmWindow *tmp) { - int i; - TwmColormap *cmap; - if (tmp->cmaps.number_cwins) { + int i; + for (i = 0; i < tmp->cmaps.number_cwins; i++) { + if (--tmp->cmaps.cwins[i]->refcnt == 0) { - cmap = tmp->cmaps.cwins[i]->colormap; + TwmColormap *cmap = tmp->cmaps.cwins[i]->colormap; + if (--cmap->refcnt == 0) { XDeleteContext(dpy, cmap->c, ColormapContext); free(cmap); @@ -714,6 +717,7 @@ free_cwins(TwmWindow *tmp) } } free(tmp->cmaps.cwins); + if (tmp->cmaps.number_cwins > 1) { free(tmp->cmaps.scoreboard); tmp->cmaps.scoreboard = NULL; @@ -729,7 +733,6 @@ void HandlePropertyNotify(void) { char *name = NULL; - unsigned long valuemask; /* mask for create windows */ XSetWindowAttributes attributes; /* attributes for create windows */ Pixmap pm; @@ -894,6 +897,8 @@ HandlePropertyNotify(void) if (Tmp_win->icon_w && !Tmp_win->forced && Tmp_win->wmhints && (Tmp_win->wmhints->flags & IconPixmapHint)) { + unsigned long valuemask; /* mask for create windows */ + if (!XGetGeometry(dpy, Tmp_win->wmhints->icon_pixmap, &JunkRoot, &JunkX, &JunkY, (unsigned int *) &Tmp_win->icon_width, @@ -1167,7 +1172,6 @@ remove_window_from_ring(TwmWindow *tmp) void HandleDestroyNotify(void) { - int i; /* * Warning, this is also called by HandleUnmapNotify; if it ever needs to @@ -1198,7 +1202,10 @@ HandleDestroyNotify(void) XDeleteContext(dpy, Tmp_win->hilite_w, TwmContext); XDeleteContext(dpy, Tmp_win->hilite_w, ScreenContext); } + if (Tmp_win->titlebuttons) { + int i; + for (i = 0; i < nb; i++) { XDeleteContext(dpy, Tmp_win->titlebuttons[i].window, TwmContext); @@ -1279,7 +1286,6 @@ void HandleMapRequest(void) { XPointer context_data; - int zoom_save; Event.xany.window = Event.xmaprequest.window; if (XFindContext(dpy, Event.xany.window, TwmContext, &context_data) == 0) @@ -1309,6 +1315,7 @@ HandleMapRequest(void) if ((!Tmp_win->icon) && Tmp_win->wmhints && (Tmp_win->wmhints->flags & StateHint)) { int state; + int zoom_save; Window icon; /* use WM_STATE if enabled */ @@ -1484,7 +1491,6 @@ HandleMotionNotify(void) void HandleButtonRelease(void) { - int xl, xr, yt, yb, w, h; unsigned mask; XPointer context_data; @@ -1496,6 +1502,9 @@ HandleButtonRelease(void) } if (DragWindow != None) { + int xl, yt; + int w, h; + MoveOutline(Scr->Root, 0, 0, 0, 0, 0, 0); if (XFindContext(dpy, DragWindow, TwmContext, &context_data) == 0) @@ -1529,8 +1538,8 @@ HandleButtonRelease(void) } if (Scr->DontMoveOff && MoveFunction != F_FORCEMOVE) { - xr = xl + w; - yb = yt + h; + int xr = xl + w; + int yb = yt + h; if (xl < 0) xl = 0; @@ -2218,7 +2227,6 @@ void HandleConfigureRequest(void) { XWindowChanges xwc; - unsigned long xwcm; int x, y, width, height, bw; int gravx, gravy; XConfigureRequestEvent *cre = &Event.xconfigurerequest; @@ -2258,6 +2266,8 @@ HandleConfigureRequest(void) * to configuration requests for windows which have never been mapped. */ if (!Tmp_win || Tmp_win->icon_w == cre->window) { + unsigned long xwcm; + xwcm = cre->value_mask & (CWX | CWY | CWWidth | CWHeight | CWBorderWidth); xwc.x = cre->x; @@ -2420,10 +2430,12 @@ ScreenInfo * FindScreenInfo(Window w) { XWindowAttributes attr; - int scrnum; attr.screen = NULL; + if (XGetWindowAttributes(dpy, w, &attr)) { + int scrnum; + for (scrnum = 0; scrnum < NumScreens; scrnum++) { if (ScreenList[scrnum] != NULL && (ScreenOfDisplay(dpy, ScreenList[scrnum]->screen) == diff --git a/src/iconmgr.c b/src/iconmgr.c index e59f849..dcf0881 100644 --- a/src/iconmgr.c +++ b/src/iconmgr.c @@ -57,7 +57,6 @@ void CreateIconManagers(void) { IconMgr *p; - int mask; char str[100]; char str1[100]; Pixel background; @@ -74,9 +73,9 @@ CreateIconManagers(void) } for (p = &Scr->iconmgr; p != NULL; p = p->next) { - mask = XParseGeometry(p->geometry, &JunkX, &JunkY, - (unsigned int *) &p->width, - (unsigned int *) &p->height); + int mask = XParseGeometry(p->geometry, &JunkX, &JunkY, + (unsigned int *) &p->width, + (unsigned int *) &p->height); if (mask & XNegative) JunkX = Scr->MyDisplayWidth - p->width - @@ -129,7 +128,7 @@ AllocateIconManager(char *name, char *icon_name, char *geom, int columns) #ifdef DEBUG_ICONMGR fprintf(stderr, "AllocateIconManager\n"); fprintf(stderr, " name=\"%s\" icon_name=\"%s\", geom=\"%s\", col=%d\n", - name, icon_name, geom, columns); + name, icon_name ? icon_name : "", geom, columns); #endif if (Scr->NoIconManagers) @@ -290,8 +289,6 @@ JumpIconManager(int dir) { IconMgr *ip, *tmp_ip = NULL; int got_it = FALSE; - ScreenInfo *sp; - int screen; if (!Active) return; @@ -309,8 +306,11 @@ JumpIconManager(int dir) if (!got_it) { int origscreen = ip->scr->screen; int inc = (dir == F_NEXTICONMGR ? 1 : -1); + int screen; for (screen = origscreen + inc;; screen += inc) { + ScreenInfo *sp; + if (screen >= NumScreens) screen = 0; else if (screen < 0) @@ -461,8 +461,8 @@ InsertInIconManager(IconMgr *ip, WList *tmp, TwmWindow *tmp_win) { WList *tmp1; int added; - int (*compar) (const char *, const char *) - = (Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1); + int (*compar)(const char *, const char *) + =(Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1); added = FALSE; if (ip->first == NULL) { @@ -594,8 +594,8 @@ SortIconManager(IconMgr *ip) { WList *tmp1, *tmp2; int done; - int (*compar) (const char *, const char *) - = (Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1); + int (*compar)(const char *, const char *) + =(Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1); if (ip == NULL) ip = Active->iconmgr; @@ -629,7 +629,6 @@ void PackIconManager(IconMgr *ip) { int newwidth, i, row, col, maxcol, colinc, rowinc, wheight, wwidth; - int new_x, new_y; int savewidth; WList *tmp; @@ -645,7 +644,10 @@ PackIconManager(IconMgr *ip) row = 0; col = ip->columns; maxcol = 0; + for (i = 0, tmp = ip->first; tmp != NULL; i++, tmp = tmp->next) { + int new_x, new_y; + tmp->me = i; if (++col >= ip->columns) { col = 0; diff --git a/src/icons.c b/src/icons.c index a437963..bf8d8aa 100644 --- a/src/icons.c +++ b/src/icons.c @@ -323,10 +323,11 @@ FreeIconEntries(IconRegion *ir) void FreeIconRegions(void) { - IconRegion *ir, *tmp; + IconRegion *ir; for (ir = Scr->FirstRegion; ir != NULL;) { - tmp = ir; + IconRegion *tmp = ir; + FreeIconEntries(ir); ir = ir->next; free(tmp); @@ -344,7 +345,6 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y) XSetWindowAttributes attributes; /* attributes for create windows */ Pixmap pm = None; /* tmp pixmap variable */ int final_x, final_y; - int x; FB(tmp_win->iconc.fore, tmp_win->iconc.back); @@ -536,6 +536,7 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y) if (pm != None && (!(tmp_win->wmhints && tmp_win->wmhints->flags & IconWindowHint))) { int y; + int x; y = 0; if (tmp_win->icon_w_width == tmp_win->icon_width) diff --git a/src/list.c b/src/list.c index 9d9bec8..593204f 100644 --- a/src/list.c +++ b/src/list.c @@ -93,7 +93,7 @@ AddToList(name_list ** list_head, char *name, char *ptr) nptr = malloc(sizeof(name_list)); if (nptr == NULL) { twmrc_error_prefix(); - fprintf(stderr, "unable to allocate %ld bytes for name_list\n", + fprintf(stderr, "unable to allocate %lu bytes for name_list\n", (unsigned long) sizeof(name_list)); Done(NULL, NULL); } diff --git a/src/menus.c b/src/menus.c index 8b1cb00..a0e5c0f 100644 --- a/src/menus.c +++ b/src/menus.c @@ -133,7 +133,7 @@ void InitMenus(void) { int i, j, k; - FuncKey *key, *tmp; + FuncKey *key; for (i = 0; i < MAX_BUTTONS + 1; i++) for (j = 0; j < NUM_CONTEXTS; j++) @@ -147,8 +147,9 @@ InitMenus(void) if (FirstScreen) { for (key = Scr->FuncKeyRoot.next; key != NULL;) { + FuncKey *tmp = key; + free(key->name); - tmp = key; key = key->next; free(tmp); } @@ -216,7 +217,7 @@ CreateTitleButton(const char *name, int func, const char *action, if (!tb) { fprintf(stderr, - "%s: unable to allocate %ld bytes for title button\n", + "%s: unable to allocate %lu bytes for title button\n", ProgramName, (unsigned long) sizeof(TitleButton)); return 0; } @@ -366,7 +367,6 @@ PaintEntry(MenuRoot *mr, MenuItem *mi, int exposure) text_y = y_offset + Scr->MenuFont.y; if (mi->func != F_TITLE) { - int x, y; if (mi->state) { XSetForeground(dpy, Scr->NormalGC, mi->hi_back); @@ -401,6 +401,8 @@ PaintEntry(MenuRoot *mr, MenuItem *mi, int exposure) } if (mi->func == F_MENU) { + int x, y; + /* create the pull right pixmap if needed */ if (Scr->pullPm == None) { Scr->pullPm = CreateMenuIcon(Scr->MenuFont.height, @@ -414,8 +416,6 @@ PaintEntry(MenuRoot *mr, MenuItem *mi, int exposure) } } else { - int y; - XSetForeground(dpy, Scr->NormalGC, mi->back); /* fill the rectangle with the title background color */ @@ -423,6 +423,8 @@ PaintEntry(MenuRoot *mr, MenuItem *mi, int exposure) (unsigned) mr->width, (unsigned) Scr->EntryHeight); { + int y; + XSetForeground(dpy, Scr->NormalGC, mi->fore); /* now draw the dividing lines */ if (y_offset) @@ -658,8 +660,8 @@ AddToMenu(MenuRoot *menu, const char *item, const char *action, int width; #ifdef DEBUG_MENUS - fprintf(stderr, "adding menu item=\"%s\", action=%s, sub=%d, f=%d\n", - item, action, sub, func); + fprintf(stderr, "adding menu item=\"%s\", action=%s, sub=%p, f=%d\n", + item, action ? action : "", sub, func); #endif tmp = malloc(sizeof(MenuItem)); @@ -731,18 +733,17 @@ MakeMenu(MenuRoot *mr) XColor f1, f2, f3; XColor b1, b2, b3; XColor save_fore, save_back; - int num, i; - int fred, fgreen, fblue; - int bred, bgreen, bblue; - int width; - unsigned long valuemask; + int i; XSetWindowAttributes attributes; Colormap cmap = Scr->TwmRoot.cmaps.cwins[0]->colormap->c; Scr->EntryHeight = Scr->MenuFont.height + 4; - /* lets first size the window accordingly */ + /* let's first size the window accordingly */ if (mr->mapped == NEVER_MAPPED) { + int width; + unsigned long valuemask; + if (mr->pull == TRUE) { mr->width = (short) (mr->width + (16 + 10)); } @@ -837,7 +838,12 @@ MakeMenu(MenuRoot *mr) return; start = mr->first; + while (TRUE) { + int num; + int fred, fgreen, fblue; + int bred, bgreen, bblue; + for (; start != NULL; start = start->next) { if (start->user_colors) break; @@ -915,10 +921,8 @@ MakeMenu(MenuRoot *mr) Bool PopUpMenu(MenuRoot *menu, int x, int y, Bool center) { - int WindowNameCount; TwmWindow **WindowNames; TwmWindow *tmp_win2, *tmp_win3; - int i; int (*compar)(const char *, const char *) = (Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1); @@ -929,6 +933,7 @@ PopUpMenu(MenuRoot *menu, int x, int y, Bool center) if (menu == Scr->Windows) { TwmWindow *tmp_win; + int WindowNameCount; /* this is the twm windows menu, let's go ahead and build it */ @@ -945,10 +950,14 @@ PopUpMenu(MenuRoot *menu, int x, int y, Bool center) for (tmp_win = Scr->TwmRoot.next, WindowNameCount = 0; tmp_win != NULL; tmp_win = tmp_win->next) WindowNameCount++; + if (WindowNameCount != 0) { + int i; + WindowNames = malloc(sizeof(TwmWindow *) * (size_t) WindowNameCount); WindowNames[0] = Scr->TwmRoot.next; + for (tmp_win = Scr->TwmRoot.next->next, WindowNameCount = 1; tmp_win != NULL; tmp_win = tmp_win->next, WindowNameCount++) { tmp_win2 = tmp_win; @@ -1687,7 +1696,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, } if (ConstMoveDir != MOVE_NONE) { - int xl, yt, xr, yb, w2, h; + int xl, yt, w2, h; xl = ConstMoveX; yt = ConstMoveY; @@ -1695,8 +1704,8 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, h = (int) ((unsigned) DragHeight + 2 * JunkBW); if (Scr->DontMoveOff && MoveFunction != F_FORCEMOVE) { - xr = xl + w2; - yb = yt + h; + int xr = xl + w2; + int yb = yt + h; if (xl < 0) xl = 0; @@ -1719,7 +1728,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, } } else if (DragWindow != None) { - int xl, yt, xr, yb, w2, h; + int xl, yt, w2, h; if (!menuFromFrameOrWindowOrTitlebar) { xl = (int) ((unsigned) eventp->xmotion.x_root - @@ -1735,8 +1744,8 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, h = (int) ((unsigned) DragHeight + 2 * JunkBW); if (Scr->DontMoveOff && MoveFunction != F_FORCEMOVE) { - xr = xl + w2; - yb = yt + h; + int xr = xl + w2; + int yb = yt + h; if (xl < 0) xl = 0; @@ -1994,7 +2003,6 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, case F_WARPNEXT: { register TwmWindow *t; - static TwmWindow *savedwarp = NULL; TwmWindow *of, *l, *n; int c = 0; @@ -2019,9 +2027,12 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, if (t == of) c++; - if (bwin(t) || c >= 2) + if (bwin(t) || c >= 2) { Bell(XkbBI_MinorError, 0, None); + } else { + static TwmWindow *savedwarp = NULL; + if (of && of == savedwarp) { Iconify(of, 0, 0); savedwarp = NULL; @@ -2301,7 +2312,7 @@ Execute(const char *s) static char *exec_display; char *ds = DisplayString(dpy); - char *colon, *dot1; + char *colon; char *oldDisplay = NULL; char *value; Bool restorevar = False; @@ -2321,6 +2332,8 @@ Execute(const char *s) char *update = malloc(need); if (update != NULL) { + char *dot1; + strcpy(update, display_eqls); strcat(update, ds); colon = strrchr(update, ':'); @@ -2529,7 +2542,7 @@ Iconify(TwmWindow *tmp_win, int def_x, int def_y) static void Identify(TwmWindow *t) { - int i, n, twidth, width, height; + int i, n, width, height; int x, y; unsigned int wwidth, wheight, bw, depth; Window junk; @@ -2552,9 +2565,9 @@ Identify(TwmWindow *t) "Class.res_class = \"%s\"", t->class.res_class); Info[n++][0] = '\0'; snprintf(Info[n++], INFO_SIZE, - "Geometry/root = %dx%d+%d+%d", wwidth, wheight, x, y); - snprintf(Info[n++], INFO_SIZE, "Border width = %d", bw); - snprintf(Info[n++], INFO_SIZE, "Depth = %d", depth); + "Geometry/root = %ux%u+%d+%d", wwidth, wheight, x, y); + snprintf(Info[n++], INFO_SIZE, "Border width = %u", bw); + snprintf(Info[n++], INFO_SIZE, "Depth = %u", depth); if (HasSync) { int priority; @@ -2570,8 +2583,9 @@ Identify(TwmWindow *t) height = n * (Scr->DefaultFont.height + 2); width = 1; for (i = 0; i < n; i++) { - twidth = MyFont_TextWidth(&Scr->DefaultFont, Info[i], - (int) strlen(Info[i])); + int twidth = MyFont_TextWidth(&Scr->DefaultFont, Info[i], + (int) strlen(Info[i])); + if (twidth > width) width = twidth; } @@ -2685,7 +2699,6 @@ WarpToScreen(int n, int inc) static void BumpWindowColormap(TwmWindow *tmp, int inc) { - int i, j, previously_installed; ColormapWindow **cwins; if (!tmp) @@ -2695,6 +2708,9 @@ BumpWindowColormap(TwmWindow *tmp, int inc) cwins = malloc(sizeof(ColormapWindow *) * (size_t) tmp->cmaps.number_cwins); if (cwins) { + int i; + int previously_installed; + /* SUPPRESS 560 */ if ((previously_installed = (Scr->cmapInfo.cmaps == &tmp->cmaps && tmp->cmaps.number_cwins))) { @@ -2703,7 +2719,8 @@ BumpWindowColormap(TwmWindow *tmp, int inc) } for (i = 0; i < tmp->cmaps.number_cwins; i++) { - j = i - inc; + int j = i - inc; + if (j >= tmp->cmaps.number_cwins) j -= tmp->cmaps.number_cwins; else if (j < 0) diff --git a/src/parse.c b/src/parse.c index d81c2f3..df6cce3 100644 --- a/src/parse.c +++ b/src/parse.c @@ -82,7 +82,7 @@ static unsigned char overflowbuff[20]; /* really only need one */ static int overflowlen; static unsigned char **stringListSource, *currentString; -static int doparse(int (*ifunc) (void), const char *srctypename, +static int doparse(int (*ifunc)(void), const char *srctypename, const char *srcname); static int twmFileInput(void); static int twmStringListInput(void); @@ -93,14 +93,14 @@ extern int yylineno; int ConstrainedMoveTime = 400; /* milliseconds, event times */ -int (*twmInputFunc) (void); +int (*twmInputFunc)(void); /** * parse the .twmrc file * \param filename the filename to parse. NULL indicates $HOME/.twmrc */ static int -doparse(int (*ifunc) (void), const char *srctypename, const char *srcname) +doparse(int (*ifunc)(void), const char *srctypename, const char *srcname) { mods = 0; ptr = 0; @@ -983,19 +983,20 @@ do_color_keyword(int keyword, int colormode, char *s) static void put_pixel_on_root(Pixel pixel) { - int i, addPixel = 1; + int addPixel = 1; Atom pixelAtom, retAtom; int retFormat; unsigned long nPixels, retAfter; unsigned char *retProp; - Pixel *pixelProp; pixelAtom = XInternAtom(dpy, "_MIT_PRIORITY_COLORS", True); if (XGetWindowProperty(dpy, Scr->Root, pixelAtom, 0, 8192, False, XA_CARDINAL, &retAtom, &retFormat, &nPixels, &retAfter, &retProp) == Success) { - pixelProp = (Pixel *) retProp; + int i; + Pixel *pixelProp = (Pixel *) retProp; + for (i = 0; (unsigned long) i < nPixels; i++) if (pixel == pixelProp[i]) addPixel = 0; @@ -1159,7 +1160,7 @@ do_squeeze_entry(name_list ** list, char *name, int justify, int num, int denom) if (!sinfo) { twmrc_error_prefix(); - fprintf(stderr, "unable to allocate %ld bytes for squeeze info\n", + fprintf(stderr, "unable to allocate %lu bytes for squeeze info\n", (unsigned long) sizeof(SqueezeInfo)); return; } diff --git a/src/resize.c b/src/resize.c index 07a1015..dce406d 100644 --- a/src/resize.c +++ b/src/resize.c @@ -608,7 +608,7 @@ ConstrainSize(TwmWindow *tmp_win, int *widthp, int *heightp) #define makemult(a,b) ((b==1) ? (a) : (((int)((a)/(b))) * (b)) ) #define _min(a,b) (((a) < (b)) ? (a) : (b)) - int minWidth, minHeight, maxWidth, maxHeight, xinc, yinc, delta; + int minWidth, minHeight, maxWidth, maxHeight, xinc, yinc; int baseWidth, baseHeight; int dwidth = *widthp, dheight = *heightp; @@ -694,6 +694,8 @@ ConstrainSize(TwmWindow *tmp_win, int *widthp, int *heightp) */ if (tmp_win->hints.flags & PAspect) { + int delta; + if (minAspectX * dheight > minAspectY * dwidth) { delta = makemult(minAspectX * dheight / minAspectY - dwidth, xinc); if (dwidth + delta <= maxWidth) @@ -914,7 +916,6 @@ fullzoom(TwmWindow *tmp_win, int flag) Window junkRoot; unsigned int junkbw, junkDepth; int basex, basey; - int frame_bw_times_2; XGetGeometry(dpy, (Drawable) tmp_win->frame, &junkRoot, &dragx, &dragy, (unsigned int *) &dragWidth, @@ -931,6 +932,8 @@ fullzoom(TwmWindow *tmp_win, int flag) tmp_win->zoomed = ZOOM_NONE; } else { + int frame_bw_times_2; + if (tmp_win->zoomed == ZOOM_NONE) { tmp_win->save_frame_x = dragx; tmp_win->save_frame_y = dragy; diff --git a/src/session.c b/src/session.c index ed8bb33..94b4d63 100644 --- a/src/session.c +++ b/src/session.c @@ -274,7 +274,7 @@ WriteWinConfigEntry(FILE *configFile, TwmWindow *theWindow, char *clientId, char *windowRole) { char **wm_command; - int wm_command_count, i; + int wm_command_count; if (!write_counted_string(configFile, clientId)) return 0; @@ -311,6 +311,8 @@ WriteWinConfigEntry(FILE *configFile, TwmWindow *theWindow, return 0; } else { + int i; + if (!write_byte(configFile, (unsigned char) wm_command_count)) return 0; for (i = 0; i < wm_command_count; i++) @@ -574,12 +576,14 @@ GetWindowConfig(TwmWindow *theWindow, */ char **wm_command = NULL; - int wm_command_count = 0, i; + int wm_command_count = 0; XGetCommand(dpy, theWindow->w, &wm_command, &wm_command_count); if (wm_command_count == ptr->wm_command_count) { + int i; + for (i = 0; i < wm_command_count; i++) if (strcmp(wm_command[i], ptr->wm_command[i]) != 0) diff --git a/src/twm.c b/src/twm.c index ce67806..405a57e 100644 --- a/src/twm.c +++ b/src/twm.c @@ -183,12 +183,12 @@ static char *atom_names[11] = { /* |hasExtension()| and |IsPrintScreen()| have been stolen from * xc/programs/xdpyinfo/xdpyinfo.c */ static Bool -hasExtension(Display *dpy, char *extname) +hasExtension(Display *dpy2, char *extname) { int num_extensions, i; char **extensions; - extensions = XListExtensions(dpy, &num_extensions); + extensions = XListExtensions(dpy2, &num_extensions); for (i = 0; i < num_extensions && (strcmp(extensions[i], extname) != 0); i++); XFreeExtensionList(extensions); @@ -198,15 +198,15 @@ hasExtension(Display *dpy, char *extname) static Bool IsPrintScreen(Screen *s) { - Display *dpy = XDisplayOfScreen(s); - int i; + Display *dpy2 = XDisplayOfScreen(s); /* Check whether this is a screen of a print DDX */ - if (hasExtension(dpy, XP_PRINTNAME)) { + if (hasExtension(dpy2, XP_PRINTNAME)) { Screen **pscreens; int pscrcount; + int i; - pscreens = XpQueryScreens(dpy, &pscrcount); + pscreens = XpQueryScreens(dpy2, &pscrcount); for (i = 0; (i < pscrcount) && pscreens; i++) { if (s == pscreens[i]) { return True; @@ -889,11 +889,12 @@ void RestoreWithdrawnLocation(TwmWindow *tmp) { int gravx, gravy; - unsigned int bw, mask; + unsigned int bw; XWindowChanges xwc; if (XGetGeometry(dpy, tmp->w, &JunkRoot, &xwc.x, &xwc.y, &JunkWidth, &JunkHeight, &bw, &JunkDepth)) { + unsigned mask; GetGravityOffsets(tmp, &gravx, &gravy); if (gravy < 0) diff --git a/src/util.c b/src/util.c index 34d5623..7b611d3 100644 --- a/src/util.c +++ b/src/util.c @@ -260,7 +260,7 @@ ExpandFilename(const char *name) newname = malloc((size_t) HomeLen + strlen(name) + 2); if (!newname) { fprintf(stderr, - "%s: unable to allocate %ld bytes to expand filename %s/%s\n", + "%s: unable to allocate %lu bytes to expand filename %s/%s\n", ProgramName, (unsigned long) HomeLen + (unsigned long) strlen(name) + 2, Home, &name[1]); @@ -398,7 +398,7 @@ InsertRGBColormap(Atom a, XStandardColormap *maps, int nmaps, Bool replace) if (!sc) { /* no existing, allocate new */ sc = malloc(sizeof(StdCmap)); if (!sc) { - fprintf(stderr, "%s: unable to allocate %ld bytes for StdCmap\n", + fprintf(stderr, "%s: unable to allocate %lu bytes for StdCmap\n", ProgramName, (unsigned long) sizeof(StdCmap)); return; } @@ -585,12 +585,13 @@ FindFontSet(MyFont *font, const char *fontname) XFontSetExtents *font_extents; XFontStruct **xfonts; char **font_names; - register int i; - int ascent; - int descent; - int fnum; if (use_fontset) { + int ascent; + int descent; + int fnum; + register int i; + if (font->fontset != NULL) { XFreeFontSet(dpy, font->fontset); } @@ -648,10 +649,10 @@ FindFontSet(MyFont *font, const char *fontname) void GetFont(MyFont *font) { - const char *deffontname = "fixed"; if (!FindFontSet(font, font->name)) { const char *what = "fonts"; + const char *deffontname = "fixed"; if (use_fontset) { what = "fontsets"; @@ -952,15 +953,6 @@ Pixmap CreateMenuIcon(int height, unsigned *widthp, unsigned *heightp) { int h, w; - int ih, iw; - int ix, iy; - int mh, mw; - int tw, th; - int lw, lh; - int lx, ly; - int lines, dly; - int off; - int bw; h = height; w = h * 7 / 8; @@ -973,6 +965,15 @@ CreateMenuIcon(int height, unsigned *widthp, unsigned *heightp) if (Scr->tbpm.menu == None) { Pixmap pix; GC gc; + int ih, iw; + int ix, iy; + int mh, mw; + int tw, th; + int lw, lh; + int lx, ly; + int lines, dly; + int off; + int bw; pix = Scr->tbpm.menu = XCreatePixmap(dpy, Scr->Root, (unsigned) w, (unsigned) h, 1); -- cgit v1.2.3 From 248be9688c23f249f1ecf1860f6f4cb09e56fab2 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Fri, 19 Jun 2020 20:23:42 -0400 Subject: add/use functions to make warning messages more consistently use the program name as a prefix Signed-off-by: Thomas E. Dickey --- src/twm.c | 109 +++++++++++++++++++++++++++++++++++++++++++++----------------- src/twm.h | 22 +++++++++++-- 2 files changed, 100 insertions(+), 31 deletions(-) diff --git a/src/twm.c b/src/twm.c index 405a57e..e6b78c1 100644 --- a/src/twm.c +++ b/src/twm.c @@ -62,6 +62,8 @@ in this Software without prior written authorization from The Open Group. #include #include #include +#include + #include "twm.h" #include "iconmgr.h" #include "add_window.h" @@ -76,6 +78,7 @@ in this Software without prior written authorization from The Open Group. #include "parse.h" #include "session.h" #include "version.h" + #include #include #include @@ -116,7 +119,7 @@ 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 */ -static Bool PrintErrorMessages = False; /* controls error messages */ +static int verbose = 1; /* 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 */ @@ -305,7 +308,7 @@ main(int argc, char *argv[]) case 'v': /* -verbose */ if (!brief_opt(argv[i], "verbose")) usage(); - PrintErrorMessages = True; + verbose++; continue; case 'c': /* -clientId */ if (!brief_opt(argv[i], "clientId")) @@ -324,7 +327,7 @@ main(int argc, char *argv[]) case 'q': /* -quiet */ if (!brief_opt(argv[i], "quiet")) usage(); - PrintErrorMessages = False; + --verbose; continue; } } @@ -379,16 +382,11 @@ main(int argc, char *argv[]) if (!(dpy = XtOpenDisplay(appContext, display_name, "twm", "twm", NULL, 0, &zero, NULL))) { - fprintf(stderr, "%s: unable to open display \"%s\"\n", - ProgramName, XDisplayName(display_name)); - exit(EXIT_FAILURE); + twmError("unable to open display \"%s\"", XDisplayName(display_name)); } if (fcntl(ConnectionNumber(dpy), F_SETFD, 1) == -1) { - fprintf(stderr, - "%s: unable to mark display connection as close-on-exec\n", - ProgramName); - exit(EXIT_FAILURE); + twmError("unable to mark display connection as close-on-exec"); } if (restore_filename) @@ -425,10 +423,7 @@ main(int argc, char *argv[]) /* for simplicity, always allocate NumScreens ScreenInfo struct pointers */ ScreenList = calloc((size_t) NumScreens, sizeof(ScreenInfo *)); if (ScreenList == NULL) { - fprintf(stderr, - "%s: Unable to allocate memory for screen list, exiting.\n", - ProgramName); - exit(EXIT_FAILURE); + twmError("Unable to allocate memory for screen list, exiting"); } numManaged = 0; PreviousScreen = DefaultScreen(dpy); @@ -438,8 +433,7 @@ main(int argc, char *argv[]) /* Ignore print screens to avoid that users accidentally warp on a * print screen (which are not visible on video displays) */ if ((!NoPrintscreens) && IsPrintScreen(XScreenOfDisplay(dpy, scrnum))) { - fprintf(stderr, "%s: skipping print screen %d\n", - ProgramName, scrnum); + twmWarning("skipping print screen %d", scrnum); continue; } #endif /* XPRINT */ @@ -457,12 +451,13 @@ main(int argc, char *argv[]) XSetErrorHandler(TwmErrorHandler); if (RedirectError) { - fprintf(stderr, "%s: another window manager is already running.", - ProgramName); - if (MultiScreen && NumScreens > 0) - fprintf(stderr, " on screen %d?\n", scrnum); - else - fprintf(stderr, "?\n"); + if (MultiScreen && NumScreens > 0) { + twmWarning("another window manager is already running." + " on screen %d?\n", scrnum); + } + else { + twmWarning("another window manager is already running."); + } continue; } @@ -471,9 +466,9 @@ main(int argc, char *argv[]) /* Note: ScreenInfo struct is calloc'ed to initialize to zero. */ Scr = ScreenList[scrnum] = calloc(1, sizeof(ScreenInfo)); if (Scr == NULL) { - fprintf(stderr, - "%s: unable to allocate memory for ScreenInfo structure for screen %d.\n", - ProgramName, scrnum); + twmWarning + ("unable to allocate memory for ScreenInfo structure for screen %d.", + scrnum); continue; } @@ -706,9 +701,10 @@ main(int argc, char *argv[]) } /* for */ if (numManaged == 0) { - if (MultiScreen && NumScreens > 0) - fprintf(stderr, "%s: unable to find any unmanaged %sscreens.\n", - ProgramName, NoPrintscreens ? "" : "video "); + if (MultiScreen && NumScreens > 0) { + twmError("unable to find any unmanaged %sscreens.\n", + NoPrintscreens ? "" : "video "); + } exit(EXIT_FAILURE); } @@ -993,7 +989,7 @@ TwmErrorHandler(Display *dpy2, XErrorEvent *event) LastErrorEvent = *event; ErrorOccurred = True; - if (PrintErrorMessages && /* don't be too obnoxious */ + if ((verbose > 1) && /* don't be too obnoxious */ event->error_code != BadWindow && /* watch for dead puppies */ (event->request_code != X_GetGeometry && /* of all styles */ event->error_code != BadDrawable)) @@ -1009,3 +1005,58 @@ CatchRedirectError(Display *dpy2 _X_UNUSED, XErrorEvent *event) ErrorOccurred = True; return 0; } + +void +twmError(const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + fprintf(stderr, "%s: error: ", ProgramName); + vfprintf(stderr, format, ap); + fputc('\n', stderr); + va_end(ap); + exit(EXIT_FAILURE); +} + +void +twmWarning(const char *format, ...) +{ + if (verbose > 0) { + va_list ap; + + va_start(ap, format); + fprintf(stderr, "%s: warning: ", ProgramName); + vfprintf(stderr, format, ap); + fputc('\n', stderr); + va_end(ap); + } +} + +void +twmVerbose(const char *format, ...) +{ + if (verbose > 1) { + va_list ap; + + va_start(ap, format); + fprintf(stderr, "%s: warning: ", ProgramName); + vfprintf(stderr, format, ap); + fputc('\n', stderr); + va_end(ap); + } +} + +void +twmMessage(const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + printf("%s: ", ProgramName); + vprintf(format, ap); + putc('\n', stdout); + va_end(ap); + + fflush(stdout); +} diff --git a/src/twm.h b/src/twm.h index 1fe106d..d39abdb 100644 --- a/src/twm.h +++ b/src/twm.h @@ -60,6 +60,7 @@ from The Open Group. #ifndef _TWM_ #define _TWM_ +/* *INDENT-OFF* */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -73,6 +74,18 @@ from The Open Group. #include #include +#ifndef GCC_PRINTFLIKE +#if defined(GCC_PRINTF) && !defined(printf) +#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) +#else +#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ +#endif +#endif + +#ifndef GCC_NORETURN +#define GCC_NORETURN _X_NORETURN +#endif + #ifndef WithdrawnState #define WithdrawnState 0 #endif @@ -335,8 +348,7 @@ extern void CreateFonts(void); extern void RestoreWithdrawnLocation(TwmWindow *tmp); extern void Reborder(Time time); extern void -Done(XtPointer, XtSignalId *) - _X_NORETURN; +Done(XtPointer, XtSignalId *) _X_NORETURN; extern void ComputeCommonTitleOffsets(void); extern void @@ -392,6 +404,11 @@ NewBitmapCursor(Cursor *cp, char *source, char *mask); extern Pixmap CreateMenuIcon(int height, unsigned int *widthp, unsigned int *heightp); +extern void twmError(const char *, ...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; +extern void twmWarning(const char *, ...) GCC_PRINTFLIKE(1,2); +extern void twmVerbose(const char *, ...) GCC_PRINTFLIKE(1,2); +extern void twmMessage(const char *, ...) GCC_PRINTFLIKE(1,2); + extern Bool ErrorOccurred; extern XErrorEvent LastErrorEvent; @@ -433,4 +450,5 @@ extern int XrandrErrorBase; #define _XA_WM_CLIENT_LEADER TwmAtoms[9] #define _XA_WM_WINDOW_ROLE TwmAtoms[10] +/* *INDENT-ON* */ #endif /* _TWM_ */ -- cgit v1.2.3 From d2690bc70d707b7a3a49839787d20eabc138e391 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Fri, 19 Jun 2020 20:27:03 -0400 Subject: use new warning-message functions in the remaining places where suitable, since -q option can be used to silence those if wanted Signed-off-by: Thomas E. Dickey --- src/add_window.c | 13 +++++-------- src/cursor.c | 13 +++++-------- src/iconmgr.c | 13 ++++++------- src/menus.c | 36 ++++++++++++++---------------------- src/parse.c | 27 +++++++++++++-------------- src/util.c | 55 +++++++++++++++++++++++++++---------------------------- 6 files changed, 70 insertions(+), 87 deletions(-) diff --git a/src/add_window.c b/src/add_window.c index e6bde43..b4189e1 100644 --- a/src/add_window.c +++ b/src/add_window.c @@ -170,9 +170,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) /* allocate space for the twm window */ 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); + twmWarning("Unable to allocate memory to manage window ID %lx.", w); return NULL; } tmp_win->w = w; @@ -1304,8 +1302,7 @@ CreateWindowTitlebarButtons(TwmWindow *tmp_win) if (nb > 0) { tmp_win->titlebuttons = malloc((size_t) nb * sizeof(TBWindow)); if (!tmp_win->titlebuttons) { - fprintf(stderr, "%s: unable to allocate %d titlebuttons\n", - ProgramName, nb); + twmWarning("unable to allocate %d titlebuttons", nb); } else { TBWindow *tbw; @@ -1497,9 +1494,9 @@ FetchWmColormapWindows(TwmWindow *tmp) malloc(sizeof(Window) * (size_t) (number_cmap_windows + 1)); if (!new_cmap_windows) { - fprintf(stderr, - "%s: unable to allocate %d element colormap window array\n", - ProgramName, number_cmap_windows + 1); + twmWarning + ("unable to allocate %d element colormap window array", + number_cmap_windows + 1); goto done; } new_cmap_windows[0] = tmp->w; /* add to front */ diff --git a/src/cursor.c b/src/cursor.c index 98a1256..84d3f0c 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -133,15 +133,13 @@ NewFontCursor(Cursor *cp, const char *str) i++) { if (strcmp(str, cursor_names[i].name) == 0) { if (cursor_names[i].cursor == None) - cursor_names[i].cursor = XCreateFontCursor(dpy, - cursor_names[i]. - shape); + cursor_names[i].cursor = + XCreateFontCursor(dpy, cursor_names[i].shape); *cp = cursor_names[i].cursor; return; } } - fprintf(stderr, "%s: unable to find font cursor \"%s\"\n", - ProgramName, str); + twmWarning("unable to find font cursor \"%s\"", str); } void @@ -164,9 +162,8 @@ NewBitmapCursor(Cursor *cp, char *source, char *mask) XGetGeometry(dpy, spm, &JunkRoot, &sx, &sy, &sw, &sh, &JunkBW, &JunkDepth); XGetGeometry(dpy, mpm, &JunkRoot, &mx, &my, &mw, &mh, &JunkBW, &JunkDepth); if (sw != mw || sh != mh) { - fprintf(stderr, - "%s: cursor bitmaps \"%s\" and \"%s\" not the same size\n", - ProgramName, source, mask); + twmWarning("cursor bitmaps \"%s\" and \"%s\" not the same size\n", + source, mask); return; } *cp = XCreatePixmapCursor(dpy, spm, mpm, &Scr->PointerForeground, diff --git a/src/iconmgr.c b/src/iconmgr.c index dcf0881..48a2931 100644 --- a/src/iconmgr.c +++ b/src/iconmgr.c @@ -249,9 +249,8 @@ MoveIconManager(int dir) } if (!got_it) { - fprintf(stderr, - "%s: unable to find window (%d, %d) in icon manager\n", - ProgramName, new_row, new_col); + twmWarning("unable to find window (%d, %d) in icon manager", + new_row, new_col); return; } @@ -461,8 +460,8 @@ InsertInIconManager(IconMgr *ip, WList *tmp, TwmWindow *tmp_win) { WList *tmp1; int added; - int (*compar)(const char *, const char *) - =(Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1); + int (*compar) (const char *, const char *) + = (Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1); added = FALSE; if (ip->first == NULL) { @@ -594,8 +593,8 @@ SortIconManager(IconMgr *ip) { WList *tmp1, *tmp2; int done; - int (*compar)(const char *, const char *) - =(Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1); + int (*compar) (const char *, const char *) + = (Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1); if (ip == NULL) ip = Active->iconmgr; diff --git a/src/menus.c b/src/menus.c index a0e5c0f..5ffaa3f 100644 --- a/src/menus.c +++ b/src/menus.c @@ -216,9 +216,8 @@ CreateTitleButton(const char *name, int func, const char *action, TitleButton *tb = malloc(sizeof(TitleButton)); if (!tb) { - fprintf(stderr, - "%s: unable to allocate %lu bytes for title button\n", - ProgramName, (unsigned long) sizeof(TitleButton)); + twmWarning("unable to allocate %lu bytes for title button", + (unsigned long) sizeof(TitleButton)); return 0; } @@ -307,11 +306,11 @@ InitTitlebarButtons(void) /* insert extra buttons */ if (!CreateTitleButton(TBPM_ICONIFY, F_ICONIFY, "", (MenuRoot *) NULL, False, False)) { - fprintf(stderr, "%s: unable to add iconify button\n", ProgramName); + twmWarning("unable to add iconify button"); } if (!CreateTitleButton(TBPM_RESIZE, F_RESIZE, "", (MenuRoot *) NULL, True, True)) { - fprintf(stderr, "%s: unable to add resize button\n", ProgramName); + twmWarning("unable to add resize button"); } AddDefaultBindings(); } @@ -326,9 +325,7 @@ InitTitlebarButtons(void) if (!tb->bitmap) { tb->bitmap = FindBitmap(TBPM_QUESTION, &tb->width, &tb->height); if (!tb->bitmap) { /* cannot happen (see util.c) */ - fprintf(stderr, - "%s: unable to add titlebar button \"%s\"\n", - ProgramName, tb->name); + twmWarning("unable to add titlebar button \"%s\"", tb->name); } } @@ -923,7 +920,7 @@ PopUpMenu(MenuRoot *menu, int x, int y, Bool center) { TwmWindow **WindowNames; TwmWindow *tmp_win2, *tmp_win3; - int (*compar)(const char *, const char *) = + int (*compar) (const char *, const char *) = (Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1); if (!menu) @@ -1294,7 +1291,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, if (smcConn) SmcCloseConnection(smcConn, 0, NULL); execvp(*Argv, Argv); - fprintf(stderr, "%s: unable to restart: %s\n", ProgramName, *Argv); + twmWarning("unable to restart: %s", *Argv); break; } @@ -1782,8 +1779,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, MenuItem *mitem; if ((mroot = FindMenuRoot(action)) == NULL) { - fprintf(stderr, "%s: couldn't find function \"%s\"\n", - ProgramName, action); + twmWarning("couldn't find function \"%s\"", action); return TRUE; } @@ -1952,9 +1948,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, close(fd); } else { - fprintf(stderr, - "%s: unable to open cut file \"%s\"\n", - ProgramName, tmp); + twmWarning("unable to open cut file \"%s\"", tmp); } free(ptr); } @@ -1964,7 +1958,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, } } else { - fprintf(stderr, "%s: cut buffer is empty\n", ProgramName); + twmWarning("cut buffer is empty"); } break; @@ -2143,13 +2137,12 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, close(fd); } else { - fprintf(stderr, "%s: unable to open file \"%s\"\n", - ProgramName, ptr); + twmWarning("unable to open file \"%s\"", ptr); } free(ptr); } else { - fprintf(stderr, "%s: error expanding filename\n", ProgramName); + twmWarning("error expanding filename"); } break; @@ -2205,7 +2198,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, break; case F_STARTWM: execlp("/bin/sh", "sh", "-c", action, (void *) NULL); - fprintf(stderr, "%s: unable to start: %s\n", ProgramName, *Argv); + twmWarning("unable to start: %s", *Argv); break; } @@ -2675,8 +2668,7 @@ WarpToScreen(int n, int inc) n += inc; continue; } - fprintf(stderr, "%s: unable to warp to unmanaged screen %d\n", - ProgramName, n); + twmWarning("unable to warp to unmanaged screen %d", n); Bell(XkbBI_MinorError, 0, None); return; } diff --git a/src/parse.c b/src/parse.c index df6cce3..18ed6b0 100644 --- a/src/parse.c +++ b/src/parse.c @@ -82,7 +82,7 @@ static unsigned char overflowbuff[20]; /* really only need one */ static int overflowlen; static unsigned char **stringListSource, *currentString; -static int doparse(int (*ifunc)(void), const char *srctypename, +static int doparse(int (*ifunc) (void), const char *srctypename, const char *srcname); static int twmFileInput(void); static int twmStringListInput(void); @@ -93,14 +93,14 @@ extern int yylineno; int ConstrainedMoveTime = 400; /* milliseconds, event times */ -int (*twmInputFunc)(void); +int (*twmInputFunc) (void); /** * parse the .twmrc file * \param filename the filename to parse. NULL indicates $HOME/.twmrc */ static int -doparse(int (*ifunc)(void), const char *srctypename, const char *srcname) +doparse(int (*ifunc) (void), const char *srctypename, const char *srcname) { mods = 0; ptr = 0; @@ -146,11 +146,12 @@ doparse(int (*ifunc)(void), const char *srctypename, const char *srcname) &Scr->PointerForeground, &Scr->PointerBackground); } if (ParseError) { - fprintf(stderr, "%s: errors found in twm %s", - ProgramName, srctypename); - if (srcname) - fprintf(stderr, " \"%s\"", srcname); - fprintf(stderr, "\n"); + if (srcname) { + twmWarning("errors found in twm %s \"%s\"", srctypename, srcname); + } + else { + twmWarning("errors found in twm %s", srctypename); + } } return (ParseError ? 0 : 1); } @@ -206,9 +207,8 @@ ParseTwmrc(char *filename) int status; if (filename && cp != filename) { - fprintf(stderr, - "%s: unable to open twmrc file %s, using %s instead\n", - ProgramName, filename, cp); + twmWarning("unable to open twmrc file %s, using %s instead", + filename, cp); } status = doparse(twmFileInput, "file", cp); fclose(twmrc); @@ -216,9 +216,8 @@ ParseTwmrc(char *filename) } else { if (filename) { - fprintf(stderr, - "%s: unable to open twmrc file %s, using built-in defaults instead\n", - ProgramName, filename); + twmWarning("unable to open twmrc file %s," + " using built-in defaults instead", filename); } return ParseStringList(defTwmrc); } diff --git a/src/util.c b/src/util.c index 7b611d3..e15c31a 100644 --- a/src/util.c +++ b/src/util.c @@ -259,11 +259,9 @@ ExpandFilename(const char *name) newname = malloc((size_t) HomeLen + strlen(name) + 2); if (!newname) { - fprintf(stderr, - "%s: unable to allocate %lu bytes to expand filename %s/%s\n", - ProgramName, - (unsigned long) HomeLen + (unsigned long) strlen(name) + 2, - Home, &name[1]); + twmWarning("unable to allocate %lu bytes to expand filename %s/%s", + (unsigned long) HomeLen + (unsigned long) strlen(name) + 2, + Home, &name[1]); } else { (void) sprintf(newname, "%s/%s", Home, &name[1]); @@ -331,8 +329,7 @@ FindBitmap(const char *name, unsigned *widthp, unsigned *heightp) if (XmuCompareISOLatin1(pmtab[i].name, name) == 0) return (*pmtab[i].proc) (widthp, heightp); } - fprintf(stderr, "%s: no such built-in bitmap \"%s\"\n", - ProgramName, name); + twmWarning("no such built-in bitmap \"%s\"", name); return None; } @@ -357,9 +354,8 @@ FindBitmap(const char *name, unsigned *widthp, unsigned *heightp) */ bigname = malloc(strlen(name) + strlen(Scr->IconDirectory) + 2); if (!bigname) { - fprintf(stderr, - "%s: unable to allocate memory for \"%s/%s\"\n", - ProgramName, Scr->IconDirectory, name); + twmWarning("unable to allocate memory for \"%s/%s\"", + Scr->IconDirectory, name); return None; } (void) sprintf(bigname, "%s/%s", Scr->IconDirectory, name); @@ -370,8 +366,7 @@ FindBitmap(const char *name, unsigned *widthp, unsigned *heightp) } free(bigname); if (pm == None) { - fprintf(stderr, "%s: unable to find bitmap \"%s\"\n", - ProgramName, name); + twmWarning("unable to find bitmap \"%s\"", name); } return pm; @@ -398,8 +393,8 @@ InsertRGBColormap(Atom a, XStandardColormap *maps, int nmaps, Bool replace) if (!sc) { /* no existing, allocate new */ sc = malloc(sizeof(StdCmap)); if (!sc) { - fprintf(stderr, "%s: unable to allocate %lu bytes for StdCmap\n", - ProgramName, (unsigned long) sizeof(StdCmap)); + twmWarning("unable to allocate %lu bytes for StdCmap", + (unsigned long) sizeof(StdCmap)); return; } replace = False; @@ -501,8 +496,7 @@ GetColor(int kind, Pixel *what, const char *name) if (name[0] != '#') stat = XParseColor(dpy, cmap, name, &color); if (!stat) { - fprintf(stderr, "%s: invalid color name \"%s\"\n", - ProgramName, name); + twmWarning("invalid color name \"%s\"", name); return; } @@ -545,8 +539,7 @@ GetColor(int kind, Pixel *what, const char *name) stdcmap->blue_mult)); } else { - fprintf(stderr, "%s: unable to allocate color \"%s\"\n", - ProgramName, name); + twmWarning("unable to allocate color \"%s\"", name); return; } } @@ -569,7 +562,7 @@ GetColorValue(int kind, XColor *what, const char *name) return; if (!XLookupColor(dpy, cmap, name, what, &junkcolor)) { - fprintf(stderr, "%s: invalid color name \"%s\"\n", ProgramName, name); + twmWarning("invalid color name \"%s\"", name); } else { what->pixel = AllPlanes; @@ -602,9 +595,13 @@ FindFontSet(MyFont *font, const char *fontname) &def_string_return)) == NULL) { return False; } - for (i = 0; i < missing_charset_count_return; i++) { - printf("%s: warning: font for charset %s is lacking.\n", - ProgramName, missing_charset_list_return[i]); + if (missing_charset_count_return) { + twmVerbose("%d fonts are missing from fontset", + missing_charset_count_return); + for (i = 0; i < missing_charset_count_return; i++) { + twmVerbose("font for charset %s is lacking.", + missing_charset_list_return[i]); + } } font_extents = XExtentsOfFontSet(font->fontset); @@ -620,6 +617,9 @@ FindFontSet(MyFont *font, const char *fontname) font->y = ascent; font->ascent = ascent; font->descent = descent; + twmMessage("created fontset with %d fonts (%d missing) for \"%s\"", + fnum, missing_charset_count_return, + fontname ? fontname : "NULL"); return True; } @@ -661,9 +661,8 @@ GetFont(MyFont *font) deffontname = Scr->DefaultFont.name; } if (!FindFontSet(font, deffontname)) { - fprintf(stderr, "%s: unable to open %s \"%s\" or \"%s\"\n", - ProgramName, what, font->name, deffontname); - exit(1); + twmError("unable to open %s \"%s\" or \"%s\"", + what, font->name, deffontname); } } } @@ -780,11 +779,11 @@ SetFocus(TwmWindow *tmp_win, Time time) #ifdef TRACE if (tmp_win) { - printf("Focusing on window \"%s\"\n", tmp_win->full_name); + twmMessage("Focusing on window \"%s\"", tmp_win->full_name); } else { - printf("Unfocusing; Scr->Focus was \"%s\"\n", - Scr->Focus ? Scr->Focus->full_name : "(nil)"); + twmMessage("Unfocusing; Scr->Focus was \"%s\"", + Scr->Focus ? Scr->Focus->full_name : "(nil)"); } #endif -- cgit v1.2.3 From fc19a82a10dc797605d6cb5d9028685644c6db3d Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sat, 20 Jun 2020 05:28:14 -0400 Subject: make the "-V" version print less cluttered (and more like most programs) Signed-off-by: Thomas E. Dickey --- src/Makefile.am | 3 +++ src/twm.c | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 75e3d4a..805eaf9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -28,6 +28,9 @@ rcdir = ${datadir}/X11/twm dist_rc_DATA = system.twmrc AM_CPPFLAGS = \ + -DAPP_NAME=\"twm\" \ + -DAPP_CLASS=\"twm\" \ + -DAPP_VERSION=\"$(VERSION)\" \ -DXVENDORNAME=\"The\ X.Org\ Foundation\" \ -DXORG_RELEASE=\"Release\ $(VERSION)\" \ -DSYSTEM_INIT_FILE=\"${rcdir}/system.twmrc\" diff --git a/src/twm.c b/src/twm.c index e6b78c1..12cac5f 100644 --- a/src/twm.c +++ b/src/twm.c @@ -69,7 +69,6 @@ in this Software without prior written authorization from The Open Group. #include "add_window.h" #include "gc.h" #include "parse.h" -#include "version.h" #include "menus.h" #include "events.h" #include "util.h" @@ -77,7 +76,6 @@ in this Software without prior written authorization from The Open Group. #include "screen.h" #include "parse.h" #include "session.h" -#include "version.h" #include #include @@ -277,7 +275,7 @@ main(int argc, char *argv[]) if (argv[i][0] == '-') { switch (argv[i][1]) { case 'V': - printf("%s %s\n", ProgramName, Version); + printf("%s %s\n", APP_NAME, APP_VERSION); exit(EXIT_SUCCESS); case 'd': /* -display dpy */ if (!brief_opt(argv[i], "display")) -- cgit v1.2.3 From 8a43400ccf2b23f60d1101ea4d348058e7ad3c36 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 21 Jun 2020 09:18:27 -0400 Subject: add/use new function parseWarning, which honors -v/-q options Signed-off-by: Thomas E. Dickey --- src/gram.y | 67 ++++++++++++++++++++++--------------------------------------- src/lex.l | 10 ++++----- src/list.c | 5 ++--- src/parse.c | 60 ++++++++++++++++++++++++++++++++++-------------------- src/twm.c | 12 +++++------ src/twm.h | 6 +++--- 6 files changed, 77 insertions(+), 83 deletions(-) diff --git a/src/gram.y b/src/gram.y index 6c4f4ea..4bf9f4c 100644 --- a/src/gram.y +++ b/src/gram.y @@ -281,19 +281,17 @@ stmt : error noarg : KEYWORD { if (!do_single_keyword ($1)) { - twmrc_error_prefix(); - fprintf (stderr, - "unknown singleton keyword %d\n", - $1); + parseWarning ( + "unknown singleton keyword %d", + $1); ParseError = 1; } } ; sarg : SKEYWORD string { if (!do_string_keyword ($1, $2)) { - twmrc_error_prefix(); - fprintf (stderr, - "unknown string keyword %d (value \"%s\")\n", + parseWarning ( + "unknown string keyword %d (value \"%s\")", $1, $2); ParseError = 1; } @@ -301,9 +299,8 @@ sarg : SKEYWORD string { if (!do_string_keyword ($1, $2)) { ; narg : NKEYWORD number { if (!do_number_keyword ($1, $2)) { - twmrc_error_prefix(); - fprintf (stderr, - "unknown numeric keyword %d (value %d)\n", + parseWarning ( + "unknown numeric keyword %d (value %d)", $1, $2); ParseError = 1; } @@ -327,9 +324,8 @@ key : META { mods |= Mod1Mask; } | LOCK { mods |= LockMask; } | CONTROL { mods |= ControlMask; } | META number { if ($2 < 1 || $2 > 5) { - twmrc_error_prefix(); - fprintf (stderr, - "bad modifier number (%d), must be 1-5\n", + parseWarning ( + "bad modifier number (%d), must be 1-5", $2); ParseError = 1; } else { @@ -445,9 +441,8 @@ color_entries : /* Empty */ color_entry : CLKEYWORD string { if (!do_colorlist_keyword ($1, color, $2)) { - twmrc_error_prefix(); - fprintf (stderr, - "unhandled list color keyword %d (string \"%s\")\n", + parseWarning ( + "unhandled list color keyword %d (string \"%s\")", $1, $2); ParseError = 1; } @@ -455,9 +450,8 @@ color_entry : CLKEYWORD string { if (!do_colorlist_keyword ($1, color, | CLKEYWORD string { list = do_colorlist_keyword($1,color, $2); if (!list) { - twmrc_error_prefix(); - fprintf (stderr, - "unhandled color list keyword %d (string \"%s\")\n", + parseWarning ( + "unhandled color list keyword %d (string \"%s\")", $1, $2); ParseError = 1; } @@ -465,9 +459,8 @@ color_entry : CLKEYWORD string { if (!do_colorlist_keyword ($1, color, win_color_list { /* No action */; } | CKEYWORD string { if (!do_color_keyword ($1, color, $2)) { - twmrc_error_prefix(); - fprintf (stderr, - "unhandled color keyword %d (string \"%s\")\n", + parseWarning ( + "unhandled color keyword %d (string \"%s\")", $1, $2); ParseError = 1; } @@ -605,18 +598,16 @@ action : FKEYWORD { $$ = $1; } break; case F_WARPRING: if (!CheckWarpRingArg (Action)) { - twmrc_error_prefix(); - fprintf (stderr, - "ignoring invalid f.warptoring argument \"%s\"\n", + parseWarning ( + "ignoring invalid f.warptoring argument \"%s\"", Action); $$ = F_NOP; } break; case F_WARPTOSCREEN: if (!CheckWarpScreenArg (Action)) { - twmrc_error_prefix(); - fprintf (stderr, - "ignoring invalid f.warptoscreen argument \"%s\"\n", + parseWarning ( + "ignoring invalid f.warptoscreen argument \"%s\"", Action); $$ = F_NOP; } @@ -625,9 +616,8 @@ action : FKEYWORD { $$ = $1; } if (CheckColormapArg (Action)) { $$ = F_COLORMAP; } else { - twmrc_error_prefix(); - fprintf (stderr, - "ignoring invalid f.colormap argument \"%s\"\n", + parseWarning ( + "ignoring invalid f.colormap argument \"%s\"", Action); $$ = F_NOP; } @@ -666,8 +656,7 @@ number : NUMBER { $$ = $1; } static void yyerror(const char *s) { - twmrc_error_prefix(); - fprintf (stderr, "error in input file: %s\n", s ? s : ""); + parseWarning ("error in input file: %s", s ? s : ""); ParseError = 1; } @@ -830,9 +819,8 @@ static void GotKey(char *key, int func) static void GotTitleButton (char *bitmapname, int func, Bool rightside) { if (!CreateTitleButton (bitmapname, func, Action, pull, rightside, True)) { - twmrc_error_prefix(); - fprintf (stderr, - "unable to create %s titlebutton \"%s\"\n", + parseWarning ( + "unable to create %s titlebutton \"%s\"", rightside ? "right" : "left", bitmapname); } Action = empty; @@ -876,10 +864,3 @@ static Bool CheckColormapArg (char *s) return False; } - - -void -twmrc_error_prefix (void) -{ - fprintf (stderr, "%s: line %d: ", ProgramName, yylineno); -} diff --git a/src/lex.l b/src/lex.l index 320d206..e8453bb 100644 --- a/src/lex.l +++ b/src/lex.l @@ -106,9 +106,8 @@ number [0-9]+ [a-zA-Z\.]+ { int token = parse_keyword ((char *)yytext, &yylval.num); if (token == ERRORTOKEN) { - twmrc_error_prefix(); - fprintf (stderr, - "ignoring unknown keyword: %s\n", + parseWarning ( + "ignoring unknown keyword: %s", yytext); ParseError = 1; } else @@ -125,9 +124,8 @@ number [0-9]+ \#[^\n]*\n {;} [\r\n\t ] {;} . { - twmrc_error_prefix(); - fprintf (stderr, - "ignoring character \"%s\"\n", + parseWarning ( + "ignoring character \"%s\"", yytext); ParseError = 1; } diff --git a/src/list.c b/src/list.c index 593204f..4422cc9 100644 --- a/src/list.c +++ b/src/list.c @@ -92,9 +92,8 @@ AddToList(name_list ** list_head, char *name, char *ptr) nptr = malloc(sizeof(name_list)); if (nptr == NULL) { - twmrc_error_prefix(); - fprintf(stderr, "unable to allocate %lu bytes for name_list\n", - (unsigned long) sizeof(name_list)); + parseWarning("unable to allocate %lu bytes for name_list", + (unsigned long) sizeof(name_list)); Done(NULL, NULL); } diff --git a/src/parse.c b/src/parse.c index 18ed6b0..48430b3 100644 --- a/src/parse.c +++ b/src/parse.c @@ -58,14 +58,17 @@ in this Software without prior written authorization from The Open Group. ***********************************************************************/ #include +#include #include #include + #include "twm.h" #include "screen.h" #include "menus.h" #include "util.h" #include "gram.h" #include "parse.h" + #include #include @@ -82,8 +85,6 @@ static unsigned char overflowbuff[20]; /* really only need one */ static int overflowlen; static unsigned char **stringListSource, *currentString; -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); @@ -95,6 +96,9 @@ int ConstrainedMoveTime = 400; /* milliseconds, event times */ int (*twmInputFunc) (void); +static const char *twmInputFile; +static const char *twmInputType; + /** * parse the .twmrc file * \param filename the filename to parse. NULL indicates $HOME/.twmrc @@ -108,6 +112,8 @@ doparse(int (*ifunc) (void), const char *srctypename, const char *srcname) yylineno = 1; ParseError = FALSE; twmInputFunc = ifunc; + twmInputFile = srcname; + twmInputType = srctypename; overflowlen = 0; yyparse(); @@ -284,8 +290,7 @@ twmUnput(int c) overflowbuff[overflowlen++] = (unsigned char) c; } else { - twmrc_error_prefix(); - fprintf(stderr, "unable to unput character (%d)\n", c); + parseWarning("unable to unput character (%d)", c); } } @@ -748,9 +753,7 @@ do_string_keyword(int keyword, char *s) int ppos = ParseUsePPosition(s); if (ppos < 0) { - twmrc_error_prefix(); - fprintf(stderr, - "ignoring invalid UsePPosition argument \"%s\"\n", s); + parseWarning("ignoring invalid UsePPosition argument \"%s\"", s); } else { Scr->UsePPosition = (short) ppos; @@ -799,13 +802,11 @@ do_string_keyword(int keyword, char *s) &JunkHeight); if ((JunkMask & (WidthValue | HeightValue)) != (WidthValue | HeightValue)) { - twmrc_error_prefix(); - fprintf(stderr, "bad MaxWindowSize \"%s\"\n", s); + parseWarning("bad MaxWindowSize \"%s\"", s); return 0; } if (JunkWidth <= 0 || JunkHeight <= 0) { - twmrc_error_prefix(); - fprintf(stderr, "MaxWindowSize \"%s\" must be positive\n", s); + parseWarning("MaxWindowSize \"%s\" must be positive", s); return 0; } Scr->MaxWindowWidth = (int) JunkWidth; @@ -1134,20 +1135,16 @@ do_squeeze_entry(name_list ** list, char *name, int justify, int num, int denom) int absnum = (num < 0 ? -num : num); if (denom < 0) { - twmrc_error_prefix(); - fprintf(stderr, "negative SqueezeTitle denominator %d\n", denom); + parseWarning("negative SqueezeTitle denominator %d", denom); return; } if (absnum > denom && denom != 0) { - twmrc_error_prefix(); - fprintf(stderr, "SqueezeTitle fraction %d/%d outside window\n", - num, denom); + parseWarning("SqueezeTitle fraction %d/%d outside window", num, denom); return; } if (denom == 1) { - twmrc_error_prefix(); - fprintf(stderr, "useless SqueezeTitle faction %d/%d, assuming 0/0\n", - num, denom); + parseWarning("useless SqueezeTitle faction %d/%d, assuming 0/0", + num, denom); num = 0; denom = 0; } @@ -1158,9 +1155,8 @@ do_squeeze_entry(name_list ** list, char *name, int justify, int num, int denom) sinfo = malloc(sizeof(SqueezeInfo)); if (!sinfo) { - twmrc_error_prefix(); - fprintf(stderr, "unable to allocate %lu bytes for squeeze info\n", - (unsigned long) sizeof(SqueezeInfo)); + parseWarning("unable to allocate %lu bytes for squeeze info", + (unsigned long) sizeof(SqueezeInfo)); return; } sinfo->justify = justify; @@ -1169,3 +1165,23 @@ do_squeeze_entry(name_list ** list, char *name, int justify, int num, int denom) AddToList(list, name, (char *) sinfo); } } + +void +parseWarning(const char *format, ...) +{ + if (message_level > 0) { + va_list ap; + + va_start(ap, format); + if (twmInputFile != NULL) { + fprintf(stderr, "%s: line %d: ", twmInputFile, yylineno); + } + else { + fprintf(stderr, "%s[%s]: line %d: ", ProgramName, twmInputType, + yylineno); + } + vfprintf(stderr, format, ap); + fputc('\n', stderr); + va_end(ap); + } +} diff --git a/src/twm.c b/src/twm.c index 12cac5f..2abb603 100644 --- a/src/twm.c +++ b/src/twm.c @@ -117,7 +117,7 @@ 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 */ -static int verbose = 1; /* controls error messages */ +int message_level = 1; /* 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 */ @@ -306,7 +306,7 @@ main(int argc, char *argv[]) case 'v': /* -verbose */ if (!brief_opt(argv[i], "verbose")) usage(); - verbose++; + message_level++; continue; case 'c': /* -clientId */ if (!brief_opt(argv[i], "clientId")) @@ -325,7 +325,7 @@ main(int argc, char *argv[]) case 'q': /* -quiet */ if (!brief_opt(argv[i], "quiet")) usage(); - --verbose; + --message_level; continue; } } @@ -987,7 +987,7 @@ TwmErrorHandler(Display *dpy2, XErrorEvent *event) LastErrorEvent = *event; ErrorOccurred = True; - if ((verbose > 1) && /* don't be too obnoxious */ + if ((message_level > 1) && /* don't be too obnoxious */ event->error_code != BadWindow && /* watch for dead puppies */ (event->request_code != X_GetGeometry && /* of all styles */ event->error_code != BadDrawable)) @@ -1020,7 +1020,7 @@ twmError(const char *format, ...) void twmWarning(const char *format, ...) { - if (verbose > 0) { + if (message_level > 0) { va_list ap; va_start(ap, format); @@ -1034,7 +1034,7 @@ twmWarning(const char *format, ...) void twmVerbose(const char *format, ...) { - if (verbose > 1) { + if (message_level > 1) { va_list ap; va_start(ap, format); diff --git a/src/twm.h b/src/twm.h index d39abdb..2428391 100644 --- a/src/twm.h +++ b/src/twm.h @@ -418,16 +418,16 @@ extern Bool RestartPreviousState; extern Bool GetWMState(Window w, int *statep, Window *iwp); -extern void -twmrc_error_prefix(void); - extern int yyparse(void); extern int yylex(void); +extern void parseWarning(const char *, ...) GCC_PRINTFLIKE(1,2); + extern Atom TwmAtoms[]; +extern int message_level; extern Bool use_fontset; extern int ShapeEventBase; -- cgit v1.2.3 From 68703413c5d6d800f0f79d08ad51a86dc53713ce Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 21 Jun 2020 09:25:49 -0400 Subject: indent lex/yacc files using xxx-indent (twm-indent uses GNU indent, which does not handle those files). Signed-off-by: Thomas E. Dickey --- src/gram.y | 1302 ++++++++++++++++++++++++++++++------------------------------ src/lex.l | 113 +++--- 2 files changed, 711 insertions(+), 704 deletions(-) diff --git a/src/gram.y b/src/gram.y index 4bf9f4c..28a4695 100644 --- a/src/gram.y +++ b/src/gram.y @@ -56,7 +56,7 @@ in this Software without prior written authorization from The Open Group. * * .twmrc command grammer * - * 07-Jan-86 Thomas E. LaStrange File created + * 07-Jan-86 Thomas E. LaStrange File created * 11-Nov-90 Dave Sternlicht Adding SaveColors * 10-Oct-90 David M. Sternlicht Storing saved colors on root * @@ -65,6 +65,7 @@ in this Software without prior written authorization from The Open Group. ***********************************************************************/ %{ + #include #include #include "twm.h" @@ -81,16 +82,16 @@ in this Software without prior written authorization from The Open Group. static char empty[1]; static char *Action = empty; static char *Name = empty; -static MenuRoot *root, *pull = NULL; +static MenuRoot *root, *pull = NULL; -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 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; @@ -100,7 +101,7 @@ int mods = 0; unsigned int mods_used = (ShiftMask | ControlMask | Mod1Mask); extern int yylineno; -static void yyerror ( const char *s ); +static void yyerror(const char *s); %} @@ -134,338 +135,338 @@ static void yyerror ( const char *s ); %start twmrc %% -twmrc : stmts - ; - -stmts : /* Empty */ - | stmts stmt - ; - -stmt : error - | noarg - | sarg - | narg - | squeeze - | ICON_REGION string DKEYWORD DKEYWORD number number - { AddIconRegion($2, $3, $4, $5, $6); } - | ICONMGR_GEOMETRY string number { if (Scr->FirstTime) - { - Scr->iconmgr.geometry=$2; - Scr->iconmgr.columns=$3; - } - } - | ICONMGR_GEOMETRY string { if (Scr->FirstTime) - Scr->iconmgr.geometry = $2; - } - | ZOOM number { if (Scr->FirstTime) - { - Scr->DoZoom = TRUE; - Scr->ZoomCount = (short)$2; - } - } - | 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) - Scr->IconifyByUnmapping = TRUE; } - | LEFT_TITLEBUTTON string EQUALS action { - GotTitleButton ($2, $4, False); - } - | RIGHT_TITLEBUTTON string EQUALS action { - GotTitleButton ($2, $4, True); - } - | button string { root = GetRoot($2, NULLSTR, NULLSTR); - Scr->Mouse[$1][C_ROOT][0].func = F_MENU; - Scr->Mouse[$1][C_ROOT][0].menu = root; - } - | button action { Scr->Mouse[$1][C_ROOT][0].func = $2; - if ($2 == F_MENU) - { - pull->prev = NULL; - Scr->Mouse[$1][C_ROOT][0].menu = pull; - } - else - { - root = GetRoot(TWM_ROOT,NULLSTR,NULLSTR); - Scr->Mouse[$1][C_ROOT][0].item = - AddToMenu(root,"x",Action, - NULL,$2,NULLSTR,NULLSTR); - } - Action = empty; - pull = NULL; - } - | string fullkey { GotKey($1, $2); } - | button full { GotButton($1, $2); } - | DONT_ICONIFY_BY_UNMAPPING { list = &Scr->DontIconify; } - win_list - | ICONMGR_NOSHOW { list = &Scr->IconMgrNoShow; } - win_list - | ICONMGR_NOSHOW { Scr->IconManagerDontShow = TRUE; } - | ICONMGRS { list = &Scr->IconMgrs; } - iconm_list - | ICONMGR_SHOW { list = &Scr->IconMgrShow; } - win_list - | NO_TITLE_HILITE { list = &Scr->NoTitleHighlight; } - win_list - | NO_TITLE_HILITE { if (Scr->FirstTime) - Scr->TitleHighlight = FALSE; } - | NO_HILITE { list = &Scr->NoHighlight; } - win_list - | NO_HILITE { if (Scr->FirstTime) - Scr->Highlight = FALSE; } - | NO_STACKMODE { list = &Scr->NoStackModeL; } - win_list - | NO_STACKMODE { if (Scr->FirstTime) - Scr->StackMode = FALSE; } - | NO_TITLE { list = &Scr->NoTitle; } - win_list - | NO_TITLE { if (Scr->FirstTime) - Scr->NoTitlebar = TRUE; } - | MAKE_TITLE { list = &Scr->MakeTitle; } - win_list - | START_ICONIFIED { list = &Scr->StartIconified; } - win_list - | AUTO_RAISE { list = &Scr->AutoRaise; } - win_list - | MENU string LP string COLON string RP { - root = GetRoot($2, $4, $6); } - menu { root->real_menu = TRUE;} - | MENU string { root = GetRoot($2, NULLSTR, NULLSTR); } - menu { root->real_menu = TRUE; } - | FUNCTION string { root = GetRoot($2, NULLSTR, NULLSTR); } - function - | ICONS { list = &Scr->IconNames; } - icon_list - | COLOR { color = COLOR; } - color_list - | GRAYSCALE { color = GRAYSCALE; } - color_list - | SAVECOLOR +twmrc : stmts + ; + +stmts : /* Empty */ + | stmts stmt + ; + +stmt : error + | noarg + | sarg + | narg + | squeeze + | ICON_REGION string DKEYWORD DKEYWORD number number + { AddIconRegion($2, $3, $4, $5, $6); } + | ICONMGR_GEOMETRY string number { if (Scr->FirstTime) + { + Scr->iconmgr.geometry=$2; + Scr->iconmgr.columns=$3; + } + } + | ICONMGR_GEOMETRY string { if (Scr->FirstTime) + Scr->iconmgr.geometry = $2; + } + | ZOOM number { if (Scr->FirstTime) + { + Scr->DoZoom = TRUE; + Scr->ZoomCount = (short)$2; + } + } + | 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) + Scr->IconifyByUnmapping = TRUE; } + | LEFT_TITLEBUTTON string EQUALS action { + GotTitleButton ($2, $4, False); + } + | RIGHT_TITLEBUTTON string EQUALS action { + GotTitleButton ($2, $4, True); + } + | button string { root = GetRoot($2, NULLSTR, NULLSTR); + Scr->Mouse[$1][C_ROOT][0].func = F_MENU; + Scr->Mouse[$1][C_ROOT][0].menu = root; + } + | button action { Scr->Mouse[$1][C_ROOT][0].func = $2; + if ($2 == F_MENU) + { + pull->prev = NULL; + Scr->Mouse[$1][C_ROOT][0].menu = pull; + } + else + { + root = GetRoot(TWM_ROOT,NULLSTR,NULLSTR); + Scr->Mouse[$1][C_ROOT][0].item = + AddToMenu(root,"x",Action, + NULL,$2,NULLSTR,NULLSTR); + } + Action = empty; + pull = NULL; + } + | string fullkey { GotKey($1, $2); } + | button full { GotButton($1, $2); } + | DONT_ICONIFY_BY_UNMAPPING { list = &Scr->DontIconify; } + win_list + | ICONMGR_NOSHOW { list = &Scr->IconMgrNoShow; } + win_list + | ICONMGR_NOSHOW { Scr->IconManagerDontShow = TRUE; } + | ICONMGRS { list = &Scr->IconMgrs; } + iconm_list + | ICONMGR_SHOW { list = &Scr->IconMgrShow; } + win_list + | NO_TITLE_HILITE { list = &Scr->NoTitleHighlight; } + win_list + | NO_TITLE_HILITE { if (Scr->FirstTime) + Scr->TitleHighlight = FALSE; } + | NO_HILITE { list = &Scr->NoHighlight; } + win_list + | NO_HILITE { if (Scr->FirstTime) + Scr->Highlight = FALSE; } + | NO_STACKMODE { list = &Scr->NoStackModeL; } + win_list + | NO_STACKMODE { if (Scr->FirstTime) + Scr->StackMode = FALSE; } + | NO_TITLE { list = &Scr->NoTitle; } + win_list + | NO_TITLE { if (Scr->FirstTime) + Scr->NoTitlebar = TRUE; } + | MAKE_TITLE { list = &Scr->MakeTitle; } + win_list + | START_ICONIFIED { list = &Scr->StartIconified; } + win_list + | AUTO_RAISE { list = &Scr->AutoRaise; } + win_list + | MENU string LP string COLON string RP { + root = GetRoot($2, $4, $6); } + menu { root->real_menu = TRUE;} + | MENU string { root = GetRoot($2, NULLSTR, NULLSTR); } + menu { root->real_menu = TRUE; } + | FUNCTION string { root = GetRoot($2, NULLSTR, NULLSTR); } + function + | ICONS { list = &Scr->IconNames; } + icon_list + | COLOR { color = COLOR; } + color_list + | GRAYSCALE { color = GRAYSCALE; } + color_list + | SAVECOLOR save_color_list - | MONOCHROME { color = MONOCHROME; } - color_list - | DEFAULT_FUNCTION action { Scr->DefaultFunction.func = $2; - if ($2 == F_MENU) - { - pull->prev = NULL; - Scr->DefaultFunction.menu = pull; - } - else - { - root = GetRoot(TWM_ROOT,NULLSTR,NULLSTR); - Scr->DefaultFunction.item = - AddToMenu(root,"x",Action, - NULL,$2, NULLSTR, NULLSTR); - } - Action = empty; - pull = NULL; - } - | WINDOW_FUNCTION action { Scr->WindowFunction.func = $2; - root = GetRoot(TWM_ROOT,NULLSTR,NULLSTR); - Scr->WindowFunction.item = - AddToMenu(root,"x",Action, - NULL,$2, NULLSTR, NULLSTR); - Action = empty; - pull = NULL; - } - | WARP_CURSOR { list = &Scr->WarpCursorL; } - win_list - | WARP_CURSOR { if (Scr->FirstTime) - Scr->WarpCursor = TRUE; } - | WINDOW_RING { list = &Scr->WindowRingL; } - win_list - ; - - -noarg : KEYWORD { if (!do_single_keyword ($1)) { - parseWarning ( - "unknown singleton keyword %d", - $1); - ParseError = 1; - } - } - ; - -sarg : SKEYWORD string { if (!do_string_keyword ($1, $2)) { - parseWarning ( - "unknown string keyword %d (value \"%s\")", - $1, $2); - ParseError = 1; - } - } - ; - -narg : NKEYWORD number { if (!do_number_keyword ($1, $2)) { - parseWarning ( - "unknown numeric keyword %d (value %d)", - $1, $2); - ParseError = 1; - } - } - ; - - - -full : EQUALS keys COLON contexts COLON action { $$ = $6; } - ; - -fullkey : EQUALS keys COLON contextkeys COLON action { $$ = $6; } - ; - -keys : /* Empty */ - | keys key - ; - -key : META { mods |= Mod1Mask; } - | SHIFT { mods |= ShiftMask; } - | LOCK { mods |= LockMask; } - | CONTROL { mods |= ControlMask; } - | META number { if ($2 < 1 || $2 > 5) { - parseWarning ( - "bad modifier number (%d), must be 1-5", - $2); - ParseError = 1; - } else { - mods |= (Mod1Mask << ($2 - 1)); - } - } - | OR { } - ; - -contexts : /* Empty */ - | contexts context - ; - -context : WINDOW { cont |= C_WINDOW_BIT; } - | TITLE { cont |= C_TITLE_BIT; } - | ICON { cont |= C_ICON_BIT; } - | ROOT { cont |= C_ROOT_BIT; } - | FRAME { cont |= C_FRAME_BIT; } - | ICONMGR { cont |= C_ICONMGR_BIT; } - | META { cont |= C_ICONMGR_BIT; } - | ALL { cont |= C_ALL_BITS; } - | OR { } - ; - -contextkeys : /* Empty */ - | contextkeys contextkey - ; - -contextkey : WINDOW { cont |= C_WINDOW_BIT; } - | TITLE { cont |= C_TITLE_BIT; } - | ICON { cont |= C_ICON_BIT; } - | ROOT { cont |= C_ROOT_BIT; } - | FRAME { cont |= C_FRAME_BIT; } - | ICONMGR { cont |= C_ICONMGR_BIT; } - | META { cont |= C_ICONMGR_BIT; } - | ALL { cont |= C_ALL_BITS; } - | OR { } - | string { Name = $1; cont |= C_NAME_BIT; } - ; - - -pixmap_list : LB pixmap_entries RB - ; - -pixmap_entries : /* Empty */ - | pixmap_entries pixmap_entry - ; - -pixmap_entry : TITLE_HILITE string { SetHighlightPixmap ($2); } - ; - - -cursor_list : LB cursor_entries RB - ; - -cursor_entries : /* Empty */ - | cursor_entries cursor_entry - ; - -cursor_entry : FRAME string string { - NewBitmapCursor(&Scr->FrameCursor, $2, $3); } - | FRAME string { - NewFontCursor(&Scr->FrameCursor, $2); } - | TITLE string string { - NewBitmapCursor(&Scr->TitleCursor, $2, $3); } - | TITLE string { - NewFontCursor(&Scr->TitleCursor, $2); } - | ICON string string { - NewBitmapCursor(&Scr->IconCursor, $2, $3); } - | ICON string { - NewFontCursor(&Scr->IconCursor, $2); } - | ICONMGR string string { - NewBitmapCursor(&Scr->IconMgrCursor, $2, $3); } - | ICONMGR string { - NewFontCursor(&Scr->IconMgrCursor, $2); } - | BUTTON string string { - NewBitmapCursor(&Scr->ButtonCursor, $2, $3); } - | BUTTON string { - NewFontCursor(&Scr->ButtonCursor, $2); } - | MOVE string string { - NewBitmapCursor(&Scr->MoveCursor, $2, $3); } - | MOVE string { - NewFontCursor(&Scr->MoveCursor, $2); } - | RESIZE string string { - NewBitmapCursor(&Scr->ResizeCursor, $2, $3); } - | RESIZE string { - NewFontCursor(&Scr->ResizeCursor, $2); } - | WAIT string string { - NewBitmapCursor(&Scr->WaitCursor, $2, $3); } - | WAIT string { - NewFontCursor(&Scr->WaitCursor, $2); } - | MENU string string { - NewBitmapCursor(&Scr->MenuCursor, $2, $3); } - | MENU string { - NewFontCursor(&Scr->MenuCursor, $2); } - | SELECT string string { - NewBitmapCursor(&Scr->SelectCursor, $2, $3); } - | SELECT string { - NewFontCursor(&Scr->SelectCursor, $2); } - | KILL string string { - NewBitmapCursor(&Scr->DestroyCursor, $2, $3); } - | KILL string { - NewFontCursor(&Scr->DestroyCursor, $2); } - ; - -color_list : LB color_entries RB - ; - - -color_entries : /* Empty */ - | color_entries color_entry - ; - -color_entry : CLKEYWORD string { if (!do_colorlist_keyword ($1, color, - $2)) { - parseWarning ( - "unhandled list color keyword %d (string \"%s\")", - $1, $2); - ParseError = 1; - } - } - | CLKEYWORD string { list = do_colorlist_keyword($1,color, - $2); - if (!list) { - parseWarning ( - "unhandled color list keyword %d (string \"%s\")", - $1, $2); - ParseError = 1; - } - } - win_color_list { /* No action */; } - | CKEYWORD string { if (!do_color_keyword ($1, color, - $2)) { - parseWarning ( - "unhandled color keyword %d (string \"%s\")", - $1, $2); - ParseError = 1; - } - } - ; + | MONOCHROME { color = MONOCHROME; } + color_list + | DEFAULT_FUNCTION action { Scr->DefaultFunction.func = $2; + if ($2 == F_MENU) + { + pull->prev = NULL; + Scr->DefaultFunction.menu = pull; + } + else + { + root = GetRoot(TWM_ROOT,NULLSTR,NULLSTR); + Scr->DefaultFunction.item = + AddToMenu(root,"x",Action, + NULL,$2, NULLSTR, NULLSTR); + } + Action = empty; + pull = NULL; + } + | WINDOW_FUNCTION action { Scr->WindowFunction.func = $2; + root = GetRoot(TWM_ROOT,NULLSTR,NULLSTR); + Scr->WindowFunction.item = + AddToMenu(root,"x",Action, + NULL,$2, NULLSTR, NULLSTR); + Action = empty; + pull = NULL; + } + | WARP_CURSOR { list = &Scr->WarpCursorL; } + win_list + | WARP_CURSOR { if (Scr->FirstTime) + Scr->WarpCursor = TRUE; } + | WINDOW_RING { list = &Scr->WindowRingL; } + win_list + ; + + +noarg : KEYWORD { if (!do_single_keyword ($1)) { + parseWarning ( + "unknown singleton keyword %d", + $1); + ParseError = 1; + } + } + ; + +sarg : SKEYWORD string { if (!do_string_keyword ($1, $2)) { + parseWarning ( + "unknown string keyword %d (value \"%s\")", + $1, $2); + ParseError = 1; + } + } + ; + +narg : NKEYWORD number { if (!do_number_keyword ($1, $2)) { + parseWarning ( + "unknown numeric keyword %d (value %d)", + $1, $2); + ParseError = 1; + } + } + ; + + + +full : EQUALS keys COLON contexts COLON action { $$ = $6; } + ; + +fullkey : EQUALS keys COLON contextkeys COLON action { $$ = $6; } + ; + +keys : /* Empty */ + | keys key + ; + +key : META { mods |= Mod1Mask; } + | SHIFT { mods |= ShiftMask; } + | LOCK { mods |= LockMask; } + | CONTROL { mods |= ControlMask; } + | META number { if ($2 < 1 || $2 > 5) { + parseWarning ( + "bad modifier number (%d), must be 1-5", + $2); + ParseError = 1; + } else { + mods |= (Mod1Mask << ($2 - 1)); + } + } + | OR { } + ; + +contexts : /* Empty */ + | contexts context + ; + +context : WINDOW { cont |= C_WINDOW_BIT; } + | TITLE { cont |= C_TITLE_BIT; } + | ICON { cont |= C_ICON_BIT; } + | ROOT { cont |= C_ROOT_BIT; } + | FRAME { cont |= C_FRAME_BIT; } + | ICONMGR { cont |= C_ICONMGR_BIT; } + | META { cont |= C_ICONMGR_BIT; } + | ALL { cont |= C_ALL_BITS; } + | OR { } + ; + +contextkeys : /* Empty */ + | contextkeys contextkey + ; + +contextkey : WINDOW { cont |= C_WINDOW_BIT; } + | TITLE { cont |= C_TITLE_BIT; } + | ICON { cont |= C_ICON_BIT; } + | ROOT { cont |= C_ROOT_BIT; } + | FRAME { cont |= C_FRAME_BIT; } + | ICONMGR { cont |= C_ICONMGR_BIT; } + | META { cont |= C_ICONMGR_BIT; } + | ALL { cont |= C_ALL_BITS; } + | OR { } + | string { Name = $1; cont |= C_NAME_BIT; } + ; + + +pixmap_list : LB pixmap_entries RB + ; + +pixmap_entries : /* Empty */ + | pixmap_entries pixmap_entry + ; + +pixmap_entry : TITLE_HILITE string { SetHighlightPixmap ($2); } + ; + + +cursor_list : LB cursor_entries RB + ; + +cursor_entries : /* Empty */ + | cursor_entries cursor_entry + ; + +cursor_entry : FRAME string string { + NewBitmapCursor(&Scr->FrameCursor, $2, $3); } + | FRAME string { + NewFontCursor(&Scr->FrameCursor, $2); } + | TITLE string string { + NewBitmapCursor(&Scr->TitleCursor, $2, $3); } + | TITLE string { + NewFontCursor(&Scr->TitleCursor, $2); } + | ICON string string { + NewBitmapCursor(&Scr->IconCursor, $2, $3); } + | ICON string { + NewFontCursor(&Scr->IconCursor, $2); } + | ICONMGR string string { + NewBitmapCursor(&Scr->IconMgrCursor, $2, $3); } + | ICONMGR string { + NewFontCursor(&Scr->IconMgrCursor, $2); } + | BUTTON string string { + NewBitmapCursor(&Scr->ButtonCursor, $2, $3); } + | BUTTON string { + NewFontCursor(&Scr->ButtonCursor, $2); } + | MOVE string string { + NewBitmapCursor(&Scr->MoveCursor, $2, $3); } + | MOVE string { + NewFontCursor(&Scr->MoveCursor, $2); } + | RESIZE string string { + NewBitmapCursor(&Scr->ResizeCursor, $2, $3); } + | RESIZE string { + NewFontCursor(&Scr->ResizeCursor, $2); } + | WAIT string string { + NewBitmapCursor(&Scr->WaitCursor, $2, $3); } + | WAIT string { + NewFontCursor(&Scr->WaitCursor, $2); } + | MENU string string { + NewBitmapCursor(&Scr->MenuCursor, $2, $3); } + | MENU string { + NewFontCursor(&Scr->MenuCursor, $2); } + | SELECT string string { + NewBitmapCursor(&Scr->SelectCursor, $2, $3); } + | SELECT string { + NewFontCursor(&Scr->SelectCursor, $2); } + | KILL string string { + NewBitmapCursor(&Scr->DestroyCursor, $2, $3); } + | KILL string { + NewFontCursor(&Scr->DestroyCursor, $2); } + ; + +color_list : LB color_entries RB + ; + + +color_entries : /* Empty */ + | color_entries color_entry + ; + +color_entry : CLKEYWORD string { if (!do_colorlist_keyword ($1, color, + $2)) { + parseWarning ( + "unhandled list color keyword %d (string \"%s\")", + $1, $2); + ParseError = 1; + } + } + | CLKEYWORD string { list = do_colorlist_keyword($1,color, + $2); + if (!list) { + parseWarning ( + "unhandled color list keyword %d (string \"%s\")", + $1, $2); + ParseError = 1; + } + } + win_color_list { /* No action */; } + | CKEYWORD string { if (!do_color_keyword ($1, color, + $2)) { + parseWarning ( + "unhandled color keyword %d (string \"%s\")", + $1, $2); + ParseError = 1; + } + } + ; save_color_list : LB s_color_entries RB ; @@ -478,185 +479,186 @@ s_color_entry : string { do_string_savecolor(color, $1); } | CLKEYWORD { do_var_savecolor($1); } ; -win_color_list : LB win_color_entries RB - ; - -win_color_entries : /* Empty */ - | win_color_entries win_color_entry - ; - -win_color_entry : string string { if (Scr->FirstTime && - color == Scr->Monochrome) - AddToList(list, $1, $2); } - ; - -squeeze : SQUEEZE_TITLE { - if (HasShape) Scr->SqueezeTitle = TRUE; - } - | SQUEEZE_TITLE { list = &Scr->SqueezeTitleL; - if (HasShape && Scr->SqueezeTitle == -1) - Scr->SqueezeTitle = TRUE; - } - LB win_sqz_entries RB - | DONT_SQUEEZE_TITLE { Scr->SqueezeTitle = FALSE; } - | DONT_SQUEEZE_TITLE { list = &Scr->DontSqueezeTitleL; } - win_list - ; - -win_sqz_entries : /* Empty */ - | win_sqz_entries string JKEYWORD signed_number number { - if (Scr->FirstTime) { - do_squeeze_entry (list, $2, $3, $4, $5); - } - } - ; - - -iconm_list : LB iconm_entries RB - ; - -iconm_entries : /* Empty */ - | iconm_entries iconm_entry - ; - -iconm_entry : string string number { if (Scr->FirstTime) - AddToList(list, $1, (char *) - AllocateIconManager($1, NULLSTR, - $2,$3)); - } - | string string string number - { if (Scr->FirstTime) - AddToList(list, $1, (char *) - AllocateIconManager($1,$2, - $3, $4)); - } - ; - -win_list : LB win_entries RB - ; - -win_entries : /* Empty */ - | win_entries win_entry - ; - -win_entry : string { if (Scr->FirstTime) - AddToList(list, $1, 0); - } - ; - -icon_list : LB icon_entries RB - ; - -icon_entries : /* Empty */ - | icon_entries icon_entry - ; - -icon_entry : string string { if (Scr->FirstTime) AddToList(list, $1, $2); } - ; - -function : LB function_entries RB - ; +win_color_list : LB win_color_entries RB + ; + +win_color_entries : /* Empty */ + | win_color_entries win_color_entry + ; + +win_color_entry : string string { if (Scr->FirstTime && + color == Scr->Monochrome) + AddToList(list, $1, $2); } + ; + +squeeze : SQUEEZE_TITLE { + if (HasShape) Scr->SqueezeTitle = TRUE; + } + | SQUEEZE_TITLE { list = &Scr->SqueezeTitleL; + if (HasShape && Scr->SqueezeTitle == -1) + Scr->SqueezeTitle = TRUE; + } + LB win_sqz_entries RB + | DONT_SQUEEZE_TITLE { Scr->SqueezeTitle = FALSE; } + | DONT_SQUEEZE_TITLE { list = &Scr->DontSqueezeTitleL; } + win_list + ; + +win_sqz_entries : /* Empty */ + | win_sqz_entries string JKEYWORD signed_number number { + if (Scr->FirstTime) { + do_squeeze_entry (list, $2, $3, $4, $5); + } + } + ; + + +iconm_list : LB iconm_entries RB + ; + +iconm_entries : /* Empty */ + | iconm_entries iconm_entry + ; + +iconm_entry : string string number { if (Scr->FirstTime) + AddToList(list, $1, (char *) + AllocateIconManager($1, NULLSTR, + $2,$3)); + } + | string string string number + { if (Scr->FirstTime) + AddToList(list, $1, (char *) + AllocateIconManager($1,$2, + $3, $4)); + } + ; + +win_list : LB win_entries RB + ; + +win_entries : /* Empty */ + | win_entries win_entry + ; + +win_entry : string { if (Scr->FirstTime) + AddToList(list, $1, 0); + } + ; + +icon_list : LB icon_entries RB + ; + +icon_entries : /* Empty */ + | icon_entries icon_entry + ; + +icon_entry : string string { if (Scr->FirstTime) AddToList(list, $1, $2); } + ; + +function : LB function_entries RB + ; function_entries: /* Empty */ - | function_entries function_entry - ; - -function_entry : action { AddToMenu(root, empty, Action, NULL, $1, - NULLSTR, NULLSTR); - Action = empty; - } - ; - -menu : LB menu_entries RB - ; - -menu_entries : /* Empty */ - | menu_entries menu_entry - ; - -menu_entry : string action { AddToMenu(root, $1, Action, pull, $2, - NULLSTR, NULLSTR); - Action = empty; - pull = NULL; - } - | string LP string COLON string RP action { - AddToMenu(root, $1, Action, pull, $7, - $3, $5); - Action = empty; - pull = NULL; - } - ; - -action : FKEYWORD { $$ = $1; } - | FSKEYWORD string { - $$ = $1; - Action = $2; - switch ($1) { - case F_MENU: - pull = GetRoot ($2, NULLSTR,NULLSTR); - pull->prev = root; - break; - case F_WARPRING: - if (!CheckWarpRingArg (Action)) { - parseWarning ( - "ignoring invalid f.warptoring argument \"%s\"", - Action); - $$ = F_NOP; - } - break; - case F_WARPTOSCREEN: - if (!CheckWarpScreenArg (Action)) { - parseWarning ( - "ignoring invalid f.warptoscreen argument \"%s\"", - Action); - $$ = F_NOP; - } - break; - case F_COLORMAP: - if (CheckColormapArg (Action)) { - $$ = F_COLORMAP; - } else { - parseWarning ( - "ignoring invalid f.colormap argument \"%s\"", - Action); - $$ = F_NOP; - } - break; - } /* end switch */ - } - ; - - -signed_number : number { $$ = $1; } - | PLUS number { $$ = $2; } - | MINUS number { $$ = -($2); } - ; - -button : BUTTON number { $$ = $2; - if ($2 == 0) - yyerror("bad button 0"); - - if ($2 > MAX_BUTTONS) - { - $$ = 0; - yyerror("button number too large"); - } - } - ; - -string : STRING { ptr = strdup($1); - RemoveDQuote(ptr); - $$ = ptr; - } - ; -number : NUMBER { $$ = $1; } - ; + | function_entries function_entry + ; + +function_entry : action { AddToMenu(root, empty, Action, NULL, $1, + NULLSTR, NULLSTR); + Action = empty; + } + ; + +menu : LB menu_entries RB + ; + +menu_entries : /* Empty */ + | menu_entries menu_entry + ; + +menu_entry : string action { AddToMenu(root, $1, Action, pull, $2, + NULLSTR, NULLSTR); + Action = empty; + pull = NULL; + } + | string LP string COLON string RP action { + AddToMenu(root, $1, Action, pull, $7, + $3, $5); + Action = empty; + pull = NULL; + } + ; + +action : FKEYWORD { $$ = $1; } + | FSKEYWORD string { + $$ = $1; + Action = $2; + switch ($1) { + case F_MENU: + pull = GetRoot ($2, NULLSTR,NULLSTR); + pull->prev = root; + break; + case F_WARPRING: + if (!CheckWarpRingArg (Action)) { + parseWarning ( + "ignoring invalid f.warptoring argument \"%s\"", + Action); + $$ = F_NOP; + } + break; + case F_WARPTOSCREEN: + if (!CheckWarpScreenArg (Action)) { + parseWarning ( + "ignoring invalid f.warptoscreen argument \"%s\"", + Action); + $$ = F_NOP; + } + break; + case F_COLORMAP: + if (CheckColormapArg (Action)) { + $$ = F_COLORMAP; + } else { + parseWarning ( + "ignoring invalid f.colormap argument \"%s\"", + Action); + $$ = F_NOP; + } + break; + } /* end switch */ + } + ; + + +signed_number : number { $$ = $1; } + | PLUS number { $$ = $2; } + | MINUS number { $$ = -($2); } + ; + +button : BUTTON number { $$ = $2; + if ($2 == 0) + yyerror("bad button 0"); + + if ($2 > MAX_BUTTONS) + { + $$ = 0; + yyerror("button number too large"); + } + } + ; + +string : STRING { ptr = strdup($1); + RemoveDQuote(ptr); + $$ = ptr; + } + ; +number : NUMBER { $$ = $1; } + ; %% + static void yyerror(const char *s) { - parseWarning ("error in input file: %s", s ? s : ""); + parseWarning("error in input file: %s", s ? s : ""); ParseError = 1; } @@ -667,200 +669,198 @@ RemoveDQuote(char *str) register int n; register int count; - for (i=str+1, o=str; *i && *i != '\"'; o++) - { - if (*i == '\\') - { - switch (*++i) - { - case 'n': - *o = '\n'; - i++; - break; - case 'b': - *o = '\b'; - i++; - break; - case 'r': - *o = '\r'; - i++; - break; - case 't': - *o = '\t'; - i++; - break; - case 'f': - *o = '\f'; - i++; - break; - case '0': - if (*++i == 'x') - goto hex; - else - --i; - /* FALLTHRU */ - case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - n = 0; - count = 0; - while (*i >= '0' && *i <= '7' && count < 3) - { - n = (n<<3) + (*i++ - '0'); - count++; - } - *o = (char)n; - break; - hex: - case 'x': - n = 0; - count = 0; - while (i++, count++ < 2) - { - if (*i >= '0' && *i <= '9') - n = (n<<4) + (*i - '0'); - else if (*i >= 'a' && *i <= 'f') - n = (n<<4) + (*i - 'a') + 10; - else if (*i >= 'A' && *i <= 'F') - n = (n<<4) + (*i - 'A') + 10; - else - break; - } - *o = (char)n; - break; - case '\n': - i++; /* punt */ - o--; /* to account for o++ at end of loop */ - break; - case '\"': - case '\'': - case '\\': - default: - *o = *i++; - break; - } - } - else - *o = *i++; + for (i = str + 1, o = str; *i && *i != '\"'; o++) { + if (*i == '\\') { + switch (*++i) { + case 'n': + *o = '\n'; + i++; + break; + case 'b': + *o = '\b'; + i++; + break; + case 'r': + *o = '\r'; + i++; + break; + case 't': + *o = '\t'; + i++; + break; + case 'f': + *o = '\f'; + i++; + break; + case '0': + if (*++i == 'x') + goto hex; + else + --i; + /* FALLTHRU */ + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + n = 0; + count = 0; + while (*i >= '0' && *i <= '7' && count < 3) { + n = (n << 3) + (*i++ - '0'); + count++; + } + *o = (char) n; + break; + hex: + case 'x': + n = 0; + count = 0; + while (i++, count++ < 2) { + if (*i >= '0' && *i <= '9') + n = (n << 4) + (*i - '0'); + else if (*i >= 'a' && *i <= 'f') + n = (n << 4) + (*i - 'a') + 10; + else if (*i >= 'A' && *i <= 'F') + n = (n << 4) + (*i - 'A') + 10; + else + break; + } + *o = (char) n; + break; + case '\n': + i++; /* punt */ + o--; /* to account for o++ at end of loop */ + break; + case '\"': + case '\'': + case '\\': + default: + *o = *i++; + break; + } + } + else + *o = *i++; } *o = '\0'; } -static MenuRoot *GetRoot(const char *name, const char* fore, const char *back) +static MenuRoot * +GetRoot(const char *name, const char *fore, const char *back) { MenuRoot *tmp; tmp = FindMenuRoot(name); if (tmp == NULL) - tmp = NewMenuRoot(name); + tmp = NewMenuRoot(name); - if (fore) - { - int save; + if (fore) { + int save; - save = Scr->FirstTime; - Scr->FirstTime = TRUE; - GetColor(COLOR, &tmp->hi_fore, fore); - GetColor(COLOR, &tmp->hi_back, back); - Scr->FirstTime = (short)save; + save = Scr->FirstTime; + Scr->FirstTime = TRUE; + GetColor(COLOR, &tmp->hi_fore, fore); + GetColor(COLOR, &tmp->hi_back, back); + Scr->FirstTime = (short) save; } return tmp; } -static void GotButton(int butt, int func) +static void +GotButton(int butt, int func) { int i; - for (i = 0; i < NUM_CONTEXTS; i++) - { - if ((cont & (1 << i)) == 0) - continue; - - Scr->Mouse[butt][i][mods].func = func; - if (func == F_MENU) - { - pull->prev = NULL; - Scr->Mouse[butt][i][mods].menu = pull; - } - else - { - root = GetRoot(TWM_ROOT, NULLSTR, NULLSTR); - Scr->Mouse[butt][i][mods].item = AddToMenu(root,"x",Action, - NULL, func, NULLSTR, NULLSTR); - } + for (i = 0; i < NUM_CONTEXTS; i++) { + if ((cont & (1 << i)) == 0) + continue; + + Scr->Mouse[butt][i][mods].func = func; + if (func == F_MENU) { + pull->prev = NULL; + Scr->Mouse[butt][i][mods].menu = pull; + } + else { + root = GetRoot(TWM_ROOT, NULLSTR, NULLSTR); + Scr->Mouse[butt][i][mods].item = AddToMenu(root, "x", Action, + NULL, func, NULLSTR, NULLSTR); + } } Action = empty; pull = NULL; cont = 0; - mods_used |= (unsigned)mods; + mods_used |= (unsigned) mods; mods = 0; } -static void GotKey(char *key, int func) +static void +GotKey(char *key, int func) { int i; - for (i = 0; i < NUM_CONTEXTS; i++) - { - if ((cont & (1 << i)) == 0) - continue; - if (!AddFuncKey(key, i, mods, func, Name, Action)) - break; + for (i = 0; i < NUM_CONTEXTS; i++) { + if ((cont & (1 << i)) == 0) + continue; + if (!AddFuncKey(key, i, mods, func, Name, Action)) + break; } Action = empty; pull = NULL; cont = 0; - mods_used |= (unsigned)mods; + mods_used |= (unsigned) mods; mods = 0; } - -static void GotTitleButton (char *bitmapname, int func, Bool rightside) +static void +GotTitleButton(char *bitmapname, int func, Bool rightside) { - if (!CreateTitleButton (bitmapname, func, Action, pull, rightside, True)) { - parseWarning ( - "unable to create %s titlebutton \"%s\"", - rightside ? "right" : "left", bitmapname); + if (!CreateTitleButton(bitmapname, func, Action, pull, rightside, True)) { + parseWarning("unable to create %s titlebutton \"%s\"", + rightside ? "right" : "left", bitmapname); } Action = empty; pull = NULL; } -static Bool CheckWarpScreenArg (char *s) +static Bool +CheckWarpScreenArg(char *s) { - XmuCopyISOLatin1Lowered (s, s); + XmuCopyISOLatin1Lowered(s, s); - if (strcmp (s, WARPSCREEN_NEXT) == 0 || - strcmp (s, WARPSCREEN_PREV) == 0 || - strcmp (s, WARPSCREEN_BACK) == 0) - return True; + if (strcmp(s, WARPSCREEN_NEXT) == 0 || + strcmp(s, WARPSCREEN_PREV) == 0 || + strcmp(s, WARPSCREEN_BACK) == 0) + return True; - for (; *s && isascii(*s) && isdigit(*s); s++) ; /* SUPPRESS 530 */ + for (; *s && isascii(*s) && isdigit(*s); s++); /* SUPPRESS 530 */ return (*s ? False : True); } - -static Bool CheckWarpRingArg (char *s) +static Bool +CheckWarpRingArg(char *s) { - XmuCopyISOLatin1Lowered (s, s); + XmuCopyISOLatin1Lowered(s, s); - if (strcmp (s, WARPSCREEN_NEXT) == 0 || - strcmp (s, WARPSCREEN_PREV) == 0) - return True; + if (strcmp(s, WARPSCREEN_NEXT) == 0 || + strcmp(s, WARPSCREEN_PREV) == 0) + return True; return False; } - -static Bool CheckColormapArg (char *s) +static Bool +CheckColormapArg(char *s) { - XmuCopyISOLatin1Lowered (s, s); + XmuCopyISOLatin1Lowered(s, s); - if (strcmp (s, COLORMAP_NEXT) == 0 || - strcmp (s, COLORMAP_PREV) == 0 || - strcmp (s, COLORMAP_DEFAULT) == 0) - return True; + if (strcmp(s, COLORMAP_NEXT) == 0 || + strcmp(s, COLORMAP_PREV) == 0 || + strcmp(s, COLORMAP_DEFAULT) == 0) + return True; return False; } diff --git a/src/lex.l b/src/lex.l index e8453bb..4718154 100644 --- a/src/lex.l +++ b/src/lex.l @@ -1,4 +1,5 @@ %{ + /*****************************************************************************/ /* @@ -56,12 +57,12 @@ in this Software without prior written authorization from The Open Group. * * .twmrc lex file * - * 12-Nov-87 Thomas E. LaStrange File created + * 12-Nov-87 Thomas E. LaStrange File created * ***********************************************************************/ /* $XFree86: xc/programs/twm/lex.l,v 3.13 2001/08/27 21:11:39 dawes Exp $ */ -/* #include */ /* lex already includes stdio.h */ +/* #include */ /* lex already includes stdio.h */ #include "twm.h" #include "gram.h" #include "list.h" @@ -72,73 +73,79 @@ int yylineno; #undef YY_INPUT #define YY_INPUT(buf,result,size) ((result) = doinput((buf),(size))) -static int doinput (char *buf, int size) +static int +doinput(char *buf, int size) { - int c; + int c; - if (size == 0) - return (0); + if (size == 0) + return (0); - if ((c = (*twmInputFunc)()) <= 0) - return (0); + if ((c = (*twmInputFunc) ()) <= 0) + return (0); - buf[0] = (char)c; - return (1); + buf[0] = (char) c; + return (1); } #define YY_NO_UNPUT #endif %} -string \"([^"]|\\.)*\" -number [0-9]+ +string \"([^"]|\\.)*\" +number [0-9]+ %% -"{" { return (LB); } -"}" { return (RB); } -"(" { return (LP); } -")" { return (RP); } -"=" { return (EQUALS); } -":" { return (COLON); } -"+" { return PLUS; } -"-" { return MINUS; } -"|" { return OR; } - -[a-zA-Z\.]+ { int token = parse_keyword ((char *)yytext, - &yylval.num); - if (token == ERRORTOKEN) { - parseWarning ( - "ignoring unknown keyword: %s", - yytext); - ParseError = 1; - } else - return token; - } - -"!" { yylval.num = F_EXEC; return FSKEYWORD; } -"^" { yylval.num = F_CUT; return FSKEYWORD; } - -{string} { yylval.ptr = (char *)yytext; return STRING; } -{number} { (void)sscanf((char *)yytext, "%d", &yylval.num); - return (NUMBER); - } -\#[^\n]*\n {;} -[\r\n\t ] {;} -. { - parseWarning ( - "ignoring character \"%s\"", - yytext); - ParseError = 1; - } +"{" { return (LB); } +"}" { return (RB); } +"(" { return (LP); } +")" { return (RP); } +"=" { return (EQUALS); } +":" { return (COLON); } +"+" { return PLUS; } +"-" { return MINUS; } +"|" { return OR; } + +[a-zA-Z\.]+ { int token = parse_keyword ((char *)yytext, + &yylval.num); + if (token == ERRORTOKEN) { + parseWarning ( + "ignoring unknown keyword: %s", + yytext); + ParseError = 1; + } else + return token; + } + +"!" { yylval.num = F_EXEC; return FSKEYWORD; } +"^" { yylval.num = F_CUT; return FSKEYWORD; } + +{string} { yylval.ptr = (char *)yytext; return STRING; } +{number} { (void)sscanf((char *)yytext, "%d", &yylval.num); + return (NUMBER); + } +\#[^\n]*\n {;} +[\r\n\t ] {;} +. { + parseWarning ( + "ignoring character \"%s\"", + yytext); + ParseError = 1; + } %% + #ifndef yywrap -int yywrap() { return(1);} +int +yywrap() +{ + return (1); +} #endif #undef unput #undef input #undef output #undef feof -#define unput(c) twmUnput(c) -#define input() (*twmInputFunc)() -#define output(c) TwmOutput(c) -#define feof() (1) +#define unput(c) twmUnput(c) +#define input() (*twmInputFunc)() +#define output(c) TwmOutput(c) +#define feof() (1) -- cgit v1.2.3 From ebaf16b08d739e798b36a0bc2ff139d068612d4d Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 21 Jun 2020 09:47:58 -0400 Subject: include twm.h in header files which rely upon its definitions Signed-off-by: Thomas E. Dickey --- src/add_window.c | 2 +- src/iconmgr.h | 2 ++ src/icons.h | 2 ++ src/menus.h | 2 ++ src/resize.h | 2 ++ src/session.h | 3 +++ src/util.h | 2 ++ 7 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/add_window.c b/src/add_window.c index b4189e1..3895729 100644 --- a/src/add_window.c +++ b/src/add_window.c @@ -51,7 +51,7 @@ in this Software without prior written authorization from The Open Group. /********************************************************************** * - * Add a new window, put the titlbar and other stuff around + * Add a new window, put the titlebar and other stuff around * the window * * 31-Mar-88 Tom LaStrange Initial Version. diff --git a/src/iconmgr.h b/src/iconmgr.h index c74ffb1..ae9214a 100644 --- a/src/iconmgr.h +++ b/src/iconmgr.h @@ -34,6 +34,8 @@ in this Software without prior written authorization from The Open Group. #ifndef _ICONMGR_ #define _ICONMGR_ +#include "twm.h" + typedef struct WList { struct WList *next; struct WList *prev; diff --git a/src/icons.h b/src/icons.h index 4945967..4bac87a 100644 --- a/src/icons.h +++ b/src/icons.h @@ -34,6 +34,8 @@ in this Software without prior written authorization from The Open Group. #ifndef ICONS_H #define ICONS_H +#include "twm.h" + typedef struct IconRegion { struct IconRegion *next; int x, y, w, h; diff --git a/src/menus.h b/src/menus.h index de0629c..0692a27 100644 --- a/src/menus.h +++ b/src/menus.h @@ -60,6 +60,8 @@ in this Software without prior written authorization from The Open Group. #ifndef _MENUS_ #define _MENUS_ +#include "twm.h" + #define TWM_ROOT "bLoB_GoOp" /* my private root menu */ #define TWM_WINDOWS "TwmWindows" /* for f.menu "TwmWindows" */ diff --git a/src/resize.h b/src/resize.h index 5eb729e..a16a238 100644 --- a/src/resize.h +++ b/src/resize.h @@ -60,6 +60,8 @@ in this Software without prior written authorization from The Open Group. #ifndef _RESIZE_ #define _RESIZE_ +#include "twm.h" + 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); diff --git a/src/session.h b/src/session.h index 3b93fb7..c574a45 100644 --- a/src/session.h +++ b/src/session.h @@ -25,6 +25,9 @@ */ #ifndef _SESSION_H #define _SESSION_H + +#include "twm.h" + #include extern void ConnectToSessionManager(char *previous_id); diff --git a/src/util.h b/src/util.h index 195432c..448ed4d 100644 --- a/src/util.h +++ b/src/util.h @@ -60,6 +60,8 @@ in this Software without prior written authorization from The Open Group. #ifndef _UTIL_ #define _UTIL_ +#include "twm.h" + extern void MoveOutline(Window root, int x, int y, int width, int height, int bw, int th); extern void Zoom(Window wf, Window wt); -- cgit v1.2.3 From a4b14ca34b68f5a6a496aec53dafd4ee06222f83 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 21 Jun 2020 11:31:27 -0400 Subject: X11R5 change lost the update for yylineno needed to make parse messages useful; a subsequent X11R6 change made the behavior a little worse. This change repairs that old damage. Signed-off-by: Thomas E. Dickey --- src/lex.l | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lex.l b/src/lex.l index 4718154..d07a085 100644 --- a/src/lex.l +++ b/src/lex.l @@ -62,6 +62,8 @@ in this Software without prior written authorization from The Open Group. ***********************************************************************/ /* $XFree86: xc/programs/twm/lex.l,v 3.13 2001/08/27 21:11:39 dawes Exp $ */ +#define YY_NO_INPUT /* we have our own! */ + /* #include */ /* lex already includes stdio.h */ #include "twm.h" #include "gram.h" @@ -85,6 +87,8 @@ doinput(char *buf, int size) return (0); buf[0] = (char) c; + if (c == '\n') + ++yylineno; return (1); } #define YY_NO_UNPUT -- cgit v1.2.3 From a754e9f5c5735787a8e22839824a33546a9c43ef Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 21 Jun 2020 11:37:21 -0400 Subject: mention newer behavior of -q/-v options Signed-off-by: Thomas E. Dickey --- man/twm.man | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/man/twm.man b/man/twm.man index c54e38e..e6ea7df 100644 --- a/man/twm.man +++ b/man/twm.man @@ -132,6 +132,9 @@ named \fI.twmrc.num\fP (where \fInum\fP is a screen number) or \fI.twmrc\fP. .B \-quiet Tells \fItwm\fP that it should not print error messages when it receives unexpected X Error events. +.IP +Besides X Error events, \fItwm\fP also reports its own warnings. +The \fB\-quiet\fP option suppresses those. .TP 8 .B \-restore \fIfilename\fP When \fItwm\fP's session is stopped, it attempts to save the current @@ -151,6 +154,9 @@ Tells \fItwm\fP that it should print error messages whenever it receives an unexpected X Error event. This can be useful when debugging applications but can be distracting in regular use. +.IP +The \fB\-verbose\fP and \fB\-quiet\fP options increment and decrement +the message level, cancelling each other. .TP 8 .B \-V Tell \fItwm\fP to print its version to the standard output, and exit. -- cgit v1.2.3 From 58a64fd73dd7a840fadebbc81126282cf3979b30 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 21 Jun 2020 12:15:01 -0400 Subject: issue #8: twm displays all windows as "Untitled" adapt the suggestion to use XFetchName to work around a system whose locale support is broken, but rather than break existing configurations, use that call as a fallback when the existing/working calls fail. Signed-off-by: Thomas E. Dickey --- src/util.c | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/src/util.c b/src/util.c index e15c31a..d89dcfe 100644 --- a/src/util.c +++ b/src/util.c @@ -729,23 +729,38 @@ I18N_FetchName(Display *dpy2, Window w, char **winname) { int status; XTextProperty text_prop; - char **list; - int num; + int rc = 0; + + *winname = NULL; status = XGetWMName(dpy2, w, &text_prop); - if (!status || !text_prop.value || !text_prop.nitems) { - *winname = NULL; - return 0; - } - status = XmbTextPropertyToTextList(dpy2, &text_prop, &list, &num); - if (status < Success || !num || !*list) { - *winname = NULL; - return 0; + if (status && text_prop.value && text_prop.nitems) { + char **list = NULL; + int num; + + status = XmbTextPropertyToTextList(dpy2, &text_prop, &list, &num); + if (status >= Success && num && list && *list) { + XFree(text_prop.value); + *winname = strdup(*list); + XFreeStringList(list); + rc = 1; + } + else { + char *value = NULL; + + /* + * If the system's locale support is broken (e.g., missing useful + * parts), the preceding Xmb call may fail. + */ + if (XFetchName(dpy2, w, &value) && value != NULL) { + *winname = strdup(value); + XFree(value); + rc = 1; + } + } } - XFree(text_prop.value); - *winname = (char *) strdup(*list); - XFreeStringList(list); - return 1; + + return rc; } Status -- cgit v1.2.3 From 12ae76feef16024a0911b0e61e64266b449599e7 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 21 Jun 2020 13:04:21 -0400 Subject: quiet a misleading warning in grammar Signed-off-by: Thomas E. Dickey --- src/gram.y | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gram.y b/src/gram.y index 28a4695..8b18038 100644 --- a/src/gram.y +++ b/src/gram.y @@ -125,11 +125,12 @@ static void yyerror(const char *s); %token SKEYWORD DKEYWORD JKEYWORD WINDOW_RING WARP_CURSOR ERRORTOKEN %token NO_STACKMODE %token STRING +%token error %type string %type pixmap_list cursor_list color_list save_color_list stmt %type win_color_list iconm_list win_list icon_list function menu -%type noarg sarg error narg squeeze color_entry +%type noarg sarg narg squeeze color_entry %type action button number signed_number full fullkey %start twmrc -- cgit v1.2.3