diff -Nru alttab-1.5.0/aclocal.m4 alttab-1.6.1/aclocal.m4 --- alttab-1.5.0/aclocal.m4 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/aclocal.m4 2021-12-05 23:22:57.000000000 +0000 @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.16.2 -*- Autoconf -*- +# generated automatically by aclocal 1.16.3 -*- Autoconf -*- # Copyright (C) 1996-2020 Free Software Foundation, Inc. @@ -311,7 +311,7 @@ [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.16.2], [], +m4_if([$1], [1.16.3], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -327,7 +327,7 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.16.2])dnl +[AM_AUTOMAKE_VERSION([1.16.3])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) @@ -979,12 +979,7 @@ [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then diff -Nru alttab-1.5.0/ChangeLog alttab-1.6.1/ChangeLog --- alttab-1.5.0/ChangeLog 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/ChangeLog 2021-12-05 23:22:57.000000000 +0000 @@ -1,3 +1,28 @@ +2021-12-06 Alexander Kulak + + version 1.6.1 + +2021-09-12 Futa Miyachi + + Vertical layout. + +2021-08-15 Aleksandrs Stier + + Extra border around the alttab window. + +2021-03-14 Alexander Kulak + + version 1.6.0 + + Fix major memory leak when huge icons are not used. + Debug by SIGUSR1. + Add test suite: running in headless X server. + Add github CI pipeline. + Bspwm documentation. + Fix possible strncpy overflows. + + Closes: #96, #107, #109. + 2020-07-23 Alexander Kulak version 1.5.0 diff -Nru alttab-1.5.0/configure alttab-1.6.1/configure --- alttab-1.5.0/configure 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/configure 2021-12-05 23:22:57.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for alttab 1.5.0. +# Generated by GNU Autoconf 2.69 for alttab 1.6.1. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -577,8 +577,8 @@ # Identity of this package. PACKAGE_NAME='alttab' PACKAGE_TARNAME='alttab' -PACKAGE_VERSION='1.5.0' -PACKAGE_STRING='alttab 1.5.0' +PACKAGE_VERSION='1.6.1' +PACKAGE_STRING='alttab 1.6.1' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1306,7 +1306,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures alttab 1.5.0 to adapt to many kinds of systems. +\`configure' configures alttab 1.6.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1373,7 +1373,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of alttab 1.5.0:";; + short | recursive ) echo "Configuration of alttab 1.6.1:";; esac cat <<\_ACEOF @@ -1485,7 +1485,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -alttab configure 1.5.0 +alttab configure 1.6.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1737,7 +1737,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by alttab $as_me 1.5.0, which was +It was created by alttab $as_me 1.6.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2290,12 +2290,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then @@ -2600,7 +2595,7 @@ # Define the identity of the package. PACKAGE='alttab' - VERSION='1.5.0' + VERSION='1.6.1' cat >>confdefs.h <<_ACEOF @@ -4840,7 +4835,8 @@ done -ac_config_files="$ac_config_files Makefile src/Makefile doc/Makefile" +ac_config_files="$ac_config_files Makefile src/Makefile doc/Makefile test/Makefile" + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -5372,7 +5368,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by alttab $as_me 1.5.0, which was +This file was extended by alttab $as_me 1.6.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5438,7 +5434,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -alttab config.status 1.5.0 +alttab config.status 1.6.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -5572,6 +5568,7 @@ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac diff -Nru alttab-1.5.0/configure.ac alttab-1.6.1/configure.ac --- alttab-1.5.0/configure.ac 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/configure.ac 2021-12-05 23:22:57.000000000 +0000 @@ -1,4 +1,4 @@ -AC_INIT([alttab], [1.5.0]) +AC_INIT([alttab], [1.6.1]) AM_INIT_AUTOMAKE([foreign subdir-objects]) AC_CONFIG_SRCDIR([configure.ac]) AC_CONFIG_HEADERS([config.h]) @@ -30,5 +30,6 @@ [], [AC_MSG_ERROR([Cannot find uthash.h, please install uthash])] ) -AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile]) +AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile test/Makefile]) +AC_REQUIRE_AUX_FILE([tap-driver.sh]) AC_OUTPUT diff -Nru alttab-1.5.0/debian/changelog alttab-1.6.1/debian/changelog --- alttab-1.5.0/debian/changelog 2021-06-27 13:57:21.000000000 +0000 +++ alttab-1.6.1/debian/changelog 2022-08-11 22:44:49.000000000 +0000 @@ -1,3 +1,26 @@ +alttab (1.6.1-1) unstable; urgency=medium + + * Rebuild the manual page from the ronn source. + * Convert the watch file to version 4 of the format and use the new + substitution variables. + * Add a trivial git-buildpackage config file. + * New upstream version: + - drop the strncpy patch, it was taken from upstream + - update the upstream copyright years + * Add my debian/* copyright notice. + * Declare compliance with Policy 4.6.1 with no changes. + * Explicitly build-depend on dh-sequence-single-binary. + * Add the cppcheck patch to fix some minor issues. + * Add the typos patch to fix some typographical errors. + * Add the window-name patch to fix an emptiness check. + * Tweak the upstream test suite a bit: + - add the test-tweaks patch to block it from installing any packages + or running any commands as root via 'sudo' + - run it during the package build + - run it as an autopkgtest + + -- Peter Pentchev Fri, 12 Aug 2022 01:44:49 +0300 + alttab (1.5.0-2) unstable; urgency=medium * New maintainer. Closes: #989842 diff -Nru alttab-1.5.0/debian/clean alttab-1.6.1/debian/clean --- alttab-1.5.0/debian/clean 1970-01-01 00:00:00.000000000 +0000 +++ alttab-1.6.1/debian/clean 2022-08-11 20:45:40.000000000 +0000 @@ -0,0 +1 @@ +doc/alttab.1 diff -Nru alttab-1.5.0/debian/control alttab-1.6.1/debian/control --- alttab-1.5.0/debian/control 2021-06-27 13:56:42.000000000 +0000 +++ alttab-1.6.1/debian/control 2022-08-11 21:45:38.000000000 +0000 @@ -3,6 +3,7 @@ Priority: optional Maintainer: Peter Pentchev Build-Depends: debhelper-compat (= 13), + dh-sequence-single-binary, libx11-dev, libxmu-dev, libxft-dev, @@ -12,8 +13,14 @@ libxpm-dev, uthash-dev, autoconf, - automake -Standards-Version: 4.5.0 + automake, + ronn, + procps , + xnee , + xvfb , + x11-apps , + x11-utils , +Standards-Version: 4.6.1 Vcs-Git: https://salsa.debian.org/debian/alttab.git Vcs-Browser: https://salsa.debian.org/debian/alttab Homepage: https://sagb.github.io/alttab diff -Nru alttab-1.5.0/debian/copyright alttab-1.6.1/debian/copyright --- alttab-1.5.0/debian/copyright 2021-06-27 13:30:15.000000000 +0000 +++ alttab-1.6.1/debian/copyright 2022-08-11 20:45:40.000000000 +0000 @@ -4,7 +4,7 @@ Upstream-Contact: Alexander Kulak Files: * -Copyright: 2017-2020 Alexander Kulak +Copyright: 2017-2021 Alexander Kulak License: GPL-3.0+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,9 +23,32 @@ Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". Files: doc/alttab.1.ronn -Copyright: 2017-2020 Alexander Kulak +Copyright: 2017-2021 Alexander Kulak License: permissive Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty. + +Files: debian/* +Copyright: + 2017-2021 Alexander Kulak + 2021, 2022 Peter Pentchev +License: GPL-3.0+ + +License: GPL-3.0+ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". diff -Nru alttab-1.5.0/debian/gbp.conf alttab-1.6.1/debian/gbp.conf --- alttab-1.5.0/debian/gbp.conf 1970-01-01 00:00:00.000000000 +0000 +++ alttab-1.6.1/debian/gbp.conf 2022-08-11 20:45:40.000000000 +0000 @@ -0,0 +1,5 @@ +[DEFAULT] +pristine-tar = True +sign-tags = True +debian-branch = debian/unstable +upstream-branch = master diff -Nru alttab-1.5.0/debian/patches/cppcheck.patch alttab-1.6.1/debian/patches/cppcheck.patch --- alttab-1.5.0/debian/patches/cppcheck.patch 1970-01-01 00:00:00.000000000 +0000 +++ alttab-1.6.1/debian/patches/cppcheck.patch 2022-08-11 20:46:49.000000000 +0000 @@ -0,0 +1,130 @@ +Description: Fix some problems reported by cppcheck. +Forwarded: no +Author: Peter Pentchev +Last-Update: 2022-08-11 + +--- a/src/icon.c ++++ b/src/icon.c +@@ -493,7 +493,7 @@ + char appl[MAXAPPLEN]; + int l; + +- for (l = 0; (*(app + l)) != '\0' && l < MAXAPPLEN; l++) ++ for (l = 0; (*(app + l)) != '\0' && l < MAXAPPLEN - 1; l++) + appl[l] = tolower(*(app + l)); + appl[l] = '\0'; + +--- a/src/win.c ++++ b/src/win.c +@@ -83,7 +83,7 @@ + int wi, si; + PermanentWindowInfo *s; + +- if (g.winlist == NULL && g.maxNdx == 0) ++ if (g.winlist == NULL || g.maxNdx == 0) + return; // safety + msg(0, "winlist:\n"); + for (wi = 0; wi < g.maxNdx; wi++) { +@@ -707,12 +707,12 @@ + window_desktop, current_desktop); + return true; + } +- if (g.option_desktop == DESK_NOSPECIAL && window_desktop == -1) { ++ if (g.option_desktop == DESK_NOSPECIAL && window_desktop == (unsigned long)-1) { + msg(1, "window on -1 desktop, skipped\n"); + return true; + } + if (g.option_desktop == DESK_NOCURRENT && +- (window_desktop == current_desktop || window_desktop == -1)) { ++ (window_desktop == current_desktop || window_desktop == (unsigned long)-1)) { + msg(1, "window on current or -1 desktop, skipped\n"); + return true; + } +--- a/src/autil.c ++++ b/src/autil.c +@@ -69,13 +69,13 @@ + switch (signum) { + case SIGUSR1: + fprintf(stderr, "debug information:\n"); +- fprintf(stderr, "winlist: %d elements of %ld bytes, %ld total\n", ++ fprintf(stderr, "winlist: %d elements of %zu bytes, %zu total\n", + g.maxNdx, sizeof(WindowInfo), g.maxNdx*sizeof(WindowInfo) ); + DL_COUNT(g.sortlist, pwi, sln); +- fprintf(stderr, "sortlist: %d elements of %ld bytes, %ld total\n", ++ fprintf(stderr, "sortlist: %d elements of %zu bytes, %zu total\n", + sln, sizeof(PermanentWindowInfo), sln*sizeof(PermanentWindowInfo) ); + in = HASH_COUNT(g.ic); +- fprintf(stderr, "icons: %d elements of %ld bytes, %ld total\n", ++ fprintf(stderr, "icons: %d elements of %zu bytes, %zu total\n", + in, sizeof(icon_t), in*sizeof(icon_t) ); + fprintf(stderr, "option_wm: %d, option_desktop: %d, option_screen: %d\n", + g.option_wm, g.option_desktop, g.option_screen); +--- a/src/ewmh.c ++++ b/src/ewmh.c +@@ -91,7 +91,7 @@ + { + int evr, elapsed; + unsigned long edata[] = { desktop, CurrentTime, 0, 0, 0 }; +- if (desktop == -1 && g.ewmh.minus1_desktop_unusable) ++ if (desktop == (unsigned long)-1 && g.ewmh.minus1_desktop_unusable) + return 0; + msg(1, "ewmh switching desktop to %ld\n", desktop); + evr = ewmh_send_wm_evt(root, "_NET_CURRENT_DESKTOP", edata); +--- a/src/gui.c ++++ b/src/gui.c +@@ -312,7 +312,7 @@ + if (g.color[p].name[0]) { + if (strncmp(g.color[p].name, "_rnd_", 5) == 0) { + // replace in-place: 8 chars is sufficient for #rrggbb +- char r[3]; ++ unsigned char r[3]; + short int rc; + for (rc = 0; rc <= 2; rc++) { + r[rc] = rand() / (RAND_MAX / 0x80); +--- a/src/util.c ++++ b/src/util.c +@@ -101,7 +101,7 @@ + } + if (grab) { + if (debug > 1) { +- fprintf(stderr, "grabbing %d with mask %d\n", ++ fprintf(stderr, "grabbing %d with mask %u\n", + keycode, (modmask | mask)); + } + ee_ignored = NULL; // to detect X error event +@@ -115,7 +115,7 @@ + } + } else { + if (debug > 1) { +- fprintf(stderr, "ungrabbing %d with mask %d\n", ++ fprintf(stderr, "ungrabbing %d with mask %u\n", + keycode, (modmask | mask)); + } + XUngrabKey(dpy, keycode, modmask | mask, win); +@@ -452,7 +452,7 @@ + XftTextExtentsUtf8(dpy, font, (unsigned char *)line, line_clen, &ext); + if (debug > 0) { + fprintf(stderr, +- "first cut approximation: \"%s\" ulen=%zu clen=%zu width=%d px, x2-x1=%d px\n", ++ "first cut approximation: \"%s\" ulen=%zu clen=%zu width=%d px, x2-x1=%u px\n", + line, line_ulen, line_clen, ext.width, width); + } + while (ext.width > width) { +@@ -466,7 +466,7 @@ + line_clen, &ext); + if (debug > 0) { + fprintf(stderr, +- "cut correction: \"%s\" ulen=%zu clen=%zu width=%d px, x2-x1=%d px\n", ++ "cut correction: \"%s\" ulen=%zu clen=%zu width=%d px, x2-x1=%u px\n", + line, line_ulen, line_clen, ext.width, width); + } + } +@@ -474,7 +474,7 @@ + if ((y + ext.height) > (y1 + height)) { + if (debug > 0) { + fprintf(stderr, +- "y+ext.height=%d, y2=%d - breaking\n", ++ "y+ext.height=%d, y2=%u - breaking\n", + y + ext.height, (y1 + height)); + } + break; diff -Nru alttab-1.5.0/debian/patches/series alttab-1.6.1/debian/patches/series --- alttab-1.5.0/debian/patches/series 2021-06-27 13:56:42.000000000 +0000 +++ alttab-1.6.1/debian/patches/series 2022-08-11 21:35:04.000000000 +0000 @@ -1 +1,4 @@ -strncpy.patch +cppcheck.patch +typos.patch +window-name.patch +test-tweaks.patch diff -Nru alttab-1.5.0/debian/patches/strncpy.patch alttab-1.6.1/debian/patches/strncpy.patch --- alttab-1.5.0/debian/patches/strncpy.patch 2021-06-27 13:56:42.000000000 +0000 +++ alttab-1.6.1/debian/patches/strncpy.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,85 +0,0 @@ -Description: fix possible strncpy overflows -Origin: upstream; https://github.com/sagb/alttab/commit/5cb60252e58646a6dd45d55e9373d27fe9f520a1 -Author: Alexander Kulak -Bug-Debian: https://bugs.debian.org/964357 -Last-Update: 2021-06-27 - ---- a/src/icon.c -+++ b/src/icon.c -@@ -260,8 +260,9 @@ - char *endptr; - char *dim; - int dimlen; -- char sx[5]; -- char sy[5]; -+ char sx[MAXICONDIMLEN]; -+ char sy[MAXICONDIMLEN]; -+ int sx_size, sy_size; - int ix, iy; - icon_t *ic; - char *suff; -@@ -309,11 +310,17 @@ - xchar = strchr(dim, 'x'); - if (xchar == NULL) - return 0; // unknown dimensions -- strncpy(sx, dim, (xchar - dim)); -- sx[xchar - dim] = '\0'; -+ sx_size = xchar - dim; -+ if (sx_size > MAXICONDIMLEN - 1) -+ return 0; -+ strncpy(sx, dim, sx_size); -+ sx[sx_size] = '\0'; - ix = atoi(sx); -- strncpy(sy, xchar + 1, dim + dimlen - xchar); -- sy[dim + dimlen - xchar - 1] = '\0'; -+ sy_size = dim + dimlen - xchar; -+ if (sy_size > MAXICONDIMLEN - 1) -+ return 0; -+ strncpy(sy, xchar + 1, sy_size); -+ sy[sy_size] = '\0'; - iy = atoi(sy); - } else { - // icon other than a priory known dimensions has lowest priority -@@ -335,16 +342,28 @@ - uchar = strrchr(app, '_'); - xchar = strrchr(app, 'x'); - if (xchar != NULL && uchar != NULL && xchar > uchar) { -- strncpy(sx, uchar+1, (xchar - uchar - 1)); -- sx[xchar - uchar - 1] = '\0'; -+ sx_size = xchar - uchar - 1; -+ if (sx_size > MAXICONDIMLEN - 1) { -+ msg (0, special_fail_1, app, "WW"); -+ ix = 0; -+ goto end_special_1; -+ } -+ strncpy(sx, uchar+1, sx_size); -+ sx[sx_size] = '\0'; - ix = strtol(sx, &endptr, 10); - if (!(*sx != '\0' && *endptr == '\0')) { - msg (0, special_fail_1, app, "WW"); - ix = 0; - goto end_special_1; - } -- strncpy(sy, xchar + 1, app + strlen(app) - xchar); -- sy[app + strlen(app) - xchar] = '\0'; -+ sy_size = app + strlen(app) - xchar; -+ if (sy_size > MAXICONDIMLEN - 1) { -+ msg (0, special_fail_1, app, "HH"); -+ iy = 0; -+ goto end_special_1; -+ } -+ strncpy(sy, xchar + 1, sy_size); -+ sy[sy_size] = '\0'; - iy = strtol(sy, &endptr, 10); - if (!(*sy != '\0' && *endptr == '\0')) { - msg (0, special_fail_1, app, "HH"); ---- a/src/icon.h -+++ b/src/icon.h -@@ -38,6 +38,7 @@ - #define MAXICONDIRS 64 - #define MAXAPPLEN 64 - #define MAXICONPATHLEN 1024 -+#define MAXICONDIMLEN 5 - - typedef struct { - char app[MAXAPPLEN]; // application name; uthash key diff -Nru alttab-1.5.0/debian/patches/test-tweaks.patch alttab-1.6.1/debian/patches/test-tweaks.patch --- alttab-1.5.0/debian/patches/test-tweaks.patch 1970-01-01 00:00:00.000000000 +0000 +++ alttab-1.6.1/debian/patches/test-tweaks.patch 2022-08-11 21:41:13.000000000 +0000 @@ -0,0 +1,40 @@ +Description: Tweak the upstream test suite a bit. + - do not install any packages + - do not invoke anything as root via sudo +Forwarded: not-needed +Author: Peter Pentchev +Last-Update: 2022-08-12 + +--- a/test/run-in-xvfb.test ++++ b/test/run-in-xvfb.test +@@ -20,9 +20,20 @@ + # along with alttab. If not, see . + + +-ALTTAB=../src/alttab ++: "${ALTTAB:=../src/alttab}" + NUMTEST=3 + ++sudo() ++{ ++ if [ "$1" != '--non-interactive' ] || ! expr "x$2" : 'x[^-].*' > /dev/null; then ++ echo "Testsuite internal error: sudo invoked with unexpected arguments: $*" 1>&2 ++ exit 1 ++ fi ++ shift ++ echo "Invoking '$*' without sudo" ++ "$@" ++} ++ + install_software() + { + packs="" ; progs="" +@@ -36,7 +47,7 @@ + done + if [ -n "$packs" ] ; then + echo "Installing: $packs" +- icmd="sudo --non-interactive apt-get -y install $packs" ++ icmd="sudo --non-interactive false apt-get -y install $packs" + $icmd || echo -e "Failed: $icmd\nThis script runs apt-get via passwordless sudo, otherwise install manually: $progs" >&2 + for prog in $progs ; do + if ! which "$prog" >/dev/null ; then diff -Nru alttab-1.5.0/debian/patches/typos.patch alttab-1.6.1/debian/patches/typos.patch --- alttab-1.5.0/debian/patches/typos.patch 1970-01-01 00:00:00.000000000 +0000 +++ alttab-1.6.1/debian/patches/typos.patch 2022-08-11 20:50:49.000000000 +0000 @@ -0,0 +1,75 @@ +Description: Fix some typographical errors. +Forwarded: no +Author: Peter Pentchev +Last-Update: 2022-08-11 + +--- a/doc/alttab.1.ronn ++++ b/doc/alttab.1.ronn +@@ -175,7 +175,7 @@ + + : in multihead configuration: the monitor which shows + largest part of currently focused window. If this part is shared +- with other monitors, then the smallest of these monitors is choosen. ++ with other monitors, then the smallest of these monitors is chosen. + In single head configuration: the geometry of default root window. + + : the monitor which has mouse pointer, otherwise +--- a/doc/wm-setup.md ++++ b/doc/wm-setup.md +@@ -74,7 +74,7 @@ + ==== + + ### keyboard shortcut +-Applications -> Settings -> Settings Editor (not Manager) -> Channel: xfce4-keyboard-shortcuts -> in rigth pane disable all entries of `cycle_windows_key` or `cycle_reverse_windows_key`. ++Applications -> Settings -> Settings Editor (not Manager) -> Channel: xfce4-keyboard-shortcuts -> in right pane disable all entries of `cycle_windows_key` or `cycle_reverse_windows_key`. + + ### startup + Applications -> Settings -> Session and Startup -> Application Autostart -> Add +--- a/src/alttab.c ++++ b/src/alttab.c +@@ -78,7 +78,7 @@ + } + + // +-// initialize globals based on executable agruments and Xresources ++// initialize globals based on executable arguments and Xresources + // return 1 if success, 0 otherwise + // on fatal failure, calls die/exit + // +--- a/src/gui.c ++++ b/src/gui.c +@@ -390,7 +390,7 @@ + scrdim.w = DisplayWidth(dpy, scr); + scrdim.h = DisplayHeight(dpy, scr); + } +-// caculate viewport. ++// calculate viewport. + #define VPM g.option_vp_mode + switch (VPM) { + case VP_SPECIFIC: +--- a/src/randr.c ++++ b/src/randr.c +@@ -249,7 +249,7 @@ + return true; + } + // if best cross-area is shared with some other monitor, +- // then smallest of these monitors is choosen. ++ // then smallest of these monitors is chosen. + smallest_2_stage_area = + oq[best_1_stage_output].w * oq[best_1_stage_output].h; + for (o = 0; o < no; o++) { +--- a/src/win.c ++++ b/src/win.c +@@ -652,10 +652,10 @@ + if (usec_delta < 5E5) { // half a second + return; + } +- msg(0, PREF"pulling 'prev' 0x%lx supressed\n", aw); ++ msg(0, PREF"pulling 'prev' 0x%lx suppressed\n", aw); + } + if (aw == g.last.to) { +- msg(0, PREF"pulling 'to' 0x%lx supressed\n", aw); ++ msg(0, PREF"pulling 'to' 0x%lx suppressed\n", aw); + return; + } + */ diff -Nru alttab-1.5.0/debian/patches/window-name.patch alttab-1.6.1/debian/patches/window-name.patch --- alttab-1.5.0/debian/patches/window-name.patch 1970-01-01 00:00:00.000000000 +0000 +++ alttab-1.6.1/debian/patches/window-name.patch 2022-08-11 20:54:11.000000000 +0000 @@ -0,0 +1,16 @@ +Description: Fix an "empty window name" check. +Forwarded: no +Author: Peter Pentchev +Last-Update: 2022-08-11 + +--- a/src/gui.c ++++ b/src/gui.c +@@ -230,7 +230,7 @@ + } + endIcon: + // draw labels +- if (wi->name && fontLabel) { ++ if (wi->name[0] && fontLabel) { + int x, y, w, h; + if (g.option_vertical) { + x = iconW + 5; diff -Nru alttab-1.5.0/debian/rules alttab-1.6.1/debian/rules --- alttab-1.5.0/debian/rules 2021-06-27 13:30:15.000000000 +0000 +++ alttab-1.6.1/debian/rules 2022-08-11 21:42:36.000000000 +0000 @@ -9,3 +9,9 @@ # important in bootstrap.sh, besides of autotools and man page. #override_dh_autoreconf: # dh_autoreconf ./bootstrap.sh -f + +execute_before_dh_auto_build: + ronn --roff doc/alttab.1.ronn + +# override_dh_auto_test: +# env ALTTAB="$(CURDIR)/src/alttab" "$(CURDIR)/test/run-in-xvfb.test" diff -Nru alttab-1.5.0/debian/tests/control alttab-1.6.1/debian/tests/control --- alttab-1.5.0/debian/tests/control 1970-01-01 00:00:00.000000000 +0000 +++ alttab-1.6.1/debian/tests/control 2022-08-11 21:51:55.000000000 +0000 @@ -0,0 +1,4 @@ +Test-Command: env ALTTAB=alttab test/run-in-xvfb.test +Depends: @, procps, x11-apps, x11-utils, xnee, xvfb +Features: test-name=upstream +Restrictions: allow-stderr diff -Nru alttab-1.5.0/debian/watch alttab-1.6.1/debian/watch --- alttab-1.5.0/debian/watch 2021-06-27 13:30:15.000000000 +0000 +++ alttab-1.6.1/debian/watch 2022-08-11 20:45:40.000000000 +0000 @@ -1,3 +1,3 @@ -version=3 -opts=filenamemangle=s%(?:.*?)?v?(\d+\.\d+\.\d+)\.tar\.gz%alttab-$1.tar.gz%,pgpsigurlmangle=s%^.*/v?(\d+\.\d+\.\d+)\.tar\.gz$%https://sagb.github.io/alttab/alttab-$1.tar.gz.asc% \ -https://github.com/sagb/alttab/tags (?:.*?/)?v?(\d+\.\d+\.\d+)\.tar\.gz +version=4 +opts=filenamemangle=s%(?:.*?)?v?@ANY_VERSION@(@ARCHIVE_EXT@)%@PACKAGE@-$1$2%,pgpsigurlmangle=s%^.*/v?@ANY_VERSION@(@ARCHIVE_EXT@)$%https://sagb.github.io/@PACKAGE@/@PACKAGE@-$1$2.asc% \ +https://github.com/sagb/@PACKAGE@/tags (?:.*?/)?v?@ANY_VERSION@@ARCHIVE_EXT@ diff -Nru alttab-1.5.0/doc/alttab.1 alttab-1.6.1/doc/alttab.1 --- alttab-1.5.0/doc/alttab.1 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/doc/alttab.1 2021-12-05 23:22:57.000000000 +0000 @@ -1,387 +1,285 @@ -.\" generated with Ronn/v0.7.3 -.\" http://github.com/rtomayko/ronn/tree/0.7.3 -. -.TH "ALTTAB" "1" "July 2020" "" "" -. +.\" generated with Ronn-NG/v0.9.1 +.\" http://github.com/apjanke/ronn-ng/tree/0.9.1 +.TH "ALTTAB" "1" "December 2021" "" .SH "NAME" \fBalttab\fR \- the task switcher -. .SH "SYNOPSIS" -\fBalttab\fR [\fB\-w\fR \fIN\fR] [\fB\-d\fR \fIN\fR] [\fB\-sc\fR \fIN\fR] [\fB\-mk\fR \fIstr\fR] [\fB\-kk\fR \fIstr\fR] [\fB\-bk\fR \fIstr\fR] [\fB\-pk\fR \fIstr\fR] [\fB\-nk\fR \fIstr\fR] [\fB\-ck\fR \fIstr\fR] [\fB\-mm\fR \fIN\fR] [\fB\-bm\fR \fIN\fR] [\fB\-t\fR \fINxM\fR] [\fB\-i\fR \fINxM\fR] [\fB\-vp\fR \fIstr\fR] [\fB\-p\fR \fIstr\fR] [\fB\-s\fR \fIN\fR] [\fB\-theme\fR \fIname\fR] [\fB\-bg\fR \fIcolor\fR] [\fB\-fg\fR \fIcolor\fR] [\fB\-frame\fR \fIcolor\fR] [\fB\-font\fR \fIname\fR] [\fB\-v\fR|\fB\-vv\fR] -. +\fBalttab\fR [\fB\-w\fR \fIN\fR] [\fB\-d\fR \fIN\fR] [\fB\-sc\fR \fIN\fR] [\fB\-mk\fR \fIstr\fR] [\fB\-kk\fR \fIstr\fR] [\fB\-bk\fR \fIstr\fR] [\fB\-pk\fR \fIstr\fR] [\fB\-nk\fR \fIstr\fR] [\fB\-mm\fR \fIN\fR] [\fB\-bm\fR \fIN\fR] [\fB\-t\fR \fINxM\fR] [\fB\-i\fR \fINxM\fR] [\fB\-vp\fR \fIstr\fR] [\fB\-p\fR \fIstr\fR] [\fB\-s\fR \fIN\fR] [\fB\-theme\fR \fIname\fR] [\fB\-bg\fR \fIcolor\fR] [\fB\-fg\fR \fIcolor\fR] [\fB\-frame\fR \fIcolor\fR] [\fB\-bc\fR \fIcolor\fR] [\fB\-bw\fR \fIN\fR] [\fB\-font\fR \fIname\fR] [\fB\-vertical\fR] [\fB\-v\fR|\fB\-vv\fR] .SH "DESCRIPTION" The task switcher designed for minimalistic window managers or standalone X11 session\. -. .P Unlike task switchers integrated in most simple WMs, \fBalttab\fR features visual interface and convenient tactile behaviour, switching windows on releasing Alt key\. -. .P Being lightweight and depending only on core X11 libs, it still features customizable look and behaviour\. -. .SH "OPTIONS" Most command line options have corresponding X resource, see doc/alttab\.ad for example\. -. .TP \fB\-w\fR \fINUMBER\fR resource: alttab\.windowmanager -. .br default: autodetect, fallback to \fI3\fR -. .IP Control how to obtain window list and set focus\. \fINUMBER\fR must be between 0 and 3: -. .IP \fI0\fR: No WM, raw X\. -. .IP -Set this value manually, as it\'s not autodetected\. Only top\-level viewable children of root window are listed\. Running \fB\-w 0\fR under WM is discouraged: hidden windows or windows on another desktops will not be listed; instead, some strange windows may be included\. -. +Set this value manually, as it's not autodetected\. Only top\-level viewable children of root window are listed\. Running \fB\-w 0\fR under WM is discouraged: hidden windows or windows on another desktops will not be listed; instead, some strange windows may be included\. .IP \fI1\fR: EWMH compatible\. -. .IP -Compatible WM list is in [SEE ALSO] below\. alttab functions in xmonad (EWMH must be allowed, details in doc/wm\-setup\.md), i3, evilwm, xfwm4, metacity, jwm, openbox, fluxbox, icewm, enlightenment, blackbox, aewm, fvwm, sawfish\. The following WMs support EWMH partially but work in \fB\-w 1\fR mode too: dwm (issue #9), matchbox (issue #34), windowmaker (issue #9), xpra (issue #37), cwm (issue #35), ctwm (issue #39), lwm (issue #40), awesome (issue #41)\. -. +Compatible WM list is in [SEE ALSO] below\. alttab functions in xmonad (EWMH must be allowed, details in doc/wm\-setup\.md), i3, evilwm, xfwm4, metacity, jwm, openbox, fluxbox, icewm, enlightenment, blackbox, aewm, fvwm, sawfish, bspwm\. The following WMs support EWMH partially but work in \fB\-w 1\fR mode too: dwm (issue #9), matchbox (issue #34), windowmaker (issue #9), xpra (issue #37), cwm (issue #35), ctwm (issue #39), lwm (issue #40), awesome (issue #41)\. .IP \fI2\fR: Ratpoison\. -. .IP Alttab uses ratpoison own remote control capability\. Additionally, alttab registers itself in its "unmanaged list" automatically\. -. .IP \fI3\fR: Ancient WM\. -. .IP Fallback, worse than \fI0\fR\. Search for application windows at random nodes of window tree (WM is probably reparenting) and select only those with a name, including non\-viewable (WM is probably iconifying)\. May cause lag\. Tested in twm, flwm, wm2\. -. .TP \fB\-d\fR \fINUMBER\fR resource: alttab\.desktops -. .br default: \fI0\fR -. .IP Show windows belonging to desktops (workspaces, groups)\. \fINUMBER\fR must be between 0 and 3: -. .IP \fI0\fR: Current desktop\. -. .IP -This is default, although in non EWMH\-compatible WM, except ratpoison, it\'s effectively the same as \fI1\fR\. -. +This is default, although in non EWMH\-compatible WM, except ratpoison, it's effectively the same as \fI1\fR\. .IP \fI1\fR: All desktops\. -. .IP \fI2\fR: All desktops, excluding special (\-1) one\. -. .IP -In various EWMH WM this desktop may be designed hidden or containing sticky windows\. In i3, it\'s "scratchpad"\. -. +In various EWMH WM this desktop may be designed hidden or containing sticky windows\. In i3, it's "scratchpad"\. .IP \fI3\fR: All desktops, excluding current and special\. -. .TP \fB\-sc\fR \fINUMBER\fR resource: alttab\.screens -. .br default: \fI1\fR -. .IP Show windows belonging to xrandr/xinerama screens\. \fINUMBER\fR must be 0 or 1: -. .IP \fI0\fR: Current screen\. -. .IP As defined according to \fB\-vp\fR \fIpointer\fR or \fB\-vp\fR \fIfocus\fR\. -. .IP \fI1\fR: All screens\. -. .IP This is default\. -. .TP \fB\-mk\fR \fIstr\fR resource: alttab\.modifier\.keysym -. .br default: Alt_L -. .IP Keysym of main modifier\. String or number accepted\. Suitable examples: Control_L, Super_L\. -. .TP \fB\-kk\fR \fIstr\fR resource: alttab\.key\.keysym -. .br default: Tab -. .IP Keysym of main key\. For example, grave (aka tilde), Escape\. -. .TP \fB\-bk\fR \fIstr\fR resource: alttab\.backscroll\.keysym -. .br default: any Shift, according to ShiftMask -. .IP Keysym of backward scroll key\. -. .TP \fB\-pk\fR \fIstr\fR resource: alttab\.prevkey\.keysym -. .br default: no key assigned -. .IP -Keysym of auxiliary \'previous\' key\. For example, Left, H\. -. +Keysym of auxiliary 'previous' key\. For example, Left, H\. .TP \fB\-nk\fR \fIstr\fR resource: alttab\.nextkey\.keysym -. .br default: no key assigned -. .IP -Keysym of auxiliary \'next\' key\. For example, Right, L\. -. +Keysym of auxiliary 'next' key\. For example, Right, L\. .TP \fB\-ck\fR \fIstr\fR resource: alttab\.cancelkey\.keysym -. .br default: Escape -. .IP -Keysym of auxiliary \'cancel\' key\. For example, Escape\. -. +Keysym of auxiliary 'cancel' key\. .TP \fB\-mm\fR \fINUM\fR resource: alttab\.modifier\.mask -. .IP OBSOLETED, guessed from \-mk instead\. -. .TP \fB\-bm\fR \fINUM\fR resource: alttab\.backscroll\.mask -. .IP OBSOLETED, guessed from \-bk instead\. -. .TP \fB\-t\fR \fINNxMM\fR resource: alttab\.tile\.geometry -. .br default: \fI112x128\fR -. .IP -Size of a single tile (mini\-window)\. If switcher doesn\'t fit the viewport (\fB\-vp\fR), tile may be thinner\. -. +Size of a single tile (mini\-window)\. If switcher doesn't fit the viewport (\fB\-vp\fR), tile may be thinner\. .TP \fB\-i\fR \fINNxMM\fR resource: alttab\.icon\.geometry -. .br default: \fI32x32\fR -. .IP Size of icons\. -. .TP \fB\-vp\fR \fIstr\fR resource: alttab\.viewport -. .br default: \fIfocus\fR -. .IP Limit viewport for the switcher\. The switcher always has variable size and position, but tries to never break out of \fB\-vp\fR container, while \fB\-p\fR specifies position relative to this container\. Together these options allow for WM\-independent multi\-monitor support\. Possible values for \fB\-vp\fR: -. .IP \fIfocus\fR: in multihead configuration: the monitor which shows largest part of currently focused window\. If this part is shared with other monitors, then the smallest of these monitors is choosen\. In single head configuration: the geometry of default root window\. -. .IP \fIpointer\fR: the monitor which has mouse pointer, otherwise the same as \fIfocus\fR\. -. .IP The "multihead" above means more than one active XRANDR output\. They are detected at runtime, so hopefully monitors may be attached/detached without restarting alttab\. -. .IP \fItotal\fR: the geometry of default root window\. -. .IP -If you specify this in tiling multihead configuration, then the switcher will be drawn relative to the entire combined screen, crossing monitors\' borders\. -. +If you specify this in tiling multihead configuration, then the switcher will be drawn relative to the entire combined screen, crossing monitors' borders\. .IP \fIWxH+X+Y\fR: Specific position relative to default root window\. -. .IP This allows for static manual bounding if XRANDR detection fails\. Suppose X root window spans over two 2560х1440 monitors, resulting in combined screen of 5120x1440 size\. Then the switcher may be positioned at the center of the right monitor with \-vp 2560x1440+2560+0 \-p center\. -. .TP \fB\-p\fR \fIstr\fR resource: alttab\.position -. .br default: center -. .IP Position of switcher: "center", "none" or specific position relative to upper left corner of viewport, in the form \fI+X+Y\fR\. -. .TP \fB\-s\fR \fINUMBER\fR resource: alttab\.icon\.source -. .br default: 2 -. .IP Source of icons\. \fINUMBER\fR must be between 0 and 3: -. .IP \fI0\fR: Use icons from X11 window attributes only\. -. .IP \fI1\fR: Load icon from file if not found in window attributes\. -. .IP Alttab searches for PNG and XPM icons in $XDG_DATA_DIRS and also under: -. .IP /usr/share/icons -. .br /usr/local/share/icons -. .br ~/\.icons -. .br ~/\.local/share/icons -. .IP -Directory structure should obey freedesktop standard, but desktop files are ignored, instead file name is expected to be equal to application class\. That is, if alttab doesn\'t recognize an icon for window of class foo, as obtained by \'xprop WM_CLASS\', then just drop a 32x32 icon into /usr/local/share/icons/hicolor/32x32/apps/foo\.png\. -. +Directory structure should obey freedesktop standard, but desktop files are ignored, instead file name is expected to be equal to application class\. That is, if alttab doesn't recognize an icon for window of class foo, as obtained by 'xprop WM_CLASS', then just drop a 32x32 icon into /usr/local/share/icons/hicolor/32x32/apps/foo\.png\. .IP Also, alttab scans for icons in legacy directories without freedesktop directory structure: -. .IP /usr/share/pixmaps -. .br ~/\.local/share/pixmaps -. .IP \fI2\fR: Prefer icon from file when it matches requested size better (see \fB\-i\fR option)\. -. .IP \fI3\fR: Use icons from files only\. -. .TP \fB\-theme\fR \fIname\fR resource: alttab\.theme -. .br default: \fIhicolor\fR -. .IP Desktop theme for application icons\. Used when \fB\-s\fR is 1, 2 or 3\. -. .P The following three options accept color names or \fI#rrggbb\fR\. Special value \fI_rnd_low\fR or \fI_rnd_high\fR produce random color from lower or upper RGB space respectively\. -. .TP \fB\-bg\fR \fIcolor\fR resource: alttab\.background -. .br default: \fIblack\fR -. .IP Tile background color\. -. .TP \fB\-fg\fR \fIcolor\fR resource: alttab\.foreground -. .br default: \fIgrey\fR -. .IP Foreground color\. -. .TP \fB\-frame\fR \fIcolor\fR resource: alttab\.framecolor -. .br default: \fI#a0abab\fR -. .IP Color of frame around selected tile\. -. +.TP +\fB\-bc\fR \fIcolor\fR +resource: alttab\.bordercolor +.br +default: \fIblack\fR +.IP +Color of extra border around the entire switcher\. This border may look redundant\. Do not confuse with \fB\-frame\fR\. +.TP +\fB\-bw\fR \fIN\fR +resource: alttab\.borderwidth +.br +default: \fI0\fR (no extra border) +.IP +Width of extra border above\. .TP \fB\-font\fR \fIname\fR resource: alttab\.font -. .br default: \fIxft:sans\-10\fR -. .IP -Label font name in format: \fBxft:fontconfig_pattern\fR, like in emacs and rxvt\. See [SEE ALSO] for fontconfig pattern\. It\'s neither GTK font pattern nor legacy XLFD\. -. +Label font name in format: \fBxft:fontconfig_pattern\fR, like in emacs and rxvt\. See [SEE ALSO] for fontconfig pattern\. It's neither GTK font pattern nor legacy XLFD\. .P Your Xresources database probably already has *background, *foreground or *font wildcard definitions, which alttab will obey\. Precedence order (preferred first): -. .P alttab\.font resource, -. .br \fB\-font\fR option, -. .br wildcard resource like *font in xfd: format\. -. +.TP +\fB\-vertical\fR +resource: alttab\.vertical +.br +default: no +.IP +Vertical layout (experimental)\. .TP \fB\-v\fR, \fB\-vv\fR resource: no -. .br default: silent -. .IP Verbosity\. -. .TP \fB\-h\fR short help -. .SH "CAVEATS" Run alttab after WM, or autodetection will fail\. -. .SH "AUTHOR" -Copyright 2017\-2020 Alexander Kulak \fB\fR\. -. +Copyright 2017\-2021 Alexander Kulak \fB\fR\. .SH "REPORTING BUGS" Please report issues on github \fIhttps://github\.com/sagb/alttab/issues\fR\. -. .SH "SEE ALSO" -skippy\-xd(1) -. -.P EWMH compatible WM list \fIhttps://en\.wikipedia\.org/wiki/Extended_Window_Manager_Hints#List_of_window_managers_that_support_Extended_Window_Manager_Hints\fR\. -. .P Description of fontconfig pattern \fIhttps://www\.freedesktop\.org/software/fontconfig/fontconfig\-user\.html\fR\. diff -Nru alttab-1.5.0/doc/alttab.1.ronn alttab-1.6.1/doc/alttab.1.ronn --- alttab-1.5.0/doc/alttab.1.ronn 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/doc/alttab.1.ronn 2021-12-05 23:22:57.000000000 +0000 @@ -2,7 +2,7 @@ The source of alttab.1. Read doc/development.md. vim:ft=markdown -Copyright 2017-2020 Alexander Kulak. +Copyright 2017-2021 Alexander Kulak. This file is part of alttab program. Copying and distribution of this file, with or without modification, @@ -16,7 +16,7 @@ ## SYNOPSIS -`alttab` [`-w` ] [`-d` ] [`-sc` ] [`-mk` ] [`-kk` ] [`-bk` ] [`-pk` ] [`-nk` ] [`-mm` ] [`-bm` ] [`-t` ] [`-i` ] [`-vp` ] [`-p` ] [`-s` ] [`-theme` ] [`-bg` ] [`-fg` ] [`-frame` ] [`-font` ] [`-v`|`-vv`] +`alttab` [`-w` ] [`-d` ] [`-sc` ] [`-mk` ] [`-kk` ] [`-bk` ] [`-pk` ] [`-nk` ] [`-mm` ] [`-bm` ] [`-t` ] [`-i` ] [`-vp` ] [`-p` ] [`-s` ] [`-theme` ] [`-bg` ] [`-fg` ] [`-frame` ] [`-bc` ] [`-bw` ] [`-font` ] [`-vertical`] [`-v`\|`-vv`] ## DESCRIPTION @@ -49,7 +49,7 @@ Compatible WM list is in [SEE ALSO] below. alttab functions in xmonad (EWMH must be allowed, details in doc/wm-setup.md), i3, evilwm, xfwm4, metacity, jwm, openbox, fluxbox, - icewm, enlightenment, blackbox, aewm, fvwm, sawfish. + icewm, enlightenment, blackbox, aewm, fvwm, sawfish, bspwm. The following WMs support EWMH partially but work in **-w 1** mode too: dwm (issue #9), matchbox (issue #34), windowmaker (issue #9), xpra (issue #37), cwm (issue #35), ctwm (issue #39), lwm (issue #40), @@ -245,7 +245,7 @@ Desktop theme for application icons. Used when `-s` is 1, 2 or 3. -The following three options accept color names or <#rrggbb>. Special value <\_rnd_low> or <\_rnd_high> produce random color from lower or upper RGB space respectively. +The following three options accept color names or <#rrggbb>. Special value <_rnd_low> or <_rnd_high> produce random color from lower or upper RGB space respectively. * `-bg` : resource: alttab.background @@ -265,6 +265,18 @@ Color of frame around selected tile. + * `-bc` : + resource: alttab.bordercolor + default: + + Color of extra border around the entire switcher. This border may look redundant. Do not confuse with `-frame`. + + * `-bw` : + resource: alttab.borderwidth + default: <0> (no extra border) + + Width of extra border above. + * `-font` : resource: alttab.font default: *xft:sans-10* @@ -277,6 +289,12 @@ `-font` option, wildcard resource like \*font in xfd: format. + * `-vertical`: + resource: alttab.vertical + default: no + + Vertical layout (experimental). + * `-v`, `-vv`: resource: no default: silent @@ -292,7 +310,7 @@ ##AUTHOR -Copyright 2017-2020 Alexander Kulak ``. +Copyright 2017-2021 Alexander Kulak ``. ##REPORTING BUGS @@ -300,8 +318,6 @@ ##SEE ALSO -skippy-xd(1) - [EWMH compatible WM list](https://en.wikipedia.org/wiki/Extended_Window_Manager_Hints#List_of_window_managers_that_support_Extended_Window_Manager_Hints). [Description of fontconfig pattern](https://www.freedesktop.org/software/fontconfig/fontconfig-user.html). diff -Nru alttab-1.5.0/doc/alttab.ad alttab-1.6.1/doc/alttab.ad --- alttab-1.5.0/doc/alttab.ad 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/doc/alttab.ad 2021-12-05 23:22:57.000000000 +0000 @@ -66,6 +66,15 @@ ! Random dark frame alttab.framecolor: _rnd_low +! Show X11 window border around the switcher +!alttab.borderwidth: 4 + +! Blue border +!alttab.bordercolor: #0000FF + ! Bigger font !alttab.font: xft:DejaVu Sans Condensed-18 +! Vertical layout +!alttab.vertical: anything + diff -Nru alttab-1.5.0/doc/development.md alttab-1.6.1/doc/development.md --- alttab-1.5.0/doc/development.md 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/doc/development.md 2021-12-05 23:22:57.000000000 +0000 @@ -35,6 +35,16 @@ X error handler doesn't abort on error. To disable even the error message, temporary set ee\_complain to false. +Test suite +---------- + +`make check` should work. + +Debug +----- + +On USR1 signal alttab dumps some debug information on STDERR. + /* vim:tabstop=4:shiftwidth=4:smarttab:expandtab:smartindent */ diff -Nru alttab-1.5.0/doc/Makefile.in alttab-1.6.1/doc/Makefile.in --- alttab-1.5.0/doc/Makefile.in 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/doc/Makefile.in 2021-12-05 23:22:57.000000000 +0000 @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.16.2 from Makefile.am. +# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. diff -Nru alttab-1.5.0/doc/README alttab-1.6.1/doc/README --- alttab-1.5.0/doc/README 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/doc/README 2021-12-05 23:22:57.000000000 +0000 @@ -1,10 +1,11 @@ alttab is X11 window switcher designed for minimalistic window managers or standalone X11 session. - alttab [-w N] [-d N] [-sc N] [`-mk` ] [`-kk` ] [`-bk` ] - [`-pk` ] [`-nk` ] [`-ck` ] [`-mm` ] [`-bm` ] + alttab [-w N] [-d N] [-sc N] [-mk ] [-kk ] [-bk ] + [-pk ] [-nk ] [-ck ] [-mm ] [-bm ] [-t NxM] [-i NxM] [-vp str] [-p str] [-s N] [-theme name] [-bg color] - [-fg color] [-frame color] [-font name] [-v|-vv] + [-fg color] [-frame color] [-bc color] [-bw N] [-font name] + [-vertical] [-v|-vv] (see man page for details) @@ -30,11 +31,11 @@ Source ------ -Copyright 2017-2020 Alexander Kulak . +Copyright 2017-2021 Alexander Kulak . License: GPLv3 (see COPYING). Repository: https://github.com/sagb/alttab Chat: #alttab on Freenode - -- Alexander Kulak Fri, 28 Apr 2017 13:19:28 +0300 + -- Alexander Kulak Sun, 14 Mar 2021 17:49:00 +0300 diff -Nru alttab-1.5.0/doc/wm-setup.md alttab-1.6.1/doc/wm-setup.md --- alttab-1.5.0/doc/wm-setup.md 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/doc/wm-setup.md 2021-12-05 23:22:57.000000000 +0000 @@ -51,6 +51,7 @@ lwm | 1 (auto, issue #40) | doesn't grab | ? sawfish | 1 (auto) | doesn't grab | ? awesome | 1 (auto) | doesn't grab | ? +bspwm | 1 (auto, see issue #109) | doesn't grab | `alttab &` in ~/.config/bspwm/bspwmrc xmonad diff -Nru alttab-1.5.0/.github/workflows/c-cpp.yml alttab-1.6.1/.github/workflows/c-cpp.yml --- alttab-1.5.0/.github/workflows/c-cpp.yml 1970-01-01 00:00:00.000000000 +0000 +++ alttab-1.6.1/.github/workflows/c-cpp.yml 2021-12-05 23:22:57.000000000 +0000 @@ -0,0 +1,25 @@ +name: C/C++ CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: install build dependencies + run: sudo apt-get -y install libx11-dev libxmu-dev libxft-dev libxrender-dev libxrandr-dev libpng-dev libxpm-dev uthash-dev autoconf automake + - name: avoid missing autotools + run: autoreconf -fvi + - name: configure + run: ./configure + - name: make + run: make + - name: make check + run: make check diff -Nru alttab-1.5.0/.gitignore alttab-1.6.1/.gitignore --- alttab-1.5.0/.gitignore 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/.gitignore 2021-12-05 23:22:57.000000000 +0000 @@ -7,6 +7,7 @@ */.nfs* src/.deps +test/.deps src/tags config.h *~ diff -Nru alttab-1.5.0/INSTALL.md alttab-1.6.1/INSTALL.md --- alttab-1.5.0/INSTALL.md 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/INSTALL.md 2021-12-05 23:22:57.000000000 +0000 @@ -23,7 +23,7 @@ pkg install alttab ``` -* In Arch Linux, alttab is available in [AUR](https://aur.archlinux.org/packages/?O=0&K=alttab) (outdated version at Mar 2018). +* In Arch Linux, alttab is available in [AUR](https://aur.archlinux.org/packages/?O=0&K=alttab). * In Alpine Linux, alttab is in _aports/testing_ repository. @@ -39,18 +39,18 @@ -------------------- 1. Install build dependencies. - Basic Xlib, Xft, Xrender, Xrandr, libpng libraries + Basic Xlib, Xft, Xrender, Xrandr, libpng, libxpm libraries and [uthash macros](http://troydhanson.github.io/uthash/) are required. In Debian or Ubuntu: ``` - apt install libx11-dev libxmu-dev libxft-dev libxrender-dev libxrandr-dev libpng-dev uthash-dev + apt install libx11-dev libxmu-dev libxft-dev libxrender-dev libxrandr-dev libpng-dev libxpm-dev uthash-dev ``` Maintainer or packager may also install autotools and ronn: ``` - apt install autoconf automake ruby-ronn + apt install autoconf automake ronn ``` 2. Download: @@ -71,6 +71,7 @@ ./configure make make install + make check # optional ``` See README for usage notes. diff -Nru alttab-1.5.0/Makefile.am alttab-1.6.1/Makefile.am --- alttab-1.5.0/Makefile.am 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/Makefile.am 2021-12-05 23:22:57.000000000 +0000 @@ -1 +1 @@ -SUBDIRS = src doc +SUBDIRS = src doc test diff -Nru alttab-1.5.0/Makefile.in alttab-1.6.1/Makefile.in --- alttab-1.5.0/Makefile.in 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/Makefile.in 2021-12-05 23:22:57.000000000 +0000 @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.16.2 from Makefile.am. +# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. @@ -156,7 +156,7 @@ CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in COPYING \ - ChangeLog compile depcomp install-sh missing + ChangeLog compile depcomp install-sh missing tap-driver.sh DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -195,6 +195,8 @@ DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip +# Exists only to be overridden by the user if desired. +AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -304,7 +306,7 @@ xrandr_LIBS = @xrandr_LIBS@ xrender_CFLAGS = @xrender_CFLAGS@ xrender_LIBS = @xrender_LIBS@ -SUBDIRS = src doc +SUBDIRS = src doc test all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -610,7 +612,7 @@ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ diff -Nru alttab-1.5.0/README.md alttab-1.6.1/README.md --- alttab-1.5.0/README.md 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/README.md 2021-12-05 23:22:57.000000000 +0000 @@ -6,17 +6,18 @@ ![Translucent](doc/screenshots/alttab-jtaala.png?raw=true) -[screenshot options](doc/screenshots/screenshots.md) +How these screenshots were [obtained](doc/screenshots/screenshots.md) -[![chat on freenode](https://img.shields.io/badge/chat-on%20freenode-brightgreen.svg)](https://webchat.freenode.net/?channels=%23alttab) +![CI status](https://github.com/sagb/alttab/actions/workflows/c-cpp.yml/badge.svg) **alttab** is X11 window switcher designed for minimalistic window managers or standalone X11 session. ``` - alttab [-w N] [-d N] [-sc N] [`-mk` ] [`-kk` ] [`-bk` ] - [`-pk` ] [`-nk` ] [`-ck` ] [`-mm` ] [`-bm` ] + alttab [-w N] [-d N] [-sc N] [-mk ] [-kk ] [-bk ] + [-pk ] [-nk ] [-ck ] [-mm ] [-bm ] [-t NxM] [-i NxM] [-vp str] [-p str] [-s N] [-theme name] [-bg color] - [-fg color] [-frame color] [-font name] [-v|-vv] + [-fg color] [-frame color] [-bc color] [-bw ] [-font name] + [-vertical] [-v|-vv] ``` (see man page for details) @@ -44,5 +45,5 @@ [no-wm](https://github.com/patrickhaller/no-wm): use X11 without a window manager     -alttab (C) Alexander Kulak <sa-dev AT odd POINT systems> 2016-2020 +alttab (C) Alexander Kulak <sa-dev AT odd POINT systems> 2016-2021 diff -Nru alttab-1.5.0/src/alttab.c alttab-1.6.1/src/alttab.c --- alttab-1.5.0/src/alttab.c 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/src/alttab.c 2021-12-05 23:22:57.000000000 +0000 @@ -1,7 +1,7 @@ /* Parsing options/resources, top-level keygrab functions and main(). -Copyright 2017-2020 Alexander Kulak. +Copyright 2017-2021 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify @@ -26,6 +26,7 @@ #include #include #include +#include #include "alttab.h" #include "util.h" #include "config.h" @@ -67,6 +68,8 @@ -bg color background color\n\ -fg color foreground color\n\ -frame color active frame color\n\ + -bc color extra border color\n\ + -bw N extra border width\n\ -font name font name in the form xft:fontconfig_pattern\n\ -v|-vv verbose\n\ -h help\n\ @@ -89,7 +92,7 @@ unsigned int wmindex, dsindex, scindex, isrc; char *gtile, *gicon, *gview, *gpos; int x, y; - unsigned int w, h; + unsigned int w, h, bw; int xpg; char *s; char *rm; @@ -120,7 +123,10 @@ {"-bg", "*background", XrmoptionSepArg, NULL}, {"-fg", "*foreground", XrmoptionSepArg, NULL}, {"-frame", "*framecolor", XrmoptionSepArg, NULL}, + {"-bc", "*bordercolor", XrmoptionSepArg, NULL}, + {"-bw", "*borderwidth", XrmoptionSepArg, NULL}, {"-font", "*font", XrmoptionSepArg, NULL}, + {"-vertical", "*vertical", XrmoptionIsArg, NULL} }; const char *inv = "invalid %s, use -h for help\n"; const char *rmb = "can't figure out modmask from keycode 0x%x\n"; @@ -344,6 +350,22 @@ msg(0, "%dx%d tile, %dx%d icon\n", g.option_tileW, g.option_tileH, g.option_iconW, g.option_iconH); + switch (xresource_load_int(&db, XRMAPPNAME, "borderwidth", &bw)) { + case 1: + if (bw >= BORDER_MIN) + g.option_borderW = bw; + else + die(inv, "bw argument range"); + break; + case 0: + g.option_borderW = DEFBORDERW; + break; + case -1: + die(inv, "bw argument"); + break; + } + msg(0, "bw: %d\n", g.option_borderW); + bzero(&(g.option_vp), sizeof(g.option_vp)); g.option_vp_mode = VP_DEFAULT; gview = xresource_load_string(&db, XRMAPPNAME, "viewport"); @@ -422,6 +444,8 @@ g.color[COLFG].name = s ? s : DEFCOLFG; s = xresource_load_string(&db, XRMAPPNAME, "framecolor"); g.color[COLFRAME].name = s ? s : DEFCOLFRAME; + s = xresource_load_string(&db, XRMAPPNAME, "bordercolor"); + g.color[COLBORDER].name = s ? s : DEFCOLBORDER; s = xresource_load_string(&db, XRMAPPNAME, "font"); if (s) { @@ -437,6 +461,10 @@ g.option_font = DEFFONT + 4; } + s = xresource_load_string(&db, XRMAPPNAME, "vertical"); + g.option_vertical = (s != NULL); + msg(0, "vertical: %d\n", g.option_vertical); + // max recursion for searching windows // -1 is "everything" // in raw X this returns too much windows, "1" is probably sufficient @@ -502,6 +530,8 @@ XErrorHandler hnd = XSetErrorHandler(zeroErrorHandler); // for entire program if (hnd) ;; // make -Wunused happy + signal(SIGUSR1, sighandler); + if (!use_args_and_xrm(&argc, argv)) die("use_args_and_xrm failed"); if (!startupWintasks()) diff -Nru alttab-1.5.0/src/alttab.h alttab-1.6.1/src/alttab.h --- alttab-1.5.0/src/alttab.h 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/src/alttab.h 2021-12-05 23:22:57.000000000 +0000 @@ -1,7 +1,7 @@ /* Global includes. -Copyright 2017-2020 Alexander Kulak. +Copyright 2017-2021 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify @@ -36,6 +36,7 @@ #define DEFTILEH 128 #define DEFICONW 32 #define DEFICONH 32 +#define DEFBORDERW 0 #define DEFTHEME "hicolor" #define FRAME_W 8 //#define DEFFONT "xft:DejaVu Sans Condensed-10" @@ -44,10 +45,12 @@ #define COLBG 0 #define COLFG 1 #define COLFRAME 2 -#define NCOLORS 3 +#define COLBORDER 3 +#define NCOLORS 4 #define DEFCOLBG "black" #define DEFCOLFG "grey" #define DEFCOLFRAME "#a0abab" +#define DEFCOLBORDER "black" #define XDEPTH 24 // TODO: get rid of this @@ -150,8 +153,12 @@ #define SCR_DEFAULT SCR_ALL int option_screen; char *option_font; +#define VERTICAL_DEFAULT false + bool option_vertical; int option_tileW, option_tileH; int option_iconW, option_iconH; +#define BORDER_MIN 0 + int option_borderW; #define VP_FOCUS 0 #define VP_POINTER 1 #define VP_TOTAL 2 @@ -243,5 +250,6 @@ /* autil */ void die(const char *format, ...); void msg(int lvl, const char *format, ...); +void sighandler(int signum); #endif diff -Nru alttab-1.5.0/src/autil.c alttab-1.6.1/src/autil.c --- alttab-1.5.0/src/autil.c 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/src/autil.c 2021-12-05 23:22:57.000000000 +0000 @@ -1,7 +1,7 @@ /* Helper functions specific to alttab. -Copyright 2017-2020 Alexander Kulak. +Copyright 2017-2021 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify @@ -19,6 +19,10 @@ */ #include "alttab.h" +#include "icon.h" +#include +#include +#include extern Globals g; //extern Display* dpy; //extern int scr; @@ -54,3 +58,39 @@ va_end(ap); exit(1); } + +// +// signal handler +// +void sighandler(int signum) +{ + PermanentWindowInfo *pwi; + int sln, in; + switch (signum) { + case SIGUSR1: + fprintf(stderr, "debug information:\n"); + fprintf(stderr, "winlist: %d elements of %ld bytes, %ld total\n", + g.maxNdx, sizeof(WindowInfo), g.maxNdx*sizeof(WindowInfo) ); + DL_COUNT(g.sortlist, pwi, sln); + fprintf(stderr, "sortlist: %d elements of %ld bytes, %ld total\n", + sln, sizeof(PermanentWindowInfo), sln*sizeof(PermanentWindowInfo) ); + in = HASH_COUNT(g.ic); + fprintf(stderr, "icons: %d elements of %ld bytes, %ld total\n", + in, sizeof(icon_t), in*sizeof(icon_t) ); + fprintf(stderr, "option_wm: %d, option_desktop: %d, option_screen: %d\n", + g.option_wm, g.option_desktop, g.option_screen); + fprintf(stderr, "option_font: '%s'\n", g.option_font); + fprintf(stderr, "option_tileW/H: %dx%d, option_iconW/H: %dx%d\n", + g.option_tileW, g.option_tileH, g.option_iconW, g.option_iconH); + fprintf(stderr, "option_vp_mode: %d, vp: [%dx%d+%d+%d], has_randr: %d\n", + g.option_vp_mode, g.vp.w, g.vp.h, g.vp.x, g.vp.y, g.has_randr); + fprintf(stderr, "option_positioning: %d, option_posX/Y: %d, %d\n", + g.option_positioning, g.option_posX, g.option_posY); + fprintf(stderr, "option_iconSrc: %d, option_theme: '%s'\n", + g.option_iconSrc, g.option_theme); + fprintf(stderr, "ewmh: wmname '%s', tslf %d, -1du %d\n", + g.ewmh.wmname, g.ewmh.try_stacking_list_first, g.ewmh.minus1_desktop_unusable); + break; + } +} + diff -Nru alttab-1.5.0/src/ewmh.c alttab-1.6.1/src/ewmh.c --- alttab-1.5.0/src/ewmh.c 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/src/ewmh.c 2021-12-05 23:22:57.000000000 +0000 @@ -2,7 +2,7 @@ Interface with EWMH-compatible window managers. Note: _WIN fallbacks are not part of EWMH or ICCCM, but kept here anyway. -Copyright 2017-2020 Alexander Kulak. +Copyright 2017-2021 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify diff -Nru alttab-1.5.0/src/gui.c alttab-1.6.1/src/gui.c --- alttab-1.5.0/src/gui.c 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/src/gui.c 2021-12-05 23:22:57.000000000 +0000 @@ -1,7 +1,7 @@ /* Draw and interface with our switcher window. -Copyright 2017-2020 Alexander Kulak. +Copyright 2017-2021 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify @@ -37,7 +37,7 @@ // PRIVATE static unsigned int tileW, tileH, iconW, iconH; -static unsigned int visualTileW; +static unsigned int visualTileW, visualTileH; static int lastPressedTile; static quad scrdim; static Window uiwin; @@ -101,9 +101,16 @@ // static void drawFr(GC gc, int f) { + int x, y; + if (g.option_vertical) { + x = 0 + (FRAME_W / 2); + y = f * (tileH + FRAME_W) + (FRAME_W / 2); + } else { + x = f * (tileW + FRAME_W) + (FRAME_W / 2); + y = 0 + (FRAME_W / 2); + } int d = XDrawRectangle(dpy, uiwin, gc, - f * (tileW + FRAME_W) + (FRAME_W / 2), - 0 + (FRAME_W / 2), + x, y, tileW + FRAME_W, tileH + FRAME_W); if (!d) { msg(-1, "can't draw frame\n"); @@ -132,11 +139,19 @@ // static int pointedTile(int x, int y) { - if (x < (FRAME_W / 2) - || x > (uiwinW - (FRAME_W / 2)) - || y < 0 || y > uiwinH) - return -1; - return (x - (FRAME_W / 2)) / visualTileW; + if (g.option_vertical) { + if (y < (FRAME_W / 2) + || y > (uiwinH - (FRAME_W / 2)) + || x < 0 || x > uiwinW) + return -1; + return (y - (FRAME_W / 2)) / visualTileH; + } else { + if (x < (FRAME_W / 2) + || x > (uiwinW - (FRAME_W / 2)) + || y < 0 || y > uiwinH) + return -1; + return (x - (FRAME_W / 2)) / visualTileW; + } } // @@ -216,11 +231,22 @@ endIcon: // draw labels if (wi->name && fontLabel) { + int x, y, w, h; + if (g.option_vertical) { + x = iconW + 5; + y = FRAME_W; // avoids overlapping with frames + w = tileW - iconW - 5; + h = tileH - FRAME_W; + } else { + x = 0; + y = iconH + 5; + w = tileW; + h = tileH - iconH - 5; + } int dr = drawMultiLine(wi->tile, fontLabel, &(g.color[COLFG].xftcolor), wi->name, - 0, (iconH + 5), tileW, - (tileH - iconH - 5)); + x, y, w, h); if (dr != 1) { msg(-1, "can't draw label\n"); } @@ -439,20 +465,31 @@ iconW = g.option_iconW; iconH = g.option_iconH; float rt = 1.0; -// for subsequent calculation of width(s), use 'avail_w' +// for subsequent calculation of width(s), use 'avail_w'/'avail_h' // instead of g.vp.w, because they don't match for POS_SPECIFIC int avail_w = g.vp.w; - if (g.option_positioning == POS_SPECIFIC) + int avail_h = g.vp.h; + if (g.option_positioning == POS_SPECIFIC) { avail_w -= g.option_posX; + avail_h -= g.option_posY; + } // tiles may be smaller if they don't fit viewport uiwinW = (tileW + FRAME_W) * g.maxNdx + FRAME_W; - if (uiwinW > avail_w) { + if (uiwinW > avail_w && !g.option_vertical) { int frames = FRAME_W * g.maxNdx + FRAME_W; rt = ((float)(avail_w - frames)) / ((float)(tileW * g.maxNdx)); tileW = (float)tileW *rt; tileH = (float)tileH *rt; uiwinW = tileW * g.maxNdx + frames; } + uiwinH = (tileH + FRAME_W) * g.maxNdx + FRAME_W; + if (uiwinH > avail_h && g.option_vertical) { + int frames = FRAME_W * g.maxNdx + FRAME_W; + rt = ((float)(avail_h - frames)) / ((float)(tileH * g.maxNdx)); + tileW = (float)tileW *rt; + tileH = (float)tileH *rt; + uiwinH = tileH * g.maxNdx + frames; + } // icon may be smaller if it doesn't fit tile if (iconW > tileW) { rt = (float)tileW / (float)iconW; @@ -464,7 +501,11 @@ iconH = tileH; iconW = rt * iconW; } - uiwinH = tileH + 2 * FRAME_W; + if (g.option_vertical) + uiwinW = tileW + 2 * FRAME_W; + else + uiwinH = tileH + 2 * FRAME_W; + if (g.option_positioning == POS_CENTER) { uiwinX = (g.vp.w - uiwinW) / 2 + g.vp.x; uiwinY = (g.vp.h - uiwinH) / 2 + g.vp.y; @@ -472,7 +513,14 @@ uiwinX = g.option_posX + g.vp.x; uiwinY = g.option_posY + g.vp.y; } - visualTileW = (uiwinW - FRAME_W) / g.maxNdx; + + if (g.option_vertical) { + visualTileW = uiwinW - FRAME_W; + visualTileH = (uiwinH - FRAME_W) / g.maxNdx; + } else { + visualTileH = uiwinH - FRAME_W; + visualTileW = (uiwinW - FRAME_W) / g.maxNdx; + } if (g.debug > 0) { msg(0, "tile w=%d h=%d\n", tileW, tileH); msg(0, "uiwin %dx%d +%d+%d", uiwinW, uiwinH, uiwinX, uiwinY); @@ -507,9 +555,9 @@ unsigned long valuemask = CWBackPixel | CWBorderPixel | CWOverrideRedirect; XSetWindowAttributes attributes; attributes.background_pixel = g.color[COLBG].xcolor.pixel; - attributes.border_pixel = g.color[COLFRAME].xcolor.pixel; + attributes.border_pixel = g.color[COLBORDER].xcolor.pixel; attributes.override_redirect = 1; - uiwin = XCreateWindow(dpy, root, uiwinX, uiwinY, uiwinW, uiwinH, 0, // border_width + uiwin = XCreateWindow(dpy, root, uiwinX, uiwinY, uiwinW, uiwinH, g.option_borderW, // border_width CopyFromParent, // depth InputOutput, // class CopyFromParent, // visual @@ -627,9 +675,17 @@ if (g.winlist[j].tile) { msg(1, "copying tile %d to canvas\n", j); //XSync (dpy, false); + int dest_x, dest_y; + if (g.option_vertical) { + dest_x = FRAME_W; + dest_y = j * (tileH + FRAME_W) + FRAME_W; + } else { + dest_x = j * (tileW + FRAME_W) + FRAME_W; + dest_y = FRAME_W; + } int r = XCopyArea(dpy, g.winlist[j].tile, uiwin, g.gcDirect, 0, 0, tileW, tileH, // src - j * (tileW + FRAME_W) + FRAME_W, FRAME_W); // dst + dest_x, dest_y); // dst //XSync (dpy, false); msg(1, "XCopyArea returned %d\n", r); } diff -Nru alttab-1.5.0/src/icon.c alttab-1.6.1/src/icon.c --- alttab-1.5.0/src/icon.c 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/src/icon.c 2021-12-05 23:22:57.000000000 +0000 @@ -1,7 +1,7 @@ /* Icon object. -Copyright 2017-2020 Alexander Kulak. +Copyright 2017-2021 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify @@ -260,8 +260,9 @@ char *endptr; char *dim; int dimlen; - char sx[5]; - char sy[5]; + char sx[MAXICONDIMLEN]; + char sy[MAXICONDIMLEN]; + int sx_size, sy_size; int ix, iy; icon_t *ic; char *suff; @@ -309,11 +310,17 @@ xchar = strchr(dim, 'x'); if (xchar == NULL) return 0; // unknown dimensions - strncpy(sx, dim, (xchar - dim)); - sx[xchar - dim] = '\0'; + sx_size = xchar - dim; + if (sx_size > MAXICONDIMLEN - 1) + return 0; + strncpy(sx, dim, sx_size); + sx[sx_size] = '\0'; ix = atoi(sx); - strncpy(sy, xchar + 1, dim + dimlen - xchar); - sy[dim + dimlen - xchar - 1] = '\0'; + sy_size = dim + dimlen - xchar; + if (sy_size > MAXICONDIMLEN - 1) + return 0; + strncpy(sy, xchar + 1, sy_size); + sy[sy_size] = '\0'; iy = atoi(sy); } else { // icon other than a priory known dimensions has lowest priority @@ -335,16 +342,28 @@ uchar = strrchr(app, '_'); xchar = strrchr(app, 'x'); if (xchar != NULL && uchar != NULL && xchar > uchar) { - strncpy(sx, uchar+1, (xchar - uchar - 1)); - sx[xchar - uchar - 1] = '\0'; + sx_size = xchar - uchar - 1; + if (sx_size > MAXICONDIMLEN - 1) { + msg (0, special_fail_1, app, "WW"); + ix = 0; + goto end_special_1; + } + strncpy(sx, uchar+1, sx_size); + sx[sx_size] = '\0'; ix = strtol(sx, &endptr, 10); if (!(*sx != '\0' && *endptr == '\0')) { msg (0, special_fail_1, app, "WW"); ix = 0; goto end_special_1; } - strncpy(sy, xchar + 1, app + strlen(app) - xchar); - sy[app + strlen(app) - xchar] = '\0'; + sy_size = app + strlen(app) - xchar; + if (sy_size > MAXICONDIMLEN - 1) { + msg (0, special_fail_1, app, "HH"); + iy = 0; + goto end_special_1; + } + strncpy(sy, xchar + 1, sy_size); + sy[sy_size] = '\0'; iy = strtol(sy, &endptr, 10); if (!(*sy != '\0' && *endptr == '\0')) { msg (0, special_fail_1, app, "HH"); diff -Nru alttab-1.5.0/src/icon.h alttab-1.6.1/src/icon.h --- alttab-1.5.0/src/icon.h 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/src/icon.h 2021-12-05 23:22:57.000000000 +0000 @@ -1,7 +1,7 @@ /* icon.c definitions. -Copyright 2017-2020 Alexander Kulak. +Copyright 2017-2021 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify @@ -38,6 +38,7 @@ #define MAXICONDIRS 64 #define MAXAPPLEN 64 #define MAXICONPATHLEN 1024 +#define MAXICONDIMLEN 5 typedef struct { char app[MAXAPPLEN]; // application name; uthash key diff -Nru alttab-1.5.0/src/Makefile.in alttab-1.6.1/src/Makefile.in --- alttab-1.5.0/src/Makefile.in 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/src/Makefile.in 2021-12-05 23:22:57.000000000 +0000 @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.16.2 from Makefile.am. +# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. diff -Nru alttab-1.5.0/src/pngd.c alttab-1.6.1/src/pngd.c --- alttab-1.5.0/src/pngd.c 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/src/pngd.c 2021-12-05 23:22:57.000000000 +0000 @@ -1,7 +1,7 @@ /* Reading PNG into Drawable. -Copyright 2017-2020 Alexander Kulak. +Copyright 2017-2021 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify diff -Nru alttab-1.5.0/src/pngd.h alttab-1.6.1/src/pngd.h --- alttab-1.5.0/src/pngd.h 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/src/pngd.h 2021-12-05 23:22:57.000000000 +0000 @@ -1,7 +1,7 @@ /* pngd.c definitions. -Copyright 2017-2020 Alexander Kulak. +Copyright 2017-2021 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify diff -Nru alttab-1.5.0/src/randr.c alttab-1.6.1/src/randr.c --- alttab-1.5.0/src/randr.c 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/src/randr.c 2021-12-05 23:22:57.000000000 +0000 @@ -1,7 +1,7 @@ /* Interface to XRANDR -Copyright 2017-2020 Alexander Kulak. +Copyright 2017-2021 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify diff -Nru alttab-1.5.0/src/rp.c alttab-1.6.1/src/rp.c --- alttab-1.5.0/src/rp.c 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/src/rp.c 2021-12-05 23:22:57.000000000 +0000 @@ -1,7 +1,7 @@ /* Interface with Ratpoison window manager. -Copyright 2017-2020 Alexander Kulak. +Copyright 2017-2021 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify diff -Nru alttab-1.5.0/src/util.c alttab-1.6.1/src/util.c --- alttab-1.5.0/src/util.c 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/src/util.c 2021-12-05 23:22:57.000000000 +0000 @@ -1,7 +1,7 @@ /* Helper functions. -Copyright 2017-2020 Alexander Kulak. +Copyright 2017-2021 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify diff -Nru alttab-1.5.0/src/util.h alttab-1.6.1/src/util.h --- alttab-1.5.0/src/util.h 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/src/util.h 2021-12-05 23:22:57.000000000 +0000 @@ -1,7 +1,7 @@ /* util.c definitions. -Copyright 2017-2020 Alexander Kulak. +Copyright 2017-2021 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify diff -Nru alttab-1.5.0/src/win.c alttab-1.6.1/src/win.c --- alttab-1.5.0/src/win.c 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/src/win.c 2021-12-05 23:22:57.000000000 +0000 @@ -1,7 +1,7 @@ /* Interface with foreign windows common for all WMs. -Copyright 2017-2020 Alexander Kulak. +Copyright 2017-2021 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify @@ -228,7 +228,7 @@ } if (best == 0) { msg(0, "%s found but no suitable icons in it\n", NWI); - //free(prop); better don't + free(pro); return 0; } msg(1, "using %dx%d %s icon for %lx\n", w, h, NWI, wi->id); @@ -262,6 +262,7 @@ wi->icon_allocated = true; wi->icon_w = best_w; wi->icon_h = best_h; + XFree(img); free(image32); free(pro); return 1; diff -Nru alttab-1.5.0/src/x.c alttab-1.6.1/src/x.c --- alttab-1.5.0/src/x.c 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/src/x.c 2021-12-05 23:22:57.000000000 +0000 @@ -1,7 +1,7 @@ /* Interface with foreign windows in raw X11. -Copyright 2017-2020 Alexander Kulak. +Copyright 2017-2021 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify diff -Nru alttab-1.5.0/tap-driver.sh alttab-1.6.1/tap-driver.sh --- alttab-1.5.0/tap-driver.sh 1970-01-01 00:00:00.000000000 +0000 +++ alttab-1.6.1/tap-driver.sh 2021-12-05 23:22:57.000000000 +0000 @@ -0,0 +1,651 @@ +#! /bin/sh +# Copyright (C) 2011-2020 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +scriptversion=2013-12-23.17; # UTC + +# Make unconditional expansion of undefined variables an error. This +# helps a lot in preventing typo-related bugs. +set -u + +me=tap-driver.sh + +fatal () +{ + echo "$me: fatal: $*" >&2 + exit 1 +} + +usage_error () +{ + echo "$me: $*" >&2 + print_usage >&2 + exit 2 +} + +print_usage () +{ + cat < + # + trap : 1 3 2 13 15 + if test $merge -gt 0; then + exec 2>&1 + else + exec 2>&3 + fi + "$@" + echo $? + ) | LC_ALL=C ${AM_TAP_AWK-awk} \ + -v me="$me" \ + -v test_script_name="$test_name" \ + -v log_file="$log_file" \ + -v trs_file="$trs_file" \ + -v expect_failure="$expect_failure" \ + -v merge="$merge" \ + -v ignore_exit="$ignore_exit" \ + -v comments="$comments" \ + -v diag_string="$diag_string" \ +' +# TODO: the usages of "cat >&3" below could be optimized when using +# GNU awk, and/on on systems that supports /dev/fd/. + +# Implementation note: in what follows, `result_obj` will be an +# associative array that (partly) simulates a TAP result object +# from the `TAP::Parser` perl module. + +## ----------- ## +## FUNCTIONS ## +## ----------- ## + +function fatal(msg) +{ + print me ": " msg | "cat >&2" + exit 1 +} + +function abort(where) +{ + fatal("internal error " where) +} + +# Convert a boolean to a "yes"/"no" string. +function yn(bool) +{ + return bool ? "yes" : "no"; +} + +function add_test_result(result) +{ + if (!test_results_index) + test_results_index = 0 + test_results_list[test_results_index] = result + test_results_index += 1 + test_results_seen[result] = 1; +} + +# Whether the test script should be re-run by "make recheck". +function must_recheck() +{ + for (k in test_results_seen) + if (k != "XFAIL" && k != "PASS" && k != "SKIP") + return 1 + return 0 +} + +# Whether the content of the log file associated to this test should +# be copied into the "global" test-suite.log. +function copy_in_global_log() +{ + for (k in test_results_seen) + if (k != "PASS") + return 1 + return 0 +} + +function get_global_test_result() +{ + if ("ERROR" in test_results_seen) + return "ERROR" + if ("FAIL" in test_results_seen || "XPASS" in test_results_seen) + return "FAIL" + all_skipped = 1 + for (k in test_results_seen) + if (k != "SKIP") + all_skipped = 0 + if (all_skipped) + return "SKIP" + return "PASS"; +} + +function stringify_result_obj(result_obj) +{ + if (result_obj["is_unplanned"] || result_obj["number"] != testno) + return "ERROR" + + if (plan_seen == LATE_PLAN) + return "ERROR" + + if (result_obj["directive"] == "TODO") + return result_obj["is_ok"] ? "XPASS" : "XFAIL" + + if (result_obj["directive"] == "SKIP") + return result_obj["is_ok"] ? "SKIP" : COOKED_FAIL; + + if (length(result_obj["directive"])) + abort("in function stringify_result_obj()") + + return result_obj["is_ok"] ? COOKED_PASS : COOKED_FAIL +} + +function decorate_result(result) +{ + color_name = color_for_result[result] + if (color_name) + return color_map[color_name] "" result "" color_map["std"] + # If we are not using colorized output, or if we do not know how + # to colorize the given result, we should return it unchanged. + return result +} + +function report(result, details) +{ + if (result ~ /^(X?(PASS|FAIL)|SKIP|ERROR)/) + { + msg = ": " test_script_name + add_test_result(result) + } + else if (result == "#") + { + msg = " " test_script_name ":" + } + else + { + abort("in function report()") + } + if (length(details)) + msg = msg " " details + # Output on console might be colorized. + print decorate_result(result) msg + # Log the result in the log file too, to help debugging (this is + # especially true when said result is a TAP error or "Bail out!"). + print result msg | "cat >&3"; +} + +function testsuite_error(error_message) +{ + report("ERROR", "- " error_message) +} + +function handle_tap_result() +{ + details = result_obj["number"]; + if (length(result_obj["description"])) + details = details " " result_obj["description"] + + if (plan_seen == LATE_PLAN) + { + details = details " # AFTER LATE PLAN"; + } + else if (result_obj["is_unplanned"]) + { + details = details " # UNPLANNED"; + } + else if (result_obj["number"] != testno) + { + details = sprintf("%s # OUT-OF-ORDER (expecting %d)", + details, testno); + } + else if (result_obj["directive"]) + { + details = details " # " result_obj["directive"]; + if (length(result_obj["explanation"])) + details = details " " result_obj["explanation"] + } + + report(stringify_result_obj(result_obj), details) +} + +# `skip_reason` should be empty whenever planned > 0. +function handle_tap_plan(planned, skip_reason) +{ + planned += 0 # Avoid getting confused if, say, `planned` is "00" + if (length(skip_reason) && planned > 0) + abort("in function handle_tap_plan()") + if (plan_seen) + { + # Error, only one plan per stream is acceptable. + testsuite_error("multiple test plans") + return; + } + planned_tests = planned + # The TAP plan can come before or after *all* the TAP results; we speak + # respectively of an "early" or a "late" plan. If we see the plan line + # after at least one TAP result has been seen, assume we have a late + # plan; in this case, any further test result seen after the plan will + # be flagged as an error. + plan_seen = (testno >= 1 ? LATE_PLAN : EARLY_PLAN) + # If testno > 0, we have an error ("too many tests run") that will be + # automatically dealt with later, so do not worry about it here. If + # $plan_seen is true, we have an error due to a repeated plan, and that + # has already been dealt with above. Otherwise, we have a valid "plan + # with SKIP" specification, and should report it as a particular kind + # of SKIP result. + if (planned == 0 && testno == 0) + { + if (length(skip_reason)) + skip_reason = "- " skip_reason; + report("SKIP", skip_reason); + } +} + +function extract_tap_comment(line) +{ + if (index(line, diag_string) == 1) + { + # Strip leading `diag_string` from `line`. + line = substr(line, length(diag_string) + 1) + # And strip any leading and trailing whitespace left. + sub("^[ \t]*", "", line) + sub("[ \t]*$", "", line) + # Return what is left (if any). + return line; + } + return ""; +} + +# When this function is called, we know that line is a TAP result line, +# so that it matches the (perl) RE "^(not )?ok\b". +function setup_result_obj(line) +{ + # Get the result, and remove it from the line. + result_obj["is_ok"] = (substr(line, 1, 2) == "ok" ? 1 : 0) + sub("^(not )?ok[ \t]*", "", line) + + # If the result has an explicit number, get it and strip it; otherwise, + # automatically assign the next test number to it. + if (line ~ /^[0-9]+$/ || line ~ /^[0-9]+[^a-zA-Z0-9_]/) + { + match(line, "^[0-9]+") + # The final `+ 0` is to normalize numbers with leading zeros. + result_obj["number"] = substr(line, 1, RLENGTH) + 0 + line = substr(line, RLENGTH + 1) + } + else + { + result_obj["number"] = testno + } + + if (plan_seen == LATE_PLAN) + # No further test results are acceptable after a "late" TAP plan + # has been seen. + result_obj["is_unplanned"] = 1 + else if (plan_seen && testno > planned_tests) + result_obj["is_unplanned"] = 1 + else + result_obj["is_unplanned"] = 0 + + # Strip trailing and leading whitespace. + sub("^[ \t]*", "", line) + sub("[ \t]*$", "", line) + + # This will have to be corrected if we have a "TODO"/"SKIP" directive. + result_obj["description"] = line + result_obj["directive"] = "" + result_obj["explanation"] = "" + + if (index(line, "#") == 0) + return # No possible directive, nothing more to do. + + # Directives are case-insensitive. + rx = "[ \t]*#[ \t]*([tT][oO][dD][oO]|[sS][kK][iI][pP])[ \t]*" + + # See whether we have the directive, and if yes, where. + pos = match(line, rx "$") + if (!pos) + pos = match(line, rx "[^a-zA-Z0-9_]") + + # If there was no TAP directive, we have nothing more to do. + if (!pos) + return + + # Let`s now see if the TAP directive has been escaped. For example: + # escaped: ok \# SKIP + # not escaped: ok \\# SKIP + # escaped: ok \\\\\# SKIP + # not escaped: ok \ # SKIP + if (substr(line, pos, 1) == "#") + { + bslash_count = 0 + for (i = pos; i > 1 && substr(line, i - 1, 1) == "\\"; i--) + bslash_count += 1 + if (bslash_count % 2) + return # Directive was escaped. + } + + # Strip the directive and its explanation (if any) from the test + # description. + result_obj["description"] = substr(line, 1, pos - 1) + # Now remove the test description from the line, that has been dealt + # with already. + line = substr(line, pos) + # Strip the directive, and save its value (normalized to upper case). + sub("^[ \t]*#[ \t]*", "", line) + result_obj["directive"] = toupper(substr(line, 1, 4)) + line = substr(line, 5) + # Now get the explanation for the directive (if any), with leading + # and trailing whitespace removed. + sub("^[ \t]*", "", line) + sub("[ \t]*$", "", line) + result_obj["explanation"] = line +} + +function get_test_exit_message(status) +{ + if (status == 0) + return "" + if (status !~ /^[1-9][0-9]*$/) + abort("getting exit status") + if (status < 127) + exit_details = "" + else if (status == 127) + exit_details = " (command not found?)" + else if (status >= 128 && status <= 255) + exit_details = sprintf(" (terminated by signal %d?)", status - 128) + else if (status > 256 && status <= 384) + # We used to report an "abnormal termination" here, but some Korn + # shells, when a child process die due to signal number n, can leave + # in $? an exit status of 256+n instead of the more standard 128+n. + # Apparently, both behaviours are allowed by POSIX (2008), so be + # prepared to handle them both. See also Austing Group report ID + # 0000051 + exit_details = sprintf(" (terminated by signal %d?)", status - 256) + else + # Never seen in practice. + exit_details = " (abnormal termination)" + return sprintf("exited with status %d%s", status, exit_details) +} + +function write_test_results() +{ + print ":global-test-result: " get_global_test_result() > trs_file + print ":recheck: " yn(must_recheck()) > trs_file + print ":copy-in-global-log: " yn(copy_in_global_log()) > trs_file + for (i = 0; i < test_results_index; i += 1) + print ":test-result: " test_results_list[i] > trs_file + close(trs_file); +} + +BEGIN { + +## ------- ## +## SETUP ## +## ------- ## + +'"$init_colors"' + +# Properly initialized once the TAP plan is seen. +planned_tests = 0 + +COOKED_PASS = expect_failure ? "XPASS": "PASS"; +COOKED_FAIL = expect_failure ? "XFAIL": "FAIL"; + +# Enumeration-like constants to remember which kind of plan (if any) +# has been seen. It is important that NO_PLAN evaluates "false" as +# a boolean. +NO_PLAN = 0 +EARLY_PLAN = 1 +LATE_PLAN = 2 + +testno = 0 # Number of test results seen so far. +bailed_out = 0 # Whether a "Bail out!" directive has been seen. + +# Whether the TAP plan has been seen or not, and if yes, which kind +# it is ("early" is seen before any test result, "late" otherwise). +plan_seen = NO_PLAN + +## --------- ## +## PARSING ## +## --------- ## + +is_first_read = 1 + +while (1) + { + # Involutions required so that we are able to read the exit status + # from the last input line. + st = getline + if (st < 0) # I/O error. + fatal("I/O error while reading from input stream") + else if (st == 0) # End-of-input + { + if (is_first_read) + abort("in input loop: only one input line") + break + } + if (is_first_read) + { + is_first_read = 0 + nextline = $0 + continue + } + else + { + curline = nextline + nextline = $0 + $0 = curline + } + # Copy any input line verbatim into the log file. + print | "cat >&3" + # Parsing of TAP input should stop after a "Bail out!" directive. + if (bailed_out) + continue + + # TAP test result. + if ($0 ~ /^(not )?ok$/ || $0 ~ /^(not )?ok[^a-zA-Z0-9_]/) + { + testno += 1 + setup_result_obj($0) + handle_tap_result() + } + # TAP plan (normal or "SKIP" without explanation). + else if ($0 ~ /^1\.\.[0-9]+[ \t]*$/) + { + # The next two lines will put the number of planned tests in $0. + sub("^1\\.\\.", "") + sub("[^0-9]*$", "") + handle_tap_plan($0, "") + continue + } + # TAP "SKIP" plan, with an explanation. + else if ($0 ~ /^1\.\.0+[ \t]*#/) + { + # The next lines will put the skip explanation in $0, stripping + # any leading and trailing whitespace. This is a little more + # tricky in truth, since we want to also strip a potential leading + # "SKIP" string from the message. + sub("^[^#]*#[ \t]*(SKIP[: \t][ \t]*)?", "") + sub("[ \t]*$", ""); + handle_tap_plan(0, $0) + } + # "Bail out!" magic. + # Older versions of prove and TAP::Harness (e.g., 3.17) did not + # recognize a "Bail out!" directive when preceded by leading + # whitespace, but more modern versions (e.g., 3.23) do. So we + # emulate the latter, "more modern" behaviour. + else if ($0 ~ /^[ \t]*Bail out!/) + { + bailed_out = 1 + # Get the bailout message (if any), with leading and trailing + # whitespace stripped. The message remains stored in `$0`. + sub("^[ \t]*Bail out![ \t]*", ""); + sub("[ \t]*$", ""); + # Format the error message for the + bailout_message = "Bail out!" + if (length($0)) + bailout_message = bailout_message " " $0 + testsuite_error(bailout_message) + } + # Maybe we have too look for dianogtic comments too. + else if (comments != 0) + { + comment = extract_tap_comment($0); + if (length(comment)) + report("#", comment); + } + } + +## -------- ## +## FINISH ## +## -------- ## + +# A "Bail out!" directive should cause us to ignore any following TAP +# error, as well as a non-zero exit status from the TAP producer. +if (!bailed_out) + { + if (!plan_seen) + { + testsuite_error("missing test plan") + } + else if (planned_tests != testno) + { + bad_amount = testno > planned_tests ? "many" : "few" + testsuite_error(sprintf("too %s tests run (expected %d, got %d)", + bad_amount, planned_tests, testno)) + } + if (!ignore_exit) + { + # Fetch exit status from the last line. + exit_message = get_test_exit_message(nextline) + if (exit_message) + testsuite_error(exit_message) + } + } + +write_test_results() + +exit 0 + +} # End of "BEGIN" block. +' + +# TODO: document that we consume the file descriptor 3 :-( +} 3>"$log_file" + +test $? -eq 0 || fatal "I/O or internal error" + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff -Nru alttab-1.5.0/test/Makefile alttab-1.6.1/test/Makefile --- alttab-1.5.0/test/Makefile 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/test/Makefile 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -# -# Stub for possible future test facility. -# -# Copyright 2017-2019 Alexander Kulak. -# This file is part of alttab program. -# -# alttab is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# alttab is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with alttab. If not, see . -# - -FLAGS=-lpng -lX11 -g -O0 -Wall - -all: pngtest - -pngtest: pngtest.o ../src/pngd.o - gcc $(FLAGS) -o pngtest pngtest.o ../src/pngd.o - -pngtest.o: pngtest.c - gcc $(FLAGS) -c pngtest.c - -../src/pngd.o: ../src/pngd.c ../src/pngd.h - gcc $(FLAGS) -o ../src/pngd.o -c ../src/pngd.c - diff -Nru alttab-1.5.0/test/Makefile.am alttab-1.6.1/test/Makefile.am --- alttab-1.5.0/test/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ alttab-1.6.1/test/Makefile.am 2021-12-05 23:22:57.000000000 +0000 @@ -0,0 +1,3 @@ +TEST_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh --merge +TESTS = run-in-xvfb.test +EXTRA_DIST = $(TESTS) diff -Nru alttab-1.5.0/test/Makefile.in alttab-1.6.1/test/Makefile.in --- alttab-1.5.0/test/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ alttab-1.6.1/test/Makefile.in 2021-12-05 23:22:57.000000000 +0000 @@ -0,0 +1,781 @@ +# Makefile.in generated by automake 1.16.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2020 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +subdir = test +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' +RECHECK_LOGS = $(TEST_LOGS) +AM_RECURSIVE_TARGETS = check recheck +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +fts_CFLAGS = @fts_CFLAGS@ +fts_LIBS = @fts_LIBS@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libpng_CFLAGS = @libpng_CFLAGS@ +libpng_LIBS = @libpng_LIBS@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +x11_CFLAGS = @x11_CFLAGS@ +x11_LIBS = @x11_LIBS@ +xft_CFLAGS = @xft_CFLAGS@ +xft_LIBS = @xft_LIBS@ +xpm_CFLAGS = @xpm_CFLAGS@ +xpm_LIBS = @xpm_LIBS@ +xrandr_CFLAGS = @xrandr_CFLAGS@ +xrandr_LIBS = @xrandr_LIBS@ +xrender_CFLAGS = @xrender_CFLAGS@ +xrender_LIBS = @xrender_LIBS@ +TEST_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh --merge +TESTS = run-in-xvfb.test +EXTRA_DIST = $(TESTS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .log .test .test$(EXEEXT) .trs +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign test/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + elif test -n "$$redo_logs"; then \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: all all-am check check-TESTS check-am clean clean-generic \ + cscopelist-am ctags-am distclean distclean-generic distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am recheck tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -Nru alttab-1.5.0/test/pngtest.c alttab-1.6.1/test/pngtest.c --- alttab-1.5.0/test/pngtest.c 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/test/pngtest.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -/* - * Stub for possible future test facility. - * - * Copyright 2017-2019 Alexander Kulak. - * This file is part of alttab program. - * - * alttab is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * alttab is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with alttab. If not, see . - * */ - - -#include "../src/pngd.h" - -Display* dpy; -int scr; -Window root; - -int main(int argc, char **argv) -{ - return !pngReadToDrawable_test ("/usr/share/icons/hicolor/48x48/apps/mkvmerge.png"); -} - diff -Nru alttab-1.5.0/test/README alttab-1.6.1/test/README --- alttab-1.5.0/test/README 2020-07-23 08:24:20.000000000 +0000 +++ alttab-1.6.1/test/README 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -This is a stub for possible future test facility diff -Nru alttab-1.5.0/test/run-in-xvfb.test alttab-1.6.1/test/run-in-xvfb.test --- alttab-1.5.0/test/run-in-xvfb.test 1970-01-01 00:00:00.000000000 +0000 +++ alttab-1.6.1/test/run-in-xvfb.test 2021-12-05 23:22:57.000000000 +0000 @@ -0,0 +1,155 @@ +#!/bin/sh + +# Tests in headless X server. +# http://www.gnu.org/software/automake/manual/automake.html#Using-the-TAP-test-protocol + +# Copyright 2017-2021 Alexander Kulak. +# This file is part of alttab program. +# +# alttab is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# alttab is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with alttab. If not, see . + + +ALTTAB=../src/alttab +NUMTEST=3 + +install_software() +{ + packs="" ; progs="" + for pair in "cnee xnee" "Xvfb xvfb" "xeyes x11-apps" "xprop x11-utils" "ps procps" ; do + prog=`echo $pair | cut -d \ -f 1` + pack=`echo $pair | cut -d \ -f 2` + if ! which "$prog" >/dev/null ; then + packs="${packs} ${pack}" + progs="${progs} ${prog}" + fi + done + if [ -n "$packs" ] ; then + echo "Installing: $packs" + icmd="sudo --non-interactive apt-get -y install $packs" + $icmd || echo -e "Failed: $icmd\nThis script runs apt-get via passwordless sudo, otherwise install manually: $progs" >&2 + for prog in $progs ; do + if ! which "$prog" >/dev/null ; then + echo "Can't find $prog. Bail out!" >&2 + exit 1 + fi + done + fi +} + +start_x() +{ + # not required, only to silent Xvfb + sudo --non-interactive \ + sh -c "mkdir -p /tmp/.X11-unix ; chmod 1777 /tmp/.X11-unix" >/dev/null + Xvfb :200 -ac & + export xvfb=$! + for ms100 in `seq 1 50` ; do + sleep 0.1 + if DISPLAY=:200 xprop -root >/dev/null ; then + return + fi + done + echo "Can't recognize Xvfb in 5 seconds. Bail out!" >&2 + exit 1 +} + +stop_x() +{ + if [ -n "$xvfb" ] ; then + kill -9 $xvfb + rm -f /tmp/.X200-lock + export xvfb="" + fi +} + +start_alttab() +{ + DISPLAY=:200 "$ALTTAB" -w 0 -vv & + export alttab=$! + sleep 1 +} + +stop_alttab() +{ + if [ -n "$alttab" ] ; then + kill -9 $alttab + export alttab="" + fi +} + +open_sample_windows() +{ + eyes="" + for c in `seq 1 7` ; do + DISPLAY=:200 xeyes & + eyes="${eyes} $!" + done + export eyes + sleep 0.5 +} + +close_sample_windows() +{ + if [ -n "$eyes" ] ; then + kill -9 $eyes + export eyes="" + fi +} + +alttab_simple_cycle() +{ + cmd="fake-key-press key=Alt_L msec=2\n" + for c in `seq 1 20` ; do + cmd="${cmd}fake-key-press key=Tab msec=100\nfake-key-release key=Tab msec=2\n" + done + cmd="${cmd}fake-key-release key=Alt_L msec=100" + echo "$cmd" | DISPLAY=:200 cnee --replay +} + +check_alttab() +{ + stage="$1" ; comment="$2" + sleep 0.5 + if ! ps -p "$alttab" >/dev/null ; then + echo "not ok $stage - $comment" + exit 1 + else + echo "ok $stage - $comment" + fi +} + +cleanup() +{ + close_sample_windows + stop_alttab + stop_x +} + + +# begin execution + +trap cleanup EXIT +echo "1..$NUMTEST" +install_software +start_x +open_sample_windows +start_alttab +check_alttab 1 "start" +alttab_simple_cycle +check_alttab 2 "simple cycle, focus" +close_sample_windows +check_alttab 3 "unmap windows" +stop_alttab +stop_x +