[hackers] [lsw] lsw -a || Connor Lane Smith

From: <hg_AT_suckless.org>
Date: Sat, 18 Jun 2011 04:24:46 +0200 (CEST)

changeset: 11:4a1c37e8b212
tag: tip
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Sat Jun 18 03:24:26 2011 +0100
files: lsw.c
description:
lsw -a

diff -r dba17963073c -r 4a1c37e8b212 lsw.c
--- a/lsw.c Mon Jun 06 12:52:04 2011 +0100
+++ b/lsw.c Sat Jun 18 03:24:26 2011 +0100
@@ -10,6 +10,7 @@
 static void lsw(Window win);
 
 static Atom netwmname;
+static Bool aflag = False;
 static Bool lflag = False;
 static Display *dpy;
 
@@ -28,6 +29,8 @@
                         puts("lsw-"VERSION", © 2006-2011 lsw engineers, see LICENSE for details");
                         exit(EXIT_SUCCESS);
                 }
+ else if(!strcmp(argv[i], "-a"))
+ aflag = True;
                 else if(!strcmp(argv[i], "-l"))
                         lflag = True;
                 else
@@ -52,7 +55,8 @@
         if(!XQueryTree(dpy, win, &dw, &dw, &wins, &n))
                 return;
         for(i = 0; i < n; i++)
- if(XGetWindowAttributes(dpy, win, &wa) && !wa.override_redirect) {
+ if(aflag || (XGetWindowAttributes(dpy, wins[i], &wa)
+ && !wa.override_redirect && wa.map_state == IsViewable)) {
                         getname(wins[i], buf, sizeof buf);
                         if(lflag)
                                 printf("0x%lx %s\n", wins[i], buf);
@@ -72,7 +76,6 @@
         if(!XGetTextProperty(dpy, win, &prop, netwmname) || prop.nitems == 0)
                 if(!XGetWMName(dpy, win, &prop) || prop.nitems == 0)
                         return;
-
         if(prop.encoding == XA_STRING)
                 strncpy(buf, (char *)prop.value, size);
         else if(!XmbTextPropertyToTextList(dpy, &prop, &list, &n) && n > 0) {
Received on Sat Jun 18 2011 - 04:24:46 CEST

This archive was generated by hypermail 2.2.0 : Sat Jun 18 2011 - 04:36:05 CEST