Update xprop to version 1.2.6

pull/1/head
matthieu 2023-01-22 11:08:30 +00:00
parent 5227ff841b
commit c58741f146
8 changed files with 196 additions and 139 deletions

View File

@ -1,3 +1,92 @@
commit 6d5cb0110b8b21ce94a52993e6e175266a4153fb
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat Dec 3 14:29:46 2022 -0800
xprop 1.2.6
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 6e2ab69bc4e339c555b03037db3c073d1a5fa965
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Tue Nov 8 19:04:05 2022 -0800
Variable scope reductions as suggested by cppcheck
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit b14f4fa558db643d1462e9346f138122cb63ce28
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Tue Nov 8 18:48:44 2022 -0800
Resolve many gcc -Wsign-compare warnings
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit f7b1a3f4fec15a0f0a0cd95308f29310adb023a4
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Tue Nov 8 18:34:35 2022 -0800
Rename "dpy" function arguments to "display" to avoid shadowing global
Clears many gcc -Wshadow warnings
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 07f869b9024847a98d0593a3d05cff122ae7c8eb
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Tue Nov 8 18:24:23 2022 -0800
Declare help() and print_help() as static
Resolves gcc -Wmissing-prototypes warnings
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 7ae07138436c9700c65192c4fbc3015819999666
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Tue Nov 8 18:23:21 2022 -0800
Mark help(), usage(), and grammar() with _X_NORETURN _X_COLD
Resolves gcc -Wsuggest-attribute=noreturn warning
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 55c9f8d4b5caf48c1d79252340e1750e160ded1e
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 c36de8de9b2a5832f848259583631310c04b3715
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Tue Dec 7 13:30:04 2021 -0800
Build xz tarballs instead of bzip2
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit d7ec12530b4e45adb6f1c88e92fb25b3ff172c79
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Tue Dec 7 13:30:01 2021 -0800
gitlab CI: add a basic build test
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit ca85da483ab1817ed449fccf3e54e8280112bdbf
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Nov 28 09:50:10 2021 -0800
Fix spelling/wording issues
Found by using:
codespell --builtin clear,rare,usage,informal,code,names
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit ec5aeaddddec4b4bdb532451f5a2bc8e3b7148a9
Author: Keith Packard <keithp@keithp.com>
Date: Thu Nov 19 16:24:50 2020 -0800
@ -672,13 +761,13 @@ Date: Thu Oct 1 14:54:29 2009 -0700
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
commit 11fb62d5aa6304d1813b56a372b8b662f0016f92
Author: Søren Sandmann Pedersen <sandmann@redhat.com>
Author: Søren Sandmann Pedersen <sandmann@redhat.com>
Date: Tue Apr 21 21:13:16 2009 -0400
Display _NET_WM_ICONs as ASCII art instead of as a big list of integers
commit 1b89edb419ee103d0ef834433b16a3822398a519
Author: Søren Sandmann Pedersen <sandmann@redhat.com>
Author: Søren Sandmann Pedersen <sandmann@redhat.com>
Date: Tue Apr 21 15:10:07 2009 -0400
The "visible bit" is called "urgency bit" in the ICCCM 2.0
@ -986,7 +1075,7 @@ Date: Wed Jul 20 19:32:03 2005 +0000
configure cache, you cache it, and the cached value is probably wrong.
commit 721114f44cbd225a8fcd3655d4ded2dc8cc8837f
Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
Date: Fri Jul 8 20:58:05 2005 +0000
Add build system for xprop

View File

@ -180,9 +180,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$$'
@ -654,6 +654,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 +662,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)

View File

@ -8,7 +8,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/xprop

View File

@ -3,7 +3,7 @@
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2020 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

63
app/xprop/configure vendored
View File

@ -1,8 +1,8 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for xprop 1.2.5.
# Generated by GNU Autoconf 2.69 for xprop 1.2.6.
#
# Report bugs to <https://gitlab.freedesktop.org/xorg/app/xprop/issues>.
# Report bugs to <https://gitlab.freedesktop.org/xorg/app/xprop/-/issues>.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@ -267,7 +267,7 @@ fi
$as_echo "$0: be upgraded to zsh 4.3.4 or later."
else
$as_echo "$0: Please tell bug-autoconf@gnu.org and
$0: https://gitlab.freedesktop.org/xorg/app/xprop/issues
$0: https://gitlab.freedesktop.org/xorg/app/xprop/-/issues
$0: about your system, including any error possibly output
$0: before this message. Then install a modern shell, or
$0: manually run the script under such a shell if you do
@ -581,9 +581,9 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='xprop'
PACKAGE_TARNAME='xprop'
PACKAGE_VERSION='1.2.5'
PACKAGE_STRING='xprop 1.2.5'
PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/app/xprop/issues'
PACKAGE_VERSION='1.2.6'
PACKAGE_STRING='xprop 1.2.6'
PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/app/xprop/-/issues'
PACKAGE_URL=''
ac_unique_file="Makefile.am"
@ -1329,7 +1329,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 xprop 1.2.5 to adapt to many kinds of systems.
\`configure' configures xprop 1.2.6 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1400,7 +1400,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of xprop 1.2.5:";;
short | recursive ) echo "Configuration of xprop 1.2.6:";;
esac
cat <<\_ACEOF
@ -1453,7 +1453,7 @@ Some influential environment variables:
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to <https://gitlab.freedesktop.org/xorg/app/xprop/issues>.
Report bugs to <https://gitlab.freedesktop.org/xorg/app/xprop/-/issues>.
_ACEOF
ac_status=$?
fi
@ -1516,7 +1516,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
xprop configure 1.2.5
xprop configure 1.2.6
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@ -1840,9 +1840,9 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
( $as_echo "## ------------------------------------------------------------------- ##
## Report this to https://gitlab.freedesktop.org/xorg/app/xprop/issues ##
## ------------------------------------------------------------------- ##"
( $as_echo "## --------------------------------------------------------------------- ##
## Report this to https://gitlab.freedesktop.org/xorg/app/xprop/-/issues ##
## --------------------------------------------------------------------- ##"
) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
@ -1864,7 +1864,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 xprop $as_me 1.2.5, which was
It was created by xprop $as_me 1.2.6, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -2693,7 +2693,7 @@ fi
# Define the identity of the package.
PACKAGE='xprop'
VERSION='1.2.5'
VERSION='1.2.6'
cat >>confdefs.h <<_ACEOF
@ -2740,29 +2740,6 @@ am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
# Check whether --enable-maintainer-mode was given.
if test "${enable_maintainer_mode+set}" = set; then :
enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
else
USE_MAINTAINER_MODE=no
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
$as_echo "$USE_MAINTAINER_MODE" >&6; }
if test $USE_MAINTAINER_MODE = yes; then
MAINTAINER_MODE_TRUE=
MAINTAINER_MODE_FALSE='#'
else
MAINTAINER_MODE_TRUE='#'
MAINTAINER_MODE_FALSE=
fi
MAINT=$MAINTAINER_MODE_TRUE
# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
@ -10874,10 +10851,6 @@ else
am__EXEEXT_FALSE=
fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@ -11291,7 +11264,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by xprop $as_me 1.2.5, which was
This file was extended by xprop $as_me 1.2.6, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -11351,13 +11324,13 @@ $config_headers
Configuration commands:
$config_commands
Report bugs to <https://gitlab.freedesktop.org/xorg/app/xprop/issues>."
Report bugs to <https://gitlab.freedesktop.org/xorg/app/xprop/-/issues>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
xprop config.status 1.2.5
xprop config.status 1.2.6
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View File

@ -22,14 +22,13 @@ dnl Process this file with autoconf to create configure.
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xprop], [1.2.5],
[https://gitlab.freedesktop.org/xorg/app/xprop/issues], [xprop])
AC_INIT([xprop], [1.2.6],
[https://gitlab.freedesktop.org/xorg/app/xprop/-/issues], [xprop])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
# Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
AM_INIT_AUTOMAKE([foreign dist-xz])
# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
m4_ifndef([XORG_MACROS_VERSION],

View File

@ -43,7 +43,7 @@ from The Open Group.
#include "dsimple.h"
/*
* Just_display: A group of routines designed to make the writting of simple
* 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,
@ -59,7 +59,7 @@ Display *dpy = NULL;
int screen = 0;
/*
* Get_Display_Name (argc, argv) Look for -display, -d, or host:dpy (obselete)
* Get_Display_Name (argc, argv) Look for -display, -d, or host:dpy (obsolete)
* If found, remove it from command line. Don't go past a lone -.
*/
char *Get_Display_Name(
@ -162,7 +162,7 @@ XFontStruct *Open_Font(const char *name)
/*
* Select_Window_Args: a rountine to provide a common interface for
* Select_Window_Args: a routine 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
@ -247,19 +247,19 @@ Window Select_Window_Args(
* Routine to let user select a window using the mouse
*/
Window Select_Window(Display *dpy, int descend)
Window Select_Window(Display *display, int descend)
{
int status;
Cursor cursor;
XEvent event;
Window target_win = None, root = RootWindow(dpy,screen);
Window target_win = None, root = RootWindow(display,screen);
int buttons = 0;
/* Make the target cursor */
cursor = XCreateFontCursor(dpy, XC_crosshair);
cursor = XCreateFontCursor(display, XC_crosshair);
/* Grab the pointer using target cursor, letting it room all over */
status = XGrabPointer(dpy, root, False,
status = XGrabPointer(display, root, False,
ButtonPressMask|ButtonReleaseMask, GrabModeSync,
GrabModeAsync, root, cursor, CurrentTime);
if (status != GrabSuccess) Fatal_Error("Can't grab the mouse.");
@ -267,8 +267,8 @@ Window Select_Window(Display *dpy, int descend)
/* 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);
XAllowEvents(display, SyncPointer, CurrentTime);
XWindowEvent(display, root, ButtonPressMask|ButtonReleaseMask, &event);
switch (event.type) {
case ButtonPress:
if (target_win == None) {
@ -284,12 +284,12 @@ Window Select_Window(Display *dpy, int descend)
}
}
XUngrabPointer(dpy, CurrentTime); /* Done with pointer */
XUngrabPointer(display, CurrentTime); /* Done with pointer */
if (!descend || (target_win == root))
return(target_win);
target_win = Find_Client(dpy, root, target_win);
target_win = Find_Client(display, root, target_win);
return(target_win);
}
@ -303,7 +303,7 @@ Window Select_Window(Display *dpy, int descend)
* are looked at. Normally, top should be the RootWindow.
*/
Window Window_With_Name(
Display *dpy,
Display *display,
Window top,
const char *name)
{
@ -313,14 +313,14 @@ Window Window_With_Name(
Window w=0;
char *window_name;
if (XFetchName(dpy, top, &window_name) && !strcmp(window_name, name))
if (XFetchName(display, top, &window_name) && !strcmp(window_name, name))
return(top);
if (!XQueryTree(dpy, top, &dummy, &dummy, &children, &nchildren))
if (!XQueryTree(display, top, &dummy, &dummy, &children, &nchildren))
return(0);
for (i=0; i<nchildren; i++) {
w = Window_With_Name(dpy, children[i], name);
w = Window_With_Name(display, children[i], name);
if (w)
break;
}

View File

@ -66,7 +66,7 @@ from The Open Group.
/* isprint() in "C" locale */
#define c_isprint(c) ((c) >= 0x20 && (c) < 0x7f)
static int term_width = 144 + 8;
static unsigned int term_width = 144 + 8;
/*
*
@ -145,7 +145,7 @@ static char *
Read_Quoted (FILE *stream)
{
char *ptr;
int c, length;
int length;
Read_White_Space(stream);
if (Read_Char(stream)!='\'')
@ -153,6 +153,8 @@ Read_Quoted (FILE *stream)
ptr = _large_buffer; length = MAXSTR;
for (;;) {
int c;
if (length < 0)
Fatal_Error("Bad format file format: dformat too long.");
c = Read_Char(stream);
@ -267,17 +269,16 @@ Apply_Default_Formats (const char **format, const char **dformat)
static void
Lookup_Formats (Atom atom, const char **format, const char **dformat)
{
int i;
if (_property_formats)
for (i = _property_formats->thunk_count-1; i >= 0; i--)
if (_property_formats[i].value == atom) {
for (int i = _property_formats->thunk_count-1; i >= 0; i--) {
if (_property_formats[i].value == (long) atom) {
if (!*format)
*format = _property_formats[i].format;
if (!*dformat)
*dformat = _property_formats[i].dformat;
break;
}
}
}
static void
@ -534,11 +535,13 @@ Read_Mappings (FILE *stream)
{
char format_buffer[100];
char name[1000];
const char *dformat, *format;
int count, c;
Atom atom;
int count;
while ((count = fscanf(stream," %990s %90s ",name,format_buffer)) != EOF) {
const char *dformat, *format;
int c;
Atom atom;
if (count != 2)
Fatal_Error("Bad format file format.");
@ -596,7 +599,7 @@ Format_Signed (long wrd)
/*ARGSUSED*/
static int
ignore_errors (Display *dpy, XErrorEvent *ev)
ignore_errors (Display *display, XErrorEvent *ev)
{
return 0;
}
@ -618,7 +621,7 @@ Format_Atom (Atom atom)
snprintf(_formatting_buffer, sizeof(_formatting_buffer),
"undefined atom # 0x%lx", atom);
else {
int namelen = strlen(name);
size_t namelen = strlen(name);
if (namelen > MAXSTR) namelen = MAXSTR;
memcpy(_formatting_buffer, name, namelen);
_formatting_buffer[namelen] = '\0';
@ -630,7 +633,7 @@ Format_Atom (Atom atom)
static const char *
Format_Mask_Word (long wrd)
{
long bit_mask, bit;
unsigned long bit_mask, bit;
int seen = 0;
strcpy(_formatting_buffer, "{MASK: ");
@ -780,7 +783,6 @@ Format_Icons (const unsigned long *icon, int len)
unsigned long width, height, display_width;
unsigned int icon_pixel_bytes;
unsigned int icon_line_bytes;
int w, h;
int offset;
width = *icon++;
@ -818,11 +820,11 @@ Format_Icons (const unsigned long *icon, int len)
continue;
}
for (h = 0; h < height; ++h)
for (unsigned int h = 0; h < height; ++h)
{
tail += sprintf (tail, "\t");
for (w = 0; w < width; ++w)
for (unsigned int w = 0; w < width; ++w)
{
unsigned char a, r, g, b;
unsigned long pixel = *icon++;
@ -894,7 +896,7 @@ static const char *
Format_Len_Text (const char *string, int len, Atom encoding)
{
XTextProperty textprop;
char **list, **start_list;
char **start_list;
int count;
/* Try to convert to local encoding. */
@ -903,7 +905,7 @@ Format_Len_Text (const char *string, int len, Atom encoding)
textprop.value = (unsigned char *) string;
textprop.nitems = len;
if (XmbTextPropertyToTextList(dpy, &textprop, &start_list, &count) == Success) {
list = start_list;
char **list = start_list;
_buf_ptr = _formatting_buffer;
_buf_len = MAXSTR;
*_buf_ptr++ = '"';
@ -977,12 +979,10 @@ static int
is_valid_utf8 (const char *string, int len)
{
unsigned long codepoint = 0;
int rem, i;
unsigned char c;
int rem = 0;
rem = 0;
for (i = 0; i < len; i++) {
c = (unsigned char) string[i];
for (int i = 0; i < len; i++) {
unsigned char c = (unsigned char) string[i];
/* Order of type check:
* - Single byte code point
@ -1024,12 +1024,12 @@ is_valid_utf8 (const char *string, int len)
static const char *
Format_Len_Unicode (const char *string, int len)
{
char *data;
const char *result, *error;
int validity = is_valid_utf8(string, len);
if (validity != UTF8_VALID) {
char *data;
const char *result, *error;
switch (validity) {
case UTF8_FORBIDDEN_VALUE:
error = "<Invalid UTF-8 string: Forbidden value> "; break;
@ -1147,9 +1147,7 @@ Format_Thunk_I (thunk *thunks, const char *format, int i)
static long
Mask_Word (thunk *thunks, const char *format)
{
int j;
for (j = 0; j < (int)strlen(format); j++)
for (int j = 0; j < (int)strlen(format); j++)
if (Get_Format_Char(format, j) == 'm')
return thunks[j].value;
return 0;
@ -1403,13 +1401,13 @@ Break_Down_Property (const char *pointer, int length, Atom type, const char *for
thunk *thunks;
thunk t = {0};
int i;
char format_char;
thunks = Create_Thunk_List();
i = 0;
while (length >= size/8) {
format_char = Get_Format_Char(format, i);
char format_char = Get_Format_Char(format, i);
if (format_char == 's' || format_char == 'u')
t.value = Extract_Len_String(&pointer,&length,size,&t.extra_value);
else if (format_char == 't') {
@ -1447,11 +1445,9 @@ static const char *
Get_Font_Property_Data_And_Type (Atom atom,
long *length, Atom *type, int *size)
{
int i;
*type = None;
for (i = 0; i < font->n_properties; i++)
for (int i = 0; i < font->n_properties; i++)
if (atom == font->properties[i].name) {
_font_prop = font->properties[i].card32;
*length = sizeof(long);
@ -1508,7 +1504,7 @@ Get_Window_Property_Data_And_Type (Atom atom,
static const char *
Get_Property_Data_And_Type (Atom atom, long *length, Atom *type, int *size)
{
if (target_win == -1)
if (target_win == (Window) -1)
return Get_Font_Property_Data_And_Type(atom, length, type, size);
else
return Get_Window_Property_Data_And_Type(atom, length, type, size);
@ -1559,23 +1555,21 @@ Show_Prop (const char *format, const char *dformat, const char *prop)
static void
Show_All_Props (void)
{
Atom *atoms, atom;
const char *name;
int count, i;
if (target_win != -1) {
atoms = XListProperties(dpy, target_win, &count);
for (i = 0; i < count; i++) {
name = Format_Atom(atoms[i]);
if (target_win != (Window) -1) {
int count;
Atom *atoms = XListProperties(dpy, target_win, &count);
for (int i = 0; i < count; i++) {
const char *name = Format_Atom(atoms[i]);
Show_Prop(NULL, NULL, name);
}
XFree(atoms);
} else
for (i = 0; i < font->n_properties; i++) {
atom = font->properties[i].name;
name = Format_Atom(atom);
} else {
for (int i = 0; i < font->n_properties; i++) {
Atom atom = font->properties[i].name;
const char *name = Format_Atom(atom);
Show_Prop(NULL, NULL, name);
}
}
}
static thunk *
@ -1621,20 +1615,20 @@ Handle_Prop_Requests (int argc, char **argv)
}
static void
Remove_Property (Display *dpy, Window w, const char *propname)
Remove_Property (Display *display, Window w, const char *propname)
{
Atom id = XInternAtom (dpy, propname, True);
Atom id = XInternAtom (display, propname, True);
if (id == None) {
fprintf (stderr, "%s: no such property \"%s\"\n",
program_name, propname);
return;
}
XDeleteProperty (dpy, w, id);
XDeleteProperty (display, w, id);
}
static void
Set_Property (Display *dpy, Window w, const char *propname, const char *value)
Set_Property (Display *display, Window w, const char *propname, const char *value)
{
Atom atom;
const char *format;
@ -1666,7 +1660,7 @@ Set_Property (Display *dpy, Window w, const char *propname, const char *value)
case 'u':
if (size != 8)
Fatal_Error("can't use format character 'u' with any size except 8.");
type = XInternAtom(dpy, "UTF8_STRING", False);
type = XInternAtom(display, "UTF8_STRING", False);
data = (const unsigned char *) value;
nelements = strlen(value);
break;
@ -1674,7 +1668,7 @@ Set_Property (Display *dpy, Window w, const char *propname, const char *value)
XTextProperty textprop;
if (size != 8)
Fatal_Error("can't use format character 't' with any size except 8.");
if (XmbTextListToTextProperty(dpy, (char **) &value, 1,
if (XmbTextListToTextProperty(display, (char **) &value, 1,
XStdICCTextStyle, &textprop) != Success) {
fprintf(stderr, "cannot convert %s argument to STRING or COMPOUND_TEXT.\n", propname);
return;
@ -1804,7 +1798,7 @@ Set_Property (Display *dpy, Window w, const char *propname, const char *value)
Fatal_Error("bad format character: %c", format_char);
}
XChangeProperty(dpy, target_win, atom, type, size, PropModeReplace,
XChangeProperty(display, target_win, atom, type, size, PropModeReplace,
data, nelements);
}
@ -1814,7 +1808,7 @@ Set_Property (Display *dpy, Window w, const char *propname, const char *value)
*
*/
void
static void
print_help (void)
{
static const char *help_message =
@ -1845,12 +1839,14 @@ print_help (void)
fprintf (stderr, "%s\n", help_message);
}
void help (void) {
static inline void _X_NORETURN _X_COLD
help (void)
{
print_help();
exit(0);
}
void
void _X_NORETURN _X_COLD
usage (const char *errmsg)
{
if (errmsg != NULL)
@ -1860,7 +1856,7 @@ usage (const char *errmsg)
exit (1);
}
static void
static void _X_NORETURN _X_COLD
grammar (void)
{
printf ("Grammar for xprop:\n\n");
@ -1890,7 +1886,7 @@ Parse_Format_Mapping (int *argc, char ***argv)
#define ARGC (*argc)
#define ARGV (*argv)
#define OPTION ARGV[0]
#define NXTOPT if (++ARGV, --ARGC==0) usage("insufficent arguments for -format")
#define NXTOPT if (++ARGV, --ARGC==0) usage("insufficient arguments for -format")
char *type_name, *format, *dformat;
NXTOPT; type_name = OPTION;
@ -1915,9 +1911,9 @@ Parse_Format_Mapping (int *argc, char ***argv)
static int spy = 0;
static int (*old_error_handler)(Display *dpy, XErrorEvent *ev);
static int (*old_error_handler)(Display *display, XErrorEvent *ev);
static int spy_error_handler(Display *dpy, XErrorEvent *ev)
static int spy_error_handler(Display *display, XErrorEvent *ev)
{
if (ev->error_code == BadWindow || ev->error_code == BadMatch) {
/* Window was destroyed */
@ -1926,7 +1922,7 @@ static int spy_error_handler(Display *dpy, XErrorEvent *ev)
}
if (old_error_handler)
return old_error_handler(dpy, ev);
return old_error_handler(display, ev);
return 0;
}
@ -2012,7 +2008,7 @@ main (int argc, char **argv)
if (!strcmp(argv[0], "-font")) {
if (++argv, --argc == 0) usage("-font requires an argument");
font = Open_Font(argv[0]);
target_win = -1;
target_win = (Window) -1;
continue;
}
if (!strcmp(argv[0], "-remove")) {
@ -2025,7 +2021,7 @@ main (int argc, char **argv)
}
if (!strcmp(argv[0], "-set")) {
thunk t = {0};
if (argc < 3) usage("insufficent arguments for -set");
if (argc < 3) usage("insufficient arguments for -set");
t.propname = argv[1];
t.extra_value = argv[2];
argv += 3; argc -= 3;
@ -2062,7 +2058,7 @@ main (int argc, char **argv)
if (remove_props != NULL) {
int count;
if (target_win == -1)
if (target_win == (Window) -1)
Fatal_Error("-remove works only on windows, not fonts");
count = remove_props->thunk_count;
@ -2073,7 +2069,7 @@ main (int argc, char **argv)
if (set_props != NULL) {
int count;
if (target_win == -1)
if (target_win == (Window) -1)
Fatal_Error("-set works only on windows, not fonts");
count = set_props->thunk_count;
@ -2089,7 +2085,7 @@ main (int argc, char **argv)
props = Handle_Prop_Requests(argc, argv);
if (spy && target_win != -1) {
if (spy && target_win != (Window) -1) {
XEvent event;
const char *format, *dformat;
@ -2106,7 +2102,7 @@ main (int argc, char **argv)
if (props) {
int i;
for (i = 0; i < props->thunk_count; i++)
if (props[i].value == event.xproperty.atom)
if (props[i].value == (long) event.xproperty.atom)
break;
if (i >= props->thunk_count)
continue;