Files
dat-thang/tests/helpers/dillo-title-probe.c
T

24 lines
766 B
C
Raw Normal View History

2026-10-19 00:12:36 -04:00
#include <X11/Xlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static void walk(Display *d, Window w, int depth) {
Window root, parent, *children = NULL;
unsigned int n = 0, i;
char *name = NULL;
if (XFetchName(d, w, &name) && name) {
if (strstr(name, "Dillo") || strstr(name, "Site is online")) printf("%.*s%s\n", depth * 2, " ", name);
XFree(name);
}
if (XQueryTree(d, w, &root, &parent, &children, &n)) {
for (i = 0; i < n; i++) walk(d, children[i], depth + 1);
if (children) XFree(children);
}
}
int main(void) {
Display *d = XOpenDisplay(NULL);
if (!d) { fputs("XOpenDisplay failed\n", stderr); return 1; }
walk(d, DefaultRootWindow(d), 0);
XCloseDisplay(d);
return 0;
}