summaryrefslogtreecommitdiff
path: root/x-window-list.c
diff options
context:
space:
mode:
Diffstat (limited to 'x-window-list.c')
-rw-r--r--x-window-list.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/x-window-list.c b/x-window-list.c
new file mode 100644
index 0000000..84c2bd2
--- /dev/null
+++ b/x-window-list.c
@@ -0,0 +1,17 @@
+#include <X11/Xlib.h>
+
+// http://tronche.com/gui/x/xlib/
+int main(void) {
+ Display *dpy;
+ Window w;
+ Window *root_return;
+ Window *parent_return;
+ Window **children_return;
+ unsigned int *nchildren_return;
+
+ if(!(dpy = XOpenDisplay(NULL)))
+ return 1;
+ XQueryTree(display, DefaultRootWindow(dpy), root_return, parent_return, children_return, nchildren_return);
+
+ for (int i=0; i < nchildren_return; i++) {
+