Introduction
Introduction Statistics Contact Development Disclaimer Help
Improve compliance with our coding style - lsw - lists window titles of X clien…
git clone git://git.suckless.org/lsw
Log
Files
Refs
README
LICENSE
---
commit 10096682a8901258b65d759fa175d052cd4f302d
parent 830c93ee64fe931136eb842a7ed89af5199d8655
Author: Tom Schwindl <[email protected]>
Date: Sun, 3 Jul 2022 14:22:31 +0000
Improve compliance with our coding style
Diffstat:
M lsw.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/lsw.c b/lsw.c
@@ -8,7 +8,7 @@
static Atom netwmname;
static Display *dpy;
-char *
+static char *
getname(Window win)
{
static char buf[BUFSIZ];
@@ -16,22 +16,23 @@ getname(Window win)
int n;
XTextProperty prop;
- if (!XGetTextProperty(dpy, win, &prop, netwmname) || prop.nitems == 0)
- if (!XGetWMName(dpy, win, &prop) || prop.nitems == 0)
+ if (!XGetTextProperty(dpy, win, &prop, netwmname) || !prop.nitems) {
+ if (!XGetWMName(dpy, win, &prop) || !prop.nitems)
return "";
+ }
if (!XmbTextPropertyToTextList(dpy, &prop, &list, &n) && n > 0) {
- strncpy(buf, list[0], sizeof buf);
+ strncpy(buf, list[0], sizeof(buf));
XFreeStringList(list);
} else {
- strncpy(buf, (char *)prop.value, sizeof buf);
+ strncpy(buf, (char *)prop.value, sizeof(buf));
}
XFree(prop.value);
- buf[sizeof buf - 1] = '\0';
+ buf[sizeof(buf) - 1] = '\0';
return buf;
}
-void
+static void
lsw(Window win)
{
unsigned int n;
@@ -40,10 +41,11 @@ lsw(Window win)
if (!XQueryTree(dpy, win, &dw, &dw, &wins, &n) || !n)
return;
- for (w = &wins[n-1]; w >= &wins[0]; w--)
+ for (w = &wins[n-1]; w >= &wins[0]; w--) {
if (XGetWindowAttributes(dpy, *w, &wa)
&& !wa.override_redirect && wa.map_state == IsViewable)
printf("0x%07lx %s\n", *w, getname(*w));
+ }
XFree(wins);
}
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.