Update to xwininfo 1.1.6
parent
92e13ba23a
commit
558b3b5e32
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 1999, 2010, 2023, Oracle and/or its affiliates.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
|
|
|
@ -1,3 +1,88 @@
|
|||
commit 13826f0412926eb4659bca21a6f0e179c7a45f11
|
||||
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Sun Apr 9 09:59:46 2023 -0700
|
||||
|
||||
xwininfo 1.1.6
|
||||
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
|
||||
commit 9a5623e2ffc6995b2c6edf379f191d76d7b4444a
|
||||
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Sat Feb 25 13:06:06 2023 -0800
|
||||
|
||||
Add option to use libxcb-errors to improve X protocol error messages
|
||||
|
||||
Requires passing --with-xcb-errors to configure
|
||||
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
|
||||
commit a60fe9c681990e0710e81ce88839aef2247e0d28
|
||||
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Sun Nov 13 15:43:57 2022 -0800
|
||||
|
||||
Variable scope reduction as recommended by cppcheck
|
||||
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
|
||||
commit a4505ad3a938cfecb501b1ce806aa39ead42ec81
|
||||
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Sun Nov 13 15:19:02 2022 -0800
|
||||
|
||||
Silence -Wdiscarded-qualifiers warning on systems with non-const iconv
|
||||
|
||||
xwininfo.c: In function ‘print_utf8’:
|
||||
xwininfo.c:1914:26: warning: initialization discards ‘const’ qualifier
|
||||
from pointer target type [-Wdiscarded-qualifiers]
|
||||
ICONV_CONST char *inp = u8str;
|
||||
^~~~~
|
||||
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
|
||||
commit 41ea77d4b64413648dd2fb61c42bf7b980b17783
|
||||
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Thu Jul 28 17:30:21 2022 -0700
|
||||
|
||||
gitlab CI: stop requiring Signed-off-by in commits
|
||||
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
|
||||
commit 90fe017c5db9ead2e8fe64bfc1d146268a2eae97
|
||||
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Sun Apr 10 13:59:59 2022 -0700
|
||||
|
||||
Window_With_Name(): make sure cookies.get_net_wm_name is set
|
||||
|
||||
Reported by Oracle Parfait:
|
||||
|
||||
Error: Uninitialised memory
|
||||
Uninitialised memory [uninitialised-mem] (CWE 456):
|
||||
Possible access to uninitialised memory referenced by 'cookies'
|
||||
at line 289 of dsimple.c in function 'recursive_Window_With_Name'.
|
||||
called at line 420 in function 'Window_With_Name' with cookies = &cookies.
|
||||
Path avoiding write at line 416
|
||||
Write does not overlap at line 417
|
||||
Write does not overlap at line 418
|
||||
cookies allocated at line 410
|
||||
cookies passed in at line 276 in function 'recursive_Window_With_Name'
|
||||
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
|
||||
commit f8ff22d7d00a96ab43bab7accbd2fcc01a1b5e0c
|
||||
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Tue Dec 7 15:56:32 2021 -0800
|
||||
|
||||
Build xz tarballs instead of bzip2
|
||||
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
|
||||
commit 9882388975f299bbff8788326e698752dd32c73c
|
||||
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Tue Dec 7 15:56:29 2021 -0800
|
||||
|
||||
gitlab CI: add a basic build test
|
||||
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
|
||||
commit 985a3a70918038bf2569e0a5ebe3fa14d720e4de
|
||||
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Sun Jul 14 13:51:36 2019 -0700
|
||||
|
@ -53,7 +138,7 @@ Date: Sun Jun 9 10:21:39 2019 -0700
|
|||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
|
||||
commit 58213a0cd39dc4ba044f48fab52ed3256ab9a9bd
|
||||
Author: Stéphane Aulery <lkppo@free.fr>
|
||||
Author: Stéphane Aulery <lkppo@free.fr>
|
||||
Date: Wed Jul 3 00:29:17 2013 +0200
|
||||
|
||||
Improve manpage and -h option
|
||||
|
@ -1082,7 +1167,7 @@ Date: Wed Jul 20 19:32:05 2005 +0000
|
|||
configure cache, you cache it, and the cached value is probably wrong.
|
||||
|
||||
commit 97aa768841e147fde3cf16ba9a4c852358085d27
|
||||
Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
|
||||
Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
|
||||
Date: Fri Jul 8 21:00:46 2005 +0000
|
||||
|
||||
Build system for xwininfo
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# $OpenBSD: Makefile.bsd-wrapper,v 1.5 2014/08/24 20:22:20 matthieu Exp $
|
||||
# $OpenBSD: Makefile.bsd-wrapper,v 1.6 2023/04/10 16:16:52 matthieu Exp $
|
||||
|
||||
CONFIGURE_ARGS += --with-xcb-icccm
|
||||
CONFIGURE_ARGS += --with-xcb-icccm --without-xcb-errors
|
||||
|
||||
.include <bsd.xorg.mk>
|
||||
|
|
|
@ -181,9 +181,9 @@ am__relativize = \
|
|||
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2
|
||||
DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.xz
|
||||
GZIP_ENV = --best
|
||||
DIST_TARGETS = dist-bzip2 dist-gzip
|
||||
DIST_TARGETS = dist-xz dist-gzip
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
|
||||
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
|
||||
|
@ -305,6 +305,7 @@ pdfdir = @pdfdir@
|
|||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
|
@ -654,6 +655,7 @@ distdir: $(DISTFILES)
|
|||
dist-gzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-bzip2: distdir
|
||||
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
|
||||
$(am__post_remove_distdir)
|
||||
|
@ -661,7 +663,6 @@ dist-bzip2: distdir
|
|||
dist-lzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-xz: distdir
|
||||
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
|
||||
$(am__post_remove_distdir)
|
||||
|
|
|
@ -6,7 +6,7 @@ Xorg mailing list:
|
|||
|
||||
https://lists.x.org/mailman/listinfo/xorg
|
||||
|
||||
The master development code repository can be found at:
|
||||
The primary development code repository can be found at:
|
||||
|
||||
https://gitlab.freedesktop.org/xorg/app/xwininfo
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,9 +1,9 @@
|
|||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2012-10-14.11; # UTC
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
@ -17,7 +17,7 @@ scriptversion=2012-10-14.11; # UTC
|
|||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
|
@ -53,7 +53,7 @@ func_file_conv ()
|
|||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
CYGWIN* | MSYS*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
|
@ -67,7 +67,7 @@ func_file_conv ()
|
|||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/*)
|
||||
cygwin/* | msys/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
|
@ -255,7 +255,8 @@ EOF
|
|||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
|
||||
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
|
||||
func_cl_wrapper "$@" # Doesn't return...
|
||||
;;
|
||||
esac
|
||||
|
@ -339,9 +340,9 @@ exit $ret
|
|||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
|
|
|
@ -94,6 +94,10 @@
|
|||
#endif
|
||||
|
||||
|
||||
/* Define to 1 to call xcb-errors library functions instead of local
|
||||
replacements */
|
||||
#undef USE_XCB_ERRORS
|
||||
|
||||
/* Define to 1 to call xcb-icccm library functions instead of local
|
||||
replacements */
|
||||
#undef USE_XCB_ICCCM
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -23,15 +23,14 @@ dnl Process this file with autoconf to create configure.
|
|||
|
||||
# Initialize Autoconf
|
||||
AC_PREREQ([2.60])
|
||||
AC_INIT([xwininfo], [1.1.5],
|
||||
[https://gitlab.freedesktop.org/xorg/app/xwininfo/issues], [xwininfo])
|
||||
AC_INIT([xwininfo], [1.1.6],
|
||||
[https://gitlab.freedesktop.org/xorg/app/xwininfo/-/issues], [xwininfo])
|
||||
AC_CONFIG_SRCDIR([Makefile.am])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
|
||||
# Initialize Automake
|
||||
AM_INIT_AUTOMAKE([foreign dist-bzip2])
|
||||
AM_MAINTAINER_MODE
|
||||
AM_INIT_AUTOMAKE([foreign dist-xz])
|
||||
AM_ICONV
|
||||
|
||||
# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
|
||||
|
@ -62,8 +61,21 @@ if test "x$with_xcb_icccm" != xno ; then
|
|||
xcb_icccm_pc='xcb-icccm >= 0.3.8'
|
||||
fi
|
||||
|
||||
# Define a configure option for using the XCB Error helper functions
|
||||
AC_MSG_CHECKING([whether to use xcb-errors library])
|
||||
AC_ARG_WITH([xcb-errors],
|
||||
[AS_HELP_STRING([--with-xcb-errors],
|
||||
[use xcb-errors (default: no)])],
|
||||
[], [with_xcb_errors=no])
|
||||
AC_MSG_RESULT([$with_xcb_errors])
|
||||
if test "x$with_xcb_errors" != xno ; then
|
||||
AC_DEFINE([USE_XCB_ERRORS], 1,
|
||||
[Define to 1 to call xcb-errors library functions instead of local replacements])
|
||||
xcb_errors_pc='xcb-errors >= 1.0'
|
||||
fi
|
||||
|
||||
# Obtain compiler/linker options for xwininfo dependencies
|
||||
PKG_CHECK_MODULES(XWININFO, [xcb >= 1.6] xcb-shape ${xcb_icccm_pc})
|
||||
PKG_CHECK_MODULES(XWININFO, [xcb >= 1.6 xcb-shape ${xcb_icccm_pc} ${xcb_errors_pc}])
|
||||
|
||||
# Even when using xcb, xproto is still required for Xfuncproto.h
|
||||
# and libX11 headers for cursorfont.h
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2023, Oracle and/or its affiliates.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
@ -55,6 +55,9 @@ from The Open Group.
|
|||
#ifdef USE_XCB_ICCCM
|
||||
# include <xcb/xcb_icccm.h>
|
||||
#endif
|
||||
#ifdef USE_XCB_ERRORS
|
||||
# include <xcb/xcb_errors.h>
|
||||
#endif
|
||||
#include <X11/cursorfont.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -73,6 +76,9 @@ from The Open Group.
|
|||
* Written by Mark Lillibridge. Last updated 7/1/87
|
||||
*/
|
||||
|
||||
#ifdef USE_XCB_ERRORS
|
||||
xcb_errors_context_t *error_context;
|
||||
#endif
|
||||
|
||||
/* This stuff is defined in the calling program by dsimple.h */
|
||||
const char *program_name = "unknown_program";
|
||||
|
@ -108,7 +114,7 @@ void Setup_Display_And_Screen (
|
|||
xcb_connection_t **dpy, /* MODIFIED */
|
||||
xcb_screen_t **screen) /* MODIFIED */
|
||||
{
|
||||
int screen_number, i, err;
|
||||
int screen_number, err;
|
||||
|
||||
/* Open Display */
|
||||
*dpy = xcb_connect (display_name, &screen_number);
|
||||
|
@ -130,6 +136,13 @@ void Setup_Display_And_Screen (
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef USE_XCB_ERRORS
|
||||
if (xcb_errors_context_new(*dpy, &error_context) != 0) {
|
||||
fprintf (stderr, "%s: unable to load xcb-errors\n\n",
|
||||
program_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (screen) {
|
||||
/* find our screen */
|
||||
const xcb_setup_t *setup = xcb_get_setup(*dpy);
|
||||
|
@ -141,7 +154,7 @@ void Setup_Display_And_Screen (
|
|||
screen_number, screen_count-1 );
|
||||
}
|
||||
|
||||
for (i = 0; i < screen_number; i++)
|
||||
for (int i = 0; i < screen_number; i++)
|
||||
xcb_screen_next(&screen_iter);
|
||||
*screen = screen_iter.data;
|
||||
}
|
||||
|
@ -178,7 +191,6 @@ xcb_window_t Select_Window(xcb_connection_t *dpy,
|
|||
int descend)
|
||||
{
|
||||
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;
|
||||
|
@ -202,6 +214,8 @@ xcb_window_t Select_Window(xcb_connection_t *dpy,
|
|||
/* Let the user select a window... */
|
||||
while ((target_win == XCB_WINDOW_NONE) || (buttons != 0)) {
|
||||
/* allow one more event */
|
||||
xcb_generic_event_t *event;
|
||||
|
||||
xcb_allow_events (dpy, XCB_ALLOW_SYNC_POINTER, XCB_TIME_CURRENT_TIME);
|
||||
xcb_flush (dpy);
|
||||
event = xcb_wait_for_event (dpy);
|
||||
|
@ -414,6 +428,8 @@ Window_With_Name (
|
|||
|
||||
if (atom_net_wm_name && atom_utf8_string)
|
||||
cookies.get_net_wm_name = xcb_get_net_wm_name (dpy, top);
|
||||
else
|
||||
cookies.get_net_wm_name.sequence = 0;
|
||||
cookies.get_wm_name = xcb_icccm_get_wm_name (dpy, top);
|
||||
cookies.query_tree = xcb_query_tree (dpy, top);
|
||||
xcb_flush (dpy);
|
||||
|
@ -437,6 +453,35 @@ void Fatal_Error (const char *msg, ...)
|
|||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Descriptions for core protocol error codes
|
||||
*
|
||||
* Since 0 is not used for an error code in X, we use it for unknown error.
|
||||
*/
|
||||
#define UNKNOWN_ERROR 0
|
||||
#define LAST_ERROR XCB_IMPLEMENTATION
|
||||
|
||||
static const char *error_desc[] = {
|
||||
[UNKNOWN_ERROR] = "Unknown error",
|
||||
[XCB_REQUEST] = "Bad Request",
|
||||
[XCB_VALUE] = "Bad Value",
|
||||
[XCB_WINDOW] = "Bad Window",
|
||||
[XCB_PIXMAP] = "Bad Pixmap",
|
||||
[XCB_ATOM] = "Bad Atom",
|
||||
[XCB_CURSOR] = "Bad Cursor",
|
||||
[XCB_FONT] = "Bad Font",
|
||||
[XCB_MATCH] = "Bad Match",
|
||||
[XCB_DRAWABLE] = "Bad Drawable",
|
||||
[XCB_ACCESS] = "Access Denied",
|
||||
[XCB_ALLOC] = "Server Memory Allocation Failure",
|
||||
[XCB_COLORMAP] = "Bad Color",
|
||||
[XCB_G_CONTEXT] = "Bad GC",
|
||||
[XCB_ID_CHOICE] = "Bad XID",
|
||||
[XCB_NAME] = "Bad Name",
|
||||
[XCB_LENGTH] = "Bad Request Length",
|
||||
[XCB_IMPLEMENTATION] = "Server Implementation Failure",
|
||||
};
|
||||
|
||||
/*
|
||||
* Print X error information like the default Xlib error handler
|
||||
*/
|
||||
|
@ -446,117 +491,89 @@ Print_X_Error (
|
|||
xcb_generic_error_t *err
|
||||
)
|
||||
{
|
||||
char buffer[256] = "";
|
||||
const char *error = NULL;
|
||||
const char *extension = NULL;
|
||||
const char *value_type = NULL;
|
||||
const char *major_name = NULL;
|
||||
const char *minor_name = NULL;
|
||||
|
||||
if ((err == NULL) || (err->response_type != 0)) /* not an error */
|
||||
return;
|
||||
|
||||
/* Todo: find a more user friendly way to show request/extension info */
|
||||
#ifdef USE_XCB_ERRORS
|
||||
if (error_context != NULL) {
|
||||
error = xcb_errors_get_name_for_error(error_context, err->error_code,
|
||||
&extension);
|
||||
major_name = xcb_errors_get_name_for_major_code(error_context,
|
||||
err->major_code);
|
||||
minor_name = xcb_errors_get_name_for_minor_code(error_context,
|
||||
err->major_code,
|
||||
err->minor_code);
|
||||
}
|
||||
/* Fallback to old code if xcb-errors wasn't initialized */
|
||||
else
|
||||
#endif
|
||||
if (err->error_code >= 128)
|
||||
{
|
||||
fprintf (stderr, "X Extension Error: Error code %d\n",
|
||||
err->error_code);
|
||||
error = "Unknown extension error";
|
||||
}
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
case XCB_LENGTH:
|
||||
snprintf (buffer, sizeof(buffer),
|
||||
"Bad Request Length");
|
||||
break;
|
||||
|
||||
case XCB_IMPLEMENTATION:
|
||||
snprintf (buffer, sizeof(buffer),
|
||||
"Server Implementation Failure");
|
||||
break;
|
||||
|
||||
default:
|
||||
snprintf (buffer, sizeof(buffer), "Unknown error");
|
||||
break;
|
||||
if (err->error_code > 0 && err->error_code <= LAST_ERROR) {
|
||||
error = error_desc[err->error_code];
|
||||
} else {
|
||||
error = error_desc[UNKNOWN_ERROR];
|
||||
}
|
||||
fprintf (stderr, "X Error: %d: %s\n", err->error_code, buffer);
|
||||
}
|
||||
|
||||
fprintf (stderr, " Request Major code: %d\n", err->major_code);
|
||||
fprintf (stderr, "X Error: %d: %s\n", err->error_code, error);
|
||||
if (extension != NULL) {
|
||||
fprintf (stderr, " Request extension: %s\n", extension);
|
||||
}
|
||||
|
||||
fprintf (stderr, " Request Major code: %d", err->major_code);
|
||||
if (major_name != NULL) {
|
||||
fprintf (stderr, " (%s)", major_name);
|
||||
}
|
||||
fputs ("\n", stderr);
|
||||
|
||||
if (err->major_code >= 128)
|
||||
{
|
||||
fprintf (stderr, " Request Minor code: %d\n", err->minor_code);
|
||||
fprintf (stderr, " Request Minor code: %d", err->minor_code);
|
||||
if (minor_name != NULL) {
|
||||
fprintf (stderr, " (%s)", minor_name);
|
||||
}
|
||||
fputs ("\n", stderr);
|
||||
}
|
||||
|
||||
fprintf (stderr, " Request serial number: %d\n", err->full_sequence);
|
||||
switch (err->error_code)
|
||||
{
|
||||
case XCB_VALUE:
|
||||
value_type = "Value";
|
||||
break;
|
||||
case XCB_ATOM:
|
||||
value_type = "AtomID";
|
||||
break;
|
||||
case XCB_WINDOW:
|
||||
case XCB_PIXMAP:
|
||||
case XCB_CURSOR:
|
||||
case XCB_FONT:
|
||||
case XCB_DRAWABLE:
|
||||
case XCB_COLORMAP:
|
||||
case XCB_G_CONTEXT:
|
||||
case XCB_ID_CHOICE:
|
||||
value_type = "ResourceID";
|
||||
break;
|
||||
default:
|
||||
value_type = NULL;
|
||||
}
|
||||
if (value_type != NULL) {
|
||||
fprintf (stderr, " %s in failed request: 0x%x\n",
|
||||
value_type, err->resource_id);
|
||||
}
|
||||
|
||||
fprintf (stderr, " Serial number of failed request: %d\n",
|
||||
err->full_sequence);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -226,6 +226,7 @@ pdfdir = @pdfdir@
|
|||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
@ -343,11 +343,10 @@ scale_init (xcb_screen_t *scale_screen)
|
|||
static char *
|
||||
nscale (int n, int np, int nmm, char *nbuf, size_t nbufsize)
|
||||
{
|
||||
int s;
|
||||
snprintf (nbuf, nbufsize, "%d", n);
|
||||
|
||||
if (metric||english) {
|
||||
s = strlcat (nbuf, " (", nbufsize);
|
||||
int s = strlcat (nbuf, " (", nbufsize);
|
||||
|
||||
if (metric) {
|
||||
snprintf (nbuf+s, nbufsize-s, "%.2f mm%s",
|
||||
|
@ -356,13 +355,13 @@ nscale (int n, int np, int nmm, char *nbuf, size_t nbufsize)
|
|||
if (english) {
|
||||
double inch_frac;
|
||||
Bool printed_anything = False;
|
||||
int mi, yar, ft, inr;
|
||||
int inr;
|
||||
|
||||
inch_frac = ((double) n)*(nmm/25.4)/np;
|
||||
inr = (int)inch_frac;
|
||||
inch_frac -= (double)inr;
|
||||
if (inr >= MILE) {
|
||||
mi = inr/MILE;
|
||||
int mi = inr/MILE;
|
||||
inr %= MILE;
|
||||
s = strlen (nbuf);
|
||||
snprintf (nbuf+s, nbufsize-s, "%d %s(?!?)",
|
||||
|
@ -370,7 +369,7 @@ nscale (int n, int np, int nmm, char *nbuf, size_t nbufsize)
|
|||
printed_anything = True;
|
||||
}
|
||||
if (inr >= YARD) {
|
||||
yar = inr/YARD;
|
||||
int yar = inr/YARD;
|
||||
inr %= YARD;
|
||||
if (printed_anything)
|
||||
strlcat (nbuf, ", ", nbufsize);
|
||||
|
@ -380,7 +379,7 @@ nscale (int n, int np, int nmm, char *nbuf, size_t nbufsize)
|
|||
printed_anything = True;
|
||||
}
|
||||
if (inr >= FOOT) {
|
||||
ft = inr/FOOT;
|
||||
int ft = inr/FOOT;
|
||||
inr %= FOOT;
|
||||
if (printed_anything)
|
||||
strlcat (nbuf, ", ", nbufsize);
|
||||
|
@ -440,7 +439,6 @@ window_id_str (xcb_window_t id)
|
|||
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;
|
||||
int use_root = 0;
|
||||
|
@ -461,7 +459,7 @@ main (int argc, char **argv)
|
|||
memset (w, 0, sizeof(struct wininfo));
|
||||
|
||||
/* Handle our command line arguments */
|
||||
for (i = 1; i < argc; i++) {
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (!strcmp (argv[i], "-help"))
|
||||
usage ();
|
||||
if (!strcmp (argv[i], "-display") || !strcmp (argv[i], "-d")) {
|
||||
|
@ -745,9 +743,9 @@ wm_size_hints_reply (xcb_connection_t *wshr_dpy, xcb_get_property_cookie_t cooki
|
|||
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) {
|
||||
xcb_size_hints_t hints;
|
||||
|
||||
if (xcb_icccm_get_wm_normal_hints_reply (dpy, w->normal_hints_cookie,
|
||||
&hints, NULL)) {
|
||||
w->normal_hints = malloc (sizeof(xcb_size_hints_t));
|
||||
|
@ -764,7 +762,6 @@ fetch_normal_hints (struct wininfo *w, xcb_size_hints_t *hints_return)
|
|||
/*
|
||||
* Lookup: lookup a code in a table.
|
||||
*/
|
||||
static char _lookup_buffer[100];
|
||||
|
||||
static const char *
|
||||
LookupL (long code, const binding *table)
|
||||
|
@ -780,6 +777,8 @@ LookupL (long code, const binding *table)
|
|||
}
|
||||
|
||||
if (name == NULL) {
|
||||
static char _lookup_buffer[100];
|
||||
|
||||
snprintf (_lookup_buffer, sizeof(_lookup_buffer),
|
||||
"unknown (code = %ld. = 0x%lx)", code, code);
|
||||
name = _lookup_buffer;
|
||||
|
@ -1280,7 +1279,6 @@ Display_Tree_Info (struct wininfo *w, int recurse)
|
|||
static void
|
||||
display_tree_info_1 (struct wininfo *w, int recurse, int level)
|
||||
{
|
||||
int i, j;
|
||||
unsigned int num_children;
|
||||
xcb_query_tree_reply_t *tree;
|
||||
|
||||
|
@ -1311,7 +1309,7 @@ display_tree_info_1 (struct wininfo *w, int recurse, int level)
|
|||
|
||||
if (level == 0 || num_children > 0) {
|
||||
printf (" ");
|
||||
for (j = 0; j < level; j++) printf (" ");
|
||||
for (int j = 0; j < level; j++) printf (" ");
|
||||
printf ("%d child%s%s\n", num_children, num_children == 1 ? "" : "ren",
|
||||
num_children ? ":" : ".");
|
||||
}
|
||||
|
@ -1324,7 +1322,7 @@ display_tree_info_1 (struct wininfo *w, int recurse, int level)
|
|||
if (children == NULL)
|
||||
Fatal_Error ("Failed to allocate memory in display_tree_info");
|
||||
|
||||
for (i = (int)num_children - 1; i >= 0; i--) {
|
||||
for (int i = (int)num_children - 1; i >= 0; i--) {
|
||||
struct wininfo *cw = &children[i];
|
||||
|
||||
cw->window = child_list[i];
|
||||
|
@ -1339,7 +1337,7 @@ display_tree_info_1 (struct wininfo *w, int recurse, int level)
|
|||
}
|
||||
xcb_flush (dpy);
|
||||
|
||||
for (i = (int)num_children - 1; i >= 0; i--) {
|
||||
for (int 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;
|
||||
|
@ -1352,7 +1350,7 @@ display_tree_info_1 (struct wininfo *w, int recurse, int level)
|
|||
xcb_get_geometry_reply_t *geometry;
|
||||
|
||||
printf (" ");
|
||||
for (j = 0; j < level; j++) printf (" ");
|
||||
for (int j = 0; j < level; j++) printf (" ");
|
||||
Display_Window_Id (cw, False);
|
||||
printf (": (");
|
||||
|
||||
|
@ -1660,8 +1658,6 @@ Display_WM_Info (struct wininfo *w)
|
|||
{
|
||||
xcb_icccm_wm_hints_t wmhints;
|
||||
long flags;
|
||||
xcb_get_property_reply_t *prop;
|
||||
int i;
|
||||
|
||||
printf ("\n");
|
||||
if (!xcb_icccm_get_wm_hints_reply(dpy, w->hints_cookie, &wmhints, &err))
|
||||
|
@ -1698,6 +1694,8 @@ Display_WM_Info (struct wininfo *w)
|
|||
Lookup (wmhints.initial_state, _state_hints));
|
||||
|
||||
if (atom_net_wm_desktop) {
|
||||
xcb_get_property_reply_t *prop;
|
||||
|
||||
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);
|
||||
|
@ -1711,6 +1709,8 @@ Display_WM_Info (struct wininfo *w)
|
|||
}
|
||||
|
||||
if (atom_net_wm_window_type) {
|
||||
xcb_get_property_reply_t *prop;
|
||||
|
||||
prop = xcb_get_property_reply (dpy, w->wm_window_type_cookie,
|
||||
NULL);
|
||||
if (prop && (prop->type != XCB_NONE) && (prop->value_len > 0)) {
|
||||
|
@ -1719,7 +1719,7 @@ Display_WM_Info (struct wininfo *w)
|
|||
|
||||
if (atom_count > 0) {
|
||||
printf (" Window type:\n");
|
||||
for (i = 0; i < atom_count; i++)
|
||||
for (int i = 0; i < atom_count; i++)
|
||||
Display_Atom_Name (atoms[i], "_NET_WM_WINDOW_TYPE_");
|
||||
}
|
||||
}
|
||||
|
@ -1727,6 +1727,8 @@ Display_WM_Info (struct wininfo *w)
|
|||
}
|
||||
|
||||
if (atom_net_wm_state) {
|
||||
xcb_get_property_reply_t *prop;
|
||||
|
||||
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);
|
||||
|
@ -1734,7 +1736,7 @@ Display_WM_Info (struct wininfo *w)
|
|||
|
||||
if (atom_count > 0) {
|
||||
printf (" Window state:\n");
|
||||
for (i = 0; i < atom_count; i++)
|
||||
for (int i = 0; i < atom_count; i++)
|
||||
Display_Atom_Name (atoms[i], "_NET_WM_STATE_");
|
||||
}
|
||||
}
|
||||
|
@ -1742,6 +1744,8 @@ Display_WM_Info (struct wininfo *w)
|
|||
}
|
||||
|
||||
if (atom_net_wm_pid) {
|
||||
xcb_get_property_reply_t *prop;
|
||||
|
||||
printf (" Process id: ");
|
||||
prop = xcb_get_property_reply (dpy, w->wm_pid_cookie, NULL);
|
||||
if (prop && (prop->type == XCB_ATOM_CARDINAL)) {
|
||||
|
@ -1763,6 +1767,8 @@ Display_WM_Info (struct wininfo *w)
|
|||
}
|
||||
|
||||
if (atom_net_frame_extents) {
|
||||
xcb_get_property_reply_t *prop;
|
||||
|
||||
prop = xcb_get_property_reply (dpy, w->frame_extents_cookie, NULL);
|
||||
if (prop && (prop->type == XCB_ATOM_CARDINAL)
|
||||
&& (prop->value_len == 4)) {
|
||||
|
@ -1836,13 +1842,10 @@ static int
|
|||
is_valid_utf8 (const char *string, size_t len)
|
||||
{
|
||||
unsigned long codepoint;
|
||||
int rem;
|
||||
size_t i;
|
||||
unsigned char c;
|
||||
int rem = 0;
|
||||
|
||||
rem = 0;
|
||||
for (i = 0; i < len; i++) {
|
||||
c = (unsigned char) string[i];
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
unsigned char c = (unsigned char) string[i];
|
||||
|
||||
/* Order of type check:
|
||||
* - Single byte code point
|
||||
|
@ -1911,16 +1914,15 @@ print_utf8 (const char *prefix, const char *u8str, size_t length, const char *su
|
|||
|
||||
if (iconv_from_utf8 != (iconv_t) -1) {
|
||||
Bool done = True;
|
||||
ICONV_CONST char *inp = u8str;
|
||||
ICONV_CONST char *inp = (ICONV_CONST char *) 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);
|
||||
int convres = iconv (iconv_from_utf8, &inp, &inlen, &outp, &outlen);
|
||||
|
||||
if ((convres == -1) && (errno == E2BIG)) {
|
||||
done = False;
|
||||
|
@ -1953,7 +1955,7 @@ static char *
|
|||
get_friendly_name (const char *string, const char *prefix)
|
||||
{
|
||||
const char *name_start = string;
|
||||
char *lowered_name, *n;
|
||||
char *lowered_name;
|
||||
Bool first = True;
|
||||
size_t prefix_len = strlen (prefix);
|
||||
|
||||
|
@ -1965,7 +1967,7 @@ get_friendly_name (const char *string, const char *prefix)
|
|||
if (lowered_name == NULL)
|
||||
Fatal_Error ("Failed to allocate memory in get_friendly_name");
|
||||
|
||||
for (n = lowered_name ; *n != 0 ; n++) {
|
||||
for (char *n = lowered_name ; *n != 0 ; n++) {
|
||||
if (*n == '_') {
|
||||
*n = ' ';
|
||||
first = True;
|
||||
|
|
Loading…
Reference in New Issue