tblame it on the dcat - wmutils - X windows manipulation utilities
(HTM) git clone git://z3bra.org/wmutils
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit c420551c1091fb6edda67493ea22925050a792ea
(DIR) parent bdb3b35e838bf051857237a5bd4e0241a0c5bc52
(HTM) Author: dcat <dcat@iotek.org>
Date: Thu, 18 Dec 2014 14:57:37 +0100
blame it on the dcat
Diffstat:
M util.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/util.c b/util.c
t@@ -1,5 +1,6 @@
#include <err.h>
#include <stdlib.h>
+#include <string.h>
#include <xcb/xcb.h>
#include "util.h"
t@@ -83,7 +84,7 @@ ignore(xcb_connection_t *con, xcb_window_t w)
int
get_windows(xcb_connection_t *con, xcb_window_t w, xcb_window_t **l)
{
- int childnum = 0;
+ uint32_t childnum = 0;
xcb_query_tree_cookie_t c;
xcb_query_tree_reply_t *r;
t@@ -92,10 +93,12 @@ get_windows(xcb_connection_t *con, xcb_window_t w, xcb_window_t **l)
if (r == NULL)
errx(1, "0x%08x: no such window", w);
- *l = xcb_query_tree_children(r);
+ *l = malloc(sizeof(xcb_window_t) * r->children_len);
+ memcpy(*l, xcb_query_tree_children(r),
+ sizeof(xcb_window_t) * r->children_len);
childnum = r->children_len;
- free(r);
+ free(r);
return childnum;
}