summaryrefslogtreecommitdiff
path: root/xprop.c
AgeCommit message (Collapse)Author
2022-11-14Variable scope reductions as suggested by cppcheckAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-11-14Resolve many gcc -Wsign-compare warningsAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-11-14Rename "dpy" function arguments to "display" to avoid shadowing globalAlan Coopersmith
Clears many gcc -Wshadow warnings Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-11-14Declare help() and print_help() as staticAlan Coopersmith
Resolves gcc -Wmissing-prototypes warnings Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-11-14Mark help(), usage(), and grammar() with _X_NORETURN _X_COLDAlan Coopersmith
Resolves gcc -Wsuggest-attribute=noreturn warning Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2021-11-28Fix spelling/wording issuesAlan Coopersmith
Found by using: codespell --builtin clear,rare,usage,informal,code,names Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-11-17Check return value from ioctl(TIOCGWINSZ)Keith Packard
Make sure the function succeeded before looking at the return value. Signed-off-by: Keith Packard <keithp@keithp.com>
2020-11-17Correct icon buffer width computation for truecolor terminalsKeith Packard
Fix the test when computing size necessary for true color output to use 'is_truecolor_term' instead of 'is_utf8_locale'. A non-utf8 locale with a true color terminal would have under-allocated the buffer. Also, check for truecolor first to match the output code. This doesn't fix the fact that this code over-allocates by a factor of two in this case, but that at least won't cause memory corruption. Signed-off-by: Keith Packard <keithp@keithp.com>
2020-11-17Free string list returned from XmbTextPropertyToTextListKeith Packard
Make sure we clean up after this call by using the XFreeStringList function. Signed-off-by: Keith Packard <keithp@keithp.com>
2020-11-17Make output with unknown width terminal the same as old codeKeith Packard
Auto-detecting the terminal width and eliding icons that are too wide is a nice new feature, but we shouldn't change the behaviour when that width is not detectable (e.g., when output to a file). Change the default terminal width from 80 to 144 + 8 to get back to the previous output format. Signed-off-by: Keith Packard <keithp@keithp.com>
2020-11-01Fix formatting of back-to-back not shown icons.Pierre-Loup A. Griffais
Otherwise looks like this: Icon (48 x 48): (not shown) Icon (64 x 64): (not shown) Icon (128 x 128): (not shown)
2020-11-01Support true color output for icons if the terminal advertises it.Pierre-Loup A. Griffais
2020-11-01Fix aspect ratio for icon display by using two characters per icon pixel.Pierre-Loup A. Griffais
2020-11-01Break down memory allocation logic and fix overallocating for UTF8.Pierre-Loup A. Griffais
We need up to 3 bytes per character in UTF8 mode, not 4.
2020-11-01Don't display icons if they would line-wrap.Pierre-Loup A. Griffais
Assuming we can query the terminal width.
2020-04-11Add missing `-help` functionJason Nader
`-help` is mentioned in the manpages, but actually running `xprop -help` results in xprop exiting with status 1 as it doesn't recognise the option. This has been the source of major confusion here: https://github.com/franciscolourenco/done/issues/77#issuecomment-612404448 Signed-off-by: Jason Nader <jason.nader@protonmail.com>
2018-05-05Add missing braces around else clause in Read_Quoted()Alan Coopersmith
Found by gcc 7.3: xprop.c: In function ‘Read_Quoted’: xprop.c:163:8: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation] } else ^~~~ xprop.c:164:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’ ptr++[0] = c; length--; ^~~~~~ Introduced in initial commit to X Consortium RCS in 1987: https://cgit.freedesktop.org/~alanc/xc-historical/commit/xc/programs/xprop/xprop.c?id=18ea83d7457743936e99a574b50e208f7697f096 Actual effect is minimal - for every \-escaped newline in the DFORMAT portion of a xprop formats file, xprop subtracted one byte too many from the count of bytes still available in the buffer, which could lead it to return an error of "Bad format file format: dformat too long." when there was still room left. Since the original buffer size was 10,000 bytes, and the current size is 500,000 bytes, it's unlikely anyone ever hit this in real usage. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2015-09-28Free the data returned by Format_Icons()Eirik Byrkjeflot Anonsen
Signed-off-by: Eirik Byrkjeflot Anonsen <eirik@eirikba.org>
2015-09-28Free the data returned by XGetWindowProperty()Eirik Byrkjeflot Anonsen
Signed-off-by: Eirik Byrkjeflot Anonsen <eirik@eirikba.org>
2015-09-22Free the data returned by XListProperties()Eirik Byrkjeflot Anonsen
Signed-off-by: Eirik Byrkjeflot Anonsen <eirik@eirikba.org>
2015-09-22Free the thunks used by Show_PropEirik Byrkjeflot Anonsen
Signed-off-by: Eirik Byrkjeflot Anonsen <eirik@eirikba.org>
2014-06-03Add -version option to print program versionAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-06-03Print which option was in error along with usage messageAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-07-19Fix const conversion warnings from gccAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-01-22Add unicode argument to Format_Len_String to reduce code duplicationAlan Coopersmith
Allows us to get rid of a second copy of the code that differed only in the unicode argument passed on to Format_String. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-01-22Replace strlen/malloc/memcpy set with strdupAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-02-21Enable setting property of type UTF8_STRING.lolilolicon
Fix "bad format character: u" error for format '8u', e.g.: xprop -root -f _NET_WM_NAME 8u -set _NET_WM_NAME LG3D Signed-off-by: James Cloos <cloos@jhcloos.com>
2011-05-08Make error handlint more robust in Format_Len_UnicodeJeremy Huddleston
xprop.c:1011:2: warning: Function call argument is an uninitialized value memcpy(_formatting_buffer, error, strlen(error)+1); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ xprop.c:1011:36: note: instantiated from: memcpy(_formatting_buffer, error, strlen(error)+1); ^ ~~~~~ Found-by: clang static analysis Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-05-08Fix uninitialize values warnings in static analysisJeremy Huddleston
xprop.c:299:25: warning: Passed-by-value struct argument contains uninitialized data (e.g., field: 'thunk_count') _property_formats = Add_Thunk(_property_formats, t); ^ ~ xprop.c:1394:11: warning: Passed-by-value struct argument contains uninitialized data (e.g., field: 'thunk_count') thunks = Add_Thunk(thunks, t); ^ ~ xprop.c:1581:15: warning: Passed-by-value struct argument contains uninitialized data (e.g., field: 'thunk_count') thunks = Add_Thunk(thunks, t); ^ ~ xprop.c:1962:18: warning: Passed-by-value struct argument contains uninitialized data (e.g., field: 'thunk_count') set_props = Add_Thunk(set_props, t); ^ ~ xprop.c:1952:21: warning: Passed-by-value struct argument contains uninitialized data (e.g., field: 'thunk_count') remove_props = Add_Thunk(remove_props, t); ^ ~ Found-by: clang static analyzer Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-02-01Replace Copy_String() with strdup + error checkAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Julien Cristau <jcristau@debian.org>
2011-02-01inline Malloc & Realloc functionsAlan Coopersmith
Since stdlib.h versions return void *, remove unneeded casts that the wrappers needed. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Julien Cristau <jcristau@debian.org>
2010-10-06Purge cvs tags.Jesse Adkins
Signed-off-by: Jesse Adkins <jesserayadkins@gmail.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2009-10-21Print UTF8_STRING type as UTF-8 when locale supports itYang Zhao
Introduces 'u' format character, which behaves like 's', but leaves UTF-8 encoding intact. Property value is checked for UTF-8 validity according to RFC 3629. If invalid, an error string is printed, followed by the string formatted using 's'. ie: PROP(UTF8_STRING) = <Invalid UTF-8 string: Forbidden value> "\374\233" Signed-off-by: Yang Zhao <yang@yangman.ca> Signed-off-by: James Cloos <cloos@jhcloos.com>
2009-04-28Display _NET_WM_ICONs as ASCII art instead of as a big list of integersSøren Sandmann Pedersen
2009-04-21The "visible bit" is called "urgency bit" in the ICCCM 2.0Søren Sandmann Pedersen
2009-02-16Exit cleanly when the target window is destroyed. (#19381)Ben Hutchings
2008-11-26-spy: flush output before waiting for more eventsNeale Pickett
I'm trying to use xprop with the -spy option in a shell script, and since it doesn't flush stdout, it's bunching up lots of modifications into a big chunk of writes.
2007-12-06Select correct client window in WM’s using virtual rootsKim Woelders
From bug 2185¹ When manually selecting a window, xprop finds the top-level window containing the pointer and uses XmuClientWindow to attempt to find a client window having WM_STATE set. In a WM using virtual roots (e.g. enlightenment, desks other than first) this fails beacuse the top-level window is a virtual root, and XmuClientWindow seems to find the first client having WM_STATE set, which only by coincidence will be the one the user intended to select (i.e. containing the pointer). The solution is to descend the window hierarchy at the pointer location to find a window with WM_STATE set. 1] https://bugs.freedesktop.org/show_bug.cgi?id=2185 Signed-off-by: James Cloos <cloos@jhcloos.com>
2007-08-10Sun Bug 4474581: xprop fails in Japanese localeJay Hobson
CJK locales need a much longer string as they include many \xXX entries which expand into /XXXXXXXX entries. Increased the buffer from 10000 to 500000 bytes. Make sure buffer pointer doesn't go negative in _put_char.
2007-08-10Simplify printing of usage messageAlan Coopersmith
2007-08-10Convert old #ifdefs for HAS_WTYPE_H & HAS_WCHAR_H to autoconf checksAlan Coopersmith
2007-08-10Replace sprintf's with snprintf'sAlan Coopersmith
2007-08-10Coverity #905: Handle_Prop_Requests returned without freeing storage "thunks"Alan Coopersmith
2006-07-27remove misleading commentDaniel Stone
2006-07-27handle actual_format_return == 0 (#7647)Branden Robinson
Handle buggy servers which set actual_format_return == 0, instead of aborting.
2004-04-23Merging XORG-CURRENT into trunkrel-0-6-1lg3d-rel-0-7-0lg3d-baseXORG-6_8_1XORG-6_8_0XORG-6_7_99_904XORG-6_7_99_903XORG-6_7_99_902XORG-6_7_99_901XORG-6_7_99_2XORG-6_7_99_1XACE-SELINUX-MERGEEgbert Eich
2004-03-14Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004xf86-4_4_99_1Egbert Eich
2004-03-03Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004xf86-4_4_0Egbert Eich
2004-02-26readding XFree86's cvs IDsxf86-4_3_99_903Egbert Eich
2004-02-26Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004Egbert Eich