twattr: added a check for ignored windows - wmutils - X windows manipulation utilities
 (HTM) git clone git://z3bra.org/wmutils
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 03cef85acf3e85baed24879027cd1aa956d4c478
 (DIR) parent 4662d2794e6e368f709d892bd1cdc225d01f2c7b
 (HTM) Author: z3bra <willy@mailoo.org>
       Date:   Thu,  4 Dec 2014 00:33:45 +0100
       
       wattr: added a check for ignored windows
       
       Diffstat:
         M wattr.c                             |      23 ++++++++++++++++++++++-
       
       1 file changed, 22 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/wattr.c b/wattr.c
       t@@ -21,13 +21,14 @@ enum {
                ATTR_Y = 1 << 3,
                ATTR_B = 1 << 4,
                ATTR_M = 1 << 5,
       +        ATTR_I = 1 << 6,
                ATTR_MAX
        };
        
        static void
        usage(void)
        {
       -        fprintf(stderr, "usage: %s [-h] [bmwhxy] <wid>\n", argv0);
       +        fprintf(stderr, "usage: %s [-h] [bmiwhxy] <wid>\n", argv0);
                exit(1);
        }
        
       t@@ -82,6 +83,25 @@ mapped(xcb_window_t w)
        }
        
        static int
       +ignored(xcb_window_t w)
       +{
       +        int or;
       +        xcb_get_window_attributes_cookie_t c;
       +        xcb_get_window_attributes_reply_t  *r;
       +
       +        c = xcb_get_window_attributes(conn, w);
       +        r = xcb_get_window_attributes_reply(conn, c, NULL);
       +
       +        if (r == NULL)
       +                return 0;
       +
       +        or = r->override_redirect;
       +
       +        free(r);
       +        return or;
       +}
       +
       +static int
        getattribute(xcb_window_t w, int attr)
        {
                xcb_get_geometry_cookie_t c;
       t@@ -128,6 +148,7 @@ main(int argc, char **argv)
                                case 'x': printf("%d", getattribute(w, ATTR_X)); break;
                                case 'y': printf("%d", getattribute(w, ATTR_Y)); break;
                                case 'w': printf("%d", getattribute(w, ATTR_W)); break;
       +                        case 'i': ignored(w)? exit(0) : exit(1);
                                case 'm': mapped(w) ? exit(0) : exit(1);
                                default : exists(w) ? exit(0) : exit(1);
                        }