diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2019-08-15 17:31:44 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2019-08-15 17:31:44 +0000 |
commit | 874b352d39e240c493c95e21bad1eadd2ccde7a8 (patch) | |
tree | 3699efadabc410cfe97e33c7b17d37e7147cb2b6 /app/xev | |
parent | 7d56f6349ab20ccd06b01e08bb28c68b507b74ff (diff) |
Update to xev 1.2.3
Diffstat (limited to 'app/xev')
-rw-r--r-- | app/xev/ChangeLog | 97 | ||||
-rw-r--r-- | app/xev/Makefile.am | 2 | ||||
-rw-r--r-- | app/xev/Makefile.in | 3 | ||||
-rw-r--r-- | app/xev/README.md (renamed from app/xev/README) | 16 | ||||
-rw-r--r-- | app/xev/aclocal.m4 | 280 | ||||
-rw-r--r-- | app/xev/configure | 102 | ||||
-rw-r--r-- | app/xev/configure.ac | 4 | ||||
-rw-r--r-- | app/xev/xev.c | 1521 |
8 files changed, 1209 insertions, 816 deletions
diff --git a/app/xev/ChangeLog b/app/xev/ChangeLog index 1c9dbe81b..9d2c5b143 100644 --- a/app/xev/ChangeLog +++ b/app/xev/ChangeLog @@ -1,3 +1,100 @@ +commit 699ec4772f024e70dbb5474921acd4977ecfce4c +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Tue Feb 19 14:21:20 2019 -0800 + + xev 1.2.3 + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 25f92ab3238e9aec22214186c64cc968fb8af416 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Wed Nov 21 17:02:34 2018 -0800 + + Update configure.ac bug URL for gitlab migration + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 2aa71349b3c3e206c0936c59322079adfab0d450 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Fri Nov 16 21:41:17 2018 -0800 + + Update README for gitlab migration + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 6cb245a4cadff580e0e5b0739f052ca74d9097b9 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sat Oct 6 12:49:26 2018 -0700 + + Replace sprintf calls with snprintf + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit fe3bbae5c75b5bb9bc34f9b3ae93b1bc66708691 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sat Oct 6 12:44:25 2018 -0700 + + Adopt X.Org standard code style + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 366b03aee6dc4cb19aa82f6cd2dd067646873777 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sat Oct 6 12:15:25 2018 -0700 + + Collapse usage message into a single string + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit e08d28020c38a9fc5167c785334d426fe0f157d1 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sat Oct 6 12:09:21 2018 -0700 + + Add -version to usage output + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 25bb70e02407822ae5b03e74571275afcd037f98 +Author: Eitan Adler <lists@eitanadler.com> +Date: Sat Jul 28 08:28:36 2018 +0000 + + xev: fix 'mode' in default case (version 2) + + Signed-off-by: Eitan Adler <lists@eitanadler.com> + Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> + +commit d1f08f62b455f5921ee4b7c86bc5b8e92d2871ed +Author: Mihail Konev <k.mvc@ya.ru> +Date: Thu Jan 26 14:00:21 2017 +1000 + + autogen: add default patch prefix + + Signed-off-by: Mihail Konev <k.mvc@ya.ru> + +commit 201b7fbfc345f38c90c38680dc98328605bbec99 +Author: Emil Velikov <emil.l.velikov@gmail.com> +Date: Mon Mar 9 12:00:52 2015 +0000 + + autogen.sh: use quoted string variables + + Place quotes around the $srcdir, $ORIGDIR and $0 variables to prevent + fall-outs, when they contain space. + + Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> + Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> + Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> + +commit 45016c5c901fcc0f898403f88b68939283d25b96 +Author: Peter Hutterer <peter.hutterer@who-t.net> +Date: Tue Jan 24 10:32:07 2017 +1000 + + autogen.sh: use exec instead of waiting for configure to finish + + Syncs the invocation of configure with the one from the server. + + Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> + Reviewed-by: Emil Velikov <emil.velikov@collabora.com> + commit a92082cb05bb3d6d3f0bebb951133774ca2dd412 Author: Alan Coopersmith <alan.coopersmith@oracle.com> Date: Thu Apr 16 23:11:22 2015 -0700 diff --git a/app/xev/Makefile.am b/app/xev/Makefile.am index a100a1d6b..41719114f 100644 --- a/app/xev/Makefile.am +++ b/app/xev/Makefile.am @@ -39,3 +39,5 @@ ChangeLog: $(CHANGELOG_CMD) dist-hook: ChangeLog INSTALL + +EXTRA_DIST = README.md diff --git a/app/xev/Makefile.in b/app/xev/Makefile.in index bb4061994..7e35dbed3 100644 --- a/app/xev/Makefile.in +++ b/app/xev/Makefile.in @@ -73,7 +73,7 @@ build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = xev$(EXEEXT) subdir = . -DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ +DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/configure COPYING ChangeLog INSTALL NEWS compile \ config.guess config.sub depcomp install-sh missing @@ -314,6 +314,7 @@ xev_SOURCES = \ xev.c MAINTAINERCLEANFILES = ChangeLog INSTALL +EXTRA_DIST = README.md all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive diff --git a/app/xev/README b/app/xev/README.md index 158b3360e..5196700ac 100644 --- a/app/xev/README +++ b/app/xev/README.md @@ -9,23 +9,15 @@ usage. All questions regarding this software should be directed at the Xorg mailing list: - http://lists.freedesktop.org/mailman/listinfo/xorg - -Please submit bug reports to the Xorg bugzilla: - - https://bugs.freedesktop.org/enter_bug.cgi?product=xorg + https://lists.x.org/mailman/listinfo/xorg The master development code repository can be found at: - git://anongit.freedesktop.org/git/xorg/app/xev + https://gitlab.freedesktop.org/xorg/app/xev - http://cgit.freedesktop.org/xorg/app/xev +Please submit bug reports and requests to merge patches there. For patch submission instructions, see: - http://www.x.org/wiki/Development/Documentation/SubmittingPatches - -For more information on the git code manager, see: - - http://wiki.x.org/wiki/GitPage + https://www.x.org/wiki/Development/Documentation/SubmittingPatches diff --git a/app/xev/aclocal.m4 b/app/xev/aclocal.m4 index c0dbcfb1f..2a518c4b6 100644 --- a/app/xev/aclocal.m4 +++ b/app/xev/aclocal.m4 @@ -19,32 +19,63 @@ You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# serial 1 (pkg-config-0.24) -# -# Copyright © 2004 Scott James Remnant <scott@netsplit.com>. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# 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. - -# PKG_PROG_PKG_CONFIG([MIN-VERSION]) -# ---------------------------------- +dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +dnl serial 11 (pkg-config-0.29.1) +dnl +dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>. +dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com> +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a +dnl configuration script generated by Autoconf, you may include it under +dnl the same distribution terms that you use for the rest of that +dnl program. + +dnl PKG_PREREQ(MIN-VERSION) +dnl ----------------------- +dnl Since: 0.29 +dnl +dnl Verify that the version of the pkg-config macros are at least +dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's +dnl installed version of pkg-config, this checks the developer's version +dnl of pkg.m4 when generating configure. +dnl +dnl To ensure that this macro is defined, also add: +dnl m4_ifndef([PKG_PREREQ], +dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) +dnl +dnl See the "Since" comment for each macro you use to see what version +dnl of the macros you require. +m4_defun([PKG_PREREQ], +[m4_define([PKG_MACROS_VERSION], [0.29.1]) +m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, + [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) +])dnl PKG_PREREQ + +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) +dnl ---------------------------------- +dnl Since: 0.16 +dnl +dnl Search for the pkg-config tool and set the PKG_CONFIG variable to +dnl first found in the path. Checks that the version of pkg-config found +dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is +dnl used since that's the first version where most current features of +dnl pkg-config existed. AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) @@ -66,18 +97,19 @@ if test -n "$PKG_CONFIG"; then PKG_CONFIG="" fi fi[]dnl -])# PKG_PROG_PKG_CONFIG +])dnl PKG_PROG_PKG_CONFIG -# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# -# Check to see whether a particular set of modules exists. Similar -# to PKG_CHECK_MODULES(), but does not set variables or print errors. -# -# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -# only at the first occurence in configure.ac, so if the first place -# it's called might be skipped (such as if it is within an "if", you -# have to call PKG_CHECK_EXISTS manually -# -------------------------------------------------------------- +dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------------------------------- +dnl Since: 0.18 +dnl +dnl Check to see whether a particular set of modules exists. Similar to +dnl PKG_CHECK_MODULES(), but does not set variables or print errors. +dnl +dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +dnl only at the first occurence in configure.ac, so if the first place +dnl it's called might be skipped (such as if it is within an "if", you +dnl have to call PKG_CHECK_EXISTS manually AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ @@ -87,8 +119,10 @@ m4_ifvaln([$3], [else $3])dnl fi]) -# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -# --------------------------------------------- +dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +dnl --------------------------------------------- +dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting +dnl pkg_failed based on the result. m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" @@ -100,10 +134,11 @@ m4_define([_PKG_CONFIG], else pkg_failed=untried fi[]dnl -])# _PKG_CONFIG +])dnl _PKG_CONFIG -# _PKG_SHORT_ERRORS_SUPPORTED -# ----------------------------- +dnl _PKG_SHORT_ERRORS_SUPPORTED +dnl --------------------------- +dnl Internal check to see if pkg-config supports short errors. AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -111,19 +146,17 @@ if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then else _pkg_short_errors_supported=no fi[]dnl -])# _PKG_SHORT_ERRORS_SUPPORTED +])dnl _PKG_SHORT_ERRORS_SUPPORTED -# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -# [ACTION-IF-NOT-FOUND]) -# -# -# Note that if there is a possibility the first call to -# PKG_CHECK_MODULES might not happen, you should be sure to include an -# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac -# -# -# -------------------------------------------------------------- +dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl -------------------------------------------------------------- +dnl Since: 0.4.0 +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES might not happen, you should be sure to include an +dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl @@ -177,16 +210,40 @@ else AC_MSG_RESULT([yes]) $3 fi[]dnl -])# PKG_CHECK_MODULES +])dnl PKG_CHECK_MODULES -# PKG_INSTALLDIR(DIRECTORY) -# ------------------------- -# Substitutes the variable pkgconfigdir as the location where a module -# should install pkg-config .pc files. By default the directory is -# $libdir/pkgconfig, but the default can be changed by passing -# DIRECTORY. The user can override through the --with-pkgconfigdir -# parameter. +dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl --------------------------------------------------------------------- +dnl Since: 0.29 +dnl +dnl Checks for existence of MODULES and gathers its build flags with +dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags +dnl and VARIABLE-PREFIX_LIBS from --libs. +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to +dnl include an explicit call to PKG_PROG_PKG_CONFIG in your +dnl configure.ac. +AC_DEFUN([PKG_CHECK_MODULES_STATIC], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +_save_PKG_CONFIG=$PKG_CONFIG +PKG_CONFIG="$PKG_CONFIG --static" +PKG_CHECK_MODULES($@) +PKG_CONFIG=$_save_PKG_CONFIG[]dnl +])dnl PKG_CHECK_MODULES_STATIC + + +dnl PKG_INSTALLDIR([DIRECTORY]) +dnl ------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable pkgconfigdir as the location where a module +dnl should install pkg-config .pc files. By default the directory is +dnl $libdir/pkgconfig, but the default can be changed by passing +dnl DIRECTORY. The user can override through the --with-pkgconfigdir +dnl parameter. AC_DEFUN([PKG_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) m4_pushdef([pkg_description], @@ -197,16 +254,18 @@ AC_ARG_WITH([pkgconfigdir], AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) -]) dnl PKG_INSTALLDIR +])dnl PKG_INSTALLDIR -# PKG_NOARCH_INSTALLDIR(DIRECTORY) -# ------------------------- -# Substitutes the variable noarch_pkgconfigdir as the location where a -# module should install arch-independent pkg-config .pc files. By -# default the directory is $datadir/pkgconfig, but the default can be -# changed by passing DIRECTORY. The user can override through the -# --with-noarch-pkgconfigdir parameter. +dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) +dnl -------------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable noarch_pkgconfigdir as the location where a +dnl module should install arch-independent pkg-config .pc files. By +dnl default the directory is $datadir/pkgconfig, but the default can be +dnl changed by passing DIRECTORY. The user can override through the +dnl --with-noarch-pkgconfigdir parameter. AC_DEFUN([PKG_NOARCH_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) m4_pushdef([pkg_description], @@ -217,7 +276,24 @@ AC_ARG_WITH([noarch-pkgconfigdir], AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) -]) dnl PKG_NOARCH_INSTALLDIR +])dnl PKG_NOARCH_INSTALLDIR + + +dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------- +dnl Since: 0.28 +dnl +dnl Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])dnl PKG_CHECK_VAR # Copyright (C) 2002-2012 Free Software Foundation, Inc. # @@ -1242,7 +1318,7 @@ AC_SUBST([am__untar]) dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure. dnl -dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. +dnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. dnl dnl Permission is hereby granted, free of charge, to any person obtaining a dnl copy of this software and associated documentation files (the "Software"), @@ -1279,7 +1355,7 @@ dnl DEALINGS IN THE SOFTWARE. # See the "minimum version" comment for each macro you use to see what # version you require. m4_defun([XORG_MACROS_VERSION],[ -m4_define([vers_have], [1.19.0]) +m4_define([vers_have], [1.19.2]) m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.]))) m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.]))) m4_if(m4_cmp(maj_have, maj_needed), 0,, @@ -1357,6 +1433,17 @@ AC_DEFUN([XORG_MANPAGE_SECTIONS],[ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_PROG_SED]) +case $host_os in + solaris*) + # Solaris 2.0 - 11.3 use SysV man page section numbers, so we + # check for a man page file found in later versions that use + # traditional section numbers instead + AC_CHECK_FILE([/usr/share/man/man7/attributes.7], + [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true]) + ;; + *) SYSV_MAN_SECTIONS=false ;; +esac + if test x$APP_MAN_SUFFIX = x ; then APP_MAN_SUFFIX=1 fi @@ -1372,9 +1459,9 @@ if test x$LIB_MAN_DIR = x ; then fi if test x$FILE_MAN_SUFFIX = x ; then - case $host_os in - solaris*) FILE_MAN_SUFFIX=4 ;; - *) FILE_MAN_SUFFIX=5 ;; + case $SYSV_MAN_SECTIONS in + true) FILE_MAN_SUFFIX=4 ;; + *) FILE_MAN_SUFFIX=5 ;; esac fi if test x$FILE_MAN_DIR = x ; then @@ -1382,9 +1469,9 @@ if test x$FILE_MAN_DIR = x ; then fi if test x$MISC_MAN_SUFFIX = x ; then - case $host_os in - solaris*) MISC_MAN_SUFFIX=5 ;; - *) MISC_MAN_SUFFIX=7 ;; + case $SYSV_MAN_SECTIONS in + true) MISC_MAN_SUFFIX=5 ;; + *) MISC_MAN_SUFFIX=7 ;; esac fi if test x$MISC_MAN_DIR = x ; then @@ -1392,9 +1479,9 @@ if test x$MISC_MAN_DIR = x ; then fi if test x$DRIVER_MAN_SUFFIX = x ; then - case $host_os in - solaris*) DRIVER_MAN_SUFFIX=7 ;; - *) DRIVER_MAN_SUFFIX=4 ;; + case $SYSV_MAN_SECTIONS in + true) DRIVER_MAN_SUFFIX=7 ;; + *) DRIVER_MAN_SUFFIX=4 ;; esac fi if test x$DRIVER_MAN_DIR = x ; then @@ -1402,9 +1489,9 @@ if test x$DRIVER_MAN_DIR = x ; then fi if test x$ADMIN_MAN_SUFFIX = x ; then - case $host_os in - solaris*) ADMIN_MAN_SUFFIX=1m ;; - *) ADMIN_MAN_SUFFIX=8 ;; + case $SYSV_MAN_SECTIONS in + true) ADMIN_MAN_SUFFIX=1m ;; + *) ADMIN_MAN_SUFFIX=8 ;; esac fi if test x$ADMIN_MAN_DIR = x ; then @@ -1665,13 +1752,24 @@ m4_ifval([$1], fi]) # Test for the ability of xmlto to generate a text target +# +# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the +# following test for empty XML docbook files. +# For compatibility reasons use the following empty XML docbook file and if +# it fails try it again with a non-empty XML file. have_xmlto_text=no cat > conftest.xml << "EOF" EOF AS_IF([test "$have_xmlto" = yes], [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1], [have_xmlto_text=yes], - [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])]) + [# Try it again with a non-empty XML file. + cat > conftest.xml << "EOF" +<x></x> +EOF + AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1], + [have_xmlto_text=yes], + [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])]) rm -f conftest.xml AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes]) AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes]) @@ -3067,8 +3165,9 @@ AC_REQUIRE([PKG_PROG_PKG_CONFIG]) macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros` INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \ mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \ -|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \ -echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)" +|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \ +touch \$(top_srcdir)/INSTALL; \ +echo 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))" AC_SUBST([INSTALL_CMD]) ]) # XORG_INSTALL dnl Copyright 2005 Red Hat, Inc @@ -3129,10 +3228,11 @@ AC_DEFUN([XORG_RELEASE_VERSION],[ # # AC_DEFUN([XORG_CHANGELOG], [ -CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \ +CHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \ mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \ -|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \ -echo 'git directory not found: installing possibly empty changelog.' >&2)" +|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \ +touch \$(top_srcdir)/ChangeLog; \ +echo 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))" AC_SUBST([CHANGELOG_CMD]) ]) # XORG_CHANGELOG diff --git a/app/xev/configure b/app/xev/configure index 6a43bbd8b..fcad72984 100644 --- a/app/xev/configure +++ b/app/xev/configure @@ -1,8 +1,8 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for xev 1.2.2. +# Generated by GNU Autoconf 2.69 for xev 1.2.3. # -# Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>. +# Report bugs to <https://gitlab.freedesktop.org/xorg/app/xev/issues>. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -267,7 +267,7 @@ fi $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and -$0: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg +$0: https://gitlab.freedesktop.org/xorg/app/xev/issues $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do @@ -581,9 +581,9 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='xev' PACKAGE_TARNAME='xev' -PACKAGE_VERSION='1.2.2' -PACKAGE_STRING='xev 1.2.2' -PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg' +PACKAGE_VERSION='1.2.3' +PACKAGE_STRING='xev 1.2.3' +PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/app/xev/issues' PACKAGE_URL='' ac_unique_file="Makefile.am" @@ -1311,7 +1311,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures xev 1.2.2 to adapt to many kinds of systems. +\`configure' configures xev 1.2.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1381,7 +1381,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of xev 1.2.2:";; + short | recursive ) echo "Configuration of xev 1.2.3:";; esac cat <<\_ACEOF @@ -1425,7 +1425,7 @@ Some influential environment variables: Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. -Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>. +Report bugs to <https://gitlab.freedesktop.org/xorg/app/xev/issues>. _ACEOF ac_status=$? fi @@ -1488,7 +1488,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -xev configure 1.2.2 +xev configure 1.2.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1647,9 +1647,9 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## ---------------------------------------------------------------------- ## -## Report this to https://bugs.freedesktop.org/enter_bug.cgi?product=xorg ## -## ---------------------------------------------------------------------- ##" +( $as_echo "## ----------------------------------------------------------------- ## +## Report this to https://gitlab.freedesktop.org/xorg/app/xev/issues ## +## ----------------------------------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac @@ -1836,7 +1836,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by xev $as_me 1.2.2, which was +It was created by xev $as_me 1.2.3, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3976,7 +3976,7 @@ fi # Define the identity of the package. PACKAGE='xev' - VERSION='1.2.2' + VERSION='1.2.3' cat >>confdefs.h <<_ACEOF @@ -10370,10 +10370,11 @@ _ACEOF -CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \ +CHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \ mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \ -|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \ -echo 'git directory not found: installing possibly empty changelog.' >&2)" +|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \ +touch \$(top_srcdir)/ChangeLog; \ +echo 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))" @@ -10381,14 +10382,45 @@ echo 'git directory not found: installing possibly empty changelog.' >&2)" macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros` INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \ mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \ -|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \ -echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)" +|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \ +touch \$(top_srcdir)/INSTALL; \ +echo 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))" +case $host_os in + solaris*) + # Solaris 2.0 - 11.3 use SysV man page section numbers, so we + # check for a man page file found in later versions that use + # traditional section numbers instead + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /usr/share/man/man7/attributes.7" >&5 +$as_echo_n "checking for /usr/share/man/man7/attributes.7... " >&6; } +if ${ac_cv_file__usr_share_man_man7_attributes_7+:} false; then : + $as_echo_n "(cached) " >&6 +else + test "$cross_compiling" = yes && + as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 +if test -r "/usr/share/man/man7/attributes.7"; then + ac_cv_file__usr_share_man_man7_attributes_7=yes +else + ac_cv_file__usr_share_man_man7_attributes_7=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__usr_share_man_man7_attributes_7" >&5 +$as_echo "$ac_cv_file__usr_share_man_man7_attributes_7" >&6; } +if test "x$ac_cv_file__usr_share_man_man7_attributes_7" = xyes; then : + SYSV_MAN_SECTIONS=false +else + SYSV_MAN_SECTIONS=true +fi + + ;; + *) SYSV_MAN_SECTIONS=false ;; +esac + if test x$APP_MAN_SUFFIX = x ; then APP_MAN_SUFFIX=1 fi @@ -10404,9 +10436,9 @@ if test x$LIB_MAN_DIR = x ; then fi if test x$FILE_MAN_SUFFIX = x ; then - case $host_os in - solaris*) FILE_MAN_SUFFIX=4 ;; - *) FILE_MAN_SUFFIX=5 ;; + case $SYSV_MAN_SECTIONS in + true) FILE_MAN_SUFFIX=4 ;; + *) FILE_MAN_SUFFIX=5 ;; esac fi if test x$FILE_MAN_DIR = x ; then @@ -10414,9 +10446,9 @@ if test x$FILE_MAN_DIR = x ; then fi if test x$MISC_MAN_SUFFIX = x ; then - case $host_os in - solaris*) MISC_MAN_SUFFIX=5 ;; - *) MISC_MAN_SUFFIX=7 ;; + case $SYSV_MAN_SECTIONS in + true) MISC_MAN_SUFFIX=5 ;; + *) MISC_MAN_SUFFIX=7 ;; esac fi if test x$MISC_MAN_DIR = x ; then @@ -10424,9 +10456,9 @@ if test x$MISC_MAN_DIR = x ; then fi if test x$DRIVER_MAN_SUFFIX = x ; then - case $host_os in - solaris*) DRIVER_MAN_SUFFIX=7 ;; - *) DRIVER_MAN_SUFFIX=4 ;; + case $SYSV_MAN_SECTIONS in + true) DRIVER_MAN_SUFFIX=7 ;; + *) DRIVER_MAN_SUFFIX=4 ;; esac fi if test x$DRIVER_MAN_DIR = x ; then @@ -10434,9 +10466,9 @@ if test x$DRIVER_MAN_DIR = x ; then fi if test x$ADMIN_MAN_SUFFIX = x ; then - case $host_os in - solaris*) ADMIN_MAN_SUFFIX=1m ;; - *) ADMIN_MAN_SUFFIX=8 ;; + case $SYSV_MAN_SECTIONS in + true) ADMIN_MAN_SUFFIX=1m ;; + *) ADMIN_MAN_SUFFIX=8 ;; esac fi if test x$ADMIN_MAN_DIR = x ; then @@ -11145,7 +11177,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by xev $as_me 1.2.2, which was +This file was extended by xev $as_me 1.2.3, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11205,13 +11237,13 @@ $config_headers Configuration commands: $config_commands -Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>." +Report bugs to <https://gitlab.freedesktop.org/xorg/app/xev/issues>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -xev config.status 1.2.2 +xev config.status 1.2.3 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/app/xev/configure.ac b/app/xev/configure.ac index a41ad7378..6adaa43be 100644 --- a/app/xev/configure.ac +++ b/app/xev/configure.ac @@ -22,8 +22,8 @@ dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT([xev], [1.2.2], - [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xev]) +AC_INIT([xev], [1.2.3], + [https://gitlab.freedesktop.org/xorg/app/xev/issues], [xev]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) AC_USE_SYSTEM_EXTENSIONS diff --git a/app/xev/xev.c b/app/xev/xev.c index 6cde09a82..4c6115fdb 100644 --- a/app/xev/xev.c +++ b/app/xev/xev.c @@ -84,19 +84,19 @@ enum EventMaskIndex { NUM_EVENT_MASKS }; -static void usage (const char *errmsg) _X_NORETURN; +static void usage(const char *errmsg) _X_NORETURN; static void -prologue (XEvent *eventp, const char *event_name) +prologue(XEvent *eventp, const char *event_name) { XAnyEvent *e = (XAnyEvent *) eventp; - printf ("\n%s event, serial %ld, synthetic %s, window 0x%lx,\n", - event_name, e->serial, e->send_event ? Yes : No, e->window); + printf("\n%s event, serial %ld, synthetic %s, window 0x%lx,\n", + event_name, e->serial, e->send_event ? Yes : No, e->window); } static void -dump (char *str, int len) +dump(char *str, int len) { printf("("); len--; @@ -106,7 +106,7 @@ dump (char *str, int len) } static void -do_KeyPress (XEvent *eventp) +do_KeyPress(XEvent *eventp) { XKeyEvent *e = (XKeyEvent *) eventp; KeySym ks; @@ -114,592 +114,752 @@ do_KeyPress (XEvent *eventp) Bool kc_set = False; const char *ksname; int nbytes, nmbbytes = 0; - char str[256+1]; + char str[256 + 1]; static char *buf = NULL; static int bsize = 8; Status status; if (buf == NULL) - buf = malloc (bsize); + buf = malloc(bsize); - nbytes = XLookupString (e, str, 256, &ks, NULL); + nbytes = XLookupString(e, str, 256, &ks, NULL); /* not supposed to call XmbLookupString on a key release event */ if (e->type == KeyPress && xic) { do { - nmbbytes = XmbLookupString (xic, e, buf, bsize - 1, &ks, &status); + nmbbytes = XmbLookupString(xic, e, buf, bsize - 1, &ks, &status); buf[nmbbytes] = '\0'; if (status == XBufferOverflow) { bsize = nmbbytes + 1; - buf = realloc (buf, bsize); + buf = realloc(buf, bsize); } } while (status == XBufferOverflow); } if (ks == NoSymbol) - ksname = "NoSymbol"; + ksname = "NoSymbol"; else { - if (!(ksname = XKeysymToString (ks))) - ksname = "(no name)"; - kc = XKeysymToKeycode(dpy, ks); - kc_set = True; + if (!(ksname = XKeysymToString(ks))) + ksname = "(no name)"; + kc = XKeysymToKeycode(dpy, ks); + kc_set = True; } - printf (" root 0x%lx, subw 0x%lx, time %lu, (%d,%d), root:(%d,%d),\n", - e->root, e->subwindow, e->time, e->x, e->y, e->x_root, e->y_root); - printf (" state 0x%x, keycode %u (keysym 0x%lx, %s), same_screen %s,\n", - e->state, e->keycode, (unsigned long) ks, ksname, - e->same_screen ? Yes : No); + printf(" root 0x%lx, subw 0x%lx, time %lu, (%d,%d), root:(%d,%d),\n", + e->root, e->subwindow, e->time, e->x, e->y, e->x_root, e->y_root); + printf(" state 0x%x, keycode %u (keysym 0x%lx, %s), same_screen %s,\n", + e->state, e->keycode, (unsigned long) ks, ksname, + e->same_screen ? Yes : No); if (kc_set && e->keycode != kc) - printf (" XKeysymToKeycode returns keycode: %u\n",kc); - if (nbytes < 0) nbytes = 0; - if (nbytes > 256) nbytes = 256; + printf(" XKeysymToKeycode returns keycode: %u\n", kc); + if (nbytes < 0) + nbytes = 0; + if (nbytes > 256) + nbytes = 256; str[nbytes] = '\0'; - printf (" XLookupString gives %d bytes: ", nbytes); + printf(" XLookupString gives %d bytes: ", nbytes); if (nbytes > 0) { - dump (str, nbytes); - printf (" \"%s\"\n", str); - } else { - printf ("\n"); + dump(str, nbytes); + printf(" \"%s\"\n", str); + } + else { + printf("\n"); } /* not supposed to call XmbLookupString on a key release event */ if (e->type == KeyPress && xic) { - printf (" XmbLookupString gives %d bytes: ", nmbbytes); + printf(" XmbLookupString gives %d bytes: ", nmbbytes); if (nmbbytes > 0) { - dump (buf, nmbbytes); - printf (" \"%s\"\n", buf); - } else { - printf ("\n"); + dump(buf, nmbbytes); + printf(" \"%s\"\n", buf); + } + else { + printf("\n"); } } - printf (" XFilterEvent returns: %s\n", - XFilterEvent (eventp, e->window) ? "True" : "False"); + printf(" XFilterEvent returns: %s\n", + XFilterEvent(eventp, e->window) ? "True" : "False"); } static void -do_KeyRelease (XEvent *eventp) +do_KeyRelease(XEvent *eventp) { - do_KeyPress (eventp); /* since it has the same info */ + do_KeyPress(eventp); /* since it has the same info */ } static void -do_ButtonPress (XEvent *eventp) +do_ButtonPress(XEvent *eventp) { XButtonEvent *e = (XButtonEvent *) eventp; - printf (" root 0x%lx, subw 0x%lx, time %lu, (%d,%d), root:(%d,%d),\n", - e->root, e->subwindow, e->time, e->x, e->y, e->x_root, e->y_root); - printf (" state 0x%x, button %u, same_screen %s\n", - e->state, e->button, e->same_screen ? Yes : No); + printf(" root 0x%lx, subw 0x%lx, time %lu, (%d,%d), root:(%d,%d),\n", + e->root, e->subwindow, e->time, e->x, e->y, e->x_root, e->y_root); + printf(" state 0x%x, button %u, same_screen %s\n", + e->state, e->button, e->same_screen ? Yes : No); } static void -do_ButtonRelease (XEvent *eventp) +do_ButtonRelease(XEvent *eventp) { - do_ButtonPress (eventp); /* since it has the same info */ + do_ButtonPress(eventp); /* since it has the same info */ } static void -do_MotionNotify (XEvent *eventp) +do_MotionNotify(XEvent *eventp) { XMotionEvent *e = (XMotionEvent *) eventp; - printf (" root 0x%lx, subw 0x%lx, time %lu, (%d,%d), root:(%d,%d),\n", - e->root, e->subwindow, e->time, e->x, e->y, e->x_root, e->y_root); - printf (" state 0x%x, is_hint %u, same_screen %s\n", - e->state, e->is_hint, e->same_screen ? Yes : No); + printf(" root 0x%lx, subw 0x%lx, time %lu, (%d,%d), root:(%d,%d),\n", + e->root, e->subwindow, e->time, e->x, e->y, e->x_root, e->y_root); + printf(" state 0x%x, is_hint %u, same_screen %s\n", + e->state, e->is_hint, e->same_screen ? Yes : No); } static void -do_EnterNotify (XEvent *eventp) +do_EnterNotify(XEvent *eventp) { XCrossingEvent *e = (XCrossingEvent *) eventp; const char *mode, *detail; char dmode[10], ddetail[10]; switch (e->mode) { - case NotifyNormal: mode = "NotifyNormal"; break; - case NotifyGrab: mode = "NotifyGrab"; break; - case NotifyUngrab: mode = "NotifyUngrab"; break; - case NotifyWhileGrabbed: mode = "NotifyWhileGrabbed"; break; - default: mode = dmode, sprintf (dmode, "%u", e->mode); break; + case NotifyNormal: + mode = "NotifyNormal"; + break; + case NotifyGrab: + mode = "NotifyGrab"; + break; + case NotifyUngrab: + mode = "NotifyUngrab"; + break; + case NotifyWhileGrabbed: + mode = "NotifyWhileGrabbed"; + break; + default: + mode = dmode; + snprintf(dmode, sizeof(dmode), "%u", e->mode); + break; } switch (e->detail) { - case NotifyAncestor: detail = "NotifyAncestor"; break; - case NotifyVirtual: detail = "NotifyVirtual"; break; - case NotifyInferior: detail = "NotifyInferior"; break; - case NotifyNonlinear: detail = "NotifyNonlinear"; break; - case NotifyNonlinearVirtual: detail = "NotifyNonlinearVirtual"; break; - case NotifyPointer: detail = "NotifyPointer"; break; - case NotifyPointerRoot: detail = "NotifyPointerRoot"; break; - case NotifyDetailNone: detail = "NotifyDetailNone"; break; - default: detail = ddetail; sprintf (ddetail, "%u", e->detail); break; + case NotifyAncestor: + detail = "NotifyAncestor"; + break; + case NotifyVirtual: + detail = "NotifyVirtual"; + break; + case NotifyInferior: + detail = "NotifyInferior"; + break; + case NotifyNonlinear: + detail = "NotifyNonlinear"; + break; + case NotifyNonlinearVirtual: + detail = "NotifyNonlinearVirtual"; + break; + case NotifyPointer: + detail = "NotifyPointer"; + break; + case NotifyPointerRoot: + detail = "NotifyPointerRoot"; + break; + case NotifyDetailNone: + detail = "NotifyDetailNone"; + break; + default: + detail = ddetail; + snprintf(ddetail, sizeof(ddetail), "%u", e->detail); + break; } - printf (" root 0x%lx, subw 0x%lx, time %lu, (%d,%d), root:(%d,%d),\n", - e->root, e->subwindow, e->time, e->x, e->y, e->x_root, e->y_root); - printf (" mode %s, detail %s, same_screen %s,\n", - mode, detail, e->same_screen ? Yes : No); - printf (" focus %s, state %u\n", e->focus ? Yes : No, e->state); + printf(" root 0x%lx, subw 0x%lx, time %lu, (%d,%d), root:(%d,%d),\n", + e->root, e->subwindow, e->time, e->x, e->y, e->x_root, e->y_root); + printf(" mode %s, detail %s, same_screen %s,\n", + mode, detail, e->same_screen ? Yes : No); + printf(" focus %s, state %u\n", e->focus ? Yes : No, e->state); } static void -do_LeaveNotify (XEvent *eventp) +do_LeaveNotify(XEvent *eventp) { - do_EnterNotify (eventp); /* since it has same information */ + do_EnterNotify(eventp); /* since it has same information */ } static void -do_FocusIn (XEvent *eventp) +do_FocusIn(XEvent *eventp) { XFocusChangeEvent *e = (XFocusChangeEvent *) eventp; const char *mode, *detail; char dmode[10], ddetail[10]; switch (e->mode) { - case NotifyNormal: mode = "NotifyNormal"; break; - case NotifyGrab: mode = "NotifyGrab"; break; - case NotifyUngrab: mode = "NotifyUngrab"; break; - case NotifyWhileGrabbed: mode = "NotifyWhileGrabbed"; break; - default: mode = dmode, sprintf (dmode, "%u", e->mode); break; + case NotifyNormal: + mode = "NotifyNormal"; + break; + case NotifyGrab: + mode = "NotifyGrab"; + break; + case NotifyUngrab: + mode = "NotifyUngrab"; + break; + case NotifyWhileGrabbed: + mode = "NotifyWhileGrabbed"; + break; + default: + mode = dmode; + snprintf(dmode, sizeof(dmode), "%u", e->mode); + break; } switch (e->detail) { - case NotifyAncestor: detail = "NotifyAncestor"; break; - case NotifyVirtual: detail = "NotifyVirtual"; break; - case NotifyInferior: detail = "NotifyInferior"; break; - case NotifyNonlinear: detail = "NotifyNonlinear"; break; - case NotifyNonlinearVirtual: detail = "NotifyNonlinearVirtual"; break; - case NotifyPointer: detail = "NotifyPointer"; break; - case NotifyPointerRoot: detail = "NotifyPointerRoot"; break; - case NotifyDetailNone: detail = "NotifyDetailNone"; break; - default: detail = ddetail; sprintf (ddetail, "%u", e->detail); break; + case NotifyAncestor: + detail = "NotifyAncestor"; + break; + case NotifyVirtual: + detail = "NotifyVirtual"; + break; + case NotifyInferior: + detail = "NotifyInferior"; + break; + case NotifyNonlinear: + detail = "NotifyNonlinear"; + break; + case NotifyNonlinearVirtual: + detail = "NotifyNonlinearVirtual"; + break; + case NotifyPointer: + detail = "NotifyPointer"; + break; + case NotifyPointerRoot: + detail = "NotifyPointerRoot"; + break; + case NotifyDetailNone: + detail = "NotifyDetailNone"; + break; + default: + detail = ddetail; + snprintf(ddetail, sizeof(ddetail), "%u", e->detail); + break; } - printf (" mode %s, detail %s\n", mode, detail); + printf(" mode %s, detail %s\n", mode, detail); } static void -do_FocusOut (XEvent *eventp) +do_FocusOut(XEvent *eventp) { - do_FocusIn (eventp); /* since it has same information */ + do_FocusIn(eventp); /* since it has same information */ } static void -do_KeymapNotify (XEvent *eventp) +do_KeymapNotify(XEvent *eventp) { XKeymapEvent *e = (XKeymapEvent *) eventp; int i; - printf (" keys: "); + printf(" keys: "); for (i = 0; i < 32; i++) { - if (i == 16) printf ("\n "); - printf ("%-3u ", (unsigned int) e->key_vector[i]); + if (i == 16) + printf("\n "); + printf("%-3u ", (unsigned int) e->key_vector[i]); } - printf ("\n"); + printf("\n"); } static void -do_Expose (XEvent *eventp) +do_Expose(XEvent *eventp) { XExposeEvent *e = (XExposeEvent *) eventp; - printf (" (%d,%d), width %d, height %d, count %d\n", - e->x, e->y, e->width, e->height, e->count); + printf(" (%d,%d), width %d, height %d, count %d\n", + e->x, e->y, e->width, e->height, e->count); } static void -do_GraphicsExpose (XEvent *eventp) +do_GraphicsExpose(XEvent *eventp) { XGraphicsExposeEvent *e = (XGraphicsExposeEvent *) eventp; const char *m; char mdummy[10]; switch (e->major_code) { - case X_CopyArea: m = "CopyArea"; break; - case X_CopyPlane: m = "CopyPlane"; break; - default: m = mdummy; sprintf (mdummy, "%d", e->major_code); break; + case X_CopyArea: + m = "CopyArea"; + break; + case X_CopyPlane: + m = "CopyPlane"; + break; + default: + m = mdummy; + snprintf(mdummy, sizeof(mdummy), "%d", e->major_code); + break; } - printf (" (%d,%d), width %d, height %d, count %d,\n", - e->x, e->y, e->width, e->height, e->count); - printf (" major %s, minor %d\n", m, e->minor_code); + printf(" (%d,%d), width %d, height %d, count %d,\n", + e->x, e->y, e->width, e->height, e->count); + printf(" major %s, minor %d\n", m, e->minor_code); } static void -do_NoExpose (XEvent *eventp) +do_NoExpose(XEvent *eventp) { XNoExposeEvent *e = (XNoExposeEvent *) eventp; const char *m; char mdummy[10]; switch (e->major_code) { - case X_CopyArea: m = "CopyArea"; break; - case X_CopyPlane: m = "CopyPlane"; break; - default: m = mdummy; sprintf (mdummy, "%d", e->major_code); break; + case X_CopyArea: + m = "CopyArea"; + break; + case X_CopyPlane: + m = "CopyPlane"; + break; + default: + m = mdummy; + snprintf(mdummy, sizeof(mdummy), "%d", e->major_code); + break; } - printf (" major %s, minor %d\n", m, e->minor_code); + printf(" major %s, minor %d\n", m, e->minor_code); return; } static void -do_VisibilityNotify (XEvent *eventp) +do_VisibilityNotify(XEvent *eventp) { XVisibilityEvent *e = (XVisibilityEvent *) eventp; const char *v; char vdummy[10]; switch (e->state) { - case VisibilityUnobscured: v = "VisibilityUnobscured"; break; - case VisibilityPartiallyObscured: v = "VisibilityPartiallyObscured"; break; - case VisibilityFullyObscured: v = "VisibilityFullyObscured"; break; - default: v = vdummy; sprintf (vdummy, "%d", e->state); break; + case VisibilityUnobscured: + v = "VisibilityUnobscured"; + break; + case VisibilityPartiallyObscured: + v = "VisibilityPartiallyObscured"; + break; + case VisibilityFullyObscured: + v = "VisibilityFullyObscured"; + break; + default: + v = vdummy; + snprintf(vdummy, sizeof(vdummy), "%d", e->state); + break; } - printf (" state %s\n", v); + printf(" state %s\n", v); } static void -do_CreateNotify (XEvent *eventp) +do_CreateNotify(XEvent *eventp) { XCreateWindowEvent *e = (XCreateWindowEvent *) eventp; - printf (" parent 0x%lx, window 0x%lx, (%d,%d), width %d, height %d\n", - e->parent, e->window, e->x, e->y, e->width, e->height); - printf ("border_width %d, override %s\n", - e->border_width, e->override_redirect ? Yes : No); + printf(" parent 0x%lx, window 0x%lx, (%d,%d), width %d, height %d\n", + e->parent, e->window, e->x, e->y, e->width, e->height); + printf("border_width %d, override %s\n", + e->border_width, e->override_redirect ? Yes : No); } static void -do_DestroyNotify (XEvent *eventp) +do_DestroyNotify(XEvent *eventp) { XDestroyWindowEvent *e = (XDestroyWindowEvent *) eventp; - printf (" event 0x%lx, window 0x%lx\n", e->event, e->window); + printf(" event 0x%lx, window 0x%lx\n", e->event, e->window); } static void -do_UnmapNotify (XEvent *eventp) +do_UnmapNotify(XEvent *eventp) { XUnmapEvent *e = (XUnmapEvent *) eventp; - printf (" event 0x%lx, window 0x%lx, from_configure %s\n", - e->event, e->window, e->from_configure ? Yes : No); + printf(" event 0x%lx, window 0x%lx, from_configure %s\n", + e->event, e->window, e->from_configure ? Yes : No); } static void -do_MapNotify (XEvent *eventp) +do_MapNotify(XEvent *eventp) { XMapEvent *e = (XMapEvent *) eventp; - printf (" event 0x%lx, window 0x%lx, override %s\n", - e->event, e->window, e->override_redirect ? Yes : No); + printf(" event 0x%lx, window 0x%lx, override %s\n", + e->event, e->window, e->override_redirect ? Yes : No); } static void -do_MapRequest (XEvent *eventp) +do_MapRequest(XEvent *eventp) { XMapRequestEvent *e = (XMapRequestEvent *) eventp; - printf (" parent 0x%lx, window 0x%lx\n", e->parent, e->window); + printf(" parent 0x%lx, window 0x%lx\n", e->parent, e->window); } static void -do_ReparentNotify (XEvent *eventp) +do_ReparentNotify(XEvent *eventp) { XReparentEvent *e = (XReparentEvent *) eventp; - printf (" event 0x%lx, window 0x%lx, parent 0x%lx,\n", - e->event, e->window, e->parent); - printf (" (%d,%d), override %s\n", e->x, e->y, - e->override_redirect ? Yes : No); + printf(" event 0x%lx, window 0x%lx, parent 0x%lx,\n", + e->event, e->window, e->parent); + printf(" (%d,%d), override %s\n", e->x, e->y, + e->override_redirect ? Yes : No); } static void -do_ConfigureNotify (XEvent *eventp) +do_ConfigureNotify(XEvent *eventp) { XConfigureEvent *e = (XConfigureEvent *) eventp; - printf (" event 0x%lx, window 0x%lx, (%d,%d), width %d, height %d,\n", - e->event, e->window, e->x, e->y, e->width, e->height); - printf (" border_width %d, above 0x%lx, override %s\n", - e->border_width, e->above, e->override_redirect ? Yes : No); + printf(" event 0x%lx, window 0x%lx, (%d,%d), width %d, height %d,\n", + e->event, e->window, e->x, e->y, e->width, e->height); + printf(" border_width %d, above 0x%lx, override %s\n", + e->border_width, e->above, e->override_redirect ? Yes : No); } static void -do_ConfigureRequest (XEvent *eventp) +do_ConfigureRequest(XEvent *eventp) { XConfigureRequestEvent *e = (XConfigureRequestEvent *) eventp; const char *detail; char ddummy[10]; switch (e->detail) { - case Above: detail = "Above"; break; - case Below: detail = "Below"; break; - case TopIf: detail = "TopIf"; break; - case BottomIf: detail = "BottomIf"; break; - case Opposite: detail = "Opposite"; break; - default: detail = ddummy; sprintf (ddummy, "%d", e->detail); break; + case Above: + detail = "Above"; + break; + case Below: + detail = "Below"; + break; + case TopIf: + detail = "TopIf"; + break; + case BottomIf: + detail = "BottomIf"; + break; + case Opposite: + detail = "Opposite"; + break; + default: + detail = ddummy; + snprintf(ddummy, sizeof(ddummy), "%d", e->detail); + break; } - printf (" parent 0x%lx, window 0x%lx, (%d,%d), width %d, height %d,\n", - e->parent, e->window, e->x, e->y, e->width, e->height); - printf (" border_width %d, above 0x%lx, detail %s, value 0x%lx\n", - e->border_width, e->above, detail, e->value_mask); + printf(" parent 0x%lx, window 0x%lx, (%d,%d), width %d, height %d,\n", + e->parent, e->window, e->x, e->y, e->width, e->height); + printf(" border_width %d, above 0x%lx, detail %s, value 0x%lx\n", + e->border_width, e->above, detail, e->value_mask); } static void -do_GravityNotify (XEvent *eventp) +do_GravityNotify(XEvent *eventp) { XGravityEvent *e = (XGravityEvent *) eventp; - printf (" event 0x%lx, window 0x%lx, (%d,%d)\n", - e->event, e->window, e->x, e->y); + printf(" event 0x%lx, window 0x%lx, (%d,%d)\n", + e->event, e->window, e->x, e->y); } static void -do_ResizeRequest (XEvent *eventp) +do_ResizeRequest(XEvent *eventp) { XResizeRequestEvent *e = (XResizeRequestEvent *) eventp; - printf (" width %d, height %d\n", e->width, e->height); + printf(" width %d, height %d\n", e->width, e->height); } static void -do_CirculateNotify (XEvent *eventp) +do_CirculateNotify(XEvent *eventp) { XCirculateEvent *e = (XCirculateEvent *) eventp; const char *p; char pdummy[10]; switch (e->place) { - case PlaceOnTop: p = "PlaceOnTop"; break; - case PlaceOnBottom: p = "PlaceOnBottom"; break; - default: p = pdummy; sprintf (pdummy, "%d", e->place); break; + case PlaceOnTop: + p = "PlaceOnTop"; + break; + case PlaceOnBottom: + p = "PlaceOnBottom"; + break; + default: + p = pdummy; + snprintf(pdummy, sizeof(pdummy), "%d", e->place); + break; } - printf (" event 0x%lx, window 0x%lx, place %s\n", - e->event, e->window, p); + printf(" event 0x%lx, window 0x%lx, place %s\n", e->event, e->window, p); } static void -do_CirculateRequest (XEvent *eventp) +do_CirculateRequest(XEvent *eventp) { XCirculateRequestEvent *e = (XCirculateRequestEvent *) eventp; const char *p; char pdummy[10]; switch (e->place) { - case PlaceOnTop: p = "PlaceOnTop"; break; - case PlaceOnBottom: p = "PlaceOnBottom"; break; - default: p = pdummy; sprintf (pdummy, "%d", e->place); break; + case PlaceOnTop: + p = "PlaceOnTop"; + break; + case PlaceOnBottom: + p = "PlaceOnBottom"; + break; + default: + p = pdummy; + snprintf(pdummy, sizeof(pdummy), "%d", e->place); + break; } - printf (" parent 0x%lx, window 0x%lx, place %s\n", - e->parent, e->window, p); + printf(" parent 0x%lx, window 0x%lx, place %s\n", + e->parent, e->window, p); } static void -do_PropertyNotify (XEvent *eventp) +do_PropertyNotify(XEvent *eventp) { XPropertyEvent *e = (XPropertyEvent *) eventp; - char *aname = XGetAtomName (dpy, e->atom); + char *aname = XGetAtomName(dpy, e->atom); const char *s; char sdummy[10]; switch (e->state) { - case PropertyNewValue: s = "PropertyNewValue"; break; - case PropertyDelete: s = "PropertyDelete"; break; - default: s = sdummy; sprintf (sdummy, "%d", e->state); break; + case PropertyNewValue: + s = "PropertyNewValue"; + break; + case PropertyDelete: + s = "PropertyDelete"; + break; + default: + s = sdummy; + snprintf(sdummy, sizeof(sdummy), "%d", e->state); + break; } - printf (" atom 0x%lx (%s), time %lu, state %s\n", - e->atom, aname ? aname : Unknown, e->time, s); + printf(" atom 0x%lx (%s), time %lu, state %s\n", + e->atom, aname ? aname : Unknown, e->time, s); - XFree (aname); + XFree(aname); } static void -do_SelectionClear (XEvent *eventp) +do_SelectionClear(XEvent *eventp) { XSelectionClearEvent *e = (XSelectionClearEvent *) eventp; - char *sname = XGetAtomName (dpy, e->selection); + char *sname = XGetAtomName(dpy, e->selection); - printf (" selection 0x%lx (%s), time %lu\n", - e->selection, sname ? sname : Unknown, e->time); + printf(" selection 0x%lx (%s), time %lu\n", + e->selection, sname ? sname : Unknown, e->time); - XFree (sname); + XFree(sname); } static void -do_SelectionRequest (XEvent *eventp) +do_SelectionRequest(XEvent *eventp) { XSelectionRequestEvent *e = (XSelectionRequestEvent *) eventp; - char *sname = XGetAtomName (dpy, e->selection); - char *tname = XGetAtomName (dpy, e->target); - char *pname = XGetAtomName (dpy, e->property); - - printf (" owner 0x%lx, requestor 0x%lx, selection 0x%lx (%s),\n", - e->owner, e->requestor, e->selection, sname ? sname : Unknown); - printf (" target 0x%lx (%s), property 0x%lx (%s), time %lu\n", - e->target, tname ? tname : Unknown, e->property, - pname ? pname : Unknown, e->time); - - XFree (sname); - XFree (tname); - XFree (pname); + char *sname = XGetAtomName(dpy, e->selection); + char *tname = XGetAtomName(dpy, e->target); + char *pname = XGetAtomName(dpy, e->property); + + printf(" owner 0x%lx, requestor 0x%lx, selection 0x%lx (%s),\n", + e->owner, e->requestor, e->selection, sname ? sname : Unknown); + printf(" target 0x%lx (%s), property 0x%lx (%s), time %lu\n", + e->target, tname ? tname : Unknown, e->property, + pname ? pname : Unknown, e->time); + + XFree(sname); + XFree(tname); + XFree(pname); } static void -do_SelectionNotify (XEvent *eventp) +do_SelectionNotify(XEvent *eventp) { XSelectionEvent *e = (XSelectionEvent *) eventp; - char *sname = XGetAtomName (dpy, e->selection); - char *tname = XGetAtomName (dpy, e->target); - char *pname = XGetAtomName (dpy, e->property); - - printf (" selection 0x%lx (%s), target 0x%lx (%s),\n", - e->selection, sname ? sname : Unknown, e->target, - tname ? tname : Unknown); - printf (" property 0x%lx (%s), time %lu\n", - e->property, pname ? pname : Unknown, e->time); - - XFree (sname); - XFree (tname); - XFree (pname); + char *sname = XGetAtomName(dpy, e->selection); + char *tname = XGetAtomName(dpy, e->target); + char *pname = XGetAtomName(dpy, e->property); + + printf(" selection 0x%lx (%s), target 0x%lx (%s),\n", + e->selection, sname ? sname : Unknown, e->target, + tname ? tname : Unknown); + printf(" property 0x%lx (%s), time %lu\n", + e->property, pname ? pname : Unknown, e->time); + + XFree(sname); + XFree(tname); + XFree(pname); } static void -do_ColormapNotify (XEvent *eventp) +do_ColormapNotify(XEvent *eventp) { XColormapEvent *e = (XColormapEvent *) eventp; const char *s; char sdummy[10]; switch (e->state) { - case ColormapInstalled: s = "ColormapInstalled"; break; - case ColormapUninstalled: s = "ColormapUninstalled"; break; - default: s = sdummy; sprintf (sdummy, "%d", e->state); break; + case ColormapInstalled: + s = "ColormapInstalled"; + break; + case ColormapUninstalled: + s = "ColormapUninstalled"; + break; + default: + s = sdummy; + snprintf(sdummy, sizeof(sdummy), "%d", e->state); + break; } - printf (" colormap 0x%lx, new %s, state %s\n", - e->colormap, e->new ? Yes : No, s); + printf(" colormap 0x%lx, new %s, state %s\n", + e->colormap, e->new ? Yes : No, s); } static void -do_ClientMessage (XEvent *eventp) +do_ClientMessage(XEvent *eventp) { XClientMessageEvent *e = (XClientMessageEvent *) eventp; - char *mname = XGetAtomName (dpy, e->message_type); + + char *mname = XGetAtomName(dpy, e->message_type); if (e->message_type == wm_protocols) { - char *message = XGetAtomName (dpy, e->data.l[0]); - printf (" message_type 0x%lx (%s), format %d, message 0x%lx (%s)\n", - e->message_type, mname ? mname : Unknown, e->format, e->data.l[0], message); - XFree (message); + char *message = XGetAtomName(dpy, e->data.l[0]); + + printf(" message_type 0x%lx (%s), format %d, message 0x%lx (%s)\n", + e->message_type, mname ? mname : Unknown, e->format, + e->data.l[0], message); + XFree(message); } else { - printf (" message_type 0x%lx (%s), format %d\n", - e->message_type, mname ? mname : Unknown, e->format); + printf(" message_type 0x%lx (%s), format %d\n", + e->message_type, mname ? mname : Unknown, e->format); } - XFree (mname); + XFree(mname); if (e->format == 32 && e->message_type == wm_protocols && (Atom) e->data.l[0] == wm_delete_window) - exit (0); + exit(0); } static void -do_MappingNotify (XEvent *eventp) +do_MappingNotify(XEvent *eventp) { XMappingEvent *e = (XMappingEvent *) eventp; const char *r; char rdummy[10]; switch (e->request) { - case MappingModifier: r = "MappingModifier"; break; - case MappingKeyboard: r = "MappingKeyboard"; break; - case MappingPointer: r = "MappingPointer"; break; - default: r = rdummy; sprintf (rdummy, "%d", e->request); break; + case MappingModifier: + r = "MappingModifier"; + break; + case MappingKeyboard: + r = "MappingKeyboard"; + break; + case MappingPointer: + r = "MappingPointer"; + break; + default: + r = rdummy; + snprintf(rdummy, sizeof(rdummy), "%d", e->request); + break; } - printf (" request %s, first_keycode %d, count %d\n", - r, e->first_keycode, e->count); + printf(" request %s, first_keycode %d, count %d\n", + r, e->first_keycode, e->count); XRefreshKeyboardMapping(e); } static void -print_SubPixelOrder (SubpixelOrder subpixel_order) +print_SubPixelOrder(SubpixelOrder subpixel_order) { switch (subpixel_order) { - case SubPixelUnknown: printf ("SubPixelUnknown"); return; - case SubPixelHorizontalRGB: printf ("SubPixelHorizontalRGB"); return; - case SubPixelHorizontalBGR: printf ("SubPixelHorizontalBGR"); return; - case SubPixelVerticalRGB: printf ("SubPixelVerticalRGB"); return; - case SubPixelVerticalBGR: printf ("SubPixelVerticalBGR"); return; - case SubPixelNone: printf ("SubPixelNone"); return; - default: printf ("%d", subpixel_order); + case SubPixelUnknown: + printf("SubPixelUnknown"); + return; + case SubPixelHorizontalRGB: + printf("SubPixelHorizontalRGB"); + return; + case SubPixelHorizontalBGR: + printf("SubPixelHorizontalBGR"); + return; + case SubPixelVerticalRGB: + printf("SubPixelVerticalRGB"); + return; + case SubPixelVerticalBGR: + printf("SubPixelVerticalBGR"); + return; + case SubPixelNone: + printf("SubPixelNone"); + return; + default: + printf("%d", subpixel_order); } } static void -print_Rotation (Rotation rotation) +print_Rotation(Rotation rotation) { if (rotation & RR_Rotate_0) - printf ("RR_Rotate_0"); + printf("RR_Rotate_0"); else if (rotation & RR_Rotate_90) - printf ("RR_Rotate_90"); + printf("RR_Rotate_90"); else if (rotation & RR_Rotate_180) - printf ("RR_Rotate_180"); + printf("RR_Rotate_180"); else if (rotation & RR_Rotate_270) - printf ("RR_Rotate_270"); + printf("RR_Rotate_270"); else { - printf ("%d", rotation); + printf("%d", rotation); return; } if (rotation & RR_Reflect_X) - printf (", RR_Reflect_X"); + printf(", RR_Reflect_X"); if (rotation & RR_Reflect_Y) - printf (", RR_Reflect_Y"); + printf(", RR_Reflect_Y"); } static void -print_Connection (Connection connection) +print_Connection(Connection connection) { switch (connection) { - case RR_Connected: printf ("RR_Connected"); return; - case RR_Disconnected: printf ("RR_Disconnected"); return; - case RR_UnknownConnection: printf ("RR_UnknownConnection"); return; - default: printf ("%d", connection); + case RR_Connected: + printf("RR_Connected"); + return; + case RR_Disconnected: + printf("RR_Disconnected"); + return; + case RR_UnknownConnection: + printf("RR_UnknownConnection"); + return; + default: + printf("%d", connection); } } static void -do_RRScreenChangeNotify (XEvent *eventp) +do_RRScreenChangeNotify(XEvent *eventp) { XRRScreenChangeNotifyEvent *e = (XRRScreenChangeNotifyEvent *) eventp; - XRRUpdateConfiguration (eventp); - printf (" root 0x%lx, timestamp %lu, config_timestamp %lu\n", - e->root, e->timestamp, e->config_timestamp); - printf (" size_index %hu", e->size_index); - printf (", subpixel_order "); - print_SubPixelOrder (e->subpixel_order); - printf ("\n rotation "); - print_Rotation (e->rotation); + XRRUpdateConfiguration(eventp); + printf(" root 0x%lx, timestamp %lu, config_timestamp %lu\n", + e->root, e->timestamp, e->config_timestamp); + printf(" size_index %hu", e->size_index); + printf(", subpixel_order "); + print_SubPixelOrder(e->subpixel_order); + printf("\n rotation "); + print_Rotation(e->rotation); printf("\n width %d, height %d, mwidth %d, mheight %d\n", e->width, e->height, e->mwidth, e->mheight); } static void -do_RRNotify_OutputChange (XEvent *eventp, XRRScreenResources *screen_resources) +do_RRNotify_OutputChange(XEvent *eventp, XRRScreenResources *screen_resources) { XRROutputChangeNotifyEvent *e = (XRROutputChangeNotifyEvent *) eventp; XRROutputInfo *output_info = NULL; @@ -708,40 +868,41 @@ do_RRNotify_OutputChange (XEvent *eventp, XRRScreenResources *screen_resources) if (screen_resources) { int i; - output_info = XRRGetOutputInfo (dpy, screen_resources, e->output); + output_info = XRRGetOutputInfo(dpy, screen_resources, e->output); for (i = 0; i < screen_resources->nmode; i++) if (screen_resources->modes[i].id == e->mode) { - mode_info = &screen_resources->modes[i]; break; + mode_info = &screen_resources->modes[i]; + break; } } - printf (" subtype XRROutputChangeNotifyEvent\n"); + printf(" subtype XRROutputChangeNotifyEvent\n"); if (output_info) - printf (" output %s, ", output_info->name); + printf(" output %s, ", output_info->name); else - printf (" output %lu, ", e->output); + printf(" output %lu, ", e->output); if (e->crtc) printf("crtc %lu, ", e->crtc); else printf("crtc None, "); if (mode_info) - printf ("mode %s (%dx%d)\n", mode_info->name, mode_info->width, - mode_info->height); + printf("mode %s (%dx%d)\n", mode_info->name, mode_info->width, + mode_info->height); else if (e->mode) - printf ("mode %lu\n", e->mode); + printf("mode %lu\n", e->mode); else printf("mode None\n"); - printf (" rotation "); - print_Rotation (e->rotation); - printf ("\n connection "); - print_Connection (e->connection); - printf (", subpixel_order "); - print_SubPixelOrder (e->subpixel_order); - printf ("\n"); - XRRFreeOutputInfo (output_info); + printf(" rotation "); + print_Rotation(e->rotation); + printf("\n connection "); + print_Connection(e->connection); + printf(", subpixel_order "); + print_SubPixelOrder(e->subpixel_order); + printf("\n"); + XRRFreeOutputInfo(output_info); } static void -do_RRNotify_CrtcChange (XEvent *eventp, XRRScreenResources *screen_resources) +do_RRNotify_CrtcChange(XEvent *eventp, XRRScreenResources *screen_resources) { XRRCrtcChangeNotifyEvent *e = (XRRCrtcChangeNotifyEvent *) eventp; XRRModeInfo *mode_info = NULL; @@ -751,81 +912,81 @@ do_RRNotify_CrtcChange (XEvent *eventp, XRRScreenResources *screen_resources) for (i = 0; i < screen_resources->nmode; i++) if (screen_resources->modes[i].id == e->mode) { - mode_info = &screen_resources->modes[i]; break; + mode_info = &screen_resources->modes[i]; + break; } } - printf (" subtype XRRCrtcChangeNotifyEvent\n"); + printf(" subtype XRRCrtcChangeNotifyEvent\n"); if (e->crtc) printf(" crtc %lu, ", e->crtc); else printf(" crtc None, "); if (mode_info) - printf ("mode %s, ", mode_info->name); + printf("mode %s, ", mode_info->name); else if (e->mode) - printf ("mode %lu, ", e->mode); + printf("mode %lu, ", e->mode); else printf("mode None, "); - printf ("rotation "); - print_Rotation (e->rotation); - printf ("\n x %d, y %d, width %d, height %d\n", - e->x, e->y, e->width, e->height); + printf("rotation "); + print_Rotation(e->rotation); + printf("\n x %d, y %d, width %d, height %d\n", + e->x, e->y, e->width, e->height); } static void -do_RRNotify_OutputProperty (XEvent *eventp, - XRRScreenResources *screen_resources) +do_RRNotify_OutputProperty(XEvent *eventp, + XRRScreenResources *screen_resources) { XRROutputPropertyNotifyEvent *e = (XRROutputPropertyNotifyEvent *) eventp; XRROutputInfo *output_info = NULL; - char *property = XGetAtomName (dpy, e->property); + char *property = XGetAtomName(dpy, e->property); if (screen_resources) - output_info = XRRGetOutputInfo (dpy, screen_resources, e->output); - printf (" subtype XRROutputPropertyChangeNotifyEvent\n"); + output_info = XRRGetOutputInfo(dpy, screen_resources, e->output); + printf(" subtype XRROutputPropertyChangeNotifyEvent\n"); if (output_info) - printf (" output %s, ", output_info->name); + printf(" output %s, ", output_info->name); else - printf (" output %lu, ", e->output); - printf ("property %s, timestamp %lu, state ", - property, e->timestamp); + printf(" output %lu, ", e->output); + printf("property %s, timestamp %lu, state ", property, e->timestamp); if (e->state == PropertyNewValue) - printf ("NewValue\n"); + printf("NewValue\n"); else if (e->state == PropertyDelete) - printf ("Delete\n"); + printf("Delete\n"); else - printf ("%d\n", e->state); - XRRFreeOutputInfo (output_info); - XFree (property); + printf("%d\n", e->state); + XRRFreeOutputInfo(output_info); + XFree(property); } static void -do_RRNotify (XEvent *eventp) +do_RRNotify(XEvent *eventp) { XRRNotifyEvent *e = (XRRNotifyEvent *) eventp; XRRScreenResources *screen_resources; - XRRUpdateConfiguration (eventp); - screen_resources = XRRGetScreenResources (dpy, e->window); - prologue (eventp, "RRNotify"); + XRRUpdateConfiguration(eventp); + screen_resources = XRRGetScreenResources(dpy, e->window); + prologue(eventp, "RRNotify"); switch (e->subtype) { - case RRNotify_OutputChange: - do_RRNotify_OutputChange (eventp, screen_resources); break; - case RRNotify_CrtcChange: - do_RRNotify_CrtcChange (eventp, screen_resources); break; - case RRNotify_OutputProperty: - do_RRNotify_OutputProperty (eventp, screen_resources); break; - default: - printf (" subtype %d\n", e->subtype); + case RRNotify_OutputChange: + do_RRNotify_OutputChange(eventp, screen_resources); + break; + case RRNotify_CrtcChange: + do_RRNotify_CrtcChange(eventp, screen_resources); + break; + case RRNotify_OutputProperty: + do_RRNotify_OutputProperty(eventp, screen_resources); + break; + default: + printf(" subtype %d\n", e->subtype); } - XRRFreeScreenResources (screen_resources); + XRRFreeScreenResources(screen_resources); } - - static void -set_sizehints (XSizeHints *hintp, int min_width, int min_height, - int defwidth, int defheight, int defx, int defy, - char *geom) +set_sizehints(XSizeHints *hintp, int min_width, int min_height, + int defwidth, int defheight, int defx, int defy, char *geom) { int geom_result; @@ -837,25 +998,25 @@ set_sizehints (XSizeHints *hintp, int min_width, int min_height, hintp->x = hintp->y = 0; geom_result = NoValue; if (geom != NULL) { - geom_result = XParseGeometry (geom, &hintp->x, &hintp->y, - (unsigned int *)&hintp->width, - (unsigned int *)&hintp->height); - if ((geom_result & WidthValue) && (geom_result & HeightValue)) { + geom_result = XParseGeometry(geom, &hintp->x, &hintp->y, + (unsigned int *) &hintp->width, + (unsigned int *) &hintp->height); + if ((geom_result & WidthValue) && (geom_result & HeightValue)) { #ifndef max #define max(a,b) ((a) > (b) ? (a) : (b)) #endif - hintp->width = max (hintp->width, hintp->min_width); - hintp->height = max (hintp->height, hintp->min_height); - hintp->flags |= USSize; - } - if ((geom_result & XValue) && (geom_result & YValue)) { - hintp->flags += USPosition; - } + hintp->width = max(hintp->width, hintp->min_width); + hintp->height = max(hintp->height, hintp->min_height); + hintp->flags |= USSize; + } + if ((geom_result & XValue) && (geom_result & YValue)) { + hintp->flags += USPosition; + } } if (!(hintp->flags & USSize)) { - hintp->width = defwidth; - hintp->height = defheight; - hintp->flags |= PSize; + hintp->width = defwidth; + hintp->height = defheight; + hintp->flags |= PSize; } /* if (!(hintp->flags & USPosition)) { @@ -865,66 +1026,65 @@ set_sizehints (XSizeHints *hintp, int min_width, int min_height, } */ if (geom_result & XNegative) { - hintp->x = DisplayWidth (dpy, DefaultScreen (dpy)) + hintp->x - - hintp->width; + hintp->x = DisplayWidth(dpy, DefaultScreen(dpy)) + hintp->x - + hintp->width; } if (geom_result & YNegative) { - hintp->y = DisplayHeight (dpy, DefaultScreen (dpy)) + hintp->y - - hintp->height; + hintp->y = DisplayHeight(dpy, DefaultScreen(dpy)) + hintp->y - + hintp->height; } } static void -usage (const char *errmsg) +usage(const char *errmsg) { - static const char *msg[] = { -" -display displayname X server to contact", -" -geometry geom size and location of window", -" -bw pixels border width in pixels", -" -bs {NotUseful,WhenMapped,Always} backingstore attribute", -" -id windowid use existing window", -" -root use root window", -" -s set save-unders attribute", -" -name string window name", -" -rv reverse video", -" -event event_mask select 'event_mask' events", -" Supported event masks: keyboard mouse expose visibility structure", -" substructure focus property colormap", -" owner_grab_button randr button", -" This option can be specified multiple times to select multiple", -" event masks.", -"", -NULL}; - const char **cpp; + const char *msg = +" -display displayname X server to contact\n" +" -geometry geom size and location of window\n" +" -bw pixels border width in pixels\n" +" -bs {NotUseful,WhenMapped,Always} backingstore attribute\n" +" -id windowid use existing window\n" +" -root use root window\n" +" -s set save-unders attribute\n" +" -name string window name\n" +" -rv reverse video\n" +" -event event_mask select 'event_mask' events\n" +" Supported event masks: keyboard mouse expose visibility structure\n" +" substructure focus property colormap\n" +" owner_grab_button randr button\n" +" This option can be specified multiple times to select multiple\n" +" event masks.\n" +" -version print version and exit\n" +"\n"; if (errmsg != NULL) - fprintf (stderr, "%s: %s\n", ProgramName, errmsg); + fprintf(stderr, "%s: %s\n", ProgramName, errmsg); - fprintf (stderr, "usage: %s [-options ...]\n", ProgramName); - fprintf (stderr, "where options include:\n"); + fprintf(stderr, "usage: %s [-options ...]\n", ProgramName); + fprintf(stderr, "where options include:\n"); + fputs(msg, stderr); - for (cpp = msg; *cpp; cpp++) - fprintf (stderr, "%s\n", *cpp); - - exit (1); + exit(1); } static int -parse_backing_store (const char *s) +parse_backing_store(const char *s) { - size_t len = strlen (s); + size_t len = strlen(s); - if (strncasecmp (s, "NotUseful", len) == 0) return (NotUseful); - if (strncasecmp (s, "WhenMapped", len) == 0) return (WhenMapped); - if (strncasecmp (s, "Always", len) == 0) return (Always); + if (strncasecmp(s, "NotUseful", len) == 0) + return (NotUseful); + if (strncasecmp(s, "WhenMapped", len) == 0) + return (WhenMapped); + if (strncasecmp(s, "Always", len) == 0) + return (Always); - fprintf (stderr, "%s: unrecognized argument '%s' for -bs\n", - ProgramName, s); - usage (NULL); + fprintf(stderr, "%s: unrecognized argument '%s' for -bs\n", ProgramName, s); + usage(NULL); } static Bool -parse_event_mask (const char *s, long event_masks[]) +parse_event_mask(const char *s, long event_masks[]) { const struct { const char *name; @@ -940,7 +1100,7 @@ parse_event_mask (const char *s, long event_masks[]) LeaveWindowMask | PointerMotionMask | Button1MotionMask | Button2MotionMask | Button3MotionMask | Button4MotionMask | Button5MotionMask | ButtonMotionMask }, - { "button", + { "button", EVENT_MASK_INDEX_CORE, ButtonPressMask | ButtonReleaseMask }, { "expose", @@ -984,13 +1144,13 @@ parse_event_mask (const char *s, long event_masks[]) } if (s != NULL) - fprintf (stderr, "%s: unrecognized event mask '%s'\n", ProgramName, s); + fprintf(stderr, "%s: unrecognized event mask '%s'\n", ProgramName, s); return False; } int -main (int argc, char **argv) +main(int argc, char **argv) { char *displayname = NULL; char *geom = NULL; @@ -1016,124 +1176,133 @@ main (int argc, char **argv) ProgramName = argv[0]; - if (setlocale(LC_ALL,"") == NULL) { - fprintf(stderr, "%s: warning: could not set default locale\n", - ProgramName); + if (setlocale(LC_ALL, "") == NULL) { + fprintf(stderr, "%s: warning: could not set default locale\n", + ProgramName); } memset(event_masks, 0, sizeof(event_masks)); w = 0; for (i = 1; i < argc; i++) { - char *arg = argv[i]; - - if (arg[0] == '-') { - switch (arg[1]) { - case 'd': /* -display host:dpy */ - if (++i >= argc) usage ("-display requires an argument"); - displayname = argv[i]; - continue; - case 'g': /* -geometry geom */ - if (++i >= argc) usage ("-geometry requires an argument"); - geom = argv[i]; - continue; - case 'b': - switch (arg[2]) { - case 'w': /* -bw pixels */ - if (++i >= argc) usage ("-bw requires an argument"); - borderwidth = atoi (argv[i]); - continue; - case 's': /* -bs type */ - if (++i >= argc) usage ("-bs requires an argument"); - attr.backing_store = parse_backing_store (argv[i]); - mask |= CWBackingStore; - continue; - default: - goto unrecognized; - } - case 'i': /* -id */ - if (++i >= argc) usage ("-id requires an argument"); - sscanf(argv[i], "0x%lx", &w); - if (!w) - sscanf(argv[i], "%lu", &w); - if (!w) { - fprintf (stderr, - "%s: unable to parse argument '%s' for -id\n", - ProgramName, argv[i]); - usage (NULL); - } - continue; - case 'n': /* -name */ - if (++i >= argc) usage ("-name requires an argument"); - name = argv[i]; - continue; - case 'r': - switch (arg[2]) { - case 'o': /* -root */ - use_root = True; - continue; - case 'v': /* -rv */ - reverse = True; - continue; - default: - goto unrecognized; - } - continue; - case 's': /* -s */ - attr.save_under = True; - mask |= CWSaveUnder; - continue; - case 'e': /* -event */ - if (++i >= argc) usage ("-event requires an argument"); - if (!parse_event_mask (argv[i], event_masks)) - usage (NULL); - event_mask_specified = True; - continue; - case 'v': - puts(PACKAGE_STRING); - exit(0); - default: - goto unrecognized; - } /* end switch on - */ - } else { - unrecognized: - fprintf (stderr, "%s: unrecognized argument '%s'\n", - ProgramName, arg); - usage (NULL); - } - } /* end for over argc */ + char *arg = argv[i]; + + if (arg[0] == '-') { + switch (arg[1]) { + case 'd': /* -display host:dpy */ + if (++i >= argc) + usage("-display requires an argument"); + displayname = argv[i]; + continue; + case 'g': /* -geometry geom */ + if (++i >= argc) + usage("-geometry requires an argument"); + geom = argv[i]; + continue; + case 'b': + switch (arg[2]) { + case 'w': /* -bw pixels */ + if (++i >= argc) + usage("-bw requires an argument"); + borderwidth = atoi(argv[i]); + continue; + case 's': /* -bs type */ + if (++i >= argc) + usage("-bs requires an argument"); + attr.backing_store = parse_backing_store(argv[i]); + mask |= CWBackingStore; + continue; + default: + goto unrecognized; + } + case 'i': /* -id */ + if (++i >= argc) + usage("-id requires an argument"); + sscanf(argv[i], "0x%lx", &w); + if (!w) + sscanf(argv[i], "%lu", &w); + if (!w) { + fprintf(stderr, + "%s: unable to parse argument '%s' for -id\n", + ProgramName, argv[i]); + usage(NULL); + } + continue; + case 'n': /* -name */ + if (++i >= argc) + usage("-name requires an argument"); + name = argv[i]; + continue; + case 'r': + switch (arg[2]) { + case 'o': /* -root */ + use_root = True; + continue; + case 'v': /* -rv */ + reverse = True; + continue; + default: + goto unrecognized; + } + continue; + case 's': /* -s */ + attr.save_under = True; + mask |= CWSaveUnder; + continue; + case 'e': /* -event */ + if (++i >= argc) + usage("-event requires an argument"); + if (!parse_event_mask(argv[i], event_masks)) + usage(NULL); + event_mask_specified = True; + continue; + case 'v': + puts(PACKAGE_STRING); + exit(0); + default: + goto unrecognized; + } /* end switch on - */ + } + else { + unrecognized: + fprintf(stderr, "%s: unrecognized argument '%s'\n", + ProgramName, arg); + usage(NULL); + } + } /* end for over argc */ /* if no -event options were specified, pretend all of them were */ if (!event_mask_specified) - parse_event_mask (NULL, event_masks); + parse_event_mask(NULL, event_masks); - dpy = XOpenDisplay (displayname); + dpy = XOpenDisplay(displayname); if (!dpy) { - fprintf (stderr, "%s: unable to open display '%s'\n", - ProgramName, XDisplayName (displayname)); - exit (1); + fprintf(stderr, "%s: unable to open display '%s'\n", + ProgramName, XDisplayName(displayname)); + exit(1); } /* we're testing the default input method */ - modifiers = XSetLocaleModifiers ("@im=none"); + modifiers = XSetLocaleModifiers("@im=none"); if (modifiers == NULL) { - fprintf (stderr, "%s: XSetLocaleModifiers failed\n", ProgramName); + fprintf(stderr, "%s: XSetLocaleModifiers failed\n", ProgramName); } - xim = XOpenIM (dpy, NULL, NULL, NULL); + xim = XOpenIM(dpy, NULL, NULL, NULL); if (xim == NULL) { - fprintf (stderr, "%s: XOpenIM failed\n", ProgramName); + fprintf(stderr, "%s: XOpenIM failed\n", ProgramName); } if (xim) { - imvalret = XGetIMValues (xim, XNQueryInputStyle, &xim_styles, NULL); + imvalret = XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL); if (imvalret != NULL || xim_styles == NULL) { - fprintf (stderr, "%s: input method doesn't support any styles\n", ProgramName); + fprintf(stderr, "%s: input method doesn't support any styles\n", + ProgramName); } if (xim_styles) { xim_style = 0; - for (i = 0; i < xim_styles->count_styles; i++) { + for (i = 0; i < xim_styles->count_styles; i++) { if (xim_styles->supported_styles[i] == (XIMPreeditNothing | XIMStatusNothing)) { xim_style = xim_styles->supported_styles[i]; @@ -1142,83 +1311,83 @@ main (int argc, char **argv) } if (xim_style == 0) { - fprintf (stderr, "%s: input method doesn't support the style we support\n", - ProgramName); + fprintf(stderr, + "%s: input method doesn't support the style we support\n", + ProgramName); } - XFree (xim_styles); + XFree(xim_styles); } } - screen = DefaultScreen (dpy); + screen = DefaultScreen(dpy); attr.event_mask = event_masks[EVENT_MASK_INDEX_CORE]; if (use_root) - w = RootWindow(dpy, screen); + w = RootWindow(dpy, screen); if (w) { - XGetWindowAttributes(dpy, w, &wattr); - if (wattr.all_event_masks & ButtonPressMask) - attr.event_mask &= ~ButtonPressMask; - attr.event_mask &= ~SubstructureRedirectMask; - XSelectInput(dpy, w, attr.event_mask); - } else { - set_sizehints (&hints, OUTER_WINDOW_MIN_WIDTH, OUTER_WINDOW_MIN_HEIGHT, - OUTER_WINDOW_DEF_WIDTH, OUTER_WINDOW_DEF_HEIGHT, - OUTER_WINDOW_DEF_X, OUTER_WINDOW_DEF_Y, geom); - - if (reverse) { - back = BlackPixel(dpy,screen); - fore = WhitePixel(dpy,screen); - } else { - back = WhitePixel(dpy,screen); - fore = BlackPixel(dpy,screen); - } - - attr.background_pixel = back; - attr.border_pixel = fore; - mask |= (CWBackPixel | CWBorderPixel | CWEventMask); - - w = XCreateWindow (dpy, RootWindow (dpy, screen), hints.x, hints.y, - hints.width, hints.height, borderwidth, 0, - InputOutput, (Visual *)CopyFromParent, - mask, &attr); - - XSetStandardProperties (dpy, w, name, NULL, (Pixmap) 0, - argv, argc, &hints); - - subw = XCreateSimpleWindow (dpy, w, INNER_WINDOW_X, INNER_WINDOW_Y, - INNER_WINDOW_WIDTH, INNER_WINDOW_HEIGHT, - INNER_WINDOW_BORDER, - attr.border_pixel, attr.background_pixel); + XGetWindowAttributes(dpy, w, &wattr); + if (wattr.all_event_masks & ButtonPressMask) + attr.event_mask &= ~ButtonPressMask; + attr.event_mask &= ~SubstructureRedirectMask; + XSelectInput(dpy, w, attr.event_mask); + } + else { + set_sizehints(&hints, OUTER_WINDOW_MIN_WIDTH, OUTER_WINDOW_MIN_HEIGHT, + OUTER_WINDOW_DEF_WIDTH, OUTER_WINDOW_DEF_HEIGHT, + OUTER_WINDOW_DEF_X, OUTER_WINDOW_DEF_Y, geom); + + if (reverse) { + back = BlackPixel(dpy, screen); + fore = WhitePixel(dpy, screen); + } + else { + back = WhitePixel(dpy, screen); + fore = BlackPixel(dpy, screen); + } + + attr.background_pixel = back; + attr.border_pixel = fore; + mask |= (CWBackPixel | CWBorderPixel | CWEventMask); + + w = XCreateWindow(dpy, RootWindow(dpy, screen), hints.x, hints.y, + hints.width, hints.height, borderwidth, 0, + InputOutput, (Visual *) CopyFromParent, mask, &attr); + + XSetStandardProperties(dpy, w, name, NULL, (Pixmap) 0, + argv, argc, &hints); + + subw = XCreateSimpleWindow(dpy, w, INNER_WINDOW_X, INNER_WINDOW_Y, + INNER_WINDOW_WIDTH, INNER_WINDOW_HEIGHT, + INNER_WINDOW_BORDER, + attr.border_pixel, attr.background_pixel); wm_protocols = XInternAtom(dpy, "WM_PROTOCOLS", False); wm_delete_window = XInternAtom(dpy, "WM_DELETE_WINDOW", False); XSetWMProtocols(dpy, w, &wm_delete_window, 1); - XMapWindow (dpy, subw); /* map before w so that it appears */ - XMapWindow (dpy, w); + XMapWindow(dpy, subw); /* map before w so that it appears */ + XMapWindow(dpy, w); - printf ("Outer window is 0x%lx, inner window is 0x%lx\n", w, subw); + printf("Outer window is 0x%lx, inner window is 0x%lx\n", w, subw); } if (xim && xim_style) { - xic = XCreateIC (xim, - XNInputStyle, xim_style, - XNClientWindow, w, - XNFocusWindow, w, - NULL); + xic = XCreateIC(xim, + XNInputStyle, xim_style, + XNClientWindow, w, XNFocusWindow, w, NULL); if (xic == NULL) { - fprintf (stderr, "XCreateIC failed\n"); + fprintf(stderr, "XCreateIC failed\n"); } } - have_rr = XRRQueryExtension (dpy, &rr_event_base, &rr_error_base); + have_rr = XRRQueryExtension(dpy, &rr_event_base, &rr_error_base); if (have_rr) { int rr_major, rr_minor; - if (XRRQueryVersion (dpy, &rr_major, &rr_minor)) { + if (XRRQueryVersion(dpy, &rr_major, &rr_minor)) { int rr_mask = event_masks[EVENT_MASK_INDEX_RANDR]; if (rr_major == 1 && rr_minor <= 1) { @@ -1227,166 +1396,166 @@ main (int argc, char **argv) RROutputPropertyNotifyMask); } - XRRSelectInput (dpy, w, rr_mask); + XRRSelectInput(dpy, w, rr_mask); } } - for (done = 0; !done; ) { - XEvent event; - - XNextEvent (dpy, &event); - - switch (event.type) { - case KeyPress: - prologue (&event, "KeyPress"); - do_KeyPress (&event); - break; - case KeyRelease: - prologue (&event, "KeyRelease"); - do_KeyRelease (&event); - break; - case ButtonPress: - prologue (&event, "ButtonPress"); - do_ButtonPress (&event); - break; - case ButtonRelease: - prologue (&event, "ButtonRelease"); - do_ButtonRelease (&event); - break; - case MotionNotify: - prologue (&event, "MotionNotify"); - do_MotionNotify (&event); - break; - case EnterNotify: - prologue (&event, "EnterNotify"); - do_EnterNotify (&event); - break; - case LeaveNotify: - prologue (&event, "LeaveNotify"); - do_LeaveNotify (&event); - break; - case FocusIn: - prologue (&event, "FocusIn"); - do_FocusIn (&event); - break; - case FocusOut: - prologue (&event, "FocusOut"); - do_FocusOut (&event); - break; - case KeymapNotify: - prologue (&event, "KeymapNotify"); - do_KeymapNotify (&event); - break; - case Expose: - prologue (&event, "Expose"); - do_Expose (&event); - break; - case GraphicsExpose: - prologue (&event, "GraphicsExpose"); - do_GraphicsExpose (&event); - break; - case NoExpose: - prologue (&event, "NoExpose"); - do_NoExpose (&event); - break; - case VisibilityNotify: - prologue (&event, "VisibilityNotify"); - do_VisibilityNotify (&event); - break; - case CreateNotify: - prologue (&event, "CreateNotify"); - do_CreateNotify (&event); - break; - case DestroyNotify: - prologue (&event, "DestroyNotify"); - do_DestroyNotify (&event); - break; - case UnmapNotify: - prologue (&event, "UnmapNotify"); - do_UnmapNotify (&event); - break; - case MapNotify: - prologue (&event, "MapNotify"); - do_MapNotify (&event); - break; - case MapRequest: - prologue (&event, "MapRequest"); - do_MapRequest (&event); - break; - case ReparentNotify: - prologue (&event, "ReparentNotify"); - do_ReparentNotify (&event); - break; - case ConfigureNotify: - prologue (&event, "ConfigureNotify"); - do_ConfigureNotify (&event); - break; - case ConfigureRequest: - prologue (&event, "ConfigureRequest"); - do_ConfigureRequest (&event); - break; - case GravityNotify: - prologue (&event, "GravityNotify"); - do_GravityNotify (&event); - break; - case ResizeRequest: - prologue (&event, "ResizeRequest"); - do_ResizeRequest (&event); - break; - case CirculateNotify: - prologue (&event, "CirculateNotify"); - do_CirculateNotify (&event); - break; - case CirculateRequest: - prologue (&event, "CirculateRequest"); - do_CirculateRequest (&event); - break; - case PropertyNotify: - prologue (&event, "PropertyNotify"); - do_PropertyNotify (&event); - break; - case SelectionClear: - prologue (&event, "SelectionClear"); - do_SelectionClear (&event); - break; - case SelectionRequest: - prologue (&event, "SelectionRequest"); - do_SelectionRequest (&event); - break; - case SelectionNotify: - prologue (&event, "SelectionNotify"); - do_SelectionNotify (&event); - break; - case ColormapNotify: - prologue (&event, "ColormapNotify"); - do_ColormapNotify (&event); - break; - case ClientMessage: - prologue (&event, "ClientMessage"); - do_ClientMessage (&event); - break; - case MappingNotify: - prologue (&event, "MappingNotify"); - do_MappingNotify (&event); - break; - default: - if (have_rr) { - if (event.type == rr_event_base + RRScreenChangeNotify) { - prologue (&event, "RRScreenChangeNotify"); - do_RRScreenChangeNotify (&event); - break; - } - if (event.type == rr_event_base + RRNotify) { - do_RRNotify (&event); - break; - } - } - printf ("Unknown event type %d\n", event.type); - break; - } - fflush(stdout); + for (done = 0; !done;) { + XEvent event; + + XNextEvent(dpy, &event); + + switch (event.type) { + case KeyPress: + prologue(&event, "KeyPress"); + do_KeyPress(&event); + break; + case KeyRelease: + prologue(&event, "KeyRelease"); + do_KeyRelease(&event); + break; + case ButtonPress: + prologue(&event, "ButtonPress"); + do_ButtonPress(&event); + break; + case ButtonRelease: + prologue(&event, "ButtonRelease"); + do_ButtonRelease(&event); + break; + case MotionNotify: + prologue(&event, "MotionNotify"); + do_MotionNotify(&event); + break; + case EnterNotify: + prologue(&event, "EnterNotify"); + do_EnterNotify(&event); + break; + case LeaveNotify: + prologue(&event, "LeaveNotify"); + do_LeaveNotify(&event); + break; + case FocusIn: + prologue(&event, "FocusIn"); + do_FocusIn(&event); + break; + case FocusOut: + prologue(&event, "FocusOut"); + do_FocusOut(&event); + break; + case KeymapNotify: + prologue(&event, "KeymapNotify"); + do_KeymapNotify(&event); + break; + case Expose: + prologue(&event, "Expose"); + do_Expose(&event); + break; + case GraphicsExpose: + prologue(&event, "GraphicsExpose"); + do_GraphicsExpose(&event); + break; + case NoExpose: + prologue(&event, "NoExpose"); + do_NoExpose(&event); + break; + case VisibilityNotify: + prologue(&event, "VisibilityNotify"); + do_VisibilityNotify(&event); + break; + case CreateNotify: + prologue(&event, "CreateNotify"); + do_CreateNotify(&event); + break; + case DestroyNotify: + prologue(&event, "DestroyNotify"); + do_DestroyNotify(&event); + break; + case UnmapNotify: + prologue(&event, "UnmapNotify"); + do_UnmapNotify(&event); + break; + case MapNotify: + prologue(&event, "MapNotify"); + do_MapNotify(&event); + break; + case MapRequest: + prologue(&event, "MapRequest"); + do_MapRequest(&event); + break; + case ReparentNotify: + prologue(&event, "ReparentNotify"); + do_ReparentNotify(&event); + break; + case ConfigureNotify: + prologue(&event, "ConfigureNotify"); + do_ConfigureNotify(&event); + break; + case ConfigureRequest: + prologue(&event, "ConfigureRequest"); + do_ConfigureRequest(&event); + break; + case GravityNotify: + prologue(&event, "GravityNotify"); + do_GravityNotify(&event); + break; + case ResizeRequest: + prologue(&event, "ResizeRequest"); + do_ResizeRequest(&event); + break; + case CirculateNotify: + prologue(&event, "CirculateNotify"); + do_CirculateNotify(&event); + break; + case CirculateRequest: + prologue(&event, "CirculateRequest"); + do_CirculateRequest(&event); + break; + case PropertyNotify: + prologue(&event, "PropertyNotify"); + do_PropertyNotify(&event); + break; + case SelectionClear: + prologue(&event, "SelectionClear"); + do_SelectionClear(&event); + break; + case SelectionRequest: + prologue(&event, "SelectionRequest"); + do_SelectionRequest(&event); + break; + case SelectionNotify: + prologue(&event, "SelectionNotify"); + do_SelectionNotify(&event); + break; + case ColormapNotify: + prologue(&event, "ColormapNotify"); + do_ColormapNotify(&event); + break; + case ClientMessage: + prologue(&event, "ClientMessage"); + do_ClientMessage(&event); + break; + case MappingNotify: + prologue(&event, "MappingNotify"); + do_MappingNotify(&event); + break; + default: + if (have_rr) { + if (event.type == rr_event_base + RRScreenChangeNotify) { + prologue(&event, "RRScreenChangeNotify"); + do_RRScreenChangeNotify(&event); + break; + } + if (event.type == rr_event_base + RRNotify) { + do_RRNotify(&event); + break; + } + } + printf("Unknown event type %d\n", event.type); + break; + } + fflush(stdout); } - XCloseDisplay (dpy); + XCloseDisplay(dpy); return 0; } |