summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2010-11-25 21:55:10 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2010-11-25 21:55:10 +0000
commit5673405fda589b3fa44c760f6a7ad2da4736ac14 (patch)
tree96bae00132299d9f39ca723f3bd45b3bca499418 /app
parent7a133c3f48de4e64026aae06c02760ffe9f7908a (diff)
Update to xwininfo 1.1.1. rewritten to use XCB.
Diffstat (limited to 'app')
-rw-r--r--app/xwininfo/COPYING23
-rw-r--r--app/xwininfo/ChangeLog486
-rw-r--r--app/xwininfo/INSTALL143
-rw-r--r--app/xwininfo/Makefile.am33
-rw-r--r--app/xwininfo/Makefile.bsd-wrapper4
-rw-r--r--app/xwininfo/Makefile.in59
-rw-r--r--app/xwininfo/aclocal.m4841
-rw-r--r--app/xwininfo/clientwin.c178
-rw-r--r--app/xwininfo/clientwin.h6
-rw-r--r--app/xwininfo/config.h.in42
-rw-r--r--app/xwininfo/configure1169
-rw-r--r--app/xwininfo/configure.ac48
-rw-r--r--app/xwininfo/dsimple.c761
-rw-r--r--app/xwininfo/dsimple.h64
-rw-r--r--app/xwininfo/strnlen.c37
-rw-r--r--app/xwininfo/strnlen.h32
-rw-r--r--app/xwininfo/xwininfo.c2399
-rw-r--r--app/xwininfo/xwininfo.man2
18 files changed, 4623 insertions, 1704 deletions
diff --git a/app/xwininfo/COPYING b/app/xwininfo/COPYING
index e5c45f609..687540f0a 100644
--- a/app/xwininfo/COPYING
+++ b/app/xwininfo/COPYING
@@ -1,5 +1,26 @@
+Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+
Copyright 1987, 1993, 1998 The Open Group
-Copyright 1999 Sun Microsystems, Inc.
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
diff --git a/app/xwininfo/ChangeLog b/app/xwininfo/ChangeLog
index 13e7a3c85..6ac85ee29 100644
--- a/app/xwininfo/ChangeLog
+++ b/app/xwininfo/ChangeLog
@@ -1,12 +1,416 @@
+commit 98d5614d4688013e2fe7447eab723e0a43ee27b8
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Sat Oct 30 11:58:33 2010 -0700
+
+ xwininfo 1.1.1
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit ca6412a29ec5b7b646b8a48bac940af2762ed54d
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Sat Oct 30 11:53:28 2010 -0700
+
+ config: Remove unnecessary calls from configure.ac
+
+ AC_PROG_CC & AC_PROG_INSTALL are provided by XORG_DEFAULT_OPTIONS now
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 3a3003dcd0737c721e8f35953a5871a50209b5d4
+Author: Julien Cristau <jcristau@debian.org>
+Date: Thu Oct 21 12:59:11 2010 +0200
+
+ Work around xcb_translate_coordinates sign bug
+
+ xcb_translate_coordinates_reply_t has unsigned dst_{x,y}, so explicitly
+ cast them to int16_t to get the right values.
+ Reported on irc by frostwork.
+
+ xcb-proto was fixed in commit 661fe8dd.
+
+ Signed-off-by: Julien Cristau <jcristau@debian.org>
+ Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 4ec65f24a0abaaf6ec1a0c930fc79b3fc5e1baf6
+Author: Tomas Chvatal <scarabeus@gentoo.org>
+Date: Mon Sep 27 14:56:14 2010 +0200
+
+ Fix build error when building --with-xcb-icccm
+
+ xwininfo.c:633:34: error: incompatible types when assigning to type xcb_get_property_cookie_t from type int
+
+ Signed-off-by: Tomas Chvatal <scarabeus@gentoo.org>
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit aac89e8e81faca5d6eb830cd65591619a26ec17a
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Sun Sep 26 18:35:40 2010 -0700
+
+ xwininfo 1.1.0
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit abcf5e76c7dfc951832fda6845ace426b9ddebce
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Sun Sep 26 18:30:08 2010 -0700
+
+ config: upgrade to util-macros 1.8 for additional man page support
+
+ Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS
+ The value of MAN_SUBST is the same for all X.Org packages.
+
+ Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS
+ Enables use of platform appropriate version of sed.
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit b6c84ba0aab5b95883a4f5759ec100b387314ec5
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date: Tue Jul 20 18:45:18 2010 -0400
+
+ config: update AC_PREREQ statement to 2.60
+
+ Unrelated to the previous patches, the new value simply reflects
+ the reality that the minimum level for autoconf to configure
+ all x.org modules is 2.60 dated June 2006.
+
+ ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz
+
+ Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 8263f19cf9002c7b5f2967a2bde7af4ed117c1e5
+Author: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Sat Jul 10 10:19:14 2010 -0700
+
+ strnlen: Fix building on systems without strnlen(3)
+
+ Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+
+commit 3fa31068bcae6a5bee7fbd41788e13d6d56da8c0
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Wed Jun 30 18:38:57 2010 -0700
+
+ Make iconv() usage optional
+
+ Allows building without iconv, though character set conversion will not
+ be supported in that case.
+
+ Handles UTF8_STRING validation and output for UTF-8 locales without iconv
+ (using is_valid_utf8() function copied from X.Org's app/xprop/xprop.c)
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+ Reviewed-by: James Cloos <cloos@jhcloos.com>
+
+commit 6a4f77d4ac1737dd49f3462d98e0f7e41e50ab18
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Tue Jun 29 22:51:38 2010 -0700
+
+ Add some EWMH hints to the -wm output
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+ Reviewed-by: James Cloos <cloos@jhcloos.com>
+
+commit baf759d33b4b360fef2b2c61094ef109bec708fa
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Tue Jun 29 17:56:07 2010 -0700
+
+ Handle non-latin-1 window names
+
+ Uses _NET_WM_NAME to get UTF-8 encoding, iconv to convert to current locale
+ Warns that COMPOUND_TEXT WM_NAMEs aren't supported if _NET_WM_NAME isn't set
+ Adds local atom caching code to dsimple.c and uses it in all three *.c
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+ Reviewed-by: James Cloos <cloos@jhcloos.com>
+
+commit 6ec3573d7876fa62d2a81057ce0d16ed328fad1f
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Fri Jun 25 21:41:21 2010 -0700
+
+ Make xcb-icccm dependency be optional and off-by-default
+
+ Changes to the xcb-icccm API/ABI are under discussion, so for now default
+ to using local property handling code modeled after the current API, with
+ a --with-xcb-icccm to enable use of the API for testing/development.
+
+ Once the API/ABI is stable & released, this set of changes should be
+ removed and the xcb-icccm API just used directly.
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+ Reviewed-by: James Cloos <cloos@jhcloos.com>
+
+commit 96f19bade9ce4940642d580f4c52e2bc0e3539ab
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Sun Jun 13 12:42:34 2010 -0700
+
+ Convert from Xlib to xcb
+
+ Testing was done with a simple GNOME 2.28 session with a number of
+ applications open (gnome-terminal, VirtualBox, Firefox).
+
+ Primary test case was xwininfo -root -all, which listed 114 children of
+ the root window. Output was identical to Xlib version (after applying
+ the fix to libxcb_icccm for always null-terminating wm_class properties).
+
+ Over a local connection on the same machine:
+
+ Xlib: 0.00u 0.01s 0:00.05 20.0%
+ xcb: 0.00u 0.00s 0:00.02 0.0%
+
+ (i.e. barely measurable difference - I had more variation between
+ repeated runs of the command)
+
+ Introducing latency by running over ssh -X from California to Beijing
+ and back:
+
+ Xlib: 0.03u 0.02s 8:19.12 0.0%
+ xcb: 0.00u 0.00s 0:45.26 0.0%
+
+ Memory size when exit() is called:
+
+ Xlib:
+ Address Kbytes RSS Anon Locked Mode Mapped File
+ 08043000 20 20 20 - rw--- [ stack ]
+ 08400000 144 144 144 - rw--- [ heap ]
+ total Kb 8972 8640 316 -
+
+ xcb:
+ Address Kbytes RSS Anon Locked Mode Mapped File
+ 08045000 12 12 12 - rwx-- [ stack ]
+ 0806C000 100 100 100 - rwx-- [ heap ]
+ total Kb 7980 7692 288 -
+
+ Bytes sent & received (counted by proxying via xscope):
+
+ Xlib: Client --> Server: 21380 bytes Client <-- Server: 54124 bytes
+ xcb: Client --> Server: 21114 bytes Client <-- Server: 53160 bytes
+
+ (The Xlib code didn't save any replies, so re-requested a couple of things
+ when running with -all - I fixed that while porting to xcb, but the same
+ could be done with Xlib easily too.)
+
+ Not yet handled: WM_NAME properties that need to be converted from another
+ character encoding.
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+ Reviewed-by: James Cloos <cloos@jhcloos.com>
+
+commit 123ff05c2e2bbdb9d7d6d958d9f096cf854b8360
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Mon Jun 7 01:00:33 2010 -0700
+
+ Delay generating unknown code string until we know we need it
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 369c37a62cdd2841a3e8778674029841231f45ad
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Sun Jun 6 16:57:22 2010 -0700
+
+ Use _X_NORETURN from xproto 7.0.17
+
+ Also throw in _X_ATTRIBUTE_PRINTF while we're here.
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit c72551c9e8805d44ee76f6723cada6843657031b
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Sun Jun 6 16:06:07 2010 -0700
+
+ Make spacing more consistent
+
+ Different functions had 2, 4, 6, or 8 spaces per indent level,
+ standardized on 4 spaces. Also more consistenly put spaces before parens.
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 6001e8721f232aa1f8b584d903edcea148b0ebc5
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Sun Jun 6 14:16:39 2010 -0700
+
+ Remove #ifdef NO_I18N code branches
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 44a6d871e2baec9724f131778887c834133a4dc5
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Sun Jun 6 14:12:24 2010 -0700
+
+ Remove RCS/CVS id tags
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 98bb85ea5fd3e2b5e077d89c6bf6e16b8829481a
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Sun Jun 6 14:11:13 2010 -0700
+
+ mark window_id_format as a const string
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 725c5bbb58e6fb2c8775512d194367e3d677ee43
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Sun Jun 6 14:05:53 2010 -0700
+
+ Collapse some series of multiline printfs into single strings/calls
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 969b179b3bfe2dd11f3426fc30cab3ac337b84d5
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date: Fri Jan 15 13:10:39 2010 -0800
+
+ Update Sun license notices to current X.Org standard form
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit b0c1a61df072c92db646257b1048798df0f1c64d
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date: Thu Nov 26 09:19:55 2009 -0500
+
+ Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES
+
+ Now that the INSTALL file is generated.
+ Allows running make maintainer-clean.
+
+commit 414b61fcc45836ea0739b32abd0eff8c4a863f8d
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date: Wed Oct 28 14:09:09 2009 -0400
+
+ INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206
+
+ Add missing INSTALL file. Use standard GNU file on building tarball
+ README may have been updated
+ Remove AUTHORS file as it is empty and no content available yet.
+ Remove NEWS file as it is empty and no content available yet.
+
+commit 458d8ae3b990c64630b0ca56f88a2955c9470681
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date: Mon Oct 26 22:08:39 2009 -0400
+
+ Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432
+
+ ChangeLog filename is known to Automake and requires no further
+ coding in the makefile.
+
+commit dd4df8d8ec6a4cb34af8ddfd65277ae602d6cdc8
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date: Thu Oct 22 12:34:16 2009 -0400
+
+ .gitignore: use common defaults with custom section # 24239
+
+ Using common defaults will reduce errors and maintenance.
+ Only the very small or inexistent custom section need periodic maintenance
+ when the structure of the component changes. Do not edit defaults.
+
+commit d245ffee6e947b275b21a7a47716410c41154d4a
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date: Sun Sep 27 15:41:05 2009 -0400
+
+ Makefile.am: do not include autogen.sh in distribution #24183
+
+ This is a private build script that should not be distributed
+
+commit a61af405625b9a284497d7b4e56ef9719d3ae14f
+Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
+Date: Wed Oct 21 12:47:22 2009 -0700
+
+ This is not a GNU project, so declare it foreign.
+
+ On Wed, 2009-10-21 at 13:36 +1000, Peter Hutterer wrote:
+ > On Tue, Oct 20, 2009 at 08:23:55PM -0700, Jeremy Huddleston wrote:
+ > > I noticed an INSTALL file in xlsclients and libXvMC today, and it
+ > > was quite annoying to work around since 'autoreconf -fvi' replaces
+ > > it and git wants to commit it. Should these files even be in git?
+ > > Can I nuke them for the betterment of humanity and since they get
+ > > created by autoreconf anyways?
+ >
+ > See https://bugs.freedesktop.org/show_bug.cgi?id=24206
+
+ As an interim measure, replace AM_INIT_AUTOMAKE([dist-bzip2]) with
+ AM_INIT_AUTOMAKE([foreign dist-bzip2]). This will prevent the generation
+ of the INSTALL file. It is also part of the 24206 solution.
+
+ Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
+
+commit 1569f4d692443bf0658dbe12902f995693b13dcf
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date: Mon Oct 12 16:08:57 2009 -0700
+
+ xwininfo 1.0.5
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit 28b34ed17506540a793a85e03c01a7b4d9aa3588
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date: Mon Oct 12 16:06:55 2009 -0700
+
+ Migrate to xorg macros 1.3 & XORG_DEFAULT_OPTIONS
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit b6837aadf7a2c30fb8c2c811d45c48047e0769e8
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date: Mon Oct 12 15:58:09 2009 -0700
+
+ Fill in COPYING file
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit 98ac096e2edae243ce2119fb70112c3c6b2bb688
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date: Thu Oct 1 14:54:32 2009 -0700
+
+ Add README with pointers to mailing lists, bugzilla, & git
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit 347ba641db84c66cd332f398423e87a882580575
+Author: Yann Droneaud <ydroneaud@mandriva.com>
+Date: Fri Mar 27 16:41:00 2009 +0100
+
+ Update manpage for visual id
+
+ Signed-off-by: James Cloos <cloos@jhcloos.com>
+
+commit ee03cf70e9e92d0e9adebaddc6b065de496cc561
+Author: Yann Droneaud <ydroneaud@mandriva.com>
+Date: Fri Mar 27 16:35:14 2009 +0100
+
+ Report visual id along visual class for -stat switch
+
+ Signed-off-by: James Cloos <cloos@jhcloos.com>
+
+commit a42690b24d828ec4cfae1bf40cac08f07c6202af
+Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
+Date: Thu Jan 15 14:27:14 2009 -0200
+
+ Ansification and compile warning fixes.
+
+ This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects
+ make distcheck and most gcc 4.3 and sparse warnings.
+
+commit 67a74f540cdbb7ded7aa44c751f5f0c8833c688f
+Author: Branden Robinson <branden@debian.org>
+Date: Fri Feb 11 02:14:27 2005 -0500
+
+ Do not spew usage on connection error
+
+ General philosophy:
+
+ The user should only be shown a usage message when:
+ * it is asked for with a --help option or the like.
+ * the command line is syntactically invalid.
+
commit b8115ee0e43c6c03025cad72219481e3fdb119d4
Author: James Cloos <cloos@jhcloos.com>
-Date: Sun Jun 29 10:49:10 2008 -0400
+Date: Sun Jun 29 10:49:33 2008 -0400
xwininfo 1.0.4
commit c229611bcb7ee94bea5c075f5e15447e14c0f6ce
Author: Kim Woelders <kim@woelders.dk>
-Date: Sun Jun 22 01:11:50 2008 -0400
+Date: Sun Jun 22 01:12:13 2008 -0400
Fix window selection by pointer.
@@ -16,37 +420,37 @@ Date: Sun Jun 22 01:11:50 2008 -0400
commit b7e88cd9d28a3d3e467b769f3efe87f7c2f4c0a5
Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date: Mon Aug 27 14:20:12 2007 -0700
+Date: Mon Aug 27 14:20:35 2007 -0700
Version bump: 1.0.3
commit 56f0b5dfb1486e262eb514fac44c73cea4bb4471
Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date: Mon Aug 27 14:19:39 2007 -0700
+Date: Mon Aug 27 14:20:02 2007 -0700
Replace static ChangeLog with dist-hook to generate from git log
commit c8d205c30547ca526404a0b257c3cc5d40970be6
Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date: Tue Aug 7 15:49:50 2007 -0700
+Date: Tue Aug 7 15:50:13 2007 -0700
Add static & const qualifiers to xwininfo.c
commit 77d50c0bf824f847bd9ede30c21618845258de76
Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date: Tue Aug 7 15:38:00 2007 -0700
+Date: Tue Aug 7 15:38:23 2007 -0700
Replace sprintf's with snprintf & strlcat
commit 118bd50a9bbc10cab7846fb6ac1a0d25ba4c3422
Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date: Mon Aug 6 19:51:50 2007 -0700
+Date: Mon Aug 6 19:52:13 2007 -0700
dsimple.c: ANSIfy function declarations
commit e093e4be56bb2be385a972962cf89f234e987ab4
Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date: Mon Aug 6 19:44:01 2007 -0700
+Date: Mon Aug 6 19:44:24 2007 -0700
Purge unused code from dsimple.c
@@ -56,7 +460,7 @@ Date: Mon Aug 6 19:44:01 2007 -0700
commit 59bbe12a40fdb3d39429d0d0ce809ad28116e7ed
Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date: Mon Aug 6 19:18:34 2007 -0700
+Date: Mon Aug 6 19:18:57 2007 -0700
Rename xwininfo_CFLAGS to AM_CFLAGS to make automake-1.10 happier
@@ -64,19 +468,19 @@ Date: Mon Aug 6 19:18:34 2007 -0700
commit 5a251886c0f158f4c8a342b6fbdeebf3dbd1c0fd
Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date: Thu May 24 18:19:48 2007 -0700
+Date: Thu May 24 18:20:11 2007 -0700
Man page formatting: make -geometry bold like other options
commit 07459b14b36f15cfdfc6384019aaf020c7920cd4
Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date: Thu May 24 18:17:05 2007 -0700
+Date: Thu May 24 18:17:28 2007 -0700
renamed: .cvsignore -> .gitignore
commit 24fc2a569df9eaa776bcdddbb26bf4ea97b69d13
Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date: Thu May 24 18:16:30 2007 -0700
+Date: Thu May 24 18:16:53 2007 -0700
X.Org bug #10616: Add all the X info commands to See Also in man page
@@ -86,75 +490,75 @@ Date: Thu May 24 18:16:30 2007 -0700
commit 412a3232373131634072df0d0b4843abf360def4
Author: Adam Jackson <ajax@nwnk.net>
-Date: Sun Apr 2 01:19:30 2006 +0000
+Date: Sun Apr 2 01:19:53 2006 +0000
Bump to 1.0.2.
commit 8d62050702532be39688d468663466199492510b
Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
-Date: Fri Mar 10 02:36:55 2006 +0000
+Date: Fri Mar 10 02:37:18 2006 +0000
Clear two tiny memory leaks. (Coverity ids #900 & 901)
commit 609828be5a05bc71fffaf8fc129a0cae8082fd57
Author: Kevin E Martin <kem@kem.org>
-Date: Wed Dec 21 02:29:33 2005 +0000
+Date: Wed Dec 21 02:29:55 2005 +0000
Update package version for X11R7 release.
commit a4169ffa7eb6eb9a28fd64a0686a813da975736c
Author: Adam Jackson <ajax@nwnk.net>
-Date: Mon Dec 19 16:22:26 2005 +0000
+Date: Mon Dec 19 16:22:48 2005 +0000
Stub COPYING files
commit b9403df95678e568a326fe3f37bf29285a6a211e
Author: Kevin E Martin <kem@kem.org>
-Date: Thu Dec 15 00:23:50 2005 +0000
+Date: Thu Dec 15 00:24:12 2005 +0000
Update package version number for final X11R7 release candidate.
commit 6f9523999cc4eb34accfe0bcc2c7a74bae9259ef
Author: Kevin E Martin <kem@kem.org>
-Date: Tue Dec 6 22:48:05 2005 +0000
+Date: Tue Dec 6 22:48:27 2005 +0000
Change *man_SOURCES ==> *man_PRE to fix autotools warnings.
commit 28c0455ea50bdf37f1d9d53c6756beebed429f0e
Author: Kevin E Martin <kem@kem.org>
-Date: Sat Dec 3 05:49:07 2005 +0000
+Date: Sat Dec 3 05:49:29 2005 +0000
Update package version number for X11R7 RC3 release.
commit 988471c67e10a5ca309b90146b37a6037f5b2efc
Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
-Date: Mon Nov 28 22:01:26 2005 +0000
+Date: Mon Nov 28 22:01:48 2005 +0000
Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4
update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir)
commit 4496e95380b2f0ad7e9bdca02ec192dbb6d5e2e5
Author: Eric Anholt <anholt@freebsd.org>
-Date: Mon Nov 21 10:34:47 2005 +0000
+Date: Mon Nov 21 10:35:09 2005 +0000
Another pass at .cvsignores for apps.
commit 296d8e6ab8a86e5653529d0497ca5751d89f23b5
Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
-Date: Mon Nov 21 03:13:55 2005 +0000
+Date: Mon Nov 21 03:14:17 2005 +0000
Change dependency from xmu to xmuu since the full xmu (with all its baggage
like Xt) is not needed here.
commit 27898506332f1a4e698cbd65aecc47fdbc6d0a7b
Author: Eric Anholt <anholt@freebsd.org>
-Date: Sun Nov 20 22:08:34 2005 +0000
+Date: Sun Nov 20 22:08:56 2005 +0000
Add/improve .cvsignore files for apps.
commit ee7bf4989434ba5f30451c3f07e4a6e01e6532d4
Author: Kevin E Martin <kem@kem.org>
-Date: Sat Nov 19 07:15:16 2005 +0000
+Date: Sat Nov 19 07:15:38 2005 +0000
Update pkgconfig files to separate library build-time dependencies from
application build-time dependencies, and update package deps to work
@@ -162,33 +566,33 @@ Date: Sat Nov 19 07:15:16 2005 +0000
commit 4e58b0e12d46503c5f75ead9a859694aafd5b9b7
Author: Kevin E Martin <kem@kem.org>
-Date: Wed Oct 19 02:47:36 2005 +0000
+Date: Wed Oct 19 02:47:58 2005 +0000
Update package version number for RC1 release.
commit fc097904a8d7ded9a60df35fd58b9f5b5e226e17
Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
-Date: Mon Oct 17 23:56:03 2005 +0000
+Date: Mon Oct 17 23:56:25 2005 +0000
Use @APP_MAN_SUFFIX@ instead of $(APP_MAN_SUFFIX) in macro substitutions to
work better with BSD make
commit 22feb546d5bf499ec0bc726c60a6c46f2e2cbd1c
Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
-Date: Fri Oct 14 00:25:26 2005 +0000
+Date: Fri Oct 14 00:25:48 2005 +0000
Use sed to fill in variables in man page
commit 9b1a4cbaf609bb102adec047934ad4c1b05f01ab
Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
-Date: Mon Aug 1 20:25:11 2005 +0000
+Date: Mon Aug 1 20:25:33 2005 +0000
Install man pages to section 1 instead of section m (Patch from Donnie
Berkholz)
commit 70ed22f5e63d5759a0b7c6574a92d124c0777562
Author: Kevin E Martin <kem@kem.org>
-Date: Fri Jul 29 21:22:17 2005 +0000
+Date: Fri Jul 29 21:22:39 2005 +0000
Various changes preparing packages for RC0:
- Verify and update package version numbers as needed
@@ -202,20 +606,20 @@ Date: Fri Jul 29 21:22:17 2005 +0000
commit 270145dc0f3ad5c7ad7d6086da19c0a25ea853a9
Author: Adam Jackson <ajax@nwnk.net>
-Date: Wed Jul 20 19:31:43 2005 +0000
+Date: Wed Jul 20 19:32:05 2005 +0000
Use a unique token for PKG_CHECK_MODULES. Otherwise, if you use a global
configure cache, you cache it, and the cached value is probably wrong.
commit 97aa768841e147fde3cf16ba9a4c852358085d27
Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
-Date: Fri Jul 8 21:00:24 2005 +0000
+Date: Fri Jul 8 21:00:46 2005 +0000
Build system for xwininfo
commit 5cd08344c43c739c9a6837f1a60ae7c42e5afabe
Author: Roland Mainz <roland.mainz@nrubsig.org>
-Date: Wed Oct 6 19:29:37 2004 +0000
+Date: Wed Oct 6 19:29:59 2004 +0000
Fix for https://freedesktop.org/bugzilla/show_bug.cgi?id=1518 - Add filter
support to "xlsfonts" that it can filter builtin-, glyph- and/or other
@@ -224,54 +628,54 @@ Date: Wed Oct 6 19:29:37 2004 +0000
commit ac7cc196b722ee4653326aee459f40ad16a260c1
Author: Egbert Eich <eich@suse.de>
-Date: Fri Apr 23 19:54:47 2004 +0000
+Date: Fri Apr 23 19:55:09 2004 +0000
Merging XORG-CURRENT into trunk
commit 43e099d499d4dbabb32ca0410175e0e1b814cd94
Author: Egbert Eich <eich@suse.de>
-Date: Sun Mar 14 08:35:32 2004 +0000
+Date: Sun Mar 14 08:35:54 2004 +0000
Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004
commit cd710399eb415673c180f65080d685ee8d149361
Author: Egbert Eich <eich@suse.de>
-Date: Wed Mar 3 12:12:58 2004 +0000
+Date: Wed Mar 3 12:13:20 2004 +0000
Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004
commit 436a7ecb4b764394abcdd06fd99d6232c633cad1
Author: Egbert Eich <eich@suse.de>
-Date: Thu Feb 26 13:36:10 2004 +0000
+Date: Thu Feb 26 13:36:32 2004 +0000
readding XFree86's cvs IDs
commit 6dfbd3f819f10e4d04653df2074526860007968e
Author: Egbert Eich <eich@suse.de>
-Date: Thu Feb 26 09:23:56 2004 +0000
+Date: Thu Feb 26 09:24:18 2004 +0000
Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004
commit a2fa980ce0e98c2bbc503d1d9fe51ab539b7ea46
Author: Egbert Eich <eich@suse.de>
-Date: Thu Jan 29 08:08:59 2004 +0000
+Date: Thu Jan 29 08:09:21 2004 +0000
Importing vendor version xf86-012804-2330 on Thu Jan 29 00:06:33 PST 2004
commit 429530ba6f7699436d6f789a17550ec1a691c675
Author: Kaleb Keithley <kaleb@freedesktop.org>
-Date: Tue Nov 25 19:29:01 2003 +0000
+Date: Tue Nov 25 19:29:23 2003 +0000
XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks
commit be0f398fee08e03ab73ec0d580df688cc989fbaa
Author: Kaleb Keithley <kaleb@freedesktop.org>
-Date: Fri Nov 14 16:49:02 2003 +0000
+Date: Fri Nov 14 16:49:24 2003 +0000
XFree86 4.3.0.1
commit 5e5a590668dc3ebe7e2cb568aad4c9c14021f2a2
Author: Kaleb Keithley <kaleb@freedesktop.org>
-Date: Fri Nov 14 15:54:33 2003 +0000
+Date: Fri Nov 14 15:54:55 2003 +0000
R6.6 is the Xorg base-line
diff --git a/app/xwininfo/INSTALL b/app/xwininfo/INSTALL
index 23e5f25d0..8b82ade08 100644
--- a/app/xwininfo/INSTALL
+++ b/app/xwininfo/INSTALL
@@ -1,16 +1,19 @@
Installation Instructions
*************************
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
-Software Foundation, Inc.
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006, 2007, 2008 Free Software Foundation, Inc.
-This file is free documentation; the Free Software Foundation gives
+ This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
-These are generic installation instructions.
+ Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package. The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
@@ -23,9 +26,9 @@ debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
-the results of its tests to speed up reconfiguring. (Caching is
+the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
-cache files.)
+cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
@@ -35,20 +38,17 @@ some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
-`configure' by a program called `autoconf'. You only need
-`configure.ac' if you want to change it or regenerate `configure' using
-a newer version of `autoconf'.
+`configure' by a program called `autoconf'. You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
- `./configure' to configure the package for your system. If you're
- using `csh' on an old version of System V, you might need to type
- `sh ./configure' instead to prevent `csh' from trying to execute
- `configure' itself.
+ `./configure' to configure the package for your system.
- Running `configure' takes awhile. While running, it prints some
- messages telling which features it is checking for.
+ Running `configure' might take a while. While running, it prints
+ some messages telling which features it is checking for.
2. Type `make' to compile the package.
@@ -67,42 +67,57 @@ The simplest way to compile this package is:
all sorts of other programs in order to regenerate files that came
with the distribution.
+ 6. Often, you can also type `make uninstall' to remove the installed
+ files again.
+
Compilers and Options
=====================
-Some systems require unusual options for compilation or linking that the
-`configure' script does not know about. Run `./configure --help' for
-details on some of the pertinent environment variables.
+ Some systems require unusual options for compilation or linking that
+the `configure' script does not know about. Run `./configure --help'
+for details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
- ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+ ./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
-You can compile the package for more than one kind of computer at the
+ You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
-own directory. To do this, you must use a version of `make' that
-supports the `VPATH' variable, such as GNU `make'. `cd' to the
+own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
- If you have to use a `make' that does not support the `VPATH'
-variable, you have to compile the package for one architecture at a
-time in the source code directory. After you have installed the
-package for one architecture, use `make distclean' before reconfiguring
-for another architecture.
+ With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory. After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+ On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor. Like
+this:
+
+ ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+ CPP="gcc -E" CXXCPP="g++ -E"
+
+ This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
Installation Names
==================
-By default, `make install' installs the package's commands under
+ By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX'.
@@ -125,7 +140,7 @@ option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
-Some packages pay attention to `--enable-FEATURE' options to
+ Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
@@ -137,14 +152,36 @@ find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
+Particular systems
+==================
+
+ On HP-UX, the default C compiler is not ANSI C compatible. If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+ ./configure CC="cc -Ae"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+ On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file. The option `-nodtk' can be used as
+a workaround. If GNU CC is not installed, it is therefore recommended
+to try
+
+ ./configure CC="cc"
+
+and if that doesn't work, try
+
+ ./configure CC="cc -nodtk"
+
Specifying the System Type
==========================
-There may be some features `configure' cannot figure out automatically,
-but needs to determine by the type of machine the package will run on.
-Usually, assuming the package is built to be run on the _same_
-architectures, `configure' can figure that out, but if it prints a
-message saying it cannot guess the machine type, give it the
+ There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on. Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
@@ -170,9 +207,9 @@ eventually be run) with `--host=TYPE'.
Sharing Defaults
================
-If you want to set default values for `configure' scripts to share, you
-can create a site shell script called `config.site' that gives default
-values for variables like `CC', `cache_file', and `prefix'.
+ If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
@@ -181,7 +218,7 @@ A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
-Variables not defined in a site shell script can be set in the
+ Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
@@ -190,21 +227,29 @@ them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
-overridden in the site shell script). Here is a another example:
+overridden in the site shell script).
- /bin/bash ./configure CONFIG_SHELL=/bin/bash
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug. Until the bug is fixed you can use this workaround:
-Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
-configuration-related scripts to be executed by `/bin/bash'.
+ CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
-`configure' recognizes the following options to control how it operates.
+ `configure' recognizes the following options to control how it
+operates.
`--help'
`-h'
- Print a summary of the options to `configure', and exit.
+ Print a summary of all of the options to `configure', and exit.
+
+`--help=short'
+`--help=recursive'
+ Print a summary of the options unique to this package's
+ `configure', and exit. The `short' variant lists options used
+ only in the top level, while the `recursive' variant lists options
+ also present in any nested packages.
`--version'
`-V'
@@ -231,6 +276,16 @@ configuration-related scripts to be executed by `/bin/bash'.
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
+`--prefix=DIR'
+ Use DIR as the installation prefix. *Note Installation Names::
+ for more details, including other options available for fine-tuning
+ the installation locations.
+
+`--no-create'
+`-n'
+ Run the configure checks, but stop before creating any output
+ files.
+
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.
diff --git a/app/xwininfo/Makefile.am b/app/xwininfo/Makefile.am
index d41281331..16e47d7dd 100644
--- a/app/xwininfo/Makefile.am
+++ b/app/xwininfo/Makefile.am
@@ -22,7 +22,7 @@
bin_PROGRAMS = xwininfo
AM_CFLAGS = $(CWARNFLAGS) $(XWININFO_CFLAGS)
-xwininfo_LDADD = $(XWININFO_LIBS)
+xwininfo_LDADD = $(XWININFO_LIBS) $(LIBOBJS)
xwininfo_SOURCES = \
clientwin.c \
@@ -39,37 +39,22 @@ appmandir = $(APP_MAN_DIR)
appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
-EXTRA_DIST = $(appman_PRE) ChangeLog autogen.sh
+EXTRA_DIST = $(appman_PRE) autogen.sh strnlen.h
+MAINTAINERCLEANFILES = ChangeLog INSTALL
CLEANFILES = $(appman_DATA)
-MAINTAINERCLEANFILES = ChangeLog
-.PHONY: ChangeLog
+.PHONY: ChangeLog INSTALL
+
+INSTALL:
+ $(INSTALL_CMD)
ChangeLog:
$(CHANGELOG_CMD)
-dist-hook: ChangeLog
-
-SED = sed
-
-# Strings to replace in man pages
-XORGRELSTRING = @PACKAGE_STRING@
- XORGMANNAME = X Version 11
-
-MAN_SUBSTS = \
- -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
- -e 's|__xorgversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
- -e 's|__xservername__|Xorg|g' \
- -e 's|__xconfigfile__|xorg.conf|g' \
- -e 's|__projectroot__|$(prefix)|g' \
- -e 's|__apploaddir__|$(appdefaultdir)|' \
- -e 's|__appmansuffix__|$(APP_MAN_SUFFIX)|g' \
- -e 's|__libmansuffix__|$(LIB_MAN_SUFFIX)|g' \
- -e 's|__adminmansuffix__|$(ADMIN_MAN_SUFFIX)|g' \
- -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g' \
- -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g'
+dist-hook: ChangeLog INSTALL
SUFFIXES = .$(APP_MAN_SUFFIX) .man
+# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
.man.$(APP_MAN_SUFFIX):
$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/app/xwininfo/Makefile.bsd-wrapper b/app/xwininfo/Makefile.bsd-wrapper
index 3dde31cba..44f9ac640 100644
--- a/app/xwininfo/Makefile.bsd-wrapper
+++ b/app/xwininfo/Makefile.bsd-wrapper
@@ -1,3 +1,5 @@
-# $OpenBSD: Makefile.bsd-wrapper,v 1.2 2006/11/27 19:27:27 matthieu Exp $
+# $OpenBSD: Makefile.bsd-wrapper,v 1.3 2010/11/25 21:55:08 matthieu Exp $
+
+CONFIGURE_ARGS += --with-xcb-icccm
.include <bsd.xorg.mk>
diff --git a/app/xwininfo/Makefile.in b/app/xwininfo/Makefile.in
index bc2144603..83bfe6ef6 100644
--- a/app/xwininfo/Makefile.in
+++ b/app/xwininfo/Makefile.in
@@ -62,7 +62,7 @@ bin_PROGRAMS = xwininfo$(EXEEXT)
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
- config.guess config.sub depcomp install-sh missing
+ config.guess config.sub depcomp install-sh missing strnlen.c
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
@@ -80,7 +80,8 @@ am_xwininfo_OBJECTS = clientwin.$(OBJEXT) dsimple.$(OBJEXT) \
xwininfo.$(OBJEXT)
xwininfo_OBJECTS = $(am_xwininfo_OBJECTS)
am__DEPENDENCIES_1 =
-xwininfo_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am__DEPENDENCIES_2 = @LIBOBJS@
+xwininfo_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -110,12 +111,14 @@ am__remove_distdir = \
DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
APP_MAN_DIR = @APP_MAN_DIR@
APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
AUTOCONF = @AUTOCONF@
@@ -142,6 +145,7 @@ EXEEXT = @EXEEXT@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
GREP = @GREP@
+INSTALL_CMD = @INSTALL_CMD@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -156,6 +160,7 @@ MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
+MAN_SUBSTS = @MAN_SUBSTS@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
OBJEXT = @OBJEXT@
@@ -167,10 +172,14 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XORG_MAN_PAGE = @XORG_MAN_PAGE@
XWININFO_CFLAGS = @XWININFO_CFLAGS@
XWININFO_LIBS = @XWININFO_LIBS@
ac_ct_CC = @ac_ct_CC@
@@ -189,7 +198,6 @@ build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
-distcleancheck_listfiles = @distcleancheck_listfiles@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
@@ -218,7 +226,7 @@ sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
AM_CFLAGS = $(CWARNFLAGS) $(XWININFO_CFLAGS)
-xwininfo_LDADD = $(XWININFO_LIBS)
+xwininfo_LDADD = $(XWININFO_LIBS) $(LIBOBJS)
xwininfo_SOURCES = \
clientwin.c \
clientwin.h \
@@ -231,27 +239,9 @@ appman_PRE = \
appmandir = $(APP_MAN_DIR)
appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
-EXTRA_DIST = $(appman_PRE) ChangeLog autogen.sh
+EXTRA_DIST = $(appman_PRE) autogen.sh strnlen.h
+MAINTAINERCLEANFILES = ChangeLog INSTALL
CLEANFILES = $(appman_DATA)
-MAINTAINERCLEANFILES = ChangeLog
-SED = sed
-
-# Strings to replace in man pages
-XORGRELSTRING = @PACKAGE_STRING@
-XORGMANNAME = X Version 11
-MAN_SUBSTS = \
- -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
- -e 's|__xorgversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
- -e 's|__xservername__|Xorg|g' \
- -e 's|__xconfigfile__|xorg.conf|g' \
- -e 's|__projectroot__|$(prefix)|g' \
- -e 's|__apploaddir__|$(appdefaultdir)|' \
- -e 's|__appmansuffix__|$(APP_MAN_SUFFIX)|g' \
- -e 's|__libmansuffix__|$(LIB_MAN_SUFFIX)|g' \
- -e 's|__adminmansuffix__|$(ADMIN_MAN_SUFFIX)|g' \
- -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g' \
- -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g'
-
SUFFIXES = .$(APP_MAN_SUFFIX) .man
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -264,15 +254,15 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
- cd $(srcdir) && $(AUTOMAKE) --gnu \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
+ cd $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu Makefile
+ $(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -341,6 +331,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strnlen.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clientwin.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dsimple.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xwininfo.Po@am__quote@
@@ -593,7 +584,7 @@ clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
distclean: distclean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
- -rm -rf ./$(DEPDIR)
+ -rm -rf $(DEPDIR) ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-hdr distclean-tags
@@ -621,7 +612,7 @@ installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
- -rm -rf ./$(DEPDIR)
+ -rm -rf $(DEPDIR) ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
@@ -656,13 +647,17 @@ uninstall-am: uninstall-appmanDATA uninstall-binPROGRAMS \
uninstall-info-am
-.PHONY: ChangeLog
+.PHONY: ChangeLog INSTALL
+
+INSTALL:
+ $(INSTALL_CMD)
ChangeLog:
$(CHANGELOG_CMD)
-dist-hook: ChangeLog
+dist-hook: ChangeLog INSTALL
+# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
.man.$(APP_MAN_SUFFIX):
$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/app/xwininfo/aclocal.m4 b/app/xwininfo/aclocal.m4
index d6409426d..3f71a4321 100644
--- a/app/xwininfo/aclocal.m4
+++ b/app/xwininfo/aclocal.m4
@@ -997,32 +997,26 @@ AC_SUBST([am__untar])
dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure.
dnl
-dnl Copyright 2005-2006 Sun Microsystems, Inc. All rights reserved.
+dnl Copyright (c) 2005, 2006, 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
-dnl "Software"), to deal in the Software without restriction, including
-dnl without limitation the rights to use, copy, modify, merge, publish,
-dnl distribute, and/or sell copies of the Software, and to permit persons
-dnl to whom the Software is furnished to do so, provided that the above
-dnl copyright notice(s) and this permission notice appear in all copies of
-dnl the Software and that both the above copyright notice(s) and this
-dnl permission notice appear in supporting documentation.
+dnl copy of this software and associated documentation files (the "Software"),
+dnl to deal in the Software without restriction, including without limitation
+dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
+dnl and/or sell copies of the Software, and to permit persons to whom the
+dnl Software is furnished to do so, subject to the following conditions:
dnl
-dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
-dnl OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-dnl HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
-dnl INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
-dnl FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
-dnl NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
-dnl WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+dnl The above copyright notice and this permission notice (including the next
+dnl paragraph) shall be included in all copies or substantial portions of the
+dnl Software.
dnl
-dnl Except as contained in this notice, the name of a copyright holder
-dnl shall not be used in advertising or otherwise to promote the sale, use
-dnl or other dealings in this Software without prior written authorization
-dnl of the copyright holder.
+dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+dnl DEALINGS IN THE SOFTWARE.
# XORG_MACROS_VERSION(required-version)
# -------------------------------------
@@ -1040,7 +1034,7 @@ dnl of the copyright holder.
# 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.3.0])
+m4_define([vers_have], [1.11.0])
m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
m4_if(m4_cmp(maj_have, maj_needed), 0,,
@@ -1108,9 +1102,12 @@ AC_SUBST(RAWCPPFLAGS)
# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
# Not sure if there's any better way than just hardcoding by OS name.
# Override default settings by setting environment variables
+# Added MAN_SUBSTS in version 1.8
+# Added AC_PROG_SED in version 1.8
AC_DEFUN([XORG_MANPAGE_SECTIONS],[
AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([AC_PROG_SED])
if test x$APP_MAN_SUFFIX = x ; then
APP_MAN_SUFFIX=1
@@ -1179,8 +1176,60 @@ AC_SUBST([FILE_MAN_DIR])
AC_SUBST([MISC_MAN_DIR])
AC_SUBST([DRIVER_MAN_DIR])
AC_SUBST([ADMIN_MAN_DIR])
+
+XORG_MAN_PAGE="X Version 11"
+AC_SUBST([XORG_MAN_PAGE])
+MAN_SUBSTS="\
+ -e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
+ -e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
+ -e 's|__xservername__|Xorg|g' \
+ -e 's|__xconfigfile__|xorg.conf|g' \
+ -e 's|__projectroot__|\$(prefix)|g' \
+ -e 's|__apploaddir__|\$(appdefaultdir)|g' \
+ -e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
+ -e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
+ -e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
+ -e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
+ -e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
+ -e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
+AC_SUBST([MAN_SUBSTS])
+
]) # XORG_MANPAGE_SECTIONS
+# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
+# ------------------------
+# Minimum version: 1.7.0
+#
+# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
+# provided by xorg-sgml-doctools, if installed.
+AC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
+AC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
+XORG_SGML_PATH=
+PKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
+ [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
+ [m4_ifval([$1],[:],
+ [if test x"$cross_compiling" != x"yes" ; then
+ AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
+ [XORG_SGML_PATH=$prefix/share/sgml])
+ fi])
+ ])
+
+# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
+# the path and the name of the doc stylesheet
+if test "x$XORG_SGML_PATH" != "x" ; then
+ AC_MSG_RESULT([$XORG_SGML_PATH])
+ STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
+ XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
+else
+ AC_MSG_RESULT([no])
+fi
+
+AC_SUBST(XORG_SGML_PATH)
+AC_SUBST(STYLESHEET_SRCDIR)
+AC_SUBST(XSL_STYLESHEET)
+AM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
+]) # XORG_CHECK_SGML_DOCTOOLS
+
# XORG_CHECK_LINUXDOC
# -------------------
# Minimum version: 1.0.0
@@ -1190,23 +1239,14 @@ AC_SUBST([ADMIN_MAN_DIR])
# Whether or not the necessary tools and files are found can be checked
# with the AM_CONDITIONAL "BUILD_LINUXDOC"
AC_DEFUN([XORG_CHECK_LINUXDOC],[
-if test x$XORG_SGML_PATH = x ; then
- XORG_SGML_PATH=$prefix/share/sgml
-fi
-HAVE_DEFS_ENT=
-
-if test x"$cross_compiling" = x"yes" ; then
- HAVE_DEFS_ENT=no
-else
- AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
-fi
+AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
+AC_REQUIRE([XORG_WITH_PS2PDF])
AC_PATH_PROG(LINUXDOC, linuxdoc)
-AC_PATH_PROG(PS2PDF, ps2pdf)
-AC_MSG_CHECKING([Whether to build documentation])
+AC_MSG_CHECKING([whether to build documentation])
-if test x$HAVE_DEFS_ENT != x && test x$LINUXDOC != x ; then
+if test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
BUILDDOC=yes
else
BUILDDOC=no
@@ -1216,9 +1256,9 @@ AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
AC_MSG_RESULT([$BUILDDOC])
-AC_MSG_CHECKING([Whether to build pdf documentation])
+AC_MSG_CHECKING([whether to build pdf documentation])
-if test x$PS2PDF != x && test x$BUILD_PDFDOC != xno; then
+if test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
BUILDPDFDOC=yes
else
BUILDPDFDOC=no
@@ -1228,7 +1268,7 @@ AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
AC_MSG_RESULT([$BUILDPDFDOC])
-MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt"
+MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
MAKE_PDF="$PS2PDF"
MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B html --split=0"
@@ -1248,48 +1288,44 @@ AC_SUBST(MAKE_HTML)
# indicates whether the necessary tools and files are found and, if set,
# $(MAKE_XXX) blah.sgml will produce blah.xxx.
AC_DEFUN([XORG_CHECK_DOCBOOK],[
-if test x$XORG_SGML_PATH = x ; then
- XORG_SGML_PATH=$prefix/share/sgml
-fi
-HAVE_DEFS_ENT=
+AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
+
BUILDTXTDOC=no
BUILDPDFDOC=no
BUILDPSDOC=no
BUILDHTMLDOC=no
-AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
-
AC_PATH_PROG(DOCBOOKPS, docbook2ps)
AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
AC_PATH_PROG(DOCBOOKHTML, docbook2html)
AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
-AC_MSG_CHECKING([Whether to build text documentation])
-if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKTXT != x &&
+AC_MSG_CHECKING([whether to build text documentation])
+if test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
test x$BUILD_TXTDOC != xno; then
BUILDTXTDOC=yes
fi
AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
AC_MSG_RESULT([$BUILDTXTDOC])
-AC_MSG_CHECKING([Whether to build PDF documentation])
-if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPDF != x &&
+AC_MSG_CHECKING([whether to build PDF documentation])
+if test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
test x$BUILD_PDFDOC != xno; then
BUILDPDFDOC=yes
fi
AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
AC_MSG_RESULT([$BUILDPDFDOC])
-AC_MSG_CHECKING([Whether to build PostScript documentation])
-if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPS != x &&
+AC_MSG_CHECKING([whether to build PostScript documentation])
+if test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
test x$BUILD_PSDOC != xno; then
BUILDPSDOC=yes
fi
AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
AC_MSG_RESULT([$BUILDPSDOC])
-AC_MSG_CHECKING([Whether to build HTML documentation])
-if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKHTML != x &&
+AC_MSG_CHECKING([whether to build HTML documentation])
+if test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
test x$BUILD_HTMLDOC != xno; then
BUILDHTMLDOC=yes
fi
@@ -1307,6 +1343,548 @@ AC_SUBST(MAKE_PDF)
AC_SUBST(MAKE_HTML)
]) # XORG_CHECK_DOCBOOK
+# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
+# ----------------
+# Minimum version: 1.5.0
+# Minimum version for optional DEFAULT argument: 1.11.0
+#
+# Documentation tools are not always available on all platforms and sometimes
+# not at the appropriate level. This macro enables a module to test for the
+# presence of the tool and obtain it's path in separate variables. Coupled with
+# the --with-xmlto option, it allows maximum flexibilty in making decisions
+# as whether or not to use the xmlto package. When DEFAULT is not specified,
+# --with-xmlto assumes 'auto'.
+#
+# Interface to module:
+# HAVE_XMLTO: used in makefiles to conditionally generate documentation
+# XMLTO: returns the path of the xmlto program found
+# returns the path set by the user in the environment
+# --with-xmlto: 'yes' user instructs the module to use xmlto
+# 'no' user instructs the module not to use xmlto
+#
+# Added in version 1.10.0
+# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
+# xmlto for text output requires either lynx, links, or w3m browsers
+#
+# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
+#
+AC_DEFUN([XORG_WITH_XMLTO],[
+AC_ARG_VAR([XMLTO], [Path to xmlto command])
+m4_define([_defopt], m4_default([$2], [auto]))
+AC_ARG_WITH(xmlto,
+ AS_HELP_STRING([--with-xmlto],
+ [Use xmlto to regenerate documentation (default: ]_defopt[)]),
+ [use_xmlto=$withval], [use_xmlto=]_defopt)
+m4_undefine([_defopt])
+
+if test "x$use_xmlto" = x"auto"; then
+ AC_PATH_PROG([XMLTO], [xmlto])
+ if test "x$XMLTO" = "x"; then
+ AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
+ have_xmlto=no
+ else
+ have_xmlto=yes
+ fi
+elif test "x$use_xmlto" = x"yes" ; then
+ AC_PATH_PROG([XMLTO], [xmlto])
+ if test "x$XMLTO" = "x"; then
+ AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
+ fi
+ have_xmlto=yes
+elif test "x$use_xmlto" = x"no" ; then
+ if test "x$XMLTO" != "x"; then
+ AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
+ fi
+ have_xmlto=no
+else
+ AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
+fi
+
+# Test for a minimum version of xmlto, if provided.
+m4_ifval([$1],
+[if test "$have_xmlto" = yes; then
+ # scrape the xmlto version
+ AC_MSG_CHECKING([the xmlto version])
+ xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
+ AC_MSG_RESULT([$xmlto_version])
+ AS_VERSION_COMPARE([$xmlto_version], [$1],
+ [if test "x$use_xmlto" = xauto; then
+ AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
+ have_xmlto=no
+ else
+ AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
+ fi])
+fi])
+
+# Test for the ability of xmlto to generate a text target
+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])])])
+rm -f conftest.xml
+AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
+AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
+]) # XORG_WITH_XMLTO
+
+# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
+# ----------------
+# Minimum version: 1.5.0
+# Minimum version for optional DEFAULT argument: 1.11.0
+#
+# Documentation tools are not always available on all platforms and sometimes
+# not at the appropriate level. This macro enables a module to test for the
+# presence of the tool and obtain it's path in separate variables. Coupled with
+# the --with-asciidoc option, it allows maximum flexibilty in making decisions
+# as whether or not to use the asciidoc package. When DEFAULT is not specified,
+# --with-asciidoc assumes 'auto'.
+#
+# Interface to module:
+# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
+# ASCIIDOC: returns the path of the asciidoc program found
+# returns the path set by the user in the environment
+# --with-asciidoc: 'yes' user instructs the module to use asciidoc
+# 'no' user instructs the module not to use asciidoc
+#
+# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
+#
+AC_DEFUN([XORG_WITH_ASCIIDOC],[
+AC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
+m4_define([_defopt], m4_default([$2], [auto]))
+AC_ARG_WITH(asciidoc,
+ AS_HELP_STRING([--with-asciidoc],
+ [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
+ [use_asciidoc=$withval], [use_asciidoc=]_defopt)
+m4_undefine([_defopt])
+
+if test "x$use_asciidoc" = x"auto"; then
+ AC_PATH_PROG([ASCIIDOC], [asciidoc])
+ if test "x$ASCIIDOC" = "x"; then
+ AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
+ have_asciidoc=no
+ else
+ have_asciidoc=yes
+ fi
+elif test "x$use_asciidoc" = x"yes" ; then
+ AC_PATH_PROG([ASCIIDOC], [asciidoc])
+ if test "x$ASCIIDOC" = "x"; then
+ AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
+ fi
+ have_asciidoc=yes
+elif test "x$use_asciidoc" = x"no" ; then
+ if test "x$ASCIIDOC" != "x"; then
+ AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
+ fi
+ have_asciidoc=no
+else
+ AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
+fi
+m4_ifval([$1],
+[if test "$have_asciidoc" = yes; then
+ # scrape the asciidoc version
+ AC_MSG_CHECKING([the asciidoc version])
+ asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
+ AC_MSG_RESULT([$asciidoc_version])
+ AS_VERSION_COMPARE([$asciidoc_version], [$1],
+ [if test "x$use_asciidoc" = xauto; then
+ AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
+ have_asciidoc=no
+ else
+ AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
+ fi])
+fi])
+AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
+]) # XORG_WITH_ASCIIDOC
+
+# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
+# --------------------------------
+# Minimum version: 1.5.0
+# Minimum version for optional DEFAULT argument: 1.11.0
+#
+# Documentation tools are not always available on all platforms and sometimes
+# not at the appropriate level. This macro enables a module to test for the
+# presence of the tool and obtain it's path in separate variables. Coupled with
+# the --with-doxygen option, it allows maximum flexibilty in making decisions
+# as whether or not to use the doxygen package. When DEFAULT is not specified,
+# --with-doxygen assumes 'auto'.
+#
+# Interface to module:
+# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
+# DOXYGEN: returns the path of the doxygen program found
+# returns the path set by the user in the environment
+# --with-doxygen: 'yes' user instructs the module to use doxygen
+# 'no' user instructs the module not to use doxygen
+#
+# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
+#
+AC_DEFUN([XORG_WITH_DOXYGEN],[
+AC_ARG_VAR([DOXYGEN], [Path to doxygen command])
+m4_define([_defopt], m4_default([$2], [auto]))
+AC_ARG_WITH(doxygen,
+ AS_HELP_STRING([--with-doxygen],
+ [Use doxygen to regenerate documentation (default: ]_defopt[)]),
+ [use_doxygen=$withval], [use_doxygen=]_defopt)
+m4_undefine([_defopt])
+
+if test "x$use_doxygen" = x"auto"; then
+ AC_PATH_PROG([DOXYGEN], [doxygen])
+ if test "x$DOXYGEN" = "x"; then
+ AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
+ have_doxygen=no
+ else
+ have_doxygen=yes
+ fi
+elif test "x$use_doxygen" = x"yes" ; then
+ AC_PATH_PROG([DOXYGEN], [doxygen])
+ if test "x$DOXYGEN" = "x"; then
+ AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
+ fi
+ have_doxygen=yes
+elif test "x$use_doxygen" = x"no" ; then
+ if test "x$DOXYGEN" != "x"; then
+ AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
+ fi
+ have_doxygen=no
+else
+ AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
+fi
+m4_ifval([$1],
+[if test "$have_doxygen" = yes; then
+ # scrape the doxygen version
+ AC_MSG_CHECKING([the doxygen version])
+ doxygen_version=`$DOXYGEN --version 2>/dev/null`
+ AC_MSG_RESULT([$doxygen_version])
+ AS_VERSION_COMPARE([$doxygen_version], [$1],
+ [if test "x$use_doxygen" = xauto; then
+ AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
+ have_doxygen=no
+ else
+ AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
+ fi])
+fi])
+AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
+]) # XORG_WITH_DOXYGEN
+
+# XORG_WITH_GROFF([DEFAULT])
+# ----------------
+# Minimum version: 1.6.0
+# Minimum version for optional DEFAULT argument: 1.11.0
+#
+# Documentation tools are not always available on all platforms and sometimes
+# not at the appropriate level. This macro enables a module to test for the
+# presence of the tool and obtain it's path in separate variables. Coupled with
+# the --with-groff option, it allows maximum flexibilty in making decisions
+# as whether or not to use the groff package. When DEFAULT is not specified,
+# --with-groff assumes 'auto'.
+#
+# Interface to module:
+# HAVE_GROFF: used in makefiles to conditionally generate documentation
+# HAVE_GROFF_MM: the memorandum macros (-mm) package
+# HAVE_GROFF_MS: the -ms macros package
+# GROFF: returns the path of the groff program found
+# returns the path set by the user in the environment
+# --with-groff: 'yes' user instructs the module to use groff
+# 'no' user instructs the module not to use groff
+#
+# Added in version 1.9.0:
+# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
+# pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
+# psselect from the psutils package.
+# the ghostcript package. Refer to the grohtml man pages
+#
+# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
+#
+# OS and distros often splits groff in a basic and full package, the former
+# having the groff program and the later having devices, fonts and macros
+# Checking for the groff executable is not enough.
+#
+# If macros are missing, we cannot assume that groff is useless, so we don't
+# unset HAVE_GROFF or GROFF env variables.
+# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
+#
+AC_DEFUN([XORG_WITH_GROFF],[
+AC_ARG_VAR([GROFF], [Path to groff command])
+m4_define([_defopt], m4_default([$1], [auto]))
+AC_ARG_WITH(groff,
+ AS_HELP_STRING([--with-groff],
+ [Use groff to regenerate documentation (default: ]_defopt[)]),
+ [use_groff=$withval], [use_groff=]_defopt)
+m4_undefine([_defopt])
+
+if test "x$use_groff" = x"auto"; then
+ AC_PATH_PROG([GROFF], [groff])
+ if test "x$GROFF" = "x"; then
+ AC_MSG_WARN([groff not found - documentation targets will be skipped])
+ have_groff=no
+ else
+ have_groff=yes
+ fi
+elif test "x$use_groff" = x"yes" ; then
+ AC_PATH_PROG([GROFF], [groff])
+ if test "x$GROFF" = "x"; then
+ AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
+ fi
+ have_groff=yes
+elif test "x$use_groff" = x"no" ; then
+ if test "x$GROFF" != "x"; then
+ AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
+ fi
+ have_groff=no
+else
+ AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
+fi
+
+# We have groff, test for the presence of the macro packages
+if test "x$have_groff" = x"yes"; then
+ AC_MSG_CHECKING([for ${GROFF} -ms macros])
+ if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
+ groff_ms_works=yes
+ else
+ groff_ms_works=no
+ fi
+ AC_MSG_RESULT([$groff_ms_works])
+ AC_MSG_CHECKING([for ${GROFF} -mm macros])
+ if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
+ groff_mm_works=yes
+ else
+ groff_mm_works=no
+ fi
+ AC_MSG_RESULT([$groff_mm_works])
+fi
+
+# We have groff, test for HTML dependencies, one command per package
+if test "x$have_groff" = x"yes"; then
+ AC_PATH_PROGS(GS_PATH, [gs gswin32c])
+ AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
+ AC_PATH_PROG(PSSELECT_PATH, [psselect])
+ if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
+ have_groff_html=yes
+ else
+ have_groff_html=no
+ AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
+ fi
+fi
+
+# Set Automake conditionals for Makefiles
+AM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
+AM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
+AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
+AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
+]) # XORG_WITH_GROFF
+
+# XORG_WITH_FOP([DEFAULT])
+# ----------------
+# Minimum version: 1.6.0
+# Minimum version for optional DEFAULT argument: 1.11.0
+#
+# Documentation tools are not always available on all platforms and sometimes
+# not at the appropriate level. This macro enables a module to test for the
+# presence of the tool and obtain it's path in separate variables. Coupled with
+# the --with-fop option, it allows maximum flexibilty in making decisions
+# as whether or not to use the fop package. When DEFAULT is not specified,
+# --with-fop assumes 'auto'.
+#
+# Interface to module:
+# HAVE_FOP: used in makefiles to conditionally generate documentation
+# FOP: returns the path of the fop program found
+# returns the path set by the user in the environment
+# --with-fop: 'yes' user instructs the module to use fop
+# 'no' user instructs the module not to use fop
+#
+# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
+#
+AC_DEFUN([XORG_WITH_FOP],[
+AC_ARG_VAR([FOP], [Path to fop command])
+m4_define([_defopt], m4_default([$1], [auto]))
+AC_ARG_WITH(fop,
+ AS_HELP_STRING([--with-fop],
+ [Use fop to regenerate documentation (default: ]_defopt[)]),
+ [use_fop=$withval], [use_fop=]_defopt)
+m4_undefine([_defopt])
+
+if test "x$use_fop" = x"auto"; then
+ AC_PATH_PROG([FOP], [fop])
+ if test "x$FOP" = "x"; then
+ AC_MSG_WARN([fop not found - documentation targets will be skipped])
+ have_fop=no
+ else
+ have_fop=yes
+ fi
+elif test "x$use_fop" = x"yes" ; then
+ AC_PATH_PROG([FOP], [fop])
+ if test "x$FOP" = "x"; then
+ AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
+ fi
+ have_fop=yes
+elif test "x$use_fop" = x"no" ; then
+ if test "x$FOP" != "x"; then
+ AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
+ fi
+ have_fop=no
+else
+ AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
+fi
+AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
+]) # XORG_WITH_FOP
+
+# XORG_WITH_PS2PDF([DEFAULT])
+# ----------------
+# Minimum version: 1.6.0
+# Minimum version for optional DEFAULT argument: 1.11.0
+#
+# Documentation tools are not always available on all platforms and sometimes
+# not at the appropriate level. This macro enables a module to test for the
+# presence of the tool and obtain it's path in separate variables. Coupled with
+# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
+# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
+# --with-ps2pdf assumes 'auto'.
+#
+# Interface to module:
+# HAVE_PS2PDF: used in makefiles to conditionally generate documentation
+# PS2PDF: returns the path of the ps2pdf program found
+# returns the path set by the user in the environment
+# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
+# 'no' user instructs the module not to use ps2pdf
+#
+# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
+#
+AC_DEFUN([XORG_WITH_PS2PDF],[
+AC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
+m4_define([_defopt], m4_default([$1], [auto]))
+AC_ARG_WITH(ps2pdf,
+ AS_HELP_STRING([--with-ps2pdf],
+ [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
+ [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
+m4_undefine([_defopt])
+
+if test "x$use_ps2pdf" = x"auto"; then
+ AC_PATH_PROG([PS2PDF], [ps2pdf])
+ if test "x$PS2PDF" = "x"; then
+ AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
+ have_ps2pdf=no
+ else
+ have_ps2pdf=yes
+ fi
+elif test "x$use_ps2pdf" = x"yes" ; then
+ AC_PATH_PROG([PS2PDF], [ps2pdf])
+ if test "x$PS2PDF" = "x"; then
+ AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
+ fi
+ have_ps2pdf=yes
+elif test "x$use_ps2pdf" = x"no" ; then
+ if test "x$PS2PDF" != "x"; then
+ AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
+ fi
+ have_ps2pdf=no
+else
+ AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
+fi
+AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
+]) # XORG_WITH_PS2PDF
+
+# XORG_ENABLE_DOCS (enable_docs=yes)
+# ----------------
+# Minimum version: 1.6.0
+#
+# Documentation tools are not always available on all platforms and sometimes
+# not at the appropriate level. This macro enables a builder to skip all
+# documentation targets except traditional man pages.
+# Combined with the specific tool checking macros XORG_WITH_*, it provides
+# maximum flexibilty in controlling documentation building.
+# Refer to:
+# XORG_WITH_XMLTO --with-xmlto
+# XORG_WITH_ASCIIDOC --with-asciidoc
+# XORG_WITH_DOXYGEN --with-doxygen
+# XORG_WITH_FOP --with-fop
+# XORG_WITH_GROFF --with-groff
+# XORG_WITH_PS2PDF --with-ps2pdf
+#
+# Interface to module:
+# ENABLE_DOCS: used in makefiles to conditionally generate documentation
+# --enable-docs: 'yes' user instructs the module to generate docs
+# 'no' user instructs the module not to generate docs
+# parm1: specify the default value, yes or no.
+#
+AC_DEFUN([XORG_ENABLE_DOCS],[
+m4_define([default], m4_default([$1], [yes]))
+AC_ARG_ENABLE(docs,
+ AS_HELP_STRING([--enable-docs],
+ [Enable building the documentation (default: ]default[)]),
+ [build_docs=$enableval], [build_docs=]default)
+m4_undefine([default])
+AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
+AC_MSG_CHECKING([whether to build documentation])
+AC_MSG_RESULT([$build_docs])
+]) # XORG_ENABLE_DOCS
+
+# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
+# ----------------
+# Minimum version: 1.6.0
+#
+# This macro enables a builder to skip all developer documentation.
+# Combined with the specific tool checking macros XORG_WITH_*, it provides
+# maximum flexibilty in controlling documentation building.
+# Refer to:
+# XORG_WITH_XMLTO --with-xmlto
+# XORG_WITH_ASCIIDOC --with-asciidoc
+# XORG_WITH_DOXYGEN --with-doxygen
+# XORG_WITH_FOP --with-fop
+# XORG_WITH_GROFF --with-groff
+# XORG_WITH_PS2PDF --with-ps2pdf
+#
+# Interface to module:
+# ENABLE_DEVEL_DOCS: used in makefiles to conditionally generate developer docs
+# --enable-devel-docs: 'yes' user instructs the module to generate developer docs
+# 'no' user instructs the module not to generate developer docs
+# parm1: specify the default value, yes or no.
+#
+AC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
+m4_define([devel_default], m4_default([$1], [yes]))
+AC_ARG_ENABLE(devel-docs,
+ AS_HELP_STRING([--enable-devel-docs],
+ [Enable building the developer documentation (default: ]devel_default[)]),
+ [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
+m4_undefine([devel_default])
+AM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
+AC_MSG_CHECKING([whether to build developer documentation])
+AC_MSG_RESULT([$build_devel_docs])
+]) # XORG_ENABLE_DEVEL_DOCS
+
+# XORG_ENABLE_SPECS (enable_specs=yes)
+# ----------------
+# Minimum version: 1.6.0
+#
+# This macro enables a builder to skip all functional specification targets.
+# Combined with the specific tool checking macros XORG_WITH_*, it provides
+# maximum flexibilty in controlling documentation building.
+# Refer to:
+# XORG_WITH_XMLTO --with-xmlto
+# XORG_WITH_ASCIIDOC --with-asciidoc
+# XORG_WITH_DOXYGEN --with-doxygen
+# XORG_WITH_FOP --with-fop
+# XORG_WITH_GROFF --with-groff
+# XORG_WITH_PS2PDF --with-ps2pdf
+#
+# Interface to module:
+# ENABLE_SPECS: used in makefiles to conditionally generate specs
+# --enable-specs: 'yes' user instructs the module to generate specs
+# 'no' user instructs the module not to generate specs
+# parm1: specify the default value, yes or no.
+#
+AC_DEFUN([XORG_ENABLE_SPECS],[
+m4_define([spec_default], m4_default([$1], [yes]))
+AC_ARG_ENABLE(specs,
+ AS_HELP_STRING([--enable-specs],
+ [Enable building the specs (default: ]spec_default[)]),
+ [build_specs=$enableval], [build_specs=]spec_default)
+m4_undefine([spec_default])
+AM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
+AC_MSG_CHECKING([whether to build functional specifications])
+AC_MSG_RESULT([$build_specs])
+]) # XORG_ENABLE_SPECS
+
# XORG_CHECK_MALLOC_ZERO
# ----------------------
# Minimum version: 1.0.0
@@ -1336,7 +1914,8 @@ main() {
exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1);
}],
[MALLOC_ZERO_RETURNS_NULL=yes],
- [MALLOC_ZERO_RETURNS_NULL=no])
+ [MALLOC_ZERO_RETURNS_NULL=no],
+ [MALLOC_ZERO_RETURNS_NULL=yes])
fi
AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
@@ -1359,38 +1938,69 @@ AC_SUBST([XTMALLOC_ZERO_CFLAGS])
# ----------------
# Minimum version: 1.1.0
#
-# Sets up flags for source checkers such as lint and sparse if --with-lint
-# is specified. (Use --with-lint=sparse for sparse.)
-# Sets $LINT to name of source checker passed with --with-lint (default: lint)
-# Sets $LINT_FLAGS to flags to pass to source checker
-# Sets LINT automake conditional if enabled (default: disabled)
+# This macro enables the use of a tool that flags some suspicious and
+# non-portable constructs (likely to be bugs) in C language source code.
+# It will attempt to locate the tool and use appropriate options.
+# There are various lint type tools on different platforms.
+#
+# Interface to module:
+# LINT: returns the path to the tool found on the platform
+# or the value set to LINT on the configure cmd line
+# also an Automake conditional
+# LINT_FLAGS: an Automake variable with appropriate flags
+#
+# --with-lint: 'yes' user instructs the module to use lint
+# 'no' user instructs the module not to use lint (default)
+#
+# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
+# If the user sets the value of LINT_FLAGS, they are used verbatim.
#
AC_DEFUN([XORG_WITH_LINT],[
-# Allow checking code with lint, sparse, etc.
+AC_ARG_VAR([LINT], [Path to a lint-style command])
+AC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
AC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
[Use a lint-style source code checker (default: disabled)])],
[use_lint=$withval], [use_lint=no])
-if test "x$use_lint" = "xyes" ; then
- LINT="lint"
+
+# Obtain platform specific info like program name and options
+# The lint program on FreeBSD and NetBSD is different from the one on Solaris
+case $host_os in
+ *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
+ lint_name=splint
+ lint_options="-badflag"
+ ;;
+ *freebsd* | *netbsd*)
+ lint_name=lint
+ lint_options="-u -b"
+ ;;
+ *solaris*)
+ lint_name=lint
+ lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
+ ;;
+esac
+
+# Test for the presence of the program (either guessed by the code or spelled out by the user)
+if test "x$use_lint" = x"yes" ; then
+ AC_PATH_PROG([LINT], [$lint_name])
+ if test "x$LINT" = "x"; then
+ AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
+ fi
+elif test "x$use_lint" = x"no" ; then
+ if test "x$LINT" != "x"; then
+ AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
+ fi
else
- LINT="$use_lint"
+ AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
fi
-if test "x$LINT_FLAGS" = "x" -a "x$LINT" != "xno" ; then
- case $LINT in
- lint|*/lint)
- case $host_os in
- solaris*)
- LINT_FLAGS="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
- ;;
- esac
- ;;
- esac
+
+# User supplied flags override default flags
+if test "x$LINT_FLAGS" != "x"; then
+ lint_options=$LINT_FLAGS
fi
-AC_SUBST(LINT)
-AC_SUBST(LINT_FLAGS)
-AM_CONDITIONAL(LINT, [test x$LINT != xno])
+AC_SUBST([LINT_FLAGS],[$lint_options])
+AM_CONDITIONAL(LINT, [test "x$LINT" != x])
]) # XORG_WITH_LINT
@@ -1400,28 +2010,29 @@ AM_CONDITIONAL(LINT, [test x$LINT != xno])
#
# Sets up flags for building lint libraries for checking programs that call
# functions in the library.
-# Disabled by default, enable with --enable-lint-library
-# Sets:
-# @LINTLIB@ - name of lint library file to make
-# MAKE_LINT_LIB - automake conditional
#
+# Interface to module:
+# LINTLIB - Automake variable with the name of lint library file to make
+# MAKE_LINT_LIB - Automake conditional
+#
+# --enable-lint-library: - 'yes' user instructs the module to created a lint library
+# - 'no' user instructs the module not to create a lint library (default)
AC_DEFUN([XORG_LINT_LIBRARY],[
AC_REQUIRE([XORG_WITH_LINT])
-# Build lint "library" for more indepth checks of programs calling this library
AC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
[Create lint library (default: disabled)])],
[make_lint_lib=$enableval], [make_lint_lib=no])
-if test "x$make_lint_lib" != "xno" ; then
- if test "x$LINT" = "xno" ; then
- AC_MSG_ERROR([Cannot make lint library without --with-lint])
- fi
- if test "x$make_lint_lib" = "xyes" ; then
- LINTLIB=llib-l$1.ln
- else
- LINTLIB=$make_lint_lib
- fi
+
+if test "x$make_lint_lib" = x"yes" ; then
+ LINTLIB=llib-l$1.ln
+ if test "x$LINT" = "x"; then
+ AC_MSG_ERROR([Cannot make lint library without --with-lint])
+ fi
+elif test "x$make_lint_lib" != x"no" ; then
+ AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
fi
+
AC_SUBST(LINTLIB)
AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
@@ -1434,11 +2045,11 @@ AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
# Defines CWARNFLAGS to enable C compiler warnings.
#
AC_DEFUN([XORG_CWARNFLAGS], [
-AC_REQUIRE([AC_PROG_CC])
+AC_REQUIRE([AC_PROG_CC_C99])
if test "x$GCC" = xyes ; then
CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
--Wbad-function-cast"
+-Wbad-function-cast -Wformat=2"
case `$CC -dumpversion` in
3.4.* | 4.*)
CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
@@ -1451,7 +2062,6 @@ else
fi
fi
AC_SUBST(CWARNFLAGS)
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
]) # XORG_CWARNFLAGS
# XORG_STRICT_OPTION
@@ -1460,7 +2070,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
#
# Add configure option to enable strict compilation
AC_DEFUN([XORG_STRICT_OPTION], [
-AC_REQUIRE([AC_PROG_CC])
+# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
AC_REQUIRE([AC_PROG_CC_C99])
AC_REQUIRE([XORG_CWARNFLAGS])
@@ -1490,12 +2100,33 @@ AC_SUBST([CWARNFLAGS])
# Defines default options for X.Org modules.
#
AC_DEFUN([XORG_DEFAULT_OPTIONS], [
+AC_REQUIRE([AC_PROG_INSTALL])
XORG_CWARNFLAGS
XORG_STRICT_OPTION
XORG_RELEASE_VERSION
XORG_CHANGELOG
+XORG_INSTALL
XORG_MANPAGE_SECTIONS
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
+ [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
]) # XORG_DEFAULT_OPTIONS
+
+# XORG_INSTALL()
+# ----------------
+# Minimum version: 1.4.0
+#
+# Defines the variable INSTALL_CMD as the command to copy
+# INSTALL from $prefix/share/util-macros.
+#
+AC_DEFUN([XORG_INSTALL], [
+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)"
+AC_SUBST([INSTALL_CMD])
+]) # XORG_INSTALL
dnl Copyright 2005 Red Hat, Inc
dnl
dnl Permission to use, copy, modify, distribute, and sell this software and its
@@ -1523,22 +2154,9 @@ dnl
# XORG_RELEASE_VERSION
# --------------------
-# Adds --with/without-release-string and changes the PACKAGE and
-# PACKAGE_TARNAME to use "$PACKAGE{_TARNAME}-$RELEASE_VERSION". If
-# no option is given, PACKAGE and PACKAGE_TARNAME are unchanged. Also
-# defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
+# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
AC_DEFUN([XORG_RELEASE_VERSION],[
- AC_ARG_WITH(release-version,
- AS_HELP_STRING([--with-release-version=STRING],
- [Use release version string in package name]),
- [RELEASE_VERSION="$withval"],
- [RELEASE_VERSION=""])
- if test "x$RELEASE_VERSION" != "x"; then
- PACKAGE="$PACKAGE-$RELEASE_VERSION"
- PACKAGE_TARNAME="$PACKAGE_TARNAME-$RELEASE_VERSION"
- AC_MSG_NOTICE([Building with package name set to $PACKAGE])
- fi
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
[`echo $PACKAGE_VERSION | cut -d . -f 1`],
[Major version of this package])
@@ -1565,13 +2183,12 @@ AC_DEFUN([XORG_RELEASE_VERSION],[
# Defines the variable CHANGELOG_CMD as the command to generate
# ChangeLog from git.
#
-# Arrange that distcleancheck ignores ChangeLog left over by distclean.
#
AC_DEFUN([XORG_CHANGELOG], [
-CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > .changelog.tmp && \
-mv .changelog.tmp ChangeLog) || (rm -f .changelog.tmp; touch ChangeLog; \
+CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
+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)"
AC_SUBST([CHANGELOG_CMD])
-AC_SUBST([distcleancheck_listfiles], ['find . -type f ! -name ChangeLog -print'])
]) # XORG_CHANGELOG
diff --git a/app/xwininfo/clientwin.c b/app/xwininfo/clientwin.c
index cce35ad24..2b1de04e8 100644
--- a/app/xwininfo/clientwin.c
+++ b/app/xwininfo/clientwin.c
@@ -19,47 +19,59 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
-#include <X11/Xatom.h>
-#include <X11/Xlib.h>
+#include <xcb/xcb.h>
+#include <xcb/xproto.h>
+
+#include <stdlib.h>
+#include <string.h>
#include "clientwin.h"
+#include "dsimple.h"
-static Atom atom_wm_state = None;
+static xcb_atom_t atom_wm_state = XCB_ATOM_NONE;
/*
* Check if window has given property
*/
static Bool
-Window_Has_Property(Display * dpy, Window win, Atom atom)
+Window_Has_Property(xcb_connection_t * dpy, xcb_window_t win, xcb_atom_t atom)
{
- Atom type_ret;
- int format_ret;
- unsigned char *prop_ret;
- unsigned long bytes_after, num_ret;
-
- type_ret = None;
- prop_ret = NULL;
- XGetWindowProperty(dpy, win, atom, 0, 0, False, AnyPropertyType,
- &type_ret, &format_ret, &num_ret,
- &bytes_after, &prop_ret);
- if (prop_ret)
- XFree(prop_ret);
-
- return (type_ret != None) ? True : False;
+ xcb_get_property_cookie_t prop_cookie;
+ xcb_get_property_reply_t *prop_reply;
+
+ prop_cookie = xcb_get_property (dpy, False, win, atom,
+ XCB_GET_PROPERTY_TYPE_ANY, 0, 0);
+
+ prop_reply = xcb_get_property_reply (dpy, prop_cookie, NULL);
+
+ if (prop_reply) {
+ xcb_atom_t reply_type = prop_reply->type;
+ free (prop_reply);
+ if (reply_type != XCB_NONE)
+ return True;
+ }
+
+ return False;
}
/*
* Check if window is viewable
*/
static Bool
-Window_Is_Viewable(Display * dpy, Window win)
+Window_Is_Viewable(xcb_connection_t * dpy, xcb_window_t win)
{
- Bool ok;
- XWindowAttributes xwa;
+ Bool ok = False;
+ xcb_get_window_attributes_cookie_t attr_cookie;
+ xcb_get_window_attributes_reply_t *xwa;
- XGetWindowAttributes(dpy, win, &xwa);
+ attr_cookie = xcb_get_window_attributes (dpy, win);
+ xwa = xcb_get_window_attributes_reply (dpy, attr_cookie, NULL);
- ok = (xwa.class == InputOutput) && (xwa.map_state == IsViewable);
+ if (xwa) {
+ ok = (xwa->_class == XCB_WINDOW_CLASS_INPUT_OUTPUT) &&
+ (xwa->map_state == XCB_MAP_STATE_VIEWABLE);
+ free (xwa);
+ }
return ok;
}
@@ -70,24 +82,32 @@ Window_Is_Viewable(Display * dpy, Window win)
* Children are searched in top-down stacking order.
* The first matching window is returned, None if no match is found.
*/
-static Window
-Find_Client_In_Children(Display * dpy, Window win)
+static xcb_window_t
+Find_Client_In_Children(xcb_connection_t * dpy, xcb_window_t win)
{
- Window root, parent;
- Window *children;
+ xcb_query_tree_cookie_t qt_cookie;
+ xcb_query_tree_reply_t *tree;
+ xcb_window_t *children;
unsigned int n_children;
int i;
- if (!XQueryTree(dpy, win, &root, &parent, &children, &n_children))
- return None;
- if (!children)
- return None;
+ qt_cookie = xcb_query_tree (dpy, win);
+ tree = xcb_query_tree_reply (dpy, qt_cookie, NULL);
+ if (!tree)
+ return XCB_WINDOW_NONE;
+ n_children = xcb_query_tree_children_length (tree);
+ if (!n_children) {
+ free (tree);
+ return XCB_WINDOW_NONE;
+ }
+ children = xcb_query_tree_children (tree);
/* Check each child for WM_STATE and other validity */
- win = None;
+ win = XCB_WINDOW_NONE;
for (i = (int) n_children - 1; i >= 0; i--) {
if (!Window_Is_Viewable(dpy, children[i])) {
- children[i] = None; /* Don't bother descending into this one */
+ /* Don't bother descending into this one */
+ children[i] = XCB_WINDOW_NONE;
continue;
}
if (!Window_Has_Property(dpy, children[i], atom_wm_state))
@@ -100,15 +120,15 @@ Find_Client_In_Children(Display * dpy, Window win)
/* No children matched, now descend into each child */
for (i = (int) n_children - 1; i >= 0; i--) {
- if (children[i] == None)
+ if (children[i] == XCB_WINDOW_NONE)
continue;
win = Find_Client_In_Children(dpy, children[i]);
- if (win != None)
+ if (win != XCB_WINDOW_NONE)
break;
}
done:
- XFree(children);
+ free (tree); /* includes children */
return win;
}
@@ -116,49 +136,60 @@ Find_Client_In_Children(Display * dpy, Window win)
/*
* Find virtual roots (_NET_VIRTUAL_ROOTS)
*/
-static unsigned long *
-Find_Roots(Display * dpy, Window root, unsigned int *num)
+static xcb_window_t *
+Find_Roots(xcb_connection_t * dpy, xcb_window_t root, unsigned int *num)
{
- Atom type_ret;
- int format_ret;
- unsigned char *prop_ret;
- unsigned long bytes_after, num_ret;
- Atom atom;
+ xcb_atom_t atom_virtual_root;
+
+ xcb_get_property_cookie_t prop_cookie;
+ xcb_get_property_reply_t *prop_reply;
+
+ xcb_window_t *prop_ret = NULL;
*num = 0;
- atom = XInternAtom(dpy, "_NET_VIRTUAL_ROOTS", False);
- if (!atom)
+
+ atom_virtual_root = Get_Atom (dpy, "_NET_VIRTUAL_ROOTS");
+ if (atom_virtual_root == XCB_ATOM_NONE)
return NULL;
- type_ret = None;
- prop_ret = NULL;
- if (XGetWindowProperty(dpy, root, atom, 0, 0x7fffffff, False,
- XA_WINDOW, &type_ret, &format_ret, &num_ret,
- &bytes_after, &prop_ret) != Success)
+ prop_cookie = xcb_get_property (dpy, False, root, atom_virtual_root,
+ XCB_ATOM_WINDOW, 0, 0x7fffffff);
+ prop_reply = xcb_get_property_reply (dpy, prop_cookie, NULL);
+ if (!prop_reply)
return NULL;
- if (prop_ret && type_ret == XA_WINDOW && format_ret == 32) {
- *num = num_ret;
- return ((unsigned long *) prop_ret);
+ if ((prop_reply->value_len > 0) && (prop_reply->type == XCB_ATOM_WINDOW)
+ && (prop_reply->format == 32)) {
+ int length = xcb_get_property_value_length (prop_reply);
+ prop_ret = malloc(length);
+ if (prop_ret) {
+ memcpy (prop_ret, xcb_get_property_value(prop_reply), length);
+ *num = prop_reply->value_len;
+ }
}
- if (prop_ret)
- XFree(prop_ret);
+ free (prop_reply);
- return NULL;
+ return prop_ret;
}
/*
* Find child window at pointer location
*/
-static Window
-Find_Child_At_Pointer(Display * dpy, Window win)
+static xcb_window_t
+Find_Child_At_Pointer(xcb_connection_t * dpy, xcb_window_t win)
{
- Window root_return, child_return;
- int dummyi;
- unsigned int dummyu;
+ xcb_window_t child_return = XCB_WINDOW_NONE;
- XQueryPointer(dpy, win, &root_return, &child_return,
- &dummyi, &dummyi, &dummyi, &dummyi, &dummyu);
+ xcb_query_pointer_cookie_t qp_cookie;
+ xcb_query_pointer_reply_t *qp_reply;
+
+ qp_cookie = xcb_query_pointer (dpy, win);
+ qp_reply = xcb_query_pointer_reply (dpy, qp_cookie, NULL);
+
+ if (qp_reply) {
+ child_return = qp_reply->child;
+ free (qp_reply);
+ }
return child_return;
}
@@ -175,12 +206,12 @@ Find_Child_At_Pointer(Display * dpy, Window win)
* This will of course work only if the virtual roots are children of the real
* root.
*/
-Window
-Find_Client(Display * dpy, Window root, Window subwin)
+xcb_window_t
+Find_Client(xcb_connection_t * dpy, xcb_window_t root, xcb_window_t subwin)
{
- unsigned long *roots;
+ xcb_window_t *roots;
unsigned int i, n_roots;
- Window win;
+ xcb_window_t win;
/* Check if subwin is a virtual root */
roots = Find_Roots(dpy, root, &n_roots);
@@ -188,17 +219,16 @@ Find_Client(Display * dpy, Window root, Window subwin)
if (subwin != roots[i])
continue;
win = Find_Child_At_Pointer(dpy, subwin);
- if (win == None)
+ if (win == XCB_WINDOW_NONE)
return subwin; /* No child - Return virtual root. */
subwin = win;
break;
}
- if (roots)
- XFree(roots);
+ free (roots);
- if (atom_wm_state == None) {
- atom_wm_state = XInternAtom(dpy, "WM_STATE", False);
- if (!atom_wm_state)
+ if (atom_wm_state == XCB_ATOM_NONE) {
+ atom_wm_state = Get_Atom(dpy, "WM_STATE");
+ if (atom_wm_state == XCB_ATOM_NONE)
return subwin;
}
@@ -208,7 +238,7 @@ Find_Client(Display * dpy, Window root, Window subwin)
/* Attempt to find a client window in subwin's children */
win = Find_Client_In_Children(dpy, subwin);
- if (win != None)
+ if (win != XCB_WINDOW_NONE)
return win; /* Found a client */
/* Did not find a client */
diff --git a/app/xwininfo/clientwin.h b/app/xwininfo/clientwin.h
index 9fc59b5eb..05aa20293 100644
--- a/app/xwininfo/clientwin.h
+++ b/app/xwininfo/clientwin.h
@@ -22,8 +22,10 @@
#ifndef _CLIENTWIN_H_
#define _CLIENTWIN_H_
-#include <X11/Xlib.h>
+#include <xcb/xcb.h>
+#include <xcb/xproto.h>
-extern Window Find_Client(Display * dpy, Window root, Window target_win);
+extern xcb_window_t Find_Client(xcb_connection_t * dpy, xcb_window_t root,
+ xcb_window_t target_win);
#endif
diff --git a/app/xwininfo/config.h.in b/app/xwininfo/config.h.in
index 345295568..cc39d1f47 100644
--- a/app/xwininfo/config.h.in
+++ b/app/xwininfo/config.h.in
@@ -1,5 +1,8 @@
/* config.h.in. Generated from configure.ac by autoheader. */
+/* Define to 1 if you have the iconv() function */
+#undef HAVE_ICONV
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@@ -21,6 +24,9 @@
/* Define to 1 if you have the `strlcat' function. */
#undef HAVE_STRLCAT
+/* Define to 1 if you have a working strnlen function. */
+#undef HAVE_STRNLEN
+
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
@@ -60,5 +66,41 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
+/* Define to 1 to call xcb-icccm library functions instead of local
+ replacements */
+#undef USE_XCB_ICCCM
+
/* Version number of package */
#undef VERSION
+
+/* Define to 1 if on MINIX. */
+#undef _MINIX
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+ this defined. */
+#undef _POSIX_1_SOURCE
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#undef _POSIX_SOURCE
+
+/* Enable extensions on AIX 3, Interix. */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable threading extensions on Solaris. */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop. */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
diff --git a/app/xwininfo/configure b/app/xwininfo/configure
index f34f02ceb..883b4bf78 100644
--- a/app/xwininfo/configure
+++ b/app/xwininfo/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.62 for xwininfo 1.0.5.
+# Generated by GNU Autoconf 2.62 for xwininfo 1.1.1.
#
# Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>.
#
@@ -596,8 +596,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='xwininfo'
PACKAGE_TARNAME='xwininfo'
-PACKAGE_VERSION='1.0.5'
-PACKAGE_STRING='xwininfo 1.0.5'
+PACKAGE_VERSION='1.1.1'
+PACKAGE_STRING='xwininfo 1.1.1'
PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg'
# Factoring default headers for most tests.
@@ -718,7 +718,8 @@ GREP
EGREP
CWARNFLAGS
CHANGELOG_CMD
-distcleancheck_listfiles
+PKG_CONFIG
+INSTALL_CMD
build
build_cpu
build_vendor
@@ -727,6 +728,7 @@ host
host_cpu
host_vendor
host_os
+SED
APP_MAN_SUFFIX
LIB_MAN_SUFFIX
FILE_MAN_SUFFIX
@@ -739,10 +741,14 @@ FILE_MAN_DIR
MISC_MAN_DIR
DRIVER_MAN_DIR
ADMIN_MAN_DIR
-PKG_CONFIG
+XORG_MAN_PAGE
+MAN_SUBSTS
+AM_DEFAULT_VERBOSITY
+LIBOBJS
XWININFO_CFLAGS
XWININFO_LIBS
-LIBOBJS
+XLIB_CFLAGS
+XLIB_LIBS
LTLIBOBJS'
ac_subst_files=''
ac_user_opts='
@@ -750,7 +756,7 @@ enable_option_checking
enable_maintainer_mode
enable_dependency_tracking
enable_strict_compilation
-with_release_version
+with_xcb_icccm
'
ac_precious_vars='build_alias
host_alias
@@ -763,7 +769,9 @@ CPPFLAGS
CPP
PKG_CONFIG
XWININFO_CFLAGS
-XWININFO_LIBS'
+XWININFO_LIBS
+XLIB_CFLAGS
+XLIB_LIBS'
# Initialize some variables set by options.
@@ -1316,7 +1324,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 xwininfo 1.0.5 to adapt to many kinds of systems.
+\`configure' configures xwininfo 1.1.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1386,7 +1394,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of xwininfo 1.0.5:";;
+ short | recursive ) echo "Configuration of xwininfo 1.1.1:";;
esac
cat <<\_ACEOF
@@ -1405,8 +1413,7 @@ Optional Features:
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --with-release-version=STRING
- Use release version string in package name
+ --with-xcb-icccm use xcb-icccm (default: no)
Some influential environment variables:
CC C compiler command
@@ -1422,6 +1429,8 @@ Some influential environment variables:
C compiler flags for XWININFO, overriding pkg-config
XWININFO_LIBS
linker flags for XWININFO, overriding pkg-config
+ XLIB_CFLAGS C compiler flags for XLIB, overriding pkg-config
+ XLIB_LIBS linker flags for XLIB, overriding pkg-config
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
@@ -1489,7 +1498,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-xwininfo configure 1.0.5
+xwininfo configure 1.1.1
generated by GNU Autoconf 2.62
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1503,7 +1512,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 xwininfo $as_me 1.0.5, which was
+It was created by xwininfo $as_me 1.1.1, which was
generated by GNU Autoconf 2.62. Invocation command line was
$ $0 $@
@@ -2152,7 +2161,7 @@ fi
# Define the identity of the package.
PACKAGE='xwininfo'
- VERSION='1.0.5'
+ VERSION='1.1.1'
cat >>confdefs.h <<_ACEOF
@@ -2323,7 +2332,7 @@ fi
-# Require xorg-macros 1.3 or later: XORG_DEFAULT_OPTIONS
+# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
@@ -2339,6 +2348,71 @@ fi
ac_config_headers="$ac_config_headers config.h"
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+
+
+{ $as_echo "$as_me:$LINENO: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+
+
+if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -3269,71 +3343,6 @@ ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-DEPDIR="${am__leading_dot}deps"
-
-ac_config_commands="$ac_config_commands depfiles"
-
-
-am_make=${MAKE-make}
-cat > confinc << 'END'
-am__doit:
- @echo done
-.PHONY: am__doit
-END
-# If we don't find an include directive, just comment out the code.
-{ $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
-$as_echo_n "checking for style of include used by $am_make... " >&6; }
-am__include="#"
-am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# We grep out `Entering directory' and `Leaving directory'
-# messages which can occur if `w' ends up in MAKEFLAGS.
-# In particular we don't look at `^make:' because GNU make might
-# be invoked under some other name (usually "gmake"), in which
-# case it prints its new name instead of `make'.
-if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
- am__include=include
- am__quote=
- _am_result=GNU
-fi
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
- echo '.include "confinc"' > confmf
- if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
- am__include=.include
- am__quote="\""
- _am_result=BSD
- fi
-fi
-
-
-{ $as_echo "$as_me:$LINENO: result: $_am_result" >&5
-$as_echo "$_am_result" >&6; }
-rm -f confinc confmf
-
-# Check whether --enable-dependency-tracking was given.
-if test "${enable_dependency_tracking+set}" = set; then
- enableval=$enable_dependency_tracking;
-fi
-
-if test "x$enable_dependency_tracking" != xno; then
- am_depcomp="$ac_aux_dir/depcomp"
- AMDEPBACKSLASH='\'
-fi
-
-
-if test "x$enable_dependency_tracking" != xno; then
- AMDEP_TRUE=
- AMDEP_FALSE='#'
-else
- AMDEP_TRUE='#'
- AMDEP_FALSE=
-fi
-
-
-
depcc="$CC" am_compiler_list=
@@ -3444,100 +3453,6 @@ else
fi
-# Find a good install program. We prefer a C program (faster),
-# so one script is as good as another. But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AmigaOS /C/install, which installs bootblocks on floppy discs
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# OS/2's system install, which has a completely different semantic
-# ./install, which can be erroneously created by make from ./install.sh.
-# Reject install programs that cannot install multiple files.
-{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-$as_echo_n "checking for a BSD-compatible install... " >&6; }
-if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in
- ./ | .// | /cC/* | \
- /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
- ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
- /usr/ucb/* ) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- # Don't use installbsd from OSF since it installs stuff as root
- # by default.
- for ac_prog in ginstall scoinst install; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
- if test $ac_prog = install &&
- grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- elif test $ac_prog = install &&
- grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
- # program-specific install script used by HP pwplus--don't use.
- :
- else
- rm -rf conftest.one conftest.two conftest.dir
- echo one > conftest.one
- echo two > conftest.two
- mkdir conftest.dir
- if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
- test -s conftest.one && test -s conftest.two &&
- test -s conftest.dir/conftest.one &&
- test -s conftest.dir/conftest.two
- then
- ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
- break 3
- fi
- fi
- fi
- done
- done
- ;;
-esac
-
-done
-IFS=$as_save_IFS
-
-rm -rf conftest.one conftest.two conftest.dir
-
-fi
- if test "${ac_cv_path_install+set}" = set; then
- INSTALL=$ac_cv_path_install
- else
- # As a last resort, use the slow shell script. Don't cache a
- # value for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the value is a relative name.
- INSTALL=$ac_install_sh
- fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
-$as_echo "$INSTALL" >&6; }
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -4158,6 +4073,241 @@ fi
done
+
+ if test "${ac_cv_header_minix_config_h+set}" = set; then
+ { $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5
+$as_echo_n "checking for minix/config.h... " >&6; }
+if test "${ac_cv_header_minix_config_h+set}" = set; then
+ $as_echo_n "(cached) " >&6
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
+$as_echo "$ac_cv_header_minix_config_h" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking minix/config.h usability" >&5
+$as_echo_n "checking minix/config.h usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <minix/config.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking minix/config.h presence" >&5
+$as_echo_n "checking minix/config.h presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <minix/config.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: minix/config.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: minix/config.h: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: minix/config.h: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: minix/config.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ---------------------------------------------------------------------- ##
+## Report this to https://bugs.freedesktop.org/enter_bug.cgi?product=xorg ##
+## ---------------------------------------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5
+$as_echo_n "checking for minix/config.h... " >&6; }
+if test "${ac_cv_header_minix_config_h+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_header_minix_config_h=$ac_header_preproc
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
+$as_echo "$ac_cv_header_minix_config_h" >&6; }
+
+fi
+if test $ac_cv_header_minix_config_h = yes; then
+ MINIX=yes
+else
+ MINIX=
+fi
+
+
+ if test "$MINIX" = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _POSIX_SOURCE 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define _POSIX_1_SOURCE 2
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define _MINIX 1
+_ACEOF
+
+ fi
+
+
+
+ { $as_echo "$as_me:$LINENO: checking whether it is safe to define __EXTENSIONS__" >&5
+$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
+if test "${ac_cv_safe_to_define___extensions__+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+# define __EXTENSIONS__ 1
+ $ac_includes_default
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_safe_to_define___extensions__=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_safe_to_define___extensions__=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_safe_to_define___extensions__" >&5
+$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
+ test $ac_cv_safe_to_define___extensions__ = yes &&
+ cat >>confdefs.h <<\_ACEOF
+#define __EXTENSIONS__ 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define _ALL_SOURCE 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define _GNU_SOURCE 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define _POSIX_PTHREAD_SEMANTICS 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define _TANDEM_SOURCE 1
+_ACEOF
+
+
+
{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C99" >&5
$as_echo_n "checking for $CC option to accept ISO C99... " >&6; }
if test "${ac_cv_prog_cc_c99+set}" = set; then
@@ -4360,6 +4510,126 @@ esac
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ case $PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+ { $as_echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+ ac_pt_PKG_CONFIG=$PKG_CONFIG
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_PKG_CONFIG" = x; then
+ PKG_CONFIG=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ PKG_CONFIG=$ac_pt_PKG_CONFIG
+ fi
+else
+ PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=0.9.0
+ { $as_echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+ PKG_CONFIG=""
+ fi
+
+fi
# Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
{ { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
@@ -4443,13 +4713,85 @@ IFS=$ac_save_IFS
case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+{ $as_echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if test "${ac_cv_path_SED+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+ for ac_i in 1 2 3 4 5 6 7; do
+ ac_script="$ac_script$as_nl$ac_script"
+ done
+ echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+ $as_unset ac_script || ac_script=
+ if test -z "$SED"; then
+ ac_path_SED_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+# Check for GNU ac_path_SED and select it if it is found.
+ # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+ ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo '' >> "conftest.nl"
+ "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ ac_count=`expr $ac_count + 1`
+ if test $ac_count -gt ${ac_path_SED_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_SED="$ac_path_SED"
+ ac_path_SED_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_SED_found && break 3
+ done
+ done
+done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_SED"; then
+ { { $as_echo "$as_me:$LINENO: error: no acceptable sed could be found in \$PATH" >&5
+$as_echo "$as_me: error: no acceptable sed could be found in \$PATH" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+else
+ ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+ rm -f conftest.sed
+
+
if test "x$GCC" = xyes ; then
CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
--Wbad-function-cast"
+-Wbad-function-cast -Wformat=2"
case `$CC -dumpversion` in
3.4.* | 4.*)
CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
@@ -4522,8 +4864,7 @@ fi
-
-
+# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
@@ -4666,20 +5007,6 @@ CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
-# Check whether --with-release-version was given.
-if test "${with_release_version+set}" = set; then
- withval=$with_release_version; RELEASE_VERSION="$withval"
-else
- RELEASE_VERSION=""
-fi
-
- if test "x$RELEASE_VERSION" != "x"; then
- PACKAGE="$PACKAGE-$RELEASE_VERSION"
- PACKAGE_TARNAME="$PACKAGE_TARNAME-$RELEASE_VERSION"
- { $as_echo "$as_me:$LINENO: Building with package name set to $PACKAGE" >&5
-$as_echo "$as_me: Building with package name set to $PACKAGE" >&6;}
- fi
-
cat >>confdefs.h <<_ACEOF
#define PACKAGE_VERSION_MAJOR `echo $PACKAGE_VERSION | cut -d . -f 1`
_ACEOF
@@ -4704,11 +5031,20 @@ _ACEOF
-CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > .changelog.tmp && \
-mv .changelog.tmp ChangeLog) || (rm -f .changelog.tmp; touch ChangeLog; \
+CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
+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)"
-distcleancheck_listfiles='find . -type f ! -name ChangeLog -print'
+
+
+
+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)"
+
@@ -4782,6 +5118,26 @@ fi
+XORG_MAN_PAGE="X Version 11"
+
+MAN_SUBSTS="\
+ -e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
+ -e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
+ -e 's|__xservername__|Xorg|g' \
+ -e 's|__xconfigfile__|xorg.conf|g' \
+ -e 's|__projectroot__|\$(prefix)|g' \
+ -e 's|__apploaddir__|\$(appdefaultdir)|g' \
+ -e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
+ -e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
+ -e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
+ -e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
+ -e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
+ -e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
+
+
+
+AM_DEFAULT_VERBOSITY=1
+
@@ -4885,128 +5241,216 @@ fi
done
-# Checks for pkg-config packages
-
-
-if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
-set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
+{ $as_echo "$as_me:$LINENO: checking for working strnlen" >&5
+$as_echo_n "checking for working strnlen... " >&6; }
+if test "${ac_cv_func_strnlen_working+set}" = set; then
$as_echo_n "(cached) " >&6
else
- case $PKG_CONFIG in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_strnlen_working=no
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
- ;;
+#define S "foobar"
+#define S_LEN (sizeof S - 1)
+
+ /* At least one implementation is buggy: that of AIX 4.3 would
+ give strnlen (S, 1) == 3. */
+
+ int i;
+ for (i = 0; i < S_LEN + 1; ++i)
+ {
+ int expected = i <= S_LEN ? i : S_LEN;
+ if (strnlen (S, i) != expected)
+ return 1;
+ }
+ return 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
- { $as_echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_strnlen_working=yes
else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_strnlen_working=no
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
-if test -z "$ac_cv_path_PKG_CONFIG"; then
- ac_pt_PKG_CONFIG=$PKG_CONFIG
- # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_strnlen_working" >&5
+$as_echo "$ac_cv_func_strnlen_working" >&6; }
+test $ac_cv_func_strnlen_working = no && case " $LIBOBJS " in
+ *" strnlen.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS strnlen.$ac_objext"
+ ;;
+esac
+
+
+if test "x$ac_cv_func_strnlen_working" = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRNLEN 1
+_ACEOF
+
+fi
+
+# Check for iconv in libc, then libiconv
+{ $as_echo "$as_me:$LINENO: checking for library containing iconv" >&5
+$as_echo_n "checking for library containing iconv... " >&6; }
+if test "${ac_cv_search_iconv+set}" = set; then
$as_echo_n "(cached) " >&6
else
- case $ac_pt_PKG_CONFIG in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
+ ac_func_search_save_LIBS=$LIBS
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
- ;;
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char iconv ();
+int
+main ()
+{
+return iconv ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' iconv; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
esac
-fi
-ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
-if test -n "$ac_pt_PKG_CONFIG"; then
- { $as_echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5
-$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_search_iconv=$ac_res
else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
fi
- if test "x$ac_pt_PKG_CONFIG" = x; then
- PKG_CONFIG=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- PKG_CONFIG=$ac_pt_PKG_CONFIG
- fi
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext
+ if test "${ac_cv_search_iconv+set}" = set; then
+ break
+fi
+done
+if test "${ac_cv_search_iconv+set}" = set; then
+ :
else
- PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+ ac_cv_search_iconv=no
fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_iconv" >&5
+$as_echo "$ac_cv_search_iconv" >&6; }
+ac_res=$ac_cv_search_iconv
+if test "$ac_res" != no; then
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ICONV 1
+_ACEOF
fi
-if test -n "$PKG_CONFIG"; then
- _pkg_min_version=0.9.0
- { $as_echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5
-$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
- if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
- { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
- else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
- PKG_CONFIG=""
- fi
+
+# Allow using xcb-icccm, but don't make it the default while the API is
+# still being changed.
+{ $as_echo "$as_me:$LINENO: checking whether to use xcb-icccm library" >&5
+$as_echo_n "checking whether to use xcb-icccm library... " >&6; }
+
+# Check whether --with-xcb-icccm was given.
+if test "${with_xcb_icccm+set}" = set; then
+ withval=$with_xcb_icccm;
+else
+ with_xcb_icccm=no
fi
+{ $as_echo "$as_me:$LINENO: result: $with_xcb_icccm" >&5
+$as_echo "$with_xcb_icccm" >&6; }
+if test "x$with_xcb_icccm" != xno ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_XCB_ICCCM 1
+_ACEOF
+
+ xcb_icccm_pc="xcb-icccm"
+fi
+
+# Checks for pkg-config packages
+
pkg_failed=no
{ $as_echo "$as_me:$LINENO: checking for XWININFO" >&5
$as_echo_n "checking for XWININFO... " >&6; }
@@ -5016,12 +5460,12 @@ if test -n "$PKG_CONFIG"; then
pkg_cv_XWININFO_CFLAGS="$XWININFO_CFLAGS"
else
if test -n "$PKG_CONFIG" && \
- { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"xext x11\"") >&5
- ($PKG_CONFIG --exists --print-errors "xext x11") 2>&5
+ { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"xcb >= 1.6 xcb-shape \${xcb_icccm_pc}\"") >&5
+ ($PKG_CONFIG --exists --print-errors "xcb >= 1.6 xcb-shape ${xcb_icccm_pc}") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- pkg_cv_XWININFO_CFLAGS=`$PKG_CONFIG --cflags "xext x11" 2>/dev/null`
+ pkg_cv_XWININFO_CFLAGS=`$PKG_CONFIG --cflags "xcb >= 1.6 xcb-shape ${xcb_icccm_pc}" 2>/dev/null`
else
pkg_failed=yes
fi
@@ -5034,12 +5478,12 @@ if test -n "$PKG_CONFIG"; then
pkg_cv_XWININFO_LIBS="$XWININFO_LIBS"
else
if test -n "$PKG_CONFIG" && \
- { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"xext x11\"") >&5
- ($PKG_CONFIG --exists --print-errors "xext x11") 2>&5
+ { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"xcb >= 1.6 xcb-shape \${xcb_icccm_pc}\"") >&5
+ ($PKG_CONFIG --exists --print-errors "xcb >= 1.6 xcb-shape ${xcb_icccm_pc}") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- pkg_cv_XWININFO_LIBS=`$PKG_CONFIG --libs "xext x11" 2>/dev/null`
+ pkg_cv_XWININFO_LIBS=`$PKG_CONFIG --libs "xcb >= 1.6 xcb-shape ${xcb_icccm_pc}" 2>/dev/null`
else
pkg_failed=yes
fi
@@ -5058,14 +5502,14 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- XWININFO_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "xext x11"`
+ XWININFO_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "xcb >= 1.6 xcb-shape ${xcb_icccm_pc}"`
else
- XWININFO_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "xext x11"`
+ XWININFO_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "xcb >= 1.6 xcb-shape ${xcb_icccm_pc}"`
fi
# Put the nasty error message in config.log where it belongs
echo "$XWININFO_PKG_ERRORS" >&5
- { { $as_echo "$as_me:$LINENO: error: Package requirements (xext x11) were not met:
+ { { $as_echo "$as_me:$LINENO: error: Package requirements (xcb >= 1.6 xcb-shape ${xcb_icccm_pc}) were not met:
$XWININFO_PKG_ERRORS
@@ -5076,7 +5520,7 @@ Alternatively, you may set the environment variables XWININFO_CFLAGS
and XWININFO_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
" >&5
-$as_echo "$as_me: error: Package requirements (xext x11) were not met:
+$as_echo "$as_me: error: Package requirements (xcb >= 1.6 xcb-shape ${xcb_icccm_pc}) were not met:
$XWININFO_PKG_ERRORS
@@ -5118,7 +5562,120 @@ $as_echo "yes" >&6; }
:
fi
+# Even when using xcb, xproto is still required for Xfuncproto.h
+# and libX11 headers for cursorfont.h
+
+pkg_failed=no
+{ $as_echo "$as_me:$LINENO: checking for XLIB" >&5
+$as_echo_n "checking for XLIB... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+ if test -n "$XLIB_CFLAGS"; then
+ pkg_cv_XLIB_CFLAGS="$XLIB_CFLAGS"
+ else
+ if test -n "$PKG_CONFIG" && \
+ { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"x11 xproto >= 7.0.17\"") >&5
+ ($PKG_CONFIG --exists --print-errors "x11 xproto >= 7.0.17") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ pkg_cv_XLIB_CFLAGS=`$PKG_CONFIG --cflags "x11 xproto >= 7.0.17" 2>/dev/null`
+else
+ pkg_failed=yes
+fi
+ fi
+else
+ pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+ if test -n "$XLIB_LIBS"; then
+ pkg_cv_XLIB_LIBS="$XLIB_LIBS"
+ else
+ if test -n "$PKG_CONFIG" && \
+ { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"x11 xproto >= 7.0.17\"") >&5
+ ($PKG_CONFIG --exists --print-errors "x11 xproto >= 7.0.17") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ pkg_cv_XLIB_LIBS=`$PKG_CONFIG --libs "x11 xproto >= 7.0.17" 2>/dev/null`
+else
+ pkg_failed=yes
+fi
+ fi
+else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ XLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "x11 xproto >= 7.0.17"`
+ else
+ XLIB_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "x11 xproto >= 7.0.17"`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$XLIB_PKG_ERRORS" >&5
+
+ { { $as_echo "$as_me:$LINENO: error: Package requirements (x11 xproto >= 7.0.17) were not met:
+
+$XLIB_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables XLIB_CFLAGS
+and XLIB_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+" >&5
+$as_echo "$as_me: error: Package requirements (x11 xproto >= 7.0.17) were not met:
+
+$XLIB_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables XLIB_CFLAGS
+and XLIB_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+" >&2;}
+ { (exit 1); exit 1; }; }
+elif test $pkg_failed = untried; then
+ { { $as_echo "$as_me:$LINENO: error: The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables XLIB_CFLAGS
+and XLIB_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables XLIB_CFLAGS
+and XLIB_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ XLIB_CFLAGS=$pkg_cv_XLIB_CFLAGS
+ XLIB_LIBS=$pkg_cv_XLIB_LIBS
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ :
+fi
+XWININFO_CFLAGS="${XWININFO_CFLAGS} ${XLIB_CFLAGS}"
ac_config_files="$ac_config_files Makefile"
@@ -5562,7 +6119,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by xwininfo $as_me 1.0.5, which was
+This file was extended by xwininfo $as_me 1.1.1, which was
generated by GNU Autoconf 2.62. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -5615,7 +6172,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-xwininfo config.status 1.0.5
+xwininfo config.status 1.1.1
configured by $0, generated by GNU Autoconf 2.62,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/app/xwininfo/configure.ac b/app/xwininfo/configure.ac
index b4b8785ff..8bf5b943d 100644
--- a/app/xwininfo/configure.ac
+++ b/app/xwininfo/configure.ac
@@ -21,28 +21,54 @@ dnl PERFORMANCE OF THIS SOFTWARE.
dnl
dnl Process this file with autoconf to create configure.
-AC_PREREQ([2.57])
-AC_INIT(xwininfo, [1.0.5], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xwininfo)
-AM_INIT_AUTOMAKE([dist-bzip2])
+AC_PREREQ([2.60])
+AC_INIT([xwininfo], [1.1.1],
+ [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xwininfo])
+AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
-# Require xorg-macros 1.3 or later: XORG_DEFAULT_OPTIONS
+# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
m4_ifndef([XORG_MACROS_VERSION],
- [m4_fatal([must install xorg-macros 1.3 or later before running autoconf/autogen])])
-XORG_MACROS_VERSION(1.3)
+ [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.8)
AM_CONFIG_HEADER(config.h)
-AC_PROG_CC
-AC_PROG_INSTALL
+AC_USE_SYSTEM_EXTENSIONS
XORG_DEFAULT_OPTIONS
AC_CHECK_FUNCS([strlcat])
+AC_FUNC_STRNLEN
+if test "x$ac_cv_func_strnlen_working" = xyes; then
+ AC_DEFINE(HAVE_STRNLEN, 1, [Define to 1 if you have a working strnlen function.])
+fi
+
+# Check for iconv in libc, then libiconv
+AC_SEARCH_LIBS([iconv], [iconv], [AC_DEFINE([HAVE_ICONV], 1,
+ [Define to 1 if you have the iconv() function])])
+
+# Allow using xcb-icccm, but don't make it the default while the API is
+# still being changed.
+AC_MSG_CHECKING([whether to use xcb-icccm library])
+AC_ARG_WITH([xcb-icccm],
+ [AS_HELP_STRING([--with-xcb-icccm],
+ [use xcb-icccm (default: no)])],
+ [], [with_xcb_icccm=no])
+AC_MSG_RESULT([$with_xcb_icccm])
+if test "x$with_xcb_icccm" != xno ; then
+ AC_DEFINE([USE_XCB_ICCCM], 1,
+ [Define to 1 to call xcb-icccm library functions instead of local replacements])
+ xcb_icccm_pc="xcb-icccm"
+fi
+
# Checks for pkg-config packages
-PKG_CHECK_MODULES(XWININFO, xext x11)
-AC_SUBST(XWININFO_CFLAGS)
-AC_SUBST(XWININFO_LIBS)
+PKG_CHECK_MODULES(XWININFO, [xcb >= 1.6] xcb-shape ${xcb_icccm_pc})
+
+# Even when using xcb, xproto is still required for Xfuncproto.h
+# and libX11 headers for cursorfont.h
+PKG_CHECK_MODULES(XLIB, x11 [xproto >= 7.0.17])
+XWININFO_CFLAGS="${XWININFO_CFLAGS} ${XLIB_CFLAGS}"
AC_OUTPUT([Makefile])
diff --git a/app/xwininfo/dsimple.c b/app/xwininfo/dsimple.c
index b70aa43f2..a9b867896 100644
--- a/app/xwininfo/dsimple.c
+++ b/app/xwininfo/dsimple.c
@@ -1,4 +1,25 @@
-/* $Xorg: dsimple.c,v 1.4 2001/02/09 02:05:54 xorgcvs Exp $ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
/*
Copyright 1993, 1998 The Open Group
@@ -26,21 +47,19 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
-/* $XFree86: xc/programs/xlsfonts/dsimple.c,v 3.6 2001/12/14 20:02:09 dawes Exp $ */
-#include <X11/Xos.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
+#include "config.h"
+
+#include <xcb/xcb.h>
+#include <xcb/xproto.h>
+#ifdef USE_XCB_ICCCM
+# include <xcb/xcb_icccm.h>
+#endif
#include <X11/cursorfont.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
-/*
- * Other_stuff.h: Definitions of routines in other_stuff.
- *
- * Written by Mark Lillibridge. Last updated 7/1/87
- */
-
+#include <string.h>
#include "clientwin.h"
#include "dsimple.h"
@@ -48,287 +67,565 @@ from The Open Group.
* Just_display: A group of routines designed to make the writing of simple
* X11 applications which open a display but do not open
* any windows much faster and easier. Unless a routine says
- * otherwise, it may be assumed to require program_name, dpy,
- * and screen already defined on entry.
+ * otherwise, it may be assumed to require program_name
+ * to be already defined on entry.
*
* Written by Mark Lillibridge. Last updated 7/1/87
*/
-/* This stuff is defined in the calling program by just_display.h */
+/* This stuff is defined in the calling program by dsimple.h */
char *program_name = "unknown_program";
-Display *dpy = NULL;
-int screen = 0;
-
/*
- * Get_Display_Name (argc, argv) Look for -display, -d, or host:dpy (obselete)
- * If found, remove it from command line. Don't go past a lone -.
+ * Get_Display_Name (argc, argv) - return string representing display name
+ * that would be used given the specified argument (i.e. if it's NULL, check
+ * getenv("DISPLAY") - always returns a non-NULL pointer, though it may be
+ * an unwritable constant, so is safe to printf() on platforms that crash
+ * on NULL printf arguments.
*/
-char *Get_Display_Name(
- int *pargc, /* MODIFIED */
- char **argv) /* MODIFIED */
+const char *Get_Display_Name (const char *display_name)
{
- int argc = *pargc;
- char **pargv = argv+1;
- char *displayname = NULL;
- int i;
-
- for (i = 1; i < argc; i++) {
- char *arg = argv[i];
+ const char *name = display_name;
- if (!strcmp (arg, "-display") || !strcmp (arg, "-d")) {
- if (++i >= argc) usage ();
-
- displayname = argv[i];
- *pargc -= 2;
- continue;
- }
- if (!strcmp(arg,"-")) {
- while (i<argc)
- *pargv++ = argv[i++];
- break;
- }
- *pargv++ = arg;
+ if (!name) {
+ name = getenv ("DISPLAY");
+ if (!name)
+ name = "";
}
-
- *pargv = NULL;
- return (displayname);
+ return (name);
}
-
/*
- * Open_Display: Routine to open a display with correct error handling.
- * Does not require dpy or screen defined on entry.
+ * Setup_Display_And_Screen: This routine opens up the correct display (i.e.,
+ * it calls Get_Display_Name) and then stores a
+ * pointer to it in dpy. The default screen
+ * for this display is then stored in screen.
*/
-Display *Open_Display(char *display_name)
+void Setup_Display_And_Screen (
+ const char *display_name,
+ xcb_connection_t **dpy, /* MODIFIED */
+ xcb_screen_t **screen) /* MODIFIED */
{
- Display *d;
+ int screen_number, i;
- d = XOpenDisplay(display_name);
- if (d == NULL) {
- fprintf (stderr, "%s: unable to open display '%s'\n",
- program_name, XDisplayName (display_name));
- exit(1);
- }
+ /* Open Display */
+ *dpy = xcb_connect (display_name, &screen_number);
+ if (xcb_connection_has_error (*dpy)) {
+ Fatal_Error ("unable to open display \"%s\"",
+ Get_Display_Name(display_name) );
+ }
- return(d);
-}
+ if (screen) {
+ /* find our screen */
+ const xcb_setup_t *setup = xcb_get_setup(*dpy);
+ xcb_screen_iterator_t screen_iter = xcb_setup_roots_iterator(setup);
+ for (i = 0; i < screen_number; i++)
+ xcb_screen_next(&screen_iter);
+ *screen = screen_iter.data;
+ }
+}
/*
- * Setup_Display_And_Screen: This routine opens up the correct display (i.e.,
- * it calls Get_Display_Name) and then stores a
- * pointer to it in dpy. The default screen
- * for this display is then stored in screen.
- * Does not require dpy or screen defined.
+ * xcb equivalent of XCreateFontCursor
*/
-void Setup_Display_And_Screen(
- int *argc, /* MODIFIED */
- char **argv) /* MODIFIED */
+static xcb_cursor_t
+Create_Font_Cursor (xcb_connection_t *dpy, uint16_t glyph)
{
- char *displayname = NULL;
-
- displayname = Get_Display_Name(argc, argv);
- dpy = Open_Display (displayname);
- screen = XDefaultScreen(dpy);
+ static xcb_font_t cursor_font;
+ xcb_cursor_t cursor;
+
+ if (!cursor_font) {
+ cursor_font = xcb_generate_id (dpy);
+ xcb_open_font (dpy, cursor_font, strlen ("cursor"), "cursor");
+ }
+
+ cursor = xcb_generate_id (dpy);
+ xcb_create_glyph_cursor (dpy, cursor, cursor_font, cursor_font,
+ glyph, glyph + 1,
+ 0, 0, 0, 0xffff, 0xffff, 0xffff); /* rgb, rgb */
+
+ return cursor;
}
/*
- * Close_Display: Close display
+ * Routine to let user select a window using the mouse
*/
-void Close_Display(void)
+
+xcb_window_t Select_Window(xcb_connection_t *dpy,
+ const xcb_screen_t *screen,
+ int descend)
{
- if (dpy == NULL)
- return;
-
- XCloseDisplay(dpy);
- dpy = NULL;
+ xcb_cursor_t cursor;
+ xcb_generic_event_t *event;
+ xcb_window_t target_win = XCB_WINDOW_NONE;
+ xcb_window_t root = screen->root;
+ int buttons = 0;
+ xcb_generic_error_t *err;
+ xcb_grab_pointer_cookie_t grab_cookie;
+ xcb_grab_pointer_reply_t *grab_reply;
+
+ /* Make the target cursor */
+ cursor = Create_Font_Cursor (dpy, XC_crosshair);
+
+ /* Grab the pointer using target cursor, letting it room all over */
+ grab_cookie = xcb_grab_pointer
+ (dpy, False, root,
+ XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE,
+ XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC,
+ root, cursor, XCB_TIME_CURRENT_TIME);
+ grab_reply = xcb_grab_pointer_reply (dpy, grab_cookie, &err);
+ if (grab_reply->status != XCB_GRAB_STATUS_SUCCESS)
+ Fatal_Error ("Can't grab the mouse.");
+
+ /* Let the user select a window... */
+ while ((target_win == XCB_WINDOW_NONE) || (buttons != 0)) {
+ /* allow one more event */
+ xcb_allow_events (dpy, XCB_ALLOW_SYNC_POINTER, XCB_TIME_CURRENT_TIME);
+ xcb_flush (dpy);
+ event = xcb_wait_for_event (dpy);
+ switch (event->response_type & 0x7f) {
+ case XCB_BUTTON_PRESS:
+ {
+ xcb_button_press_event_t *bp = (xcb_button_press_event_t *)event;
+
+ if (target_win == XCB_WINDOW_NONE) {
+ target_win = bp->child; /* window selected */
+ if (target_win == XCB_WINDOW_NONE)
+ target_win = root;
+ }
+ buttons++;
+ break;
+ }
+ case XCB_BUTTON_RELEASE:
+ if (buttons > 0) /* there may have been some down before we started */
+ buttons--;
+ break;
+ default:
+ /* just discard all other events */
+ break;
+ }
+ free (event);
+ }
+
+ xcb_ungrab_pointer (dpy, XCB_TIME_CURRENT_TIME); /* Done with pointer */
+
+ if (!descend || (target_win == root))
+ return (target_win);
+
+ target_win = Find_Client (dpy, root, target_win);
+
+ return (target_win);
}
/*
- * Select_Window_Args: a rountine to provide a common interface for
- * applications that need to allow the user to select one
- * window on the screen for special consideration.
- * This routine implements the following command line
- * arguments:
- *
- * -root Selects the root window.
- * -id <id> Selects window with id <id>. <id> may
- * be either in decimal or hex.
- * -name <name> Selects the window with name <name>.
- *
- * Call as Select_Window_Args(&argc, argv) in main before
- * parsing any of your program's command line arguments.
- * Select_Window_Args will remove its arguments so that
- * your program does not have to worry about them.
- * The window returned is the window selected or 0 if
- * none of the above arguments was present. If 0 is
- * returned, Select_Window should probably be called after
- * all command line arguments, and other setup is done.
- * For examples of usage, see xwininfo, xwd, or xprop.
+ * Window_With_Name: routine to locate a window with a given name on a display.
+ * If no window with the given name is found, 0 is returned.
+ * If more than one window has the given name, the first
+ * one found will be returned. Only top and its subwindows
+ * are looked at. Normally, top should be the RootWindow.
*/
-Window Select_Window_Args(
- int *rargc,
- char **argv)
-#define ARGC (*rargc)
+
+struct wininfo_cookies {
+ xcb_get_property_cookie_t get_net_wm_name;
+ xcb_get_property_cookie_t get_wm_name;
+ xcb_query_tree_cookie_t query_tree;
+};
+
+#ifndef USE_XCB_ICCCM
+# define xcb_get_wm_name(Dpy, Win) \
+ xcb_get_property (Dpy, False, Win, XCB_ATOM_WM_NAME, \
+ XCB_GET_PROPERTY_TYPE_ANY, 0, BUFSIZ)
+#endif
+
+static xcb_atom_t atom_net_wm_name, atom_utf8_string;
+
+# define xcb_get_net_wm_name(Dpy, Win) \
+ xcb_get_property (Dpy, False, Win, atom_net_wm_name, \
+ atom_utf8_string, 0, BUFSIZ)
+
+
+static xcb_window_t
+recursive_Window_With_Name (
+ xcb_connection_t *dpy,
+ xcb_window_t window,
+ struct wininfo_cookies *cookies,
+ const char *name)
{
- int nargc=1;
- int argc;
- char **nargv;
- Window w=0;
-
- nargv = argv+1; argc = ARGC;
-#define OPTION argv[0]
-#define NXTOPTP ++argv, --argc>0
-#define NXTOPT if (++argv, --argc==0) usage()
-#define COPYOPT nargv++[0]=OPTION, nargc++
-
- while (NXTOPTP) {
- if (!strcmp(OPTION, "-")) {
- COPYOPT;
- while (NXTOPTP)
- COPYOPT;
- break;
- }
- if (!strcmp(OPTION, "-root")) {
- w=RootWindow(dpy, screen);
- continue;
- }
- if (!strcmp(OPTION, "-name")) {
- NXTOPT;
- w = Window_With_Name(dpy, RootWindow(dpy, screen),
- OPTION);
- if (!w)
- Fatal_Error("No window with name %s exists!",OPTION);
- continue;
+ xcb_window_t *children;
+ unsigned int nchildren;
+ int i;
+ xcb_window_t w = 0;
+ xcb_generic_error_t *err;
+ xcb_query_tree_reply_t *tree;
+ struct wininfo_cookies *child_cookies;
+ xcb_get_property_reply_t *prop;
+
+ if (cookies->get_net_wm_name.sequence) {
+ prop = xcb_get_property_reply (dpy, cookies->get_net_wm_name, &err);
+
+ if (prop) {
+ if (prop->type == atom_utf8_string) {
+ const char *prop_name = xcb_get_property_value (prop);
+ int prop_name_len = xcb_get_property_value_length (prop);
+
+ /* can't use strcmp, since prop.name is not null terminated */
+ if (strncmp (prop_name, name, prop_name_len) == 0) {
+ w = window;
}
- if (!strcmp(OPTION, "-id")) {
- NXTOPT;
- w=0;
- sscanf(OPTION, "0x%lx", &w);
- if (!w)
- sscanf(OPTION, "%lu", &w);
- if (!w)
- Fatal_Error("Invalid window id format: %s.", OPTION);
- continue;
+ }
+ free (prop);
+ } else if (err) {
+ if (err->response_type == 0)
+ Print_X_Error (dpy, err);
+ return 0;
+ }
+ }
+
+ if (w) {
+ xcb_discard_reply (dpy, cookies->get_wm_name.sequence);
+ } else {
+#ifdef USE_XCB_ICCCM
+ xcb_get_text_property_reply_t nameprop;
+
+ if (xcb_get_wm_name_reply (dpy, cookies->get_wm_name,
+ &nameprop, &err)) {
+ /* can't use strcmp, since nameprop.name is not null terminated */
+ if (strncmp (nameprop.name, name, nameprop.name_len) == 0) {
+ w = window;
+ }
+
+ xcb_get_text_property_reply_wipe (&nameprop);
+ }
+#else
+ prop = xcb_get_property_reply (dpy, cookies->get_wm_name, &err);
+
+ if (prop) {
+ if (prop->type == XCB_ATOM_STRING) {
+ const char *prop_name = xcb_get_property_value (prop);
+ int prop_name_len = xcb_get_property_value_length (prop);
+
+ /* can't use strcmp, since prop.name is not null terminated */
+ if (strncmp (prop_name, name, prop_name_len) == 0) {
+ w = window;
}
- COPYOPT;
+ }
+ free (prop);
}
- ARGC = nargc;
-
- return(w);
+#endif
+ else if (err) {
+ if (err->response_type == 0)
+ Print_X_Error (dpy, err);
+ return 0;
+ }
+ }
+
+ if (w)
+ {
+ xcb_discard_reply (dpy, cookies->query_tree.sequence);
+ return w;
+ }
+
+ tree = xcb_query_tree_reply (dpy, cookies->query_tree, &err);
+ if (!tree) {
+ if (err->response_type == 0)
+ Print_X_Error (dpy, err);
+ return 0;
+ }
+
+ nchildren = xcb_query_tree_children_length (tree);
+ children = xcb_query_tree_children (tree);
+ child_cookies = calloc(nchildren, sizeof(struct wininfo_cookies));
+
+ if (child_cookies == NULL)
+ Fatal_Error("Failed to allocate memory in recursive_Window_With_Name");
+
+ for (i = 0; i < nchildren; i++) {
+ if (atom_net_wm_name && atom_utf8_string)
+ child_cookies[i].get_net_wm_name =
+ xcb_get_net_wm_name (dpy, children[i]);
+ child_cookies[i].get_wm_name = xcb_get_wm_name (dpy, children[i]);
+ child_cookies[i].query_tree = xcb_query_tree (dpy, children[i]);
+ }
+ xcb_flush (dpy);
+
+ for (i = 0; i < nchildren; i++) {
+ w = recursive_Window_With_Name (dpy, children[i],
+ &child_cookies[i], name);
+ if (w)
+ break;
+ }
+
+ if (w)
+ {
+ /* clean up remaining replies */
+ for (/* keep previous i */; i < nchildren; i++) {
+ if (child_cookies[i].get_net_wm_name.sequence)
+ xcb_discard_reply (dpy,
+ child_cookies[i].get_net_wm_name.sequence);
+ xcb_discard_reply (dpy, child_cookies[i].get_wm_name.sequence);
+ xcb_discard_reply (dpy, child_cookies[i].query_tree.sequence);
+ }
+ }
+
+ free (child_cookies);
+ free (tree); /* includes storage for children[] */
+ return (w);
}
-/*
- * Other_stuff: A group of routines which do common X11 tasks.
- *
- * Written by Mark Lillibridge. Last updated 7/1/87
- */
+xcb_window_t
+Window_With_Name (
+ xcb_connection_t *dpy,
+ xcb_window_t top,
+ const char *name)
+{
+ struct wininfo_cookies cookies;
+
+ atom_net_wm_name = Get_Atom (dpy, "_NET_WM_NAME");
+ atom_utf8_string = Get_Atom (dpy, "UTF8_STRING");
+
+ if (atom_net_wm_name && atom_utf8_string)
+ cookies.get_net_wm_name = xcb_get_net_wm_name (dpy, top);
+ cookies.get_wm_name = xcb_get_wm_name (dpy, top);
+ cookies.query_tree = xcb_query_tree (dpy, top);
+ xcb_flush (dpy);
+ return recursive_Window_With_Name(dpy, top, &cookies, name);
+}
/*
- * Routine to let user select a window using the mouse
+ * Standard fatal error routine - call like printf
*/
+void Fatal_Error (char *msg, ...)
+{
+ va_list args;
+ fflush (stdout);
+ fflush (stderr);
+ fprintf (stderr, "%s: error: ", program_name);
+ va_start (args, msg);
+ vfprintf (stderr, msg, args);
+ va_end (args);
+ fprintf (stderr, "\n");
+ exit (EXIT_FAILURE);
+}
-Window Select_Window(Display *dpy, int descend)
+/*
+ * Print X error information like the default Xlib error handler
+ */
+void
+Print_X_Error (
+ xcb_connection_t *dpy,
+ xcb_generic_error_t *err
+ )
{
- int status;
- Cursor cursor;
- XEvent event;
- Window target_win = None, root = RootWindow(dpy,screen);
- int buttons = 0;
-
- /* Make the target cursor */
- cursor = XCreateFontCursor(dpy, XC_crosshair);
-
- /* Grab the pointer using target cursor, letting it room all over */
- status = XGrabPointer(dpy, root, False,
- ButtonPressMask|ButtonReleaseMask, GrabModeSync,
- GrabModeAsync, root, cursor, CurrentTime);
- if (status != GrabSuccess) Fatal_Error("Can't grab the mouse.");
-
- /* Let the user select a window... */
- while ((target_win == None) || (buttons != 0)) {
- /* allow one more event */
- XAllowEvents(dpy, SyncPointer, CurrentTime);
- XWindowEvent(dpy, root, ButtonPressMask|ButtonReleaseMask, &event);
- switch (event.type) {
- case ButtonPress:
- if (target_win == None) {
- target_win = event.xbutton.subwindow; /* window selected */
- if (target_win == None) target_win = root;
- }
- buttons++;
- break;
- case ButtonRelease:
- if (buttons > 0) /* there may have been some down before we started */
- buttons--;
- break;
+ char buffer[256] = "";
+
+ if ((err == NULL) || (err->response_type != 0)) /* not an error */
+ return;
+
+ /* Todo: find a more user friendly way to show request/extension info */
+ if (err->error_code >= 128)
+ {
+ fprintf (stderr, "X Extension Error: Error code %d\n",
+ err->error_code);
}
- }
+ else
+ {
+ switch (err->error_code)
+ {
+ case XCB_REQUEST:
+ snprintf (buffer, sizeof(buffer), ": Bad Request");
+ break;
+
+ case XCB_VALUE:
+ snprintf (buffer, sizeof(buffer),
+ ": Bad Value: 0x%x", err->resource_id);
+ break;
+
+ case XCB_WINDOW:
+ snprintf (buffer, sizeof(buffer),
+ ": Bad Window: 0x%x", err->resource_id);
+ break;
+
+ case XCB_PIXMAP:
+ snprintf (buffer, sizeof(buffer),
+ ": Bad Pixmap: 0x%x", err->resource_id);
+ break;
+
+ case XCB_ATOM:
+ snprintf (buffer, sizeof(buffer),
+ ": Bad Atom: 0x%x", err->resource_id);
+ break;
+
+ case XCB_CURSOR:
+ snprintf (buffer, sizeof(buffer),
+ ": Bad Cursor: 0x%x", err->resource_id);
+ break;
+
+ case XCB_FONT:
+ snprintf (buffer, sizeof(buffer),
+ ": Bad Font: 0x%x", err->resource_id);
+ break;
+
+ case XCB_MATCH:
+ snprintf (buffer, sizeof(buffer), ": Bad Match");
+ break;
+
+ case XCB_DRAWABLE:
+ snprintf (buffer, sizeof(buffer),
+ ": Bad Drawable: 0x%x", err->resource_id);
+ break;
+
+ case XCB_ACCESS:
+ snprintf (buffer, sizeof(buffer), ": Access Denied");
+ break;
+
+ case XCB_ALLOC:
+ snprintf (buffer, sizeof(buffer),
+ ": Server Memory Allocation Failure");
+ break;
+
+ case XCB_COLORMAP:
+ snprintf (buffer, sizeof(buffer),
+ ": Bad Color: 0x%x", err->resource_id);
+ break;
+
+ case XCB_G_CONTEXT:
+ snprintf (buffer, sizeof(buffer),
+ ": Bad GC: 0x%x", err->resource_id);
+ break;
- XUngrabPointer(dpy, CurrentTime); /* Done with pointer */
+ case XCB_ID_CHOICE:
+ snprintf (buffer, sizeof(buffer),
+ ": Bad XID: 0x%x", err->resource_id);
+ break;
+
+ case XCB_NAME:
+ snprintf (buffer, sizeof(buffer),
+ ": Bad Name");
+ break;
- if (!descend || (target_win == root))
- return(target_win);
+ case XCB_LENGTH:
+ snprintf (buffer, sizeof(buffer),
+ ": Bad Request Length");
+ break;
+
+ case XCB_IMPLEMENTATION:
+ snprintf (buffer, sizeof(buffer),
+ ": Server Implementation Failure");
+ break;
- target_win = Find_Client(dpy, root, target_win);
+ default:
+ snprintf (buffer, sizeof(buffer), ": Unknown error");
+ break;
+ }
+ fprintf (stderr, "X Error: %d%s\n", err->error_code, buffer);
+ }
+
+ fprintf (stderr, " Request Major code: %d\n", err->major_code);
+ if (err->major_code >= 128)
+ {
+ fprintf (stderr, " Request Minor code: %d\n", err->minor_code);
+ }
- return(target_win);
+ fprintf (stderr, " Request serial number: %d\n", err->full_sequence);
}
+/*
+ * Cache for atom lookups in either direction
+ */
+struct atom_cache_entry {
+ xcb_atom_t atom;
+ const char *name;
+ xcb_intern_atom_cookie_t intern_atom;
+ struct atom_cache_entry *next;
+};
+
+static struct atom_cache_entry *atom_cache;
/*
- * Window_With_Name: routine to locate a window with a given name on a display.
- * If no window with the given name is found, 0 is returned.
- * If more than one window has the given name, the first
- * one found will be returned. Only top and its subwindows
- * are looked at. Normally, top should be the RootWindow.
+ * Send a request to the server for an atom by name
+ * Does not create the atom if it is not already present
*/
-Window Window_With_Name(
- Display *dpy,
- Window top,
- char *name)
+struct atom_cache_entry *Intern_Atom (xcb_connection_t * dpy, const char *name)
{
- Window *children, dummy;
- unsigned int nchildren;
- int i;
- Window w=0;
- char *window_name;
-
- if (XFetchName(dpy, top, &window_name) && !strcmp(window_name, name))
- return(top);
-
- if (!XQueryTree(dpy, top, &dummy, &dummy, &children, &nchildren))
- return(0);
-
- for (i=0; i<nchildren; i++) {
- w = Window_With_Name(dpy, children[i], name);
- if (w)
- break;
- }
- if (children) XFree ((char *)children);
- return(w);
+ struct atom_cache_entry *a;
+
+ for (a = atom_cache ; a != NULL ; a = a->next) {
+ if (strcmp (a->name, name) == 0)
+ return a; /* already requested or found */
+ }
+
+ a = calloc(1, sizeof(struct atom_cache_entry));
+ if (a != NULL) {
+ a->name = name;
+ a->intern_atom = xcb_intern_atom (dpy, False, strlen (name), (name));
+ a->next = atom_cache;
+ atom_cache = a;
+ }
+ return a;
}
+/* Get an atom by name when it is needed. */
+xcb_atom_t Get_Atom (xcb_connection_t * dpy, const char *name)
+{
+ struct atom_cache_entry *a = Intern_Atom (dpy, name);
-/*
- * Standard fatal error routine - call like printf
- * Does not require dpy or screen defined.
- */
-void Fatal_Error(char *msg, ...)
+ if (a == NULL)
+ return XCB_ATOM_NONE;
+
+ if (a->atom == XCB_ATOM_NONE) {
+ xcb_intern_atom_reply_t *reply;
+
+ reply = xcb_intern_atom_reply(dpy, a->intern_atom, NULL);
+ if (reply) {
+ a->atom = reply->atom;
+ free (reply);
+ } else {
+ a->atom = -1;
+ }
+ }
+ if (a->atom == -1) /* internal error */
+ return XCB_ATOM_NONE;
+
+ return a->atom;
+}
+
+/* Get the name for an atom when it is needed. */
+const char *Get_Atom_Name (xcb_connection_t * dpy, xcb_atom_t atom)
{
- va_list args;
- fflush(stdout);
- fflush(stderr);
- fprintf(stderr, "%s: error: ", program_name);
- va_start(args, msg);
- vfprintf(stderr, msg, args);
- va_end(args);
- fprintf(stderr, "\n");
- Close_Display();
- exit(EXIT_FAILURE);
+ struct atom_cache_entry *a;
+
+ for (a = atom_cache ; a != NULL ; a = a->next) {
+ if (a->atom == atom)
+ return a->name; /* already requested or found */
+ }
+
+ a = calloc(1, sizeof(struct atom_cache_entry));
+ if (a != NULL) {
+ xcb_get_atom_name_cookie_t cookie = xcb_get_atom_name (dpy, atom);
+ xcb_get_atom_name_reply_t *reply
+ = xcb_get_atom_name_reply (dpy, cookie, NULL);
+
+ a->atom = atom;
+ if (reply) {
+ int len = xcb_get_atom_name_name_length (reply);
+ char *name = malloc(len + 1);
+ if (name) {
+ memcpy (name, xcb_get_atom_name_name (reply), len);
+ name[len] = '\0';
+ a->name = name;
+ }
+ free (reply);
+ }
+
+ a->next = atom_cache;
+ atom_cache = a;
+
+ return a->name;
+ }
+ return NULL;
}
diff --git a/app/xwininfo/dsimple.h b/app/xwininfo/dsimple.h
index 90a6c66a2..b6adc4345 100644
--- a/app/xwininfo/dsimple.h
+++ b/app/xwininfo/dsimple.h
@@ -1,4 +1,3 @@
-/* $Xorg: dsimple.h,v 1.4 2001/02/09 02:05:54 xorgcvs Exp $ */
/*
Copyright 1993, 1998 The Open Group
@@ -26,60 +25,39 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
-/* $XFree86: xc/programs/xlsfonts/dsimple.h,v 1.8 2002/12/24 17:43:01 tsi Exp $ */
/*
- * Just_display.h: This file contains the definitions needed to use the
- * functions in just_display.c. It also declares the global
- * variables dpy, screen, and program_name which are needed to
- * use just_display.c.
+ * dsimple.h: This file contains the definitions needed to use the
+ * functions in dsimple.c. It also declares the global
+ * variable program_name which is needed to use dsimple.c.
*
- * Written by Mark Lillibridge. Last updated 7/1/87
- *
- * Send bugs, etc. to chariot@athena.mit.edu.
+ * Written by Mark Lillibridge for Xlib. Last updated 7/1/87
+ * Ported to XCB over two decades later.
*/
- /* Simple helper macros */
-#ifndef MAX
-#define MAX(a,b) (((a)>(b))?(a):(b))
-#endif /* MAX */
-#ifndef MIN
-#define MIN(a,b) (((a)<(b))?(a):(b))
-#endif /* MIN */
+#include <X11/Xfuncproto.h>
+#include <xcb/xcb.h>
+#include <xcb/xproto.h>
+
+typedef enum { False = 0, True } Bool;
/* Global variables used by routines in dsimple.c */
extern char *program_name; /* Name of this program */
-extern Display *dpy; /* The current display */
-extern int screen; /* The current screen */
-#define INIT_NAME program_name=argv[0] /* use this in main to setup
- program_name */
+ /* Declarations for functions in dsimple.c */
- /* Declaritions for functions in dsimple.c */
+const char *Get_Display_Name (const char *displayname);
+void Setup_Display_And_Screen (const char *displayname,
+ xcb_connection_t **dpy, xcb_screen_t **screen);
-char *Get_Display_Name(int *, char **);
-Display *Open_Display(char *);
-void Setup_Display_And_Screen(int *, char **);
-void Close_Display(void);
-Window Select_Window_Args(int *, char **);
-void usage(void);
+xcb_window_t Select_Window (xcb_connection_t *, const xcb_screen_t *, int);
+xcb_window_t Window_With_Name (xcb_connection_t *, xcb_window_t, const char *);
-#define X_USAGE "[host:display]" /* X arguments handled by
- Get_Display_Name */
+void Fatal_Error (char *, ...) _X_NORETURN _X_ATTRIBUTE_PRINTF(1, 2);
-/*
- * Other_stuff.h: Definitions of routines in other_stuff.
- *
- * Written by Mark Lillibridge. Last updated 7/1/87
- *
- * Send bugs, etc. to chariot@athena.mit.edu.
- */
+void Print_X_Error (xcb_connection_t *, xcb_generic_error_t *);
-Window Select_Window(Display *, int);
-Window Window_With_Name(Display *, Window, char *);
-#ifdef __GNUC__
-void Fatal_Error(char *, ...) __attribute__((__noreturn__));
-#else
-void Fatal_Error(char *, ...);
-#endif
+struct atom_cache_entry *Intern_Atom (xcb_connection_t *, const char *);
+xcb_atom_t Get_Atom (xcb_connection_t *, const char *);
+const char *Get_Atom_Name (xcb_connection_t *, xcb_atom_t);
diff --git a/app/xwininfo/strnlen.c b/app/xwininfo/strnlen.c
new file mode 100644
index 000000000..725e26248
--- /dev/null
+++ b/app/xwininfo/strnlen.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2009 Apple Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+ /*
+ * Author: Jeremy Huddleston, Apple Inc.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <strnlen.h>
+#include <string.h>
+
+size_t strnlen(const char *s, size_t maxlen) {
+ const char *p = memchr(s, 0, maxlen);
+ return (size_t)(p ? (p - s) : maxlen);
+}
diff --git a/app/xwininfo/strnlen.h b/app/xwininfo/strnlen.h
new file mode 100644
index 000000000..e1cdb8510
--- /dev/null
+++ b/app/xwininfo/strnlen.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2009 Apple Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+ /*
+ * Author: Jeremy Huddleston, Apple Inc.
+ */
+
+#ifndef __STRNLEN_H__
+#define __STRNLEN_H__ 1
+#include <stdlib.h>
+
+extern size_t strnlen(const char *s, size_t maxlen);
+#endif /* __STRNLEN_H__ */
diff --git a/app/xwininfo/xwininfo.c b/app/xwininfo/xwininfo.c
index 838408ab3..42a38a04c 100644
--- a/app/xwininfo/xwininfo.c
+++ b/app/xwininfo/xwininfo.c
@@ -1,9 +1,28 @@
-/* $XdotOrg: $ */
-/* $Xorg: xwininfo.c,v 1.4 2001/02/09 02:06:04 xorgcvs Exp $ */
+/*
+ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
/*
Copyright 1987, 1998 The Open Group
-Copyright 1999 Sun Microsystems, Inc.
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
@@ -30,7 +49,6 @@ or other dealings in this Software without prior written authorization
of the copyright holder.
*/
-/* $XFree86: xc/programs/xwininfo/xwininfo.c,v 1.9 2003/09/09 22:08:25 herrb Exp $ */
/*
@@ -46,59 +64,210 @@ of the copyright holder.
*/
#include "config.h"
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xatom.h>
-#include <X11/Xos.h>
-#include <X11/extensions/shape.h>
-#ifndef NO_I18N
-#include <X11/Xlocale.h>
+
+#include <xcb/xcb.h>
+#include <xcb/xproto.h>
+#ifdef USE_XCB_ICCCM
+# include <xcb/xcb_icccm.h>
#endif
+#include <xcb/shape.h>
+
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <locale.h>
+#include <langinfo.h>
+#ifdef HAVE_ICONV
+# include <iconv.h>
+#endif
+#include <ctype.h>
+#include <errno.h>
+
+#ifndef HAVE_STRNLEN
+#include "strnlen.h"
+#endif
/* Include routines to handle parsing defaults */
#include "dsimple.h"
typedef struct {
- long code;
- const char *name;
+ long code;
+ const char *name;
} binding;
-static void scale_init(void);
-static char *nscale(int, int, int, char *, size_t);
-static char *xscale(int);
-static char *yscale(int);
-static char *bscale(int);
-static int bad_window_handler(Display *, XErrorEvent *);
-int main(int, char **);
-static const char *LookupL(long, const binding *);
-static const char *Lookup(int, const binding *);
-static void Display_Window_Id(Window, int);
-static void Display_Stats_Info(Window);
-static void Display_Bits_Info(Window);
-static void Display_Event_Mask(long);
-static void Display_Events_Info(Window);
-static void Display_Tree_Info(Window, int);
-static void display_tree_info_1(Window, int, int);
-static void Display_Hints(XSizeHints *);
-static void Display_Size_Hints(Window);
-static void Display_Window_Shape(Window);
-static void Display_WM_Info(Window);
-
-static char *window_id_format = "0x%lx";
+#ifndef USE_XCB_ICCCM
+/* Once xcb-icccm's API is stable, this should be replaced by
+ xcb_size_hints_t & xcb_size_hints_flags_t */
+typedef struct {
+ /** User specified flags */
+ uint32_t flags;
+ /** User-specified position */
+ int32_t x, y;
+ /** User-specified size */
+ int32_t width, height;
+ /** Program-specified minimum size */
+ int32_t min_width, min_height;
+ /** Program-specified maximum size */
+ int32_t max_width, max_height;
+ /** Program-specified resize increments */
+ int32_t width_inc, height_inc;
+ /** Program-specified minimum aspect ratios */
+ int32_t min_aspect_num, min_aspect_den;
+ /** Program-specified maximum aspect ratios */
+ int32_t max_aspect_num, max_aspect_den;
+ /** Program-specified base size */
+ int32_t base_width, base_height;
+ /** Program-specified window gravity */
+ uint32_t win_gravity;
+} wm_size_hints_t;
+
+# define xcb_size_hints_t wm_size_hints_t
+
+typedef struct {
+ /** Marks which fields in this structure are defined */
+ int32_t flags;
+ /** Does this application rely on the window manager to get keyboard
+ input? */
+ uint32_t input;
+ /** See below */
+ int32_t initial_state;
+ /** Pixmap to be used as icon */
+ xcb_pixmap_t icon_pixmap;
+ /** Window to be used as icon */
+ xcb_window_t icon_window;
+ /** Initial position of icon */
+ int32_t icon_x, icon_y;
+ /** Icon mask bitmap */
+ xcb_pixmap_t icon_mask;
+ /* Identifier of related window group */
+ xcb_window_t window_group;
+} wm_hints_t;
+
+#define xcb_wm_hints_t wm_hints_t
+
+enum {
+ /* xcb_size_hints_flags_t */
+ XCB_SIZE_HINT_US_POSITION = 1 << 0,
+ XCB_SIZE_HINT_US_SIZE = 1 << 1,
+ XCB_SIZE_HINT_P_POSITION = 1 << 2,
+ XCB_SIZE_HINT_P_SIZE = 1 << 3,
+ XCB_SIZE_HINT_P_MIN_SIZE = 1 << 4,
+ XCB_SIZE_HINT_P_MAX_SIZE = 1 << 5,
+ XCB_SIZE_HINT_P_RESIZE_INC = 1 << 6,
+ XCB_SIZE_HINT_P_ASPECT = 1 << 7,
+ XCB_SIZE_HINT_BASE_SIZE = 1 << 8,
+ XCB_SIZE_HINT_P_WIN_GRAVITY = 1 << 9,
+ /* xcb_wm_state_t */
+ XCB_WM_STATE_WITHDRAWN = 0,
+ XCB_WM_STATE_NORMAL = 1,
+ XCB_WM_STATE_ICONIC = 3,
+ /* xcb_wm_t */
+ XCB_WM_HINT_INPUT = (1L << 0),
+ XCB_WM_HINT_STATE = (1L << 1),
+ XCB_WM_HINT_ICON_PIXMAP = (1L << 2),
+ XCB_WM_HINT_ICON_WINDOW = (1L << 3),
+ XCB_WM_HINT_ICON_POSITION = (1L << 4),
+ XCB_WM_HINT_ICON_MASK = (1L << 5),
+ XCB_WM_HINT_WINDOW_GROUP = (1L << 6),
+ XCB_WM_HINT_X_URGENCY = (1L << 8)
+};
+
+/* Once xcb-icccm's API is stable, these should be replaced by calls to it */
+# define GET_TEXT_PROPERTY(Dpy, Win, Atom) \
+ xcb_get_property (Dpy, False, Win, Atom, XCB_GET_PROPERTY_TYPE_ANY, 0, BUFSIZ)
+# define xcb_get_wm_name(Dpy, Win) GET_TEXT_PROPERTY(Dpy, Win, XCB_ATOM_WM_NAME)
+
+# define xcb_get_wm_class(Dpy, Win) \
+ xcb_get_property (Dpy, False, Win, XCB_ATOM_WM_CLASS, XCB_ATOM_STRING, 0, BUFSIZ)
+# define xcb_get_wm_hints(Dpy, Win) \
+ xcb_get_property(Dpy, False, Win, XCB_ATOM_WM_HINTS, XCB_ATOM_WM_HINTS, 0, 9)
+
+# define xcb_get_wm_size_hints(Dpy, Win, Atom) \
+ xcb_get_property (Dpy, False, Win, Atom, XCB_ATOM_WM_SIZE_HINTS, 0, 18)
+# define xcb_get_wm_normal_hints(Dpy, Win) \
+ xcb_get_wm_size_hints(Dpy, Win, XCB_ATOM_WM_NORMAL_HINTS)
+#endif
+
+/* Possibly in xcb-emwh in the future? */
+static xcb_atom_t atom_net_wm_name, atom_utf8_string;
+static xcb_atom_t atom_net_wm_desktop, atom_net_wm_window_type,
+ atom_net_wm_state, atom_net_wm_pid, atom_net_frame_extents;
+static xcb_get_property_cookie_t get_net_wm_name (xcb_connection_t *,
+ xcb_window_t);
+
+/* Information we keep track of for each window to allow prefetching/reusing */
+struct wininfo {
+ xcb_window_t window;
+
+ /* cookies for requests we've sent */
+ xcb_get_geometry_cookie_t geometry_cookie;
+ xcb_get_property_cookie_t net_wm_name_cookie;
+ xcb_get_property_cookie_t wm_name_cookie;
+ xcb_get_property_cookie_t wm_class_cookie;
+ xcb_translate_coordinates_cookie_t trans_coords_cookie;
+ xcb_query_tree_cookie_t tree_cookie;
+ xcb_get_window_attributes_cookie_t attr_cookie;
+ xcb_get_property_cookie_t normal_hints_cookie;
+ xcb_get_property_cookie_t hints_cookie;
+ xcb_get_property_cookie_t wm_desktop_cookie;
+ xcb_get_property_cookie_t wm_window_type_cookie;
+ xcb_get_property_cookie_t wm_state_cookie;
+ xcb_get_property_cookie_t wm_pid_cookie;
+ xcb_get_property_cookie_t wm_client_machine_cookie;
+ xcb_get_property_cookie_t frame_extents_cookie;
+ xcb_get_property_cookie_t zoom_cookie;
+
+ /* cached results from previous requests */
+ xcb_get_geometry_reply_t * geometry;
+ xcb_get_window_attributes_reply_t * win_attributes;
+ xcb_size_hints_t * normal_hints;
+};
+
+static void scale_init (xcb_screen_t *scrn);
+static char *nscale (int, int, int, char *, size_t);
+static char *xscale (int);
+static char *yscale (int);
+static char *bscale (int);
+int main (int, char **);
+static const char *LookupL (long, const binding *);
+static const char *Lookup (int, const binding *);
+static void Display_Window_Id (struct wininfo *, Bool);
+static void Display_Stats_Info (struct wininfo *);
+static void Display_Bits_Info (struct wininfo *);
+static void Display_Event_Mask (long);
+static void Display_Events_Info (struct wininfo *);
+static void Display_Tree_Info (struct wininfo *, int);
+static void display_tree_info_1 (struct wininfo *, int, int);
+static void Display_Hints (xcb_size_hints_t *);
+static void Display_Size_Hints (struct wininfo *);
+static void Display_Window_Shape (xcb_window_t);
+static void Display_WM_Info (struct wininfo *);
+static void wininfo_wipe (struct wininfo *);
+
+static const char *window_id_format = "0x%lx";
+
+#ifdef HAVE_ICONV
+static iconv_t iconv_from_utf8;
+#endif
+static const char *user_encoding;
+static void print_utf8 (const char *, char *, size_t, const char *);
+static void print_friendly_name (const char *, const char *, const char *);
+
+static xcb_connection_t *dpy;
+static xcb_screen_t *screen;
+static xcb_generic_error_t *err;
#ifndef HAVE_STRLCAT
-static size_t strlcat(char *dst, const char *src, size_t dstsize)
+static size_t strlcat (char *dst, const char *src, size_t dstsize)
{
- size_t sd = strlen(dst);
- size_t ss = strlen(src);
+ size_t sd = strlen (dst);
+ size_t ss = strlen (src);
size_t s = sd + ss;
-
+
if (s < dstsize) {
- strcpy(dst + sd, src);
+ strcpy (dst + sd, src);
} else {
- strncpy(dst + sd, src, dstsize-sd-1);
+ strncpy (dst + sd, src, dstsize-sd-1);
dst[dstsize] = '\0';
}
return s;
@@ -109,50 +278,31 @@ static size_t strlcat(char *dst, const char *src, size_t dstsize)
* Report the syntax for calling xwininfo:
*/
void
-usage(void)
+usage (void)
{
fprintf (stderr,
- "usage: %s [-options ...]\n\n", program_name);
- fprintf (stderr,
- "where options include:\n");
- fprintf (stderr,
- " -help print this message\n");
- fprintf (stderr,
- " -display host:dpy X server to contact\n");
- fprintf (stderr,
- " -root use the root window\n");
- fprintf (stderr,
- " -id windowid use the window with the specified id\n");
- fprintf (stderr,
- " -name windowname use the window with the specified name\n");
- fprintf (stderr,
- " -int print window id in decimal\n");
- fprintf (stderr,
- " -children print parent and child identifiers\n");
- fprintf (stderr,
- " -tree print children identifiers recursively\n");
- fprintf (stderr,
- " -stats print window geometry [DEFAULT]\n");
- fprintf (stderr,
- " -bits print window pixel information\n");
- fprintf (stderr,
- " -events print events selected for on window\n");
- fprintf (stderr,
- " -size print size hints\n");
- fprintf (stderr,
- " -wm print window manager hints\n");
- fprintf (stderr,
- " -shape print shape extents\n");
- fprintf (stderr,
- " -frame don't ignore window manager frames\n");
- fprintf (stderr,
- " -english print sizes in english units\n");
- fprintf (stderr,
- " -metric print sizes in metric units\n");
- fprintf (stderr,
- " -all -tree, -stats, -bits, -events, -wm, -size, -shape\n");
- fprintf (stderr,
- "\n");
+ "usage: %s [-options ...]\n\n"
+ "where options include:\n"
+ " -help print this message\n"
+ " -display host:dpy X server to contact\n"
+ " -root use the root window\n"
+ " -id windowid use the window with the specified id\n"
+ " -name windowname use the window with the specified name\n"
+ " -int print window id in decimal\n"
+ " -children print parent and child identifiers\n"
+ " -tree print children identifiers recursively\n"
+ " -stats print window geometry [DEFAULT]\n"
+ " -bits print window pixel information\n"
+ " -events print events selected for on window\n"
+ " -size print size hints\n"
+ " -wm print window manager hints\n"
+ " -shape print shape extents\n"
+ " -frame don't ignore window manager frames\n"
+ " -english print sizes in english units\n"
+ " -metric print sizes in metric units\n"
+ " -all -tree, -stats, -bits, -events, -wm, -size, -shape\n"
+ "\n",
+ program_name);
exit (1);
}
@@ -167,21 +317,20 @@ usage(void)
*
*/
-#define getdsp(var,fn) var = fn(dpy, DefaultScreen(dpy))
-static int xp=0, xmm=0;
-static int yp=0, ymm=0;
-static int bp=0, bmm=0;
+static int xp = 0, xmm = 0;
+static int yp = 0, ymm = 0;
+static int bp = 0, bmm = 0;
static int english = 0, metric = 0;
static void
-scale_init(void)
+scale_init (xcb_screen_t *screen)
{
- getdsp(yp, DisplayHeight);
- getdsp(ymm, DisplayHeightMM);
- getdsp(xp, DisplayWidth);
- getdsp(xmm, DisplayWidthMM);
- bp = xp + yp;
- bmm = xmm + ymm;
+ xp = screen->width_in_pixels;
+ yp = screen->height_in_pixels;
+ xmm = screen->width_in_millimeters;
+ ymm = screen->height_in_millimeters;
+ bp = xp + yp;
+ bmm = xmm + ymm;
}
#define MILE (5280*12)
@@ -189,17 +338,17 @@ scale_init(void)
#define FOOT (12)
static char *
-nscale(int n, int np, int nmm, char *nbuf, size_t nbufsize)
+nscale (int n, int np, int nmm, char *nbuf, size_t nbufsize)
{
int s;
- snprintf(nbuf, nbufsize, "%d", n);
-
+ snprintf (nbuf, nbufsize, "%d", n);
+
if (metric||english) {
- s = strlcat(nbuf, " (", nbufsize);
+ s = strlcat (nbuf, " (", nbufsize);
if (metric) {
- snprintf(nbuf+s, nbufsize-s, "%.2f mm%s",
- ((double) n)*nmm/np, english ? "; " : "");
+ snprintf (nbuf+s, nbufsize-s, "%.2f mm%s",
+ ((double) n) * nmm/np , english ? "; " : "");
}
if (english) {
double inch_frac;
@@ -212,223 +361,384 @@ nscale(int n, int np, int nmm, char *nbuf, size_t nbufsize)
if (inr >= MILE) {
mi = inr/MILE;
inr %= MILE;
- s = strlen(nbuf);
- snprintf(nbuf+s, nbufsize-s, "%d %s(?!?)",
- mi, (mi==1) ? "mile" : "miles");
+ s = strlen (nbuf);
+ snprintf (nbuf+s, nbufsize-s, "%d %s(?!?)",
+ mi, (mi == 1) ? "mile" : "miles");
printed_anything = True;
}
if (inr >= YARD) {
yar = inr/YARD;
inr %= YARD;
if (printed_anything)
- strlcat(nbuf, ", ", nbufsize);
- s = strlen(nbuf);
- snprintf(nbuf+s, nbufsize-s, "%d %s",
- yar, (yar==1) ? "yard" : "yards");
+ strlcat (nbuf, ", ", nbufsize);
+ s = strlen (nbuf);
+ snprintf (nbuf+s, nbufsize-s, "%d %s",
+ yar, (yar==1) ? "yard" : "yards");
printed_anything = True;
}
if (inr >= FOOT) {
ft = inr/FOOT;
inr %= FOOT;
if (printed_anything)
- strlcat(nbuf, ", ", nbufsize);
- s = strlen(nbuf);
- snprintf(nbuf+s, nbufsize-s, "%d %s",
- ft, (ft==1) ? "foot" : "feet");
+ strlcat (nbuf, ", ", nbufsize);
+ s = strlen (nbuf);
+ snprintf (nbuf+s, nbufsize-s, "%d %s",
+ ft, (ft==1) ? "foot" : "feet");
printed_anything = True;
}
if (!printed_anything || inch_frac != 0.0 || inr != 0) {
if (printed_anything)
- strlcat(nbuf, ", ", nbufsize);
- s = strlen(nbuf);
- snprintf(nbuf+s, nbufsize-s, "%.2f inches", inr+inch_frac);
+ strlcat (nbuf, ", ", nbufsize);
+ s = strlen (nbuf);
+ snprintf (nbuf+s, nbufsize-s, "%.2f inches", inr+inch_frac);
}
}
strlcat (nbuf, ")", nbufsize);
}
- return(nbuf);
-}
-
+ return (nbuf);
+}
+
static char xbuf[BUFSIZ];
static char *
-xscale(int x)
+xscale (int x)
{
- if(!xp) {
- scale_init();
- }
- return(nscale(x, xp, xmm, xbuf, sizeof(xbuf)));
+ return (nscale (x, xp, xmm, xbuf, sizeof(xbuf)));
}
static char ybuf[BUFSIZ];
static char *
-yscale(int y)
+yscale (int y)
{
- if(!yp) {
- scale_init();
- }
- return(nscale(y, yp, ymm, ybuf, sizeof(ybuf)));
+ return (nscale (y, yp, ymm, ybuf, sizeof(ybuf)));
}
static char bbuf[BUFSIZ];
static char *
-bscale(int b)
+bscale (int b)
{
- if(!bp) {
- scale_init();
- }
- return(nscale(b, bp, bmm, bbuf, sizeof(bbuf)));
+ return (nscale (b, bp, bmm, bbuf, sizeof(bbuf)));
}
/* end of pixel to inch, metric converter */
-/* This handler is enabled when we are checking
- to see if the -id the user specified is valid. */
-
-/* ARGSUSED */
-static int
-bad_window_handler(Display *disp, XErrorEvent *err)
+int
+main (int argc, char **argv)
{
- char badid[20];
+ register int i;
+ int tree = 0, stats = 0, bits = 0, events = 0, wm = 0, size = 0, shape = 0;
+ int frame = 0, children = 0;
+ int use_root = 0;
+ xcb_window_t window = 0;
+ char *display_name = NULL;
+ const char *window_name = NULL;
+ struct wininfo wininfo;
+ struct wininfo *w = &wininfo;
+
+ program_name = argv[0];
+
+ if (!setlocale (LC_ALL, ""))
+ fprintf (stderr, "%s: can not set locale properly\n", program_name);
+ user_encoding = nl_langinfo (CODESET);
+ if (user_encoding == NULL)
+ user_encoding = "unknown encoding";
+
+ memset (w, 0, sizeof(struct wininfo));
+
+ /* Handle our command line arguments */
+ for (i = 1; i < argc; i++) {
+ if (!strcmp (argv[i], "-help"))
+ usage ();
+ if (!strcmp (argv[i], "-display") || !strcmp (argv[i], "-d")) {
+ if (++i >= argc)
+ Fatal_Error("-display requires argument");
+ display_name = argv[i];
+ continue;
+ }
+ if (!strcmp (argv[i], "-root")) {
+ use_root = 1;
+ continue;
+ }
+ if (!strcmp (argv[i], "-id")) {
+ if (++i >= argc)
+ Fatal_Error("-id requires argument");
+ window = strtoul(argv[i], NULL, 0);
+ continue;
+ }
+ if (!strcmp (argv[i], "-name")) {
+ if (++i >= argc)
+ Fatal_Error("-name requires argument");
+ window_name = argv[i];
+ continue;
+ }
+ if (!strcmp (argv[i], "-int")) {
+ window_id_format = "%ld";
+ continue;
+ }
+ if (!strcmp (argv[i], "-children")) {
+ children = 1;
+ continue;
+ }
+ if (!strcmp (argv[i], "-tree")) {
+ tree = 1;
+ continue;
+ }
+ if (!strcmp (argv[i], "-stats")) {
+ stats = 1;
+ continue;
+ }
+ if (!strcmp (argv[i], "-bits")) {
+ bits = 1;
+ continue;
+ }
+ if (!strcmp (argv[i], "-events")) {
+ events = 1;
+ continue;
+ }
+ if (!strcmp (argv[i], "-wm")) {
+ wm = 1;
+ continue;
+ }
+ if (!strcmp (argv[i], "-frame")) {
+ frame = 1;
+ continue;
+ }
+ if (!strcmp (argv[i], "-size")) {
+ size = 1;
+ continue;
+ }
+ if (!strcmp (argv[i], "-shape")) {
+ shape = 1;
+ continue;
+ }
+ if (!strcmp (argv[i], "-english")) {
+ english = 1;
+ continue;
+ }
+ if (!strcmp (argv[i], "-metric")) {
+ metric = 1;
+ continue;
+ }
+ if (!strcmp (argv[i], "-all")) {
+ tree = stats = bits = events = wm = size = shape = 1;
+ continue;
+ }
+ usage ();
+ }
- snprintf(badid, sizeof(badid), window_id_format, err->resourceid);
- Fatal_Error("No such window with id %s.", badid);
- exit (1);
- return 0;
-}
+ Setup_Display_And_Screen (display_name, &dpy, &screen);
+
+ /* preload atoms we may need later */
+ Intern_Atom (dpy, "_NET_WM_NAME");
+ Intern_Atom (dpy, "UTF8_STRING");
+ if (wm) {
+ Intern_Atom (dpy, "_NET_WM_DESKTOP");
+ Intern_Atom (dpy, "_NET_WM_WINDOW_TYPE");
+ Intern_Atom (dpy, "_NET_WM_STATE");
+ Intern_Atom (dpy, "_NET_WM_PID");
+ Intern_Atom (dpy, "_NET_FRAME_EXTENTS");
+ }
+ /* initialize scaling data */
+ scale_init(screen);
+
+ if (use_root)
+ window = screen->root;
+ else if (window_name) {
+ window = Window_With_Name (dpy, screen->root, window_name);
+ if (!window)
+ Fatal_Error ("No window with name \"%s\" exists!", window_name);
+ }
+ /* If no window selected on command line, let user pick one the hard way */
+ if (!window) {
+ printf ("\n"
+ "xwininfo: Please select the window about which you\n"
+ " would like information by clicking the\n"
+ " mouse in that window.\n");
+ Intern_Atom (dpy, "_NET_VIRTUAL_ROOTS");
+ Intern_Atom (dpy, "WM_STATE");
+ window = Select_Window (dpy, screen, !frame);
+ }
-int
-main(int argc, char **argv)
-{
- register int i;
- int tree = 0, stats = 0, bits = 0, events = 0, wm = 0, size = 0, shape = 0;
- int frame = 0, children = 0;
- Window window;
-
- INIT_NAME;
-
-#ifndef NO_I18N
- {
- char *lc;
- lc = setlocale(LC_ALL, "");
- if(!lc)
- fprintf(stderr, "can not set locale properly\n");
- }
-#endif
+ /*
+ * Do the actual displaying as per parameters
+ */
+ if (!(children || tree || bits || events || wm || size))
+ stats = 1;
- /* Open display, handle command line arguments */
- Setup_Display_And_Screen(&argc, argv);
+ /*
+ * make sure that the window is valid
+ */
+ {
+ xcb_get_geometry_cookie_t gg_cookie =
+ xcb_get_geometry (dpy, window);
- /* Get window selected on command line, if any */
- window = Select_Window_Args(&argc, argv);
+ w->geometry = xcb_get_geometry_reply(dpy, gg_cookie, &err);
- /* Handle our command line arguments */
- for (i = 1; i < argc; i++) {
- if (!strcmp(argv[i], "-help"))
- usage();
- if (!strcmp(argv[i], "-int")) {
- window_id_format = "%ld";
- continue;
- }
- if (!strcmp(argv[i], "-children")) {
- children = 1;
- continue;
- }
- if (!strcmp(argv[i], "-tree")) {
- tree = 1;
- continue;
- }
- if (!strcmp(argv[i], "-stats")) {
- stats = 1;
- continue;
- }
- if (!strcmp(argv[i], "-bits")) {
- bits = 1;
- continue;
- }
- if (!strcmp(argv[i], "-events")) {
- events = 1;
- continue;
- }
- if (!strcmp(argv[i], "-wm")) {
- wm = 1;
- continue;
+ if (!w->geometry) {
+ char badid[20];
+
+ if (err)
+ Print_X_Error (dpy, err);
+
+ snprintf (badid, sizeof(badid), window_id_format, window);
+ Fatal_Error ("No such window with id %s.", badid);
+ }
}
- if (!strcmp(argv[i], "-frame")) {
- frame = 1;
- continue;
+
+ /* Send requests to prefetch data we'll need */
+ w->window = window;
+ w->net_wm_name_cookie = get_net_wm_name (dpy, window);
+ w->wm_name_cookie = xcb_get_wm_name (dpy, window);
+ if (children || tree)
+ w->tree_cookie = xcb_query_tree (dpy, window);
+ if (stats) {
+ w->trans_coords_cookie =
+ xcb_translate_coordinates (dpy, window, w->geometry->root,
+ -(w->geometry->border_width),
+ -(w->geometry->border_width));
}
- if (!strcmp(argv[i], "-size")) {
- size = 1;
- continue;
+ if (stats || bits || events)
+ w->attr_cookie = xcb_get_window_attributes (dpy, window);
+ if (stats || size)
+ w->normal_hints_cookie = xcb_get_wm_normal_hints (dpy, window);
+ if (wm) {
+ w->hints_cookie = xcb_get_wm_hints(dpy, window);
+
+ atom_net_wm_desktop = Get_Atom (dpy, "_NET_WM_DESKTOP");
+ if (atom_net_wm_desktop) {
+ w->wm_desktop_cookie = xcb_get_property
+ (dpy, False, window, atom_net_wm_desktop,
+ XCB_ATOM_CARDINAL, 0, 4);
+ }
+
+ atom_net_wm_window_type = Get_Atom (dpy, "_NET_WM_WINDOW_TYPE");
+ if (atom_net_wm_window_type) {
+ w->wm_window_type_cookie = xcb_get_property
+ (dpy, False, window, atom_net_wm_window_type,
+ XCB_ATOM_ATOM, 0, BUFSIZ);
+ }
+
+ atom_net_wm_state = Get_Atom (dpy, "_NET_WM_STATE");
+ if (atom_net_wm_state) {
+ w->wm_state_cookie = xcb_get_property
+ (dpy, False, window, atom_net_wm_state,
+ XCB_ATOM_ATOM, 0, BUFSIZ);
+ }
+
+ atom_net_wm_pid = Get_Atom (dpy, "_NET_WM_PID");
+ if (atom_net_wm_pid) {
+ w->wm_pid_cookie = xcb_get_property
+ (dpy, False, window, atom_net_wm_pid,
+ XCB_ATOM_CARDINAL, 0, BUFSIZ);
+ w->wm_client_machine_cookie = xcb_get_property
+ (dpy, False, window, XCB_ATOM_WM_CLIENT_MACHINE,
+ XCB_GET_PROPERTY_TYPE_ANY, 0, BUFSIZ);
+ }
+
+ atom_net_frame_extents = Get_Atom (dpy, "_NET_FRAME_EXTENTS");
+ if (atom_net_frame_extents) {
+ w->frame_extents_cookie = xcb_get_property
+ (dpy, False, window, atom_net_frame_extents,
+ XCB_ATOM_CARDINAL, 0, 4 * 4);
+ }
}
- if (!strcmp(argv[i], "-shape")) {
- shape = 1;
- continue;
+ if (size)
+ w->zoom_cookie = xcb_get_wm_size_hints (dpy, window,
+ XCB_ATOM_WM_ZOOM_HINTS);
+ xcb_flush (dpy);
+
+ printf ("\nxwininfo: Window id: ");
+ Display_Window_Id (w, True);
+ if (children || tree)
+ Display_Tree_Info (w, tree);
+ if (stats)
+ Display_Stats_Info (w);
+ if (bits)
+ Display_Bits_Info (w);
+ if (events)
+ Display_Events_Info (w);
+ if (wm)
+ Display_WM_Info (w);
+ if (size)
+ Display_Size_Hints (w);
+ if (shape)
+ Display_Window_Shape (window);
+ printf ("\n");
+
+ wininfo_wipe (w);
+ xcb_disconnect (dpy);
+#ifdef HAVE_ICONV
+ if (iconv_from_utf8 && (iconv_from_utf8 != (iconv_t) -1)) {
+ iconv_close (iconv_from_utf8);
}
- if (!strcmp(argv[i], "-english")) {
- english = 1;
- continue;
+#endif
+ exit (0);
+}
+
+/* Ensure win_attributes field is filled in */
+static xcb_get_window_attributes_reply_t *
+fetch_win_attributes (struct wininfo *w)
+{
+ if (!w->win_attributes) {
+ w->win_attributes =
+ xcb_get_window_attributes_reply (dpy, w->attr_cookie, &err);
+
+ if (!w->win_attributes) {
+ Print_X_Error (dpy, err);
+ Fatal_Error ("Can't get window attributes.");
+ }
}
- if (!strcmp(argv[i], "-metric")) {
- metric = 1;
- continue;
+ return w->win_attributes;
+}
+
+#ifndef USE_XCB_ICCCM
+static Bool
+wm_size_hints_reply (xcb_connection_t *dpy, xcb_get_property_cookie_t cookie,
+ wm_size_hints_t *hints_return, xcb_generic_error_t **err)
+{
+ xcb_get_property_reply_t *prop = xcb_get_property_reply (dpy, cookie, err);
+ int length;
+
+ if (!prop || (prop->type != XCB_ATOM_WM_SIZE_HINTS) ||
+ (prop->format != 32)) {
+ free (prop);
+ return False;
}
- if (!strcmp(argv[i], "-all")) {
- tree = stats = bits = events = wm = size = shape = 1;
- continue;
+
+ memset (hints_return, 0, sizeof(wm_size_hints_t));
+
+ length = xcb_get_property_value_length(prop);
+ if (length > sizeof(wm_size_hints_t))
+ length = sizeof(wm_size_hints_t);
+ memcpy (hints_return, xcb_get_property_value (prop), length);
+
+ free (prop);
+ return True;
+}
+
+#define xcb_get_wm_normal_hints_reply wm_size_hints_reply
+#define xcb_get_wm_size_hints_reply wm_size_hints_reply
+#endif
+
+
+
+/* Ensure normal_hints field is filled in */
+static xcb_size_hints_t *
+fetch_normal_hints (struct wininfo *w, xcb_size_hints_t *hints_return)
+{
+ xcb_size_hints_t hints;
+
+ if (!w->normal_hints) {
+ if (xcb_get_wm_normal_hints_reply (dpy, w->normal_hints_cookie,
+ &hints, NULL)) {
+ w->normal_hints = malloc (sizeof(xcb_size_hints_t));
+ if (w->normal_hints)
+ memcpy(w->normal_hints, &hints, sizeof(xcb_size_hints_t));
+ }
}
- usage();
- }
-
- /* If no window selected on command line, let user pick one the hard way */
- if (!window) {
- printf("\n");
- printf("xwininfo: Please select the window about which you\n");
- printf(" would like information by clicking the\n");
- printf(" mouse in that window.\n");
- window = Select_Window(dpy, !frame);
- }
-
- /*
- * Do the actual displaying as per parameters
- */
- if (!(children || tree || bits || events || wm || size))
- stats = 1;
-
- /*
- * make sure that the window is valid
- */
- {
- Window root;
- int x, y;
- unsigned width, height, bw, depth;
- XErrorHandler old_handler;
-
- old_handler = XSetErrorHandler(bad_window_handler);
- XGetGeometry (dpy, window, &root, &x, &y, &width, &height, &bw, &depth);
- XSync (dpy, False);
- (void) XSetErrorHandler(old_handler);
- }
-
- printf("\nxwininfo: Window id: ");
- Display_Window_Id(window, True);
- if (children || tree)
- Display_Tree_Info(window, tree);
- if (stats)
- Display_Stats_Info(window);
- if (bits)
- Display_Bits_Info(window);
- if (events)
- Display_Events_Info(window);
- if (wm)
- Display_WM_Info(window);
- if (size)
- Display_Size_Hints(window);
- if (shape)
- Display_Window_Shape(window);
- printf("\n");
- exit(0);
+ if (hints_return && w->normal_hints)
+ memcpy(hints_return, w->normal_hints, sizeof(xcb_size_hints_t));
+ return w->normal_hints;
}
@@ -438,85 +748,115 @@ main(int argc, char **argv)
static char _lookup_buffer[100];
static const char *
-LookupL(long code, const binding *table)
+LookupL (long code, const binding *table)
{
- const char *name;
+ const char *name = NULL;
- snprintf(_lookup_buffer, sizeof(_lookup_buffer),
- "unknown (code = %ld. = 0x%lx)", code, code);
- name = _lookup_buffer;
-
- while (table->name) {
- if (table->code == code) {
- name = table->name;
- break;
- }
- table++;
+ while (table->name) {
+ if (table->code == code) {
+ name = table->name;
+ break;
}
+ table++;
+ }
- return(name);
+ if (name == NULL) {
+ snprintf (_lookup_buffer, sizeof(_lookup_buffer),
+ "unknown (code = %ld. = 0x%lx)", code, code);
+ name = _lookup_buffer;
+ }
+
+ return (name);
}
static const char *
-Lookup(int code, const binding *table)
+Lookup (int code, const binding *table)
{
- return LookupL((long)code, table);
+ return LookupL ((long)code, table);
}
/*
* Routine to display a window id in dec/hex with name if window has one
+ *
+ * Requires wininfo members initialized: window, wm_name_cookie
*/
static void
-Display_Window_Id(Window window, Bool newline_wanted)
+Display_Window_Id (struct wininfo *w, Bool newline_wanted)
{
-#ifdef NO_I18N
- char *win_name;
-#else
- XTextProperty tp;
+#ifdef USE_XCB_ICCCM
+ xcb_get_text_property_reply_t wmn_reply;
#endif
-
- printf(window_id_format, window); /* print id # in hex/dec */
+ xcb_get_property_reply_t *prop;
+ uint8_t got_reply = False;
+ const char *wm_name = NULL;
+ unsigned int wm_name_len = 0;
+ xcb_atom_t wm_name_encoding = XCB_NONE;
- if (!window) {
- printf(" (none)");
+ printf (window_id_format, w->window); /* print id # in hex/dec */
+
+ if (!w->window) {
+ printf (" (none)");
} else {
- if (window == RootWindow(dpy, screen)) {
- printf(" (the root window)");
+ if (w->window == screen->root) {
+ printf (" (the root window)");
}
-#ifdef NO_I18N
- if (!XFetchName(dpy, window, &win_name)) { /* Get window name if any */
- printf(" (has no name)");
- } else if (win_name) {
- printf(" \"%s\"", win_name);
- XFree(win_name);
+ /* Get window name if any */
+ prop = xcb_get_property_reply (dpy, w->net_wm_name_cookie, NULL);
+ if (prop && (prop->type != XCB_NONE)) {
+ wm_name = xcb_get_property_value (prop);
+ wm_name_len = xcb_get_property_value_length (prop);
+ wm_name_encoding = prop->type;
+ got_reply = True;
}
+
+ if (!got_reply) { /* No _NET_WM_NAME, check WM_NAME */
+#ifdef USE_XCB_ICCCM
+ got_reply = xcb_get_wm_name_reply (dpy, w->wm_name_cookie,
+ &wmn_reply, NULL);
+ if (got_reply) {
+ wm_name = wmn_reply.name;
+ wm_name_len = wmn_reply.name_len;
+ wm_name_encoding = wmn_reply.encoding;
+ }
#else
- if (!XGetWMName(dpy, window, &tp)) { /* Get window name if any */
- printf(" (has no name)");
- } else if (tp.nitems > 0) {
- printf(" \"");
- {
- int count = 0, i, ret;
- char **list = NULL;
- ret = XmbTextPropertyToTextList(dpy, &tp, &list, &count);
- if((ret == Success || ret > 0) && list != NULL){
- for(i=0; i<count; i++)
- printf("%s", list[i]);
- XFreeStringList(list);
- } else {
- printf("%s", tp.value);
- }
- }
- printf("\"");
+ prop = xcb_get_property_reply (dpy, w->wm_name_cookie, NULL);
+ if (prop && (prop->type != XCB_NONE)) {
+ wm_name = xcb_get_property_value (prop);
+ wm_name_len = xcb_get_property_value_length (prop);
+ wm_name_encoding = prop->type;
+ got_reply = True;
+ }
+#endif
}
+ if (!got_reply || wm_name_len == 0) {
+ printf (" (has no name)");
+ } else {
+ if (wm_name_encoding == XCB_ATOM_STRING) {
+ printf (" \"%.*s\"", wm_name_len, wm_name);
+ } else if (wm_name_encoding == atom_utf8_string) {
+ print_utf8 (" \"", (char *) wm_name, wm_name_len, "\"");
+ } else {
+ /* Encodings we don't support, including COMPOUND_TEXT */
+ const char *enc_name = Get_Atom_Name (dpy, wm_name_encoding);
+ if (enc_name) {
+ printf (" (name in unsupported encoding %s)", enc_name);
+ } else {
+ printf (" (name in unsupported encoding ATOM 0x%x)",
+ wm_name_encoding);
+ }
+ }
+ }
+#ifdef USE_XCB_ICCCM
+ if (got_reply)
+ xcb_get_text_property_reply_wipe (&wmn_reply);
+#else
+ free (prop);
#endif
- else
- printf(" (has no name)");
}
if (newline_wanted)
- printf("\n");
+ printf ("\n");
return;
}
@@ -526,221 +866,255 @@ Display_Window_Id(Window window, Bool newline_wanted)
* Display Stats on window
*/
static const binding _window_classes[] = {
- { InputOutput, "InputOutput" },
- { InputOnly, "InputOnly" },
+ { XCB_WINDOW_CLASS_INPUT_OUTPUT, "InputOutput" },
+ { XCB_WINDOW_CLASS_INPUT_ONLY, "InputOnly" },
{ 0, NULL } };
static const binding _map_states[] = {
- { IsUnmapped, "IsUnMapped" },
- { IsUnviewable, "IsUnviewable" },
- { IsViewable, "IsViewable" },
+ { XCB_MAP_STATE_UNMAPPED, "IsUnMapped" },
+ { XCB_MAP_STATE_UNVIEWABLE, "IsUnviewable" },
+ { XCB_MAP_STATE_VIEWABLE, "IsViewable" },
{ 0, NULL } };
static const binding _backing_store_states[] = {
- { NotUseful, "NotUseful" },
- { WhenMapped, "WhenMapped" },
- { Always, "Always" },
+ { XCB_BACKING_STORE_NOT_USEFUL, "NotUseful" },
+ { XCB_BACKING_STORE_WHEN_MAPPED,"WhenMapped" },
+ { XCB_BACKING_STORE_ALWAYS, "Always" },
{ 0, NULL } };
static const binding _bit_gravity_states[] = {
- { ForgetGravity, "ForgetGravity" },
- { NorthWestGravity, "NorthWestGravity" },
- { NorthGravity, "NorthGravity" },
- { NorthEastGravity, "NorthEastGravity" },
- { WestGravity, "WestGravity" },
- { CenterGravity, "CenterGravity" },
- { EastGravity, "EastGravity" },
- { SouthWestGravity, "SouthWestGravity" },
- { SouthGravity, "SouthGravity" },
- { SouthEastGravity, "SouthEastGravity" },
- { StaticGravity, "StaticGravity" },
+ { XCB_GRAVITY_BIT_FORGET, "ForgetGravity" },
+ { XCB_GRAVITY_NORTH_WEST, "NorthWestGravity" },
+ { XCB_GRAVITY_NORTH, "NorthGravity" },
+ { XCB_GRAVITY_NORTH_EAST, "NorthEastGravity" },
+ { XCB_GRAVITY_WEST, "WestGravity" },
+ { XCB_GRAVITY_CENTER, "CenterGravity" },
+ { XCB_GRAVITY_EAST, "EastGravity" },
+ { XCB_GRAVITY_SOUTH_WEST, "SouthWestGravity" },
+ { XCB_GRAVITY_SOUTH, "SouthGravity" },
+ { XCB_GRAVITY_SOUTH_EAST, "SouthEastGravity" },
+ { XCB_GRAVITY_STATIC, "StaticGravity" },
{ 0, NULL }};
static const binding _window_gravity_states[] = {
- { UnmapGravity, "UnmapGravity" },
- { NorthWestGravity, "NorthWestGravity" },
- { NorthGravity, "NorthGravity" },
- { NorthEastGravity, "NorthEastGravity" },
- { WestGravity, "WestGravity" },
- { CenterGravity, "CenterGravity" },
- { EastGravity, "EastGravity" },
- { SouthWestGravity, "SouthWestGravity" },
- { SouthGravity, "SouthGravity" },
- { SouthEastGravity, "SouthEastGravity" },
- { StaticGravity, "StaticGravity" },
+ { XCB_GRAVITY_WIN_UNMAP, "UnmapGravity" },
+ { XCB_GRAVITY_NORTH_WEST, "NorthWestGravity" },
+ { XCB_GRAVITY_NORTH, "NorthGravity" },
+ { XCB_GRAVITY_NORTH_EAST, "NorthEastGravity" },
+ { XCB_GRAVITY_WEST, "WestGravity" },
+ { XCB_GRAVITY_CENTER, "CenterGravity" },
+ { XCB_GRAVITY_EAST, "EastGravity" },
+ { XCB_GRAVITY_SOUTH_WEST, "SouthWestGravity" },
+ { XCB_GRAVITY_SOUTH, "SouthGravity" },
+ { XCB_GRAVITY_SOUTH_EAST, "SouthEastGravity" },
+ { XCB_GRAVITY_STATIC, "StaticGravity" },
{ 0, NULL }};
static const binding _visual_classes[] = {
- { StaticGray, "StaticGray" },
- { GrayScale, "GrayScale" },
- { StaticColor, "StaticColor" },
- { PseudoColor, "PseudoColor" },
- { TrueColor, "TrueColor" },
- { DirectColor, "DirectColor" },
+ { XCB_VISUAL_CLASS_STATIC_GRAY, "StaticGray" },
+ { XCB_VISUAL_CLASS_GRAY_SCALE, "GrayScale" },
+ { XCB_VISUAL_CLASS_STATIC_COLOR,"StaticColor" },
+ { XCB_VISUAL_CLASS_PSEUDO_COLOR,"PseudoColor" },
+ { XCB_VISUAL_CLASS_TRUE_COLOR, "TrueColor" },
+ { XCB_VISUAL_CLASS_DIRECT_COLOR,"DirectColor" },
{ 0, NULL }};
+/*
+ * Requires wininfo members initialized:
+ * window, geometry, attr_cookie, trans_coords_cookie, normal_hints_cookie
+ */
static void
-Display_Stats_Info(Window window)
+Display_Stats_Info (struct wininfo *w)
{
- XWindowAttributes win_attributes;
- XVisualInfo vistemplate, *vinfo;
- XSizeHints hints;
- int dw = DisplayWidth (dpy, screen), dh = DisplayHeight (dpy, screen);
- int rx, ry, xright, ybelow;
- int showright = 0, showbelow = 0;
- Status status;
- Window wmframe;
- int junk;
- long longjunk;
- Window junkwin;
-
- if (!XGetWindowAttributes(dpy, window, &win_attributes))
- Fatal_Error("Can't get window attributes.");
- vistemplate.visualid = XVisualIDFromVisual(win_attributes.visual);
- vinfo = XGetVisualInfo(dpy, VisualIDMask, &vistemplate, &junk);
-
- (void) XTranslateCoordinates (dpy, window, win_attributes.root,
- -win_attributes.border_width,
- -win_attributes.border_width,
- &rx, &ry, &junkwin);
-
- xright = (dw - rx - win_attributes.border_width * 2 -
- win_attributes.width);
- ybelow = (dh - ry - win_attributes.border_width * 2 -
- win_attributes.height);
-
- printf("\n");
- printf(" Absolute upper-left X: %s\n", xscale(rx));
- printf(" Absolute upper-left Y: %s\n", yscale(ry));
- printf(" Relative upper-left X: %s\n", xscale(win_attributes.x));
- printf(" Relative upper-left Y: %s\n", yscale(win_attributes.y));
- printf(" Width: %s\n", xscale(win_attributes.width));
- printf(" Height: %s\n", yscale(win_attributes.height));
- printf(" Depth: %d\n", win_attributes.depth);
- printf(" Visual: 0x%lx\n", vinfo->visualid);
- printf(" Visual Class: %s\n", Lookup(vinfo->class, _visual_classes));
- printf(" Border width: %s\n", bscale(win_attributes.border_width));
- printf(" Class: %s\n",
- Lookup(win_attributes.class, _window_classes));
- printf(" Colormap: 0x%lx (%sinstalled)\n",
- win_attributes.colormap, win_attributes.map_installed ? "" : "not ");
- printf(" Bit Gravity State: %s\n",
- Lookup(win_attributes.bit_gravity, _bit_gravity_states));
- printf(" Window Gravity State: %s\n",
- Lookup(win_attributes.win_gravity, _window_gravity_states));
- printf(" Backing Store State: %s\n",
- Lookup(win_attributes.backing_store, _backing_store_states));
- printf(" Save Under State: %s\n",
- win_attributes.save_under ? "yes" : "no");
- printf(" Map State: %s\n",
- Lookup(win_attributes.map_state, _map_states));
- printf(" Override Redirect State: %s\n",
- win_attributes.override_redirect ? "yes" : "no");
- printf(" Corners: +%d+%d -%d+%d -%d-%d +%d-%d\n",
- rx, ry, xright, ry, xright, ybelow, rx, ybelow);
-
- XFree(vinfo);
-
- /*
- * compute geometry string that would recreate window
- */
- printf(" -geometry ");
-
- /* compute size in appropriate units */
- status = XGetWMNormalHints(dpy, window, &hints, &longjunk);
- if (status && hints.flags & PResizeInc &&
- hints.width_inc != 0 && hints.height_inc != 0) {
- if (hints.flags & (PBaseSize|PMinSize)) {
- if (hints.flags & PBaseSize) {
- win_attributes.width -= hints.base_width;
- win_attributes.height -= hints.base_height;
- } else {
- /* ICCCM says MinSize is default for BaseSize */
- win_attributes.width -= hints.min_width;
- win_attributes.height -= hints.min_height;
- }
- }
- printf("%dx%d", win_attributes.width/hints.width_inc,
- win_attributes.height/hints.height_inc);
- } else
- printf("%dx%d", win_attributes.width, win_attributes.height);
-
- if (!(hints.flags&PWinGravity))
- hints.win_gravity = NorthWestGravity; /* per ICCCM */
- /* find our window manager frame, if any */
- wmframe = window;
- while (True) {
- Window root, parent;
- Window *childlist;
- unsigned int ujunk;
-
- status = XQueryTree(dpy, wmframe, &root, &parent, &childlist, &ujunk);
- if (parent == root || !parent || !status)
- break;
- wmframe = parent;
- if (status && childlist)
- XFree((char *)childlist);
- }
- if (wmframe != window) {
- /* WM reparented, so find edges of the frame */
- /* Only works for ICCCM-compliant WMs, and then only if the
- window has corner gravity. We would need to know the original width
- of the window to correctly handle the other gravities. */
-
- XWindowAttributes frame_attr;
-
- if (!XGetWindowAttributes(dpy, wmframe, &frame_attr))
- Fatal_Error("Can't get frame attributes.");
- switch (hints.win_gravity) {
- case NorthWestGravity: case SouthWestGravity:
- case NorthEastGravity: case SouthEastGravity:
- case WestGravity:
- rx = frame_attr.x;
- }
- switch (hints.win_gravity) {
- case NorthWestGravity: case SouthWestGravity:
- case NorthEastGravity: case SouthEastGravity:
- case EastGravity:
- xright = dw - frame_attr.x - frame_attr.width -
- 2*frame_attr.border_width;
- }
- switch (hints.win_gravity) {
- case NorthWestGravity: case SouthWestGravity:
- case NorthEastGravity: case SouthEastGravity:
- case NorthGravity:
- ry = frame_attr.y;
- }
- switch (hints.win_gravity) {
- case NorthWestGravity: case SouthWestGravity:
- case NorthEastGravity: case SouthEastGravity:
- case SouthGravity:
- ybelow = dh - frame_attr.y - frame_attr.height -
- 2*frame_attr.border_width;
- }
- }
- /* If edge gravity, offer a corner on that edge (because the application
- programmer cares about that edge), otherwise offer upper left unless
- some other corner is close to an edge of the screen.
- (For corner gravity, assume gravity was set by XWMGeometry.
- For CenterGravity, it doesn't matter.) */
- if (hints.win_gravity == EastGravity ||
- (abs(xright) <= 100 && abs(xright) < abs(rx)
- && hints.win_gravity != WestGravity))
- showright = 1;
- if (hints.win_gravity == SouthGravity ||
- (abs(ybelow) <= 100 && abs(ybelow) < abs(ry)
- && hints.win_gravity != NorthGravity))
- showbelow = 1;
-
- if (showright)
- printf("-%d", xright);
- else
- printf("+%d", rx);
- if (showbelow)
- printf("-%d", ybelow);
- else
- printf("+%d", ry);
- printf("\n");
+ xcb_translate_coordinates_reply_t *trans_coords;
+ xcb_get_window_attributes_reply_t *win_attributes;
+ xcb_size_hints_t hints;
+
+ int dw = screen->width_in_pixels, dh = screen->height_in_pixels;
+ int rx, ry, xright, ybelow;
+ int showright = 0, showbelow = 0;
+ xcb_window_t wmframe, parent;
+
+ trans_coords =
+ xcb_translate_coordinates_reply (dpy, w->trans_coords_cookie, NULL);
+ if (!trans_coords)
+ Fatal_Error ("Can't get translated coordinates.");
+
+ rx = (int16_t)trans_coords->dst_x;
+ ry = (int16_t)trans_coords->dst_y;
+ free (trans_coords);
+
+ xright = (dw - rx - w->geometry->border_width * 2 -
+ w->geometry->width);
+ ybelow = (dh - ry - w->geometry->border_width * 2 -
+ w->geometry->height);
+
+
+ printf ("\n");
+ printf (" Absolute upper-left X: %s\n", xscale (rx));
+ printf (" Absolute upper-left Y: %s\n", yscale (ry));
+ printf (" Relative upper-left X: %s\n", xscale (w->geometry->x));
+ printf (" Relative upper-left Y: %s\n", yscale (w->geometry->y));
+ printf (" Width: %s\n", xscale (w->geometry->width));
+ printf (" Height: %s\n", yscale (w->geometry->height));
+ printf (" Depth: %d\n", w->geometry->depth);
+
+ win_attributes = fetch_win_attributes (w);
+
+ printf (" Visual: 0x%lx\n", (unsigned long) win_attributes->visual);
+ if (screen)
+ {
+ xcb_depth_iterator_t depth_iter;
+ xcb_visualtype_t *visual_type = NULL;
+
+ depth_iter = xcb_screen_allowed_depths_iterator (screen);
+ for (; depth_iter.rem; xcb_depth_next (&depth_iter)) {
+ xcb_visualtype_iterator_t visual_iter;
+
+ visual_iter = xcb_depth_visuals_iterator (depth_iter.data);
+ for (; visual_iter.rem; xcb_visualtype_next (&visual_iter)) {
+ if (screen->root_visual == visual_iter.data->visual_id) {
+ visual_type = visual_iter.data;
+ break;
+ }
+ }
+ }
+ if (visual_type)
+ printf (" Visual Class: %s\n", Lookup (visual_type->_class,
+ _visual_classes));
+ }
+
+ printf (" Border width: %s\n", bscale (w->geometry->border_width));
+ printf (" Class: %s\n",
+ Lookup (win_attributes->_class, _window_classes));
+ printf (" Colormap: 0x%lx (%sinstalled)\n",
+ (unsigned long) win_attributes->colormap,
+ win_attributes->map_is_installed ? "" : "not ");
+ printf (" Bit Gravity State: %s\n",
+ Lookup (win_attributes->bit_gravity, _bit_gravity_states));
+ printf (" Window Gravity State: %s\n",
+ Lookup (win_attributes->win_gravity, _window_gravity_states));
+ printf (" Backing Store State: %s\n",
+ Lookup (win_attributes->backing_store, _backing_store_states));
+ printf (" Save Under State: %s\n",
+ win_attributes->save_under ? "yes" : "no");
+ printf (" Map State: %s\n",
+ Lookup (win_attributes->map_state, _map_states));
+ printf (" Override Redirect State: %s\n",
+ win_attributes->override_redirect ? "yes" : "no");
+ printf (" Corners: +%d+%d -%d+%d -%d-%d +%d-%d\n",
+ rx, ry, xright, ry, xright, ybelow, rx, ybelow);
+
+ /*
+ * compute geometry string that would recreate window
+ */
+ printf (" -geometry ");
+
+ /* compute size in appropriate units */
+ if (!fetch_normal_hints (w, &hints))
+ hints.flags = 0;
+
+ if ((hints.flags & XCB_SIZE_HINT_P_RESIZE_INC) &&
+ (hints.width_inc != 0) && (hints.height_inc != 0)) {
+ if (hints.flags & (XCB_SIZE_HINT_BASE_SIZE|XCB_SIZE_HINT_P_MIN_SIZE)) {
+ if (hints.flags & XCB_SIZE_HINT_BASE_SIZE) {
+ w->geometry->width -= hints.base_width;
+ w->geometry->height -= hints.base_height;
+ } else {
+ /* ICCCM says MinSize is default for BaseSize */
+ w->geometry->width -= hints.min_width;
+ w->geometry->height -= hints.min_height;
+ }
+ }
+ printf ("%dx%d", w->geometry->width/hints.width_inc,
+ w->geometry->height/hints.height_inc);
+ } else
+ printf ("%dx%d", w->geometry->width, w->geometry->height);
+
+ if (!(hints.flags & XCB_SIZE_HINT_P_WIN_GRAVITY))
+ hints.win_gravity = XCB_GRAVITY_NORTH_WEST; /* per ICCCM */
+ /* find our window manager frame, if any */
+ for (wmframe = parent = w->window; parent != 0 ; wmframe = parent) {
+ xcb_query_tree_cookie_t qt_cookie;
+ xcb_query_tree_reply_t *tree;
+
+ qt_cookie = xcb_query_tree (dpy, wmframe);
+ tree = xcb_query_tree_reply (dpy, qt_cookie, &err);
+ if (!tree) {
+ Print_X_Error (dpy, err);
+ Fatal_Error ("Can't query window tree.");
+ }
+ parent = tree->parent;
+ free (tree);
+ if (parent == w->geometry->root || !parent)
+ break;
+ }
+ if (wmframe != w->window) {
+ /* WM reparented, so find edges of the frame */
+ /* Only works for ICCCM-compliant WMs, and then only if the
+ window has corner gravity. We would need to know the original width
+ of the window to correctly handle the other gravities. */
+ xcb_get_geometry_cookie_t geom_cookie;
+ xcb_get_geometry_reply_t *frame_geometry;
+
+ geom_cookie = xcb_get_geometry (dpy, wmframe);
+ frame_geometry = xcb_get_geometry_reply (dpy, geom_cookie, &err);
+
+ if (!frame_geometry) {
+ Print_X_Error (dpy, err);
+ Fatal_Error ("Can't get frame geometry.");
+ }
+ switch (hints.win_gravity) {
+ case XCB_GRAVITY_NORTH_WEST: case XCB_GRAVITY_SOUTH_WEST:
+ case XCB_GRAVITY_NORTH_EAST: case XCB_GRAVITY_SOUTH_EAST:
+ case XCB_GRAVITY_WEST:
+ rx = frame_geometry->x;
+ }
+ switch (hints.win_gravity) {
+ case XCB_GRAVITY_NORTH_WEST: case XCB_GRAVITY_SOUTH_WEST:
+ case XCB_GRAVITY_NORTH_EAST: case XCB_GRAVITY_SOUTH_EAST:
+ case XCB_GRAVITY_EAST:
+ xright = dw - frame_geometry->x - frame_geometry->width -
+ (2 * frame_geometry->border_width);
+ }
+ switch (hints.win_gravity) {
+ case XCB_GRAVITY_NORTH_WEST: case XCB_GRAVITY_SOUTH_WEST:
+ case XCB_GRAVITY_NORTH_EAST: case XCB_GRAVITY_SOUTH_EAST:
+ case XCB_GRAVITY_NORTH:
+ ry = frame_geometry->y;
+ }
+ switch (hints.win_gravity) {
+ case XCB_GRAVITY_NORTH_WEST: case XCB_GRAVITY_SOUTH_WEST:
+ case XCB_GRAVITY_NORTH_EAST: case XCB_GRAVITY_SOUTH_EAST:
+ case XCB_GRAVITY_SOUTH:
+ ybelow = dh - frame_geometry->y - frame_geometry->height -
+ (2 * frame_geometry->border_width);
+ }
+ free (frame_geometry);
+ }
+ /* If edge gravity, offer a corner on that edge (because the application
+ programmer cares about that edge), otherwise offer upper left unless
+ some other corner is close to an edge of the screen.
+ (For corner gravity, assume gravity was set by XWMGeometry.
+ For CenterGravity, it doesn't matter.) */
+ if (hints.win_gravity == XCB_GRAVITY_EAST ||
+ (abs (xright) <= 100 && abs (xright) < abs (rx)
+ && hints.win_gravity != XCB_GRAVITY_WEST))
+ showright = 1;
+ if (hints.win_gravity == XCB_GRAVITY_SOUTH ||
+ (abs (ybelow) <= 100 && abs (ybelow) < abs (ry)
+ && hints.win_gravity != XCB_GRAVITY_NORTH))
+ showbelow = 1;
+
+ if (showright)
+ printf ("-%d", xright);
+ else
+ printf ("+%d", rx);
+ if (showbelow)
+ printf ("-%d", ybelow);
+ else
+ printf ("+%d", ry);
+ printf ("\n");
}
@@ -748,24 +1122,25 @@ Display_Stats_Info(Window window)
* Display bits info:
*/
static const binding _gravities[] = {
- { UnmapGravity, "UnMapGravity" }, /* WARNING: both of these have*/
- { ForgetGravity, "ForgetGravity" }, /* the same value - see code */
- { NorthWestGravity, "NorthWestGravity" },
- { NorthGravity, "NorthGravity" },
- { NorthEastGravity, "NorthEastGravity" },
- { WestGravity, "WestGravity" },
- { CenterGravity, "CenterGravity" },
- { EastGravity, "EastGravity" },
- { SouthWestGravity, "SouthWestGravity" },
- { SouthGravity, "SouthGravity" },
- { SouthEastGravity, "SouthEastGravity" },
- { StaticGravity, "StaticGravity" },
+ /* WARNING: the first two of these have the same value - see code */
+ { XCB_GRAVITY_WIN_UNMAP, "UnMapGravity" },
+ { XCB_GRAVITY_BIT_FORGET, "ForgetGravity" },
+ { XCB_GRAVITY_NORTH_WEST, "NorthWestGravity" },
+ { XCB_GRAVITY_NORTH, "NorthGravity" },
+ { XCB_GRAVITY_NORTH_EAST, "NorthEastGravity" },
+ { XCB_GRAVITY_WEST, "WestGravity" },
+ { XCB_GRAVITY_CENTER, "CenterGravity" },
+ { XCB_GRAVITY_EAST, "EastGravity" },
+ { XCB_GRAVITY_SOUTH_WEST, "SouthWestGravity" },
+ { XCB_GRAVITY_SOUTH, "SouthGravity" },
+ { XCB_GRAVITY_SOUTH_EAST, "SouthEastGravity" },
+ { XCB_GRAVITY_STATIC, "StaticGravity" },
{ 0, NULL } };
static const binding _backing_store_hint[] = {
- { NotUseful, "NotUseful" },
- { WhenMapped, "WhenMapped" },
- { Always, "Always" },
+ { XCB_BACKING_STORE_NOT_USEFUL, "NotUseful" },
+ { XCB_BACKING_STORE_WHEN_MAPPED,"WhenMapped" },
+ { XCB_BACKING_STORE_ALWAYS, "Always" },
{ 0, NULL } };
static const binding _bool[] = {
@@ -773,26 +1148,29 @@ static const binding _bool[] = {
{ 1, "Yes" },
{ 0, NULL } };
+/*
+ * Requires wininfo members initialized:
+ * window, attr_cookie (or win_attributes)
+ */
static void
-Display_Bits_Info(Window window)
+Display_Bits_Info (struct wininfo * w)
{
- XWindowAttributes win_attributes;
-
- if (!XGetWindowAttributes(dpy, window, &win_attributes))
- Fatal_Error("Can't get window attributes.");
-
- printf("\n");
- printf(" Bit gravity: %s\n",
- Lookup(win_attributes.bit_gravity, _gravities+1));
- printf(" Window gravity: %s\n",
- Lookup(win_attributes.win_gravity, _gravities));
- printf(" Backing-store hint: %s\n",
- Lookup(win_attributes.backing_store, _backing_store_hint));
- printf(" Backing-planes to be preserved: 0x%lx\n",
- win_attributes.backing_planes);
- printf(" Backing pixel: %ld\n", win_attributes.backing_pixel);
- printf(" Save-unders: %s\n",
- Lookup(win_attributes.save_under, _bool));
+ xcb_get_window_attributes_reply_t *win_attributes
+ = fetch_win_attributes (w);
+
+ printf ("\n");
+ printf (" Bit gravity: %s\n",
+ Lookup (win_attributes->bit_gravity, _gravities+1));
+ printf (" Window gravity: %s\n",
+ Lookup (win_attributes->win_gravity, _gravities));
+ printf (" Backing-store hint: %s\n",
+ Lookup (win_attributes->backing_store, _backing_store_hint));
+ printf (" Backing-planes to be preserved: 0x%lx\n",
+ (unsigned long) win_attributes->backing_planes);
+ printf (" Backing pixel: %ld\n",
+ (unsigned long) win_attributes->backing_pixel);
+ printf (" Save-unders: %s\n",
+ Lookup (win_attributes->save_under, _bool));
}
@@ -800,65 +1178,66 @@ Display_Bits_Info(Window window)
* Routine to display all events in an event mask
*/
static const binding _event_mask_names[] = {
- { KeyPressMask, "KeyPress" },
- { KeyReleaseMask, "KeyRelease" },
- { ButtonPressMask, "ButtonPress" },
- { ButtonReleaseMask, "ButtonRelease" },
- { EnterWindowMask, "EnterWindow" },
- { LeaveWindowMask, "LeaveWindow" },
- { PointerMotionMask, "PointerMotion" },
- { PointerMotionHintMask, "PointerMotionHint" },
- { Button1MotionMask, "Button1Motion" },
- { Button2MotionMask, "Button2Motion" },
- { Button3MotionMask, "Button3Motion" },
- { Button4MotionMask, "Button4Motion" },
- { Button5MotionMask, "Button5Motion" },
- { ButtonMotionMask, "ButtonMotion" },
- { KeymapStateMask, "KeymapState" },
- { ExposureMask, "Exposure" },
- { VisibilityChangeMask, "VisibilityChange" },
- { StructureNotifyMask, "StructureNotify" },
- { ResizeRedirectMask, "ResizeRedirect" },
- { SubstructureNotifyMask, "SubstructureNotify" },
- { SubstructureRedirectMask, "SubstructureRedirect" },
- { FocusChangeMask, "FocusChange" },
- { PropertyChangeMask, "PropertyChange" },
- { ColormapChangeMask, "ColormapChange" },
- { OwnerGrabButtonMask, "OwnerGrabButton" },
+ { XCB_EVENT_MASK_KEY_PRESS, "KeyPress" },
+ { XCB_EVENT_MASK_KEY_RELEASE, "KeyRelease" },
+ { XCB_EVENT_MASK_BUTTON_PRESS, "ButtonPress" },
+ { XCB_EVENT_MASK_BUTTON_RELEASE, "ButtonRelease" },
+ { XCB_EVENT_MASK_ENTER_WINDOW, "EnterWindow" },
+ { XCB_EVENT_MASK_LEAVE_WINDOW, "LeaveWindow" },
+ { XCB_EVENT_MASK_POINTER_MOTION, "PointerMotion" },
+ { XCB_EVENT_MASK_POINTER_MOTION_HINT, "PointerMotionHint" },
+ { XCB_EVENT_MASK_BUTTON_1_MOTION, "Button1Motion" },
+ { XCB_EVENT_MASK_BUTTON_2_MOTION, "Button2Motion" },
+ { XCB_EVENT_MASK_BUTTON_3_MOTION, "Button3Motion" },
+ { XCB_EVENT_MASK_BUTTON_4_MOTION, "Button4Motion" },
+ { XCB_EVENT_MASK_BUTTON_5_MOTION, "Button5Motion" },
+ { XCB_EVENT_MASK_BUTTON_MOTION, "ButtonMotion" },
+ { XCB_EVENT_MASK_KEYMAP_STATE, "KeymapState" },
+ { XCB_EVENT_MASK_EXPOSURE, "Exposure" },
+ { XCB_EVENT_MASK_VISIBILITY_CHANGE, "VisibilityChange" },
+ { XCB_EVENT_MASK_STRUCTURE_NOTIFY, "StructureNotify" },
+ { XCB_EVENT_MASK_RESIZE_REDIRECT, "ResizeRedirect" },
+ { XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY, "SubstructureNotify" },
+ { XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, "SubstructureRedirect" },
+ { XCB_EVENT_MASK_FOCUS_CHANGE, "FocusChange" },
+ { XCB_EVENT_MASK_PROPERTY_CHANGE, "PropertyChange" },
+ { XCB_EVENT_MASK_COLOR_MAP_CHANGE, "ColormapChange" },
+ { XCB_EVENT_MASK_OWNER_GRAB_BUTTON, "OwnerGrabButton" },
{ 0, NULL } };
static void
-Display_Event_Mask(long mask)
+Display_Event_Mask (long mask)
{
- long bit, bit_mask;
+ long bit, bit_mask;
- for (bit=0, bit_mask=1; bit<sizeof(long)*8; bit++, bit_mask <<= 1)
- if (mask & bit_mask)
- printf(" %s\n",
- LookupL(bit_mask, _event_mask_names));
+ for (bit=0, bit_mask=1; bit < sizeof(long)*8; bit++, bit_mask <<= 1)
+ if (mask & bit_mask)
+ printf (" %s\n",
+ LookupL (bit_mask, _event_mask_names));
}
/*
* Display info on events
+ *
+ * Requires wininfo members initialized:
+ * window, attr_cookie (or win_attributes)
*/
static void
-Display_Events_Info(Window window)
+Display_Events_Info (struct wininfo *w)
{
- XWindowAttributes win_attributes;
-
- if (!XGetWindowAttributes(dpy, window, &win_attributes))
- Fatal_Error("Can't get window attributes.");
+ xcb_get_window_attributes_reply_t *win_attributes
+ = fetch_win_attributes (w);
- printf("\n");
- printf(" Someone wants these events:\n");
- Display_Event_Mask(win_attributes.all_event_masks);
+ printf ("\n");
+ printf (" Someone wants these events:\n");
+ Display_Event_Mask (win_attributes->all_event_masks);
- printf(" Do not propagate these events:\n");
- Display_Event_Mask(win_attributes.do_not_propagate_mask);
+ printf (" Do not propagate these events:\n");
+ Display_Event_Mask (win_attributes->do_not_propagate_mask);
- printf(" Override redirection?: %s\n",
- Lookup(win_attributes.override_redirect, _bool));
+ printf (" Override redirection?: %s\n",
+ Lookup (win_attributes->override_redirect, _bool));
}
@@ -870,82 +1249,184 @@ Display_Events_Info(Window window)
/*
* Display root, parent, and (recursively) children information
* recurse - true to show children information
+ *
+ * Requires wininfo members initialized: window, tree_cookie
*/
static void
-Display_Tree_Info(Window window, int recurse)
+Display_Tree_Info (struct wininfo *w, int recurse)
{
- display_tree_info_1(window, recurse, 0);
+ display_tree_info_1 (w, recurse, 0);
}
/*
* level - recursion level
*/
static void
-display_tree_info_1(Window window, int recurse, int level)
+display_tree_info_1 (struct wininfo *w, int recurse, int level)
{
- int i, j;
- int rel_x, rel_y, abs_x, abs_y;
- unsigned int width, height, border, depth;
- Window root_win, parent_win;
- unsigned int num_children;
- Window *child_list;
- XClassHint classhint;
-
- if (!XQueryTree(dpy, window, &root_win, &parent_win, &child_list,
- &num_children))
- Fatal_Error("Can't query window tree.");
-
- if (level == 0) {
- printf("\n");
- printf(" Root window id: ");
- Display_Window_Id(root_win, True);
- printf(" Parent window id: ");
- Display_Window_Id(parent_win, True);
- }
-
- if (level == 0 || num_children > 0) {
- printf(" ");
- for (j=0; j<level; j++) printf(" ");
- printf("%d child%s%s\n", num_children, num_children == 1 ? "" : "ren",
- num_children ? ":" : ".");
- }
-
- for (i = (int)num_children - 1; i >= 0; i--) {
- printf(" ");
- for (j=0; j<level; j++) printf(" ");
- Display_Window_Id(child_list[i], False);
- printf(": (");
- if(XGetClassHint(dpy, child_list[i], &classhint)) {
- if(classhint.res_name) {
- printf("\"%s\" ", classhint.res_name);
- XFree(classhint.res_name);
- } else
- printf("(none) ");
- if(classhint.res_class) {
- printf("\"%s\") ", classhint.res_class);
- XFree(classhint.res_class);
- } else
- printf("(none)) ");
- } else
- printf(") ");
+ int i, j;
+ unsigned int num_children;
+ xcb_query_tree_reply_t *tree;
+
+ tree = xcb_query_tree_reply (dpy, w->tree_cookie, &err);
+ if (!tree) {
+ Print_X_Error (dpy, err);
+ Fatal_Error ("Can't query window tree.");
+ }
- if (XGetGeometry(dpy, child_list[i], &root_win,
- &rel_x, &rel_y, &width, &height, &border, &depth)) {
- Window child;
+ if (level == 0) {
+ struct wininfo rw, pw;
+ rw.window = tree->root;
+ rw.net_wm_name_cookie = get_net_wm_name (dpy, rw.window);
+ rw.wm_name_cookie = xcb_get_wm_name (dpy, rw.window);
+ pw.window = tree->parent;
+ pw.net_wm_name_cookie = get_net_wm_name (dpy, pw.window);
+ pw.wm_name_cookie = xcb_get_wm_name (dpy, pw.window);
+ xcb_flush (dpy);
+
+ printf ("\n");
+ printf (" Root window id: ");
+ Display_Window_Id (&rw, True);
+ printf (" Parent window id: ");
+ Display_Window_Id (&pw, True);
+ }
+
+ num_children = xcb_query_tree_children_length (tree);
- printf (" %ux%u+%d+%d", width, height, rel_x, rel_y);
- if (XTranslateCoordinates (dpy, child_list[i], root_win,
- 0 ,0, &abs_x, &abs_y, &child)) {
- printf (" +%d+%d", abs_x - border, abs_y - border);
+ if (level == 0 || num_children > 0) {
+ printf (" ");
+ for (j = 0; j < level; j++) printf (" ");
+ printf ("%d child%s%s\n", num_children, num_children == 1 ? "" : "ren",
+ num_children ? ":" : ".");
+ }
+
+ if (num_children > 0) {
+ xcb_window_t *child_list = xcb_query_tree_children (tree);
+ struct wininfo *children
+ = calloc (num_children, sizeof(struct wininfo));
+
+ if (children == NULL)
+ Fatal_Error ("Failed to allocate memory in display_tree_info");
+
+ for (i = (int)num_children - 1; i >= 0; i--) {
+ struct wininfo *cw = &children[i];
+
+ cw->window = child_list[i];
+ cw->net_wm_name_cookie = get_net_wm_name (dpy, child_list[i]);
+ cw->wm_name_cookie = xcb_get_wm_name (dpy, child_list[i]);
+ cw->wm_class_cookie = xcb_get_wm_class (dpy, child_list[i]);
+ cw->geometry_cookie = xcb_get_geometry (dpy, child_list[i]);
+ cw->trans_coords_cookie = xcb_translate_coordinates
+ (dpy, child_list[i], tree->root, 0, 0);
+ if (recurse)
+ cw->tree_cookie = xcb_query_tree (dpy, child_list[i]);
}
+ xcb_flush (dpy);
+
+ for (i = (int)num_children - 1; i >= 0; i--) {
+ struct wininfo *cw = &children[i];
+ Bool got_wm_class = False;
+ char *instance_name = NULL, *class_name = NULL;
+ int instance_name_len, class_name_len;
+#ifdef USE_XCB_ICCCM
+ xcb_get_wm_class_reply_t classhint;
+#else
+ xcb_get_property_reply_t *classprop;
+#endif
+ xcb_get_geometry_reply_t *geometry;
+
+ printf (" ");
+ for (j = 0; j < level; j++) printf (" ");
+ Display_Window_Id (cw, False);
+ printf (": (");
+
+#ifdef USE_XCB_ICCCM
+ if (xcb_get_wm_class_reply (dpy, cw->wm_class_cookie,
+ &classhint, NULL)) {
+ got_wm_class = True;
+ instance_name = classhint.instance_name;
+ class_name = classhint.class_name;
+ instance_name_len = strlen(instance_name);
+ class_name_len = strlen(class_name);
+ }
+#else
+ classprop = xcb_get_property_reply
+ (dpy, cw->wm_class_cookie, NULL);
+ if (classprop) {
+ if (classprop->type == XCB_ATOM_STRING &&
+ classprop->format == 8) {
+ int proplen = xcb_get_property_value_length (classprop);
+
+ instance_name = xcb_get_property_value (classprop);
+ instance_name_len = strnlen (instance_name, proplen);
+ if (instance_name_len < proplen) {
+ class_name = instance_name + instance_name_len + 1;
+ class_name_len = strnlen
+ (class_name, proplen - (instance_name_len + 1));
+ } else
+ class_name_len = 0;
+ got_wm_class = True;
+ }
+ else
+ free (classprop);
+ }
+#endif
+
+ if (got_wm_class) {
+ if (instance_name)
+ printf ("\"%.*s\" ", instance_name_len, instance_name);
+ else
+ printf ("(none) ");
+
+ if (class_name)
+ printf ("\"%.*s\") ", class_name_len, class_name);
+ else
+ printf ("(none)) ");
+
+#ifdef USE_XCB_ICCCM
+ xcb_get_wm_class_reply_wipe (&classhint);
+#else
+ free (classprop);
+#endif
+ } else
+ printf (") ");
+
+ geometry = xcb_get_geometry_reply(dpy, cw->geometry_cookie, &err);
+ if (geometry) {
+ xcb_translate_coordinates_reply_t *trans_coords;
+
+ printf (" %ux%u+%d+%d", geometry->width, geometry->height,
+ geometry->x, geometry->y);
+
+ trans_coords = xcb_translate_coordinates_reply
+ (dpy, cw->trans_coords_cookie, &err);
+
+ if (trans_coords) {
+ int16_t abs_x = (int16_t) trans_coords->dst_x;
+ int16_t abs_y = (int16_t) trans_coords->dst_y;
+ int border = geometry->border_width;
+
+ printf (" +%d+%d", abs_x - border, abs_y - border);
+ free (trans_coords);
+ } else if (err) {
+ Print_X_Error (dpy, err);
+ }
+
+ free (geometry);
+ } else if (err) {
+ Print_X_Error (dpy, err);
+ }
+ printf ("\n");
+
+ if (recurse)
+ display_tree_info_1 (cw, 1, level+1);
+
+ wininfo_wipe (cw);
+ }
+ free (children);
}
- printf("\n");
-
- if (recurse)
- display_tree_info_1(child_list[i], 1, level+1);
- }
- if (child_list) XFree((char *)child_list);
+ free (tree); /* includes storage for child_list[] */
}
@@ -953,77 +1434,77 @@ display_tree_info_1(Window window, int recurse, int level)
* Display a set of size hints
*/
static void
-Display_Hints(XSizeHints *hints)
+Display_Hints (xcb_size_hints_t *hints)
{
- long flags;
+ long flags;
- flags = hints->flags;
-
- if (flags & USPosition)
- printf(" User supplied location: %s, %s\n",
- xscale(hints->x), yscale(hints->y));
+ flags = hints->flags;
- if (flags & PPosition)
- printf(" Program supplied location: %s, %s\n",
- xscale(hints->x), yscale(hints->y));
+ if (flags & XCB_SIZE_HINT_US_POSITION)
+ printf (" User supplied location: %s, %s\n",
+ xscale (hints->x), yscale (hints->y));
- if (flags & USSize) {
- printf(" User supplied size: %s by %s\n",
- xscale(hints->width), yscale(hints->height));
- }
+ if (flags & XCB_SIZE_HINT_P_POSITION)
+ printf (" Program supplied location: %s, %s\n",
+ xscale (hints->x), yscale (hints->y));
- if (flags & PSize)
- printf(" Program supplied size: %s by %s\n",
- xscale(hints->width), yscale(hints->height));
+ if (flags & XCB_SIZE_HINT_US_SIZE) {
+ printf (" User supplied size: %s by %s\n",
+ xscale (hints->width), yscale (hints->height));
+ }
- if (flags & PMinSize)
- printf(" Program supplied minimum size: %s by %s\n",
- xscale(hints->min_width), yscale(hints->min_height));
+ if (flags & XCB_SIZE_HINT_P_SIZE)
+ printf (" Program supplied size: %s by %s\n",
+ xscale (hints->width), yscale (hints->height));
- if (flags & PMaxSize)
- printf(" Program supplied maximum size: %s by %s\n",
- xscale(hints->max_width), yscale(hints->max_height));
+ if (flags & XCB_SIZE_HINT_P_MIN_SIZE)
+ printf (" Program supplied minimum size: %s by %s\n",
+ xscale (hints->min_width), yscale (hints->min_height));
- if (flags & PBaseSize) {
- printf(" Program supplied base size: %s by %s\n",
- xscale(hints->base_width), yscale(hints->base_height));
- }
+ if (flags & XCB_SIZE_HINT_P_MAX_SIZE)
+ printf (" Program supplied maximum size: %s by %s\n",
+ xscale (hints->max_width), yscale (hints->max_height));
- if (flags & PResizeInc) {
- printf(" Program supplied x resize increment: %s\n",
- xscale(hints->width_inc));
- printf(" Program supplied y resize increment: %s\n",
- yscale(hints->height_inc));
- if (hints->width_inc != 0 && hints->height_inc != 0) {
- if (flags & USSize)
- printf(" User supplied size in resize increments: %s by %s\n",
- (xscale(hints->width / hints->width_inc)),
- (yscale(hints->height / hints->height_inc)));
- if (flags & PSize)
- printf(" Program supplied size in resize increments: %s by %s\n",
- (xscale(hints->width / hints->width_inc)),
- (yscale(hints->height / hints->height_inc)));
- if (flags & PMinSize)
- printf(" Program supplied minimum size in resize increments: %s by %s\n",
- xscale(hints->min_width / hints->width_inc), yscale(hints->min_height / hints->height_inc));
- if (flags & PBaseSize)
- printf(" Program supplied base size in resize increments: %s by %s\n",
- (xscale(hints->base_width / hints->width_inc)),
- (yscale(hints->base_height / hints->height_inc)));
- }
- }
-
- if (flags & PAspect) {
- printf(" Program supplied min aspect ratio: %s/%s\n",
- xscale(hints->min_aspect.x), yscale(hints->min_aspect.y));
- printf(" Program supplied max aspect ratio: %s/%s\n",
- xscale(hints->max_aspect.x), yscale(hints->max_aspect.y));
- }
-
- if (flags & PWinGravity) {
- printf(" Program supplied window gravity: %s\n",
- Lookup(hints->win_gravity, _gravities));
+ if (flags & XCB_SIZE_HINT_BASE_SIZE) {
+ printf (" Program supplied base size: %s by %s\n",
+ xscale (hints->base_width), yscale (hints->base_height));
+ }
+
+ if (flags & XCB_SIZE_HINT_P_RESIZE_INC) {
+ printf (" Program supplied x resize increment: %s\n",
+ xscale (hints->width_inc));
+ printf (" Program supplied y resize increment: %s\n",
+ yscale (hints->height_inc));
+ if (hints->width_inc != 0 && hints->height_inc != 0) {
+ if (flags & XCB_SIZE_HINT_US_SIZE)
+ printf (" User supplied size in resize increments: %s by %s\n",
+ (xscale (hints->width / hints->width_inc)),
+ (yscale (hints->height / hints->height_inc)));
+ if (flags & XCB_SIZE_HINT_P_SIZE)
+ printf (" Program supplied size in resize increments: %s by %s\n",
+ (xscale (hints->width / hints->width_inc)),
+ (yscale (hints->height / hints->height_inc)));
+ if (flags & XCB_SIZE_HINT_P_MIN_SIZE)
+ printf (" Program supplied minimum size in resize increments: %s by %s\n",
+ xscale (hints->min_width / hints->width_inc), yscale (hints->min_height / hints->height_inc));
+ if (flags & XCB_SIZE_HINT_BASE_SIZE)
+ printf (" Program supplied base size in resize increments: %s by %s\n",
+ (xscale (hints->base_width / hints->width_inc)),
+ (yscale (hints->base_height / hints->height_inc)));
}
+ }
+
+ if (flags & XCB_SIZE_HINT_P_ASPECT) {
+ printf (" Program supplied min aspect ratio: %s/%s\n",
+ xscale (hints->min_aspect_num), yscale (hints->min_aspect_den));
+ printf (" Program supplied max aspect ratio: %s/%s\n",
+ xscale (hints->max_aspect_num), yscale (hints->max_aspect_den));
+ }
+
+ if (flags & XCB_SIZE_HINT_P_WIN_GRAVITY) {
+ printf (" Program supplied window gravity: %s\n",
+ Lookup (hints->win_gravity, _gravities));
+ }
}
@@ -1031,103 +1512,463 @@ Display_Hints(XSizeHints *hints)
* Display Size Hints info
*/
static void
-Display_Size_Hints(Window window)
+Display_Size_Hints (struct wininfo *w)
{
- XSizeHints *hints = XAllocSizeHints();
- long supplied;
-
- printf("\n");
- if (!XGetWMNormalHints(dpy, window, hints, &supplied))
- printf(" No normal window size hints defined\n");
- else {
- printf(" Normal window size hints:\n");
- hints->flags &= supplied;
- Display_Hints(hints);
- }
+ xcb_size_hints_t hints;
- if (!XGetWMSizeHints(dpy, window, hints, &supplied, XA_WM_ZOOM_HINTS))
- printf(" No zoom window size hints defined\n");
- else {
- printf(" Zoom window size hints:\n");
- hints->flags &= supplied;
- Display_Hints(hints);
- }
- XFree((char *)hints);
+ printf ("\n");
+ if (!fetch_normal_hints (w, &hints))
+ printf (" No normal window size hints defined\n");
+ else {
+ printf (" Normal window size hints:\n");
+ Display_Hints (&hints);
+ }
+
+ if (!xcb_get_wm_size_hints_reply (dpy, w->zoom_cookie, &hints, NULL))
+ printf (" No zoom window size hints defined\n");
+ else {
+ printf (" Zoom window size hints:\n");
+ Display_Hints (&hints);
+ }
}
static void
-Display_Window_Shape (Window window)
+Display_Window_Shape (xcb_window_t window)
{
- Bool ws, bs;
- int xws, yws, xbs, ybs;
- unsigned int wws, hws, wbs, hbs;
+ const xcb_query_extension_reply_t *shape_query;
+ xcb_shape_query_extents_cookie_t extents_cookie;
+ xcb_shape_query_extents_reply_t *extents;
- if (!XShapeQueryExtension (dpy, &bs, &ws))
+ shape_query = xcb_get_extension_data (dpy, &xcb_shape_id);
+ if (!shape_query->present)
return;
- printf("\n");
- XShapeQueryExtents (dpy, window, &ws, &xws, &yws, &wws, &hws,
- &bs, &xbs, &ybs, &wbs, &hbs);
- if (!ws)
- printf(" No window shape defined\n");
+ printf ("\n");
+
+ extents_cookie = xcb_shape_query_extents (dpy, window);
+ extents = xcb_shape_query_extents_reply (dpy, extents_cookie, &err);
+
+ if (!extents) {
+ if (err)
+ Print_X_Error (dpy, err);
+ else
+ {
+ printf (" No window shape defined\n");
+ printf (" No border shape defined\n");
+ }
+ return;
+ }
+
+ if (!extents->bounding_shaped)
+ printf (" No window shape defined\n");
else {
- printf(" Window shape extents: %sx%s",
- xscale(wws), yscale(hws));
- printf("+%s+%s\n", xscale(xws), yscale(yws));
+ printf (" Window shape extents: %sx%s",
+ xscale (extents->bounding_shape_extents_width),
+ yscale (extents->bounding_shape_extents_height));
+ printf ("+%s+%s\n",
+ xscale (extents->bounding_shape_extents_x),
+ yscale (extents->bounding_shape_extents_y));
}
- if (!bs)
- printf(" No border shape defined\n");
+ if (!extents->clip_shaped)
+ printf (" No border shape defined\n");
else {
- printf(" Border shape extents: %sx%s",
- xscale(wbs), yscale(hbs));
- printf("+%s+%s\n", xscale(xbs), yscale(ybs));
+ printf (" Border shape extents: %sx%s",
+ xscale (extents->clip_shape_extents_width),
+ yscale (extents->clip_shape_extents_height));
+ printf ("+%s+%s\n",
+ xscale (extents->clip_shape_extents_x),
+ yscale (extents->clip_shape_extents_y));
}
+
+ free (extents);
}
/*
* Display Window Manager Info
+ *
+ * Requires wininfo members initialized:
+ * window, hints_cookie
*/
static const binding _state_hints[] = {
- { DontCareState, "Don't Care State" },
- { NormalState, "Normal State" },
- { ZoomState, "Zoomed State" },
- { IconicState, "Iconic State" },
- { InactiveState, "Inactive State" },
+ { XCB_WM_STATE_WITHDRAWN, "Withdrawn State" },
+ { XCB_WM_STATE_NORMAL, "Normal State" },
+ { XCB_WM_STATE_ICONIC, "Iconic State" },
+/* xwininfo previously also reported the ZoomState & InactiveState,
+ but ICCCM declared those obsolete long ago */
{ 0, NULL } };
+#ifndef USE_XCB_ICCCM
+static Bool
+wm_hints_reply (xcb_connection_t *dpy, xcb_get_property_cookie_t cookie,
+ wm_hints_t *hints_return, xcb_generic_error_t **err)
+{
+ xcb_get_property_reply_t *prop = xcb_get_property_reply (dpy, cookie, err);
+ int length;
+
+ if (!prop || (prop->type != XCB_ATOM_WM_HINTS) || (prop->format != 32)) {
+ free (prop);
+ return False;
+ }
+
+ memset (hints_return, 0, sizeof(wm_hints_t));
+
+ length = xcb_get_property_value_length(prop);
+ if (length > sizeof(wm_hints_t))
+ length = sizeof(wm_hints_t);
+ memcpy (hints_return, xcb_get_property_value (prop), length);
+
+ free (prop);
+ return True;
+}
+
+#define xcb_get_wm_hints_reply wm_hints_reply
+#endif
+
static void
-Display_WM_Info(Window window)
+Display_WM_Info (struct wininfo *w)
{
- XWMHints *wmhints;
- long flags;
-
- wmhints = XGetWMHints(dpy, window);
- printf("\n");
- if (!wmhints) {
- printf(" No window manager hints defined\n");
- return;
+ xcb_wm_hints_t wmhints;
+ long flags;
+ xcb_get_property_reply_t *prop;
+ int i;
+
+ printf ("\n");
+ if (!xcb_get_wm_hints_reply(dpy, w->hints_cookie, &wmhints, &err))
+ {
+ printf (" No window manager hints defined\n");
+ if (err)
+ Print_X_Error (dpy, err);
+ flags = 0;
+ } else
+ flags = wmhints.flags;
+
+ printf (" Window manager hints:\n");
+
+ if (flags & XCB_WM_HINT_INPUT)
+ printf (" Client accepts input or input focus: %s\n",
+ Lookup (wmhints.input, _bool));
+
+ if (flags & XCB_WM_HINT_ICON_WINDOW) {
+ struct wininfo iw;
+ iw.window = wmhints.icon_window;
+ iw.net_wm_name_cookie = get_net_wm_name (dpy, iw.window);
+ iw.wm_name_cookie = xcb_get_wm_name (dpy, iw.window);
+
+ printf (" Icon window id: ");
+ Display_Window_Id (&iw, True);
+ }
+
+ if (flags & XCB_WM_HINT_ICON_POSITION)
+ printf (" Initial icon position: %s, %s\n",
+ xscale (wmhints.icon_x), yscale (wmhints.icon_y));
+
+ if (flags & XCB_WM_HINT_STATE)
+ printf (" Initial state is %s\n",
+ Lookup (wmhints.initial_state, _state_hints));
+
+ if (atom_net_wm_desktop) {
+ prop = xcb_get_property_reply (dpy, w->wm_desktop_cookie, NULL);
+ if (prop && (prop->type != XCB_NONE)) {
+ uint32_t *desktop = xcb_get_property_value (prop);
+ if (*desktop == 0xFFFFFFFF) {
+ printf (" Displayed on all desktops\n");
+ } else {
+ printf (" Displayed on desktop %d\n", *desktop);
+ }
}
- flags = wmhints->flags;
+ free (prop);
+ }
- printf(" Window manager hints:\n");
+ if (atom_net_wm_window_type) {
+ prop = xcb_get_property_reply (dpy, w->wm_window_type_cookie,
+ NULL);
+ if (prop && (prop->type != XCB_NONE) && (prop->value_len > 0)) {
+ xcb_atom_t *atoms = xcb_get_property_value (prop);
+ int atom_count = prop->value_len;
+
+ if (atom_count > 0) {
+ printf (" Window type:\n");
+ for (i = 0; i < atom_count; i++) {
+ const char *atom_name = Get_Atom_Name (dpy, atoms[i]);
+
+ if (atom_name) {
+ print_friendly_name (" %s\n", atom_name,
+ "_NET_WM_WINDOW_TYPE_");
+ } else {
+ printf (" (unresolvable ATOM 0x%x)\n",
+ atoms[i]);
+ }
+ }
+ }
+ }
+ free (prop);
+ }
+
+ if (atom_net_wm_state) {
+ prop = xcb_get_property_reply (dpy, w->wm_state_cookie, NULL);
+ if (prop && (prop->type != XCB_NONE) && (prop->value_len > 0)) {
+ xcb_atom_t *atoms = xcb_get_property_value (prop);
+ int atom_count = prop->value_len;
+
+ if (atom_count > 0) {
+ printf (" Window state:\n");
+ for (i = 0; i < atom_count; i++) {
+ const char *atom_name = Get_Atom_Name (dpy, atoms[i]);
+
+ if (atom_name) {
+ print_friendly_name (" %s\n", atom_name,
+ "_NET_WM_STATE_");
+ } else {
+ printf (" (unresolvable ATOM 0x%x)\n",
+ atoms[i]);
+ }
+ }
+ }
+ }
+ free (prop);
+ }
- if (flags & InputHint)
- printf(" Client accepts input or input focus: %s\n",
- Lookup(wmhints->input, _bool));
+ if (atom_net_wm_pid) {
+ printf (" Process id: ");
+ prop = xcb_get_property_reply (dpy, w->wm_pid_cookie, NULL);
+ if (prop && (prop->type == XCB_ATOM_CARDINAL)) {
+ uint32_t *pid = xcb_get_property_value (prop);
+ printf ("%d", *pid);
+ } else {
+ printf ("(unknown)");
+ }
+ free (prop);
- if (flags & IconWindowHint) {
- printf(" Icon window id: ");
- Display_Window_Id(wmhints->icon_window, True);
+ prop = xcb_get_property_reply (dpy, w->wm_client_machine_cookie, NULL);
+ if (prop && (prop->type == XCB_ATOM_STRING)) {
+ const char *hostname = xcb_get_property_value (prop);
+ int hostname_len = xcb_get_property_value_length (prop);
+ printf (" on host %.*s", hostname_len, hostname);
}
+ printf ("\n");
+ free (prop);
+ }
+
+ if (atom_net_frame_extents) {
+ prop = xcb_get_property_reply (dpy, w->frame_extents_cookie, NULL);
+ if (prop && (prop->type == XCB_ATOM_CARDINAL)
+ && (prop->value_len == 4)) {
+ uint32_t *extents = xcb_get_property_value (prop);
+
+ printf (" Frame extents: %d, %d, %d, %d\n",
+ extents[0], extents[1], extents[2], extents[3]);
+ }
+ free (prop);
+ }
+}
+
+/* Frees all members of a wininfo struct, but not the struct itself */
+static void
+wininfo_wipe (struct wininfo *w)
+{
+ free (w->geometry);
+ free (w->win_attributes);
+ free (w->normal_hints);
+}
+
+/* Gets UTF-8 encoded EMWH property _NET_WM_NAME for a window */
+static xcb_get_property_cookie_t
+get_net_wm_name (xcb_connection_t *dpy, xcb_window_t win)
+{
+ if (!atom_net_wm_name)
+ atom_net_wm_name = Get_Atom (dpy, "_NET_WM_NAME");
+
+ if (!atom_utf8_string)
+ atom_utf8_string = Get_Atom (dpy, "UTF8_STRING");
+
+ if (atom_net_wm_name && atom_utf8_string)
+ return xcb_get_property (dpy, False, win, atom_net_wm_name,
+ atom_utf8_string, 0, BUFSIZ);
+ else {
+ xcb_get_property_cookie_t dummy = { 0 };
+ return dummy;
+ }
+}
+
+/* [Copied from code added by Yang Zhao to xprop/xprop.c]
+ *
+ * Validate a string as UTF-8 encoded according to RFC 3629
+ *
+ * Simply, a unicode code point (up to 21-bits long) is encoded as follows:
+ *
+ * Char. number range | UTF-8 octet sequence
+ * (hexadecimal) | (binary)
+ * --------------------+---------------------------------------------
+ * 0000 0000-0000 007F | 0xxxxxxx
+ * 0000 0080-0000 07FF | 110xxxxx 10xxxxxx
+ * 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx
+ * 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+ *
+ * Validation is done left-to-right, and an error condition, if any, refers to
+ * only the left-most problem in the string.
+ *
+ * Return values:
+ * UTF8_VALID: Valid UTF-8 encoded string
+ * UTF8_OVERLONG: Using more bytes than needed for a code point
+ * UTF8_SHORT_TAIL: Not enough bytes in a multi-byte sequence
+ * UTF8_LONG_TAIL: Too many bytes in a multi-byte sequence
+ * UTF8_FORBIDDEN_VALUE: Forbidden prefix or code point outside 0x10FFFF
+ */
+#define UTF8_VALID 0
+#define UTF8_FORBIDDEN_VALUE 1
+#define UTF8_OVERLONG 2
+#define UTF8_SHORT_TAIL 3
+#define UTF8_LONG_TAIL 4
+static int
+is_valid_utf8 (const char *string, int len)
+{
+ unsigned long codepoint;
+ int rem, i;
+ unsigned char c;
+
+ rem = 0;
+ for (i = 0; i < len; i++) {
+ c = (unsigned char) string[i];
+
+ /* Order of type check:
+ * - Single byte code point
+ * - Non-starting byte of multi-byte sequence
+ * - Start of 2-byte sequence
+ * - Start of 3-byte sequence
+ * - Start of 4-byte sequence
+ */
+ if (!(c & 0x80)) {
+ if (rem > 0) return UTF8_SHORT_TAIL;
+ rem = 0;
+ codepoint = c;
+ } else if ((c & 0xC0) == 0x80) {
+ if (rem == 0) return UTF8_LONG_TAIL;
+ rem--;
+ codepoint |= (c & 0x3F) << (rem * 6);
+ if (codepoint == 0) return UTF8_OVERLONG;
+ } else if ((c & 0xE0) == 0xC0) {
+ if (rem > 0) return UTF8_SHORT_TAIL;
+ rem = 1;
+ codepoint = (c & 0x1F) << 6;
+ if (codepoint == 0) return UTF8_OVERLONG;
+ } else if ((c & 0xF0) == 0xE0) {
+ if (rem > 0) return UTF8_SHORT_TAIL;
+ rem = 2;
+ codepoint = (c & 0x0F) << 12;
+ } else if ((c & 0xF8) == 0xF0) {
+ if (rem > 0) return UTF8_SHORT_TAIL;
+ rem = 3;
+ codepoint = (c & 0x07) << 18;
+ if (codepoint > 0x10FFFF) return UTF8_FORBIDDEN_VALUE;
+ } else
+ return UTF8_FORBIDDEN_VALUE;
+ }
- if (flags & IconPositionHint)
- printf(" Initial icon position: %s, %s\n",
- xscale(wmhints->icon_x), yscale(wmhints->icon_y));
+ return UTF8_VALID;
+}
+
+/*
+ * Converts a UTF-8 encoded string to the current locale encoding,
+ * if possible, and prints it, with prefix before and suffix after.
+ * Length of the string is specified in bytes, or -1 for going until '\0'
+ */
+static void
+print_utf8 (const char *prefix, char *u8str, size_t length, const char *suffix)
+{
+ size_t inlen = length;
+
+ if (inlen < 0) {
+ inlen = strlen (u8str);
+ }
+
+ if (is_valid_utf8 (u8str, inlen) != UTF8_VALID) {
+ printf (" (invalid UTF8_STRING)");
+ return;
+ }
+
+ if (strcmp (user_encoding, "UTF-8") == 0) {
+ /* Don't need to convert */
+ printf ("%s", prefix);
+ fwrite (u8str, 1, inlen, stdout);
+ printf ("%s", suffix);
+ return;
+ }
+
+#ifdef HAVE_ICONV
+ if (!iconv_from_utf8) {
+ iconv_from_utf8 = iconv_open (user_encoding, "UTF-8");
+ }
+
+ if (iconv_from_utf8 != (iconv_t) -1) {
+ Bool done = True;
+ char *inp = u8str;
+ char convbuf[BUFSIZ];
+ int convres;
+
+ printf ("%s", prefix);
+ do {
+ char *outp = convbuf;
+ size_t outlen = sizeof(convbuf);
+
+ convres = iconv (iconv_from_utf8, &inp, &inlen, &outp, &outlen);
- if (flags & StateHint)
- printf(" Initial state is %s\n",
- Lookup(wmhints->initial_state, _state_hints));
+ if ((convres == -1) && (errno == E2BIG)) {
+ done = False;
+ convres = 0;
+ }
+
+ if (convres == 0) {
+ fwrite (convbuf, 1, sizeof(convbuf) - outlen, stdout);
+ } else {
+ printf (" (failure in conversion from UTF8_STRING to %s)",
+ user_encoding);
+ }
+ } while (!done);
+ printf ("%s", suffix);
+ } else {
+ printf (" (can't load iconv conversion for UTF8_STRING to %s)",
+ user_encoding);
+ }
+#else
+ printf (" (can't convert UTF8_STRING to %s)", user_encoding);
+#endif
+}
+
+/*
+ * Takes a string such as an atom name, strips the prefix, converts
+ * underscores to spaces, lowercases all but the first letter of each word,
+ * and prints it.
+ */
+static void
+print_friendly_name (const char *format, const char *string,
+ const char *prefix)
+{
+ const char *name_start = string;
+ char *lowered_name, *n;
+ int prefix_len = strlen (prefix);
+
+ if (strncmp (name_start, prefix, prefix_len) == 0) {
+ name_start += prefix_len;
+ }
+
+ lowered_name = strdup (name_start);
+ if (lowered_name) {
+ Bool first = True;
+
+ for (n = lowered_name ; *n != 0 ; n++) {
+ if (*n == '_') {
+ *n = ' ';
+ first = True;
+ } else if (first) {
+ first = False;
+ } else {
+ *n = tolower(*n);
+ }
+ }
+ name_start = lowered_name;
+ }
- XFree(wmhints);
+ printf (format, name_start);
+ free (lowered_name);
}
diff --git a/app/xwininfo/xwininfo.man b/app/xwininfo/xwininfo.man
index c28801561..550374efc 100644
--- a/app/xwininfo/xwininfo.man
+++ b/app/xwininfo/xwininfo.man
@@ -1,4 +1,3 @@
-.\" $Xorg: xwininfo.man,v 1.4 2001/02/09 02:06:04 xorgcvs Exp $
.\" Copyright 1988, 1998 The Open Group
.\"
.\" Permission to use, copy, modify, distribute, and sell this software and its
@@ -23,7 +22,6 @@
.\" other dealings in this Software without prior written authorization
.\" from The Open Group.
.\"
-.\" $XFree86: xwininfo.man,v 1.8 2001/12/14 20:02:35 dawes Exp $
.\"
.TH XWININFO 1 __xorgversion__
.SH NAME