int main(int argc, char **argv) { Display *dpy; XWindowAttributes attr; unsigned int nwins, count = 0; if ( (dpy = XOpenDisplay(NULL)) == NULL) return 1; do { Window root, parent, *wins, *w; if (argc > 1) XCirculateSubwindowsDown(dpy, DefaultRootWindow(dpy)); else XCirculateSubwindowsUp(dpy, DefaultRootWindow(dpy)); XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); XSync(dpy, True); XQueryTree(dpy, DefaultRootWindow(dpy), &root, &parent, &wins, &nwins); w = wins + nwins - 1; XGetWindowAttributes(dpy, *w, &attr); count++; } while (attr.map_state != IsViewable && count <= nwins+1); return 0; }
int main(int argc, char **argv) { Display *dpy; if(!(dpy = XOpenDisplay(0x0))) return 1; if (argc > 1) XCirculateSubwindowsDown(dpy, DefaultRootWindow(dpy)); else XCirculateSubwindowsUp(dpy, DefaultRootWindow(dpy)); XSetInputFocus(dpy, NULL, RevertToPointerRoot, CurrentTime); // nuke focus back to pointer XSync(dpy, True); return 0; }
int main(int argc, char **argv) { Display *dpy; if ( (dpy = XOpenDisplay(NULL)) == NULL) return 1; if (argc > 1) XCirculateSubwindowsDown(dpy, DefaultRootWindow(dpy)); else XCirculateSubwindowsUp(dpy, DefaultRootWindow(dpy)); XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); XSync(dpy, True); return 0; }