summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Haller <patrick@haller.ws>2011-03-09 13:01:01 +0800
committerPatrick Haller <patrick@haller.ws>2011-03-09 13:01:01 +0800
commit940b2ed7498beeffc59d072e8d46f4018d72e443 (patch)
tree780a98de491b39a1c4847d58fa2c82aa8056d290
parent1cca9c6938b1d77b3ea2f851d0a47f0d9156f2c2 (diff)
initial x-window-list dev
-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++) {
+