tlsw: ignore windows with override_redirect set to 1 - wmutils - X windows manipulation utilities
(HTM) git clone git://z3bra.org/wmutils
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit d6536fa10c3dfcabbfc644dc8301a1c7d562d5c6
(DIR) parent 7362053d6865989c655e2089b88986d4462d5498
(HTM) Author: z3bra <willy@mailoo.org>
Date: Tue, 2 Dec 2014 14:06:45 +0100
lsw: ignore windows with override_redirect set to 1
Diffstat:
M lsw.c | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/lsw.c b/lsw.c
t@@ -12,7 +12,8 @@ static xcb_screen_t *scrn;
static void usage(void);
static void xcbinit(void);
static void cleanup(void);
-static int ismapped(xcb_window_t w);
+static int mapped(xcb_window_t);
+static int ignored(xcb_window_t);
static void
usage(void)
t@@ -42,7 +43,7 @@ cleanup(void)
}
static int
-ismapped(xcb_window_t w)
+mapped(xcb_window_t w)
{
int ms;
xcb_get_window_attributes_cookie_t c;
t@@ -60,6 +61,25 @@ ismapped(xcb_window_t w)
return ms;
}
+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 void
listwindows(xcb_window_t w, int listhidden)
{
t@@ -78,8 +98,10 @@ listwindows(xcb_window_t w, int listhidden)
errx(1, "0x%08x: unable to retrieve children", w);
for (i=0; i<r->children_len; i++) {
- if (ismapped(wc[i]) || listhidden)
- printf("0x%08x\n", wc[i]);
+ if (!ignored(wc[i])) {
+ if (mapped(wc[i]) || listhidden)
+ printf("0x%08x\n", wc[i]);
+ }
}
free(r);