static Window TryChildren(Display *dpy, Window win, Atom WM_STATE) { Window root, parent; Window *children; unsigned int nchildren; unsigned int i; Atom type = None; int format; unsigned long nitems, after; unsigned char *data; Window inf = 0; if (!XQueryTree(dpy, win, &root, &parent, &children, &nchildren)) return 0; for (i = 0; !inf && (i < nchildren); i++) { data = NULL; XGetWindowProperty(dpy, children[i], WM_STATE, 0, 0, False, AnyPropertyType, &type, &format, &nitems, &after, &data); if (data) XFree(data); if (type) inf = children[i]; } for (i = 0; !inf && (i < nchildren); i++) inf = TryChildren(dpy, children[i], WM_STATE); if (children) XFree(children); return inf; }
Window XmuClientWindow (Display *dpy,Window win) { Atom WM_STATE; Atom type = None; int format; unsigned long nitems, after; unsigned char *data; Window inf; WM_STATE = XInternAtom(dpy, "WM_STATE", True); if (!WM_STATE) return win; XGetWindowProperty(dpy, win, WM_STATE, 0, 0, False, AnyPropertyType, &type, &format, &nitems, &after, &data); if (type) return win; inf = TryChildren(dpy, win, WM_STATE); if (!inf) inf = win; return inf; }
void AnimContextStack::MoveToNext(const uint64 delta, int fps) { spt<GeneralAnim> actualNode; do { // get actual node actualNode = context.GetActualChild(); // 1) scan frames of actual node // 2) scan children of actual node // 3) check next loop of actual node // 4) scan siblings if (!TryNextFrame(actualNode, delta, fps) && !TryChildren(actualNode) && !TryNextLoop(actualNode, delta, fps) && !TrySibling()) { // nothing found -> pop context and go to the higher level bool foundNode = false; while (!nodeStack.empty()) { // pop context context = nodeStack.top(); nodeStack.pop(); actualNode = context.GetActualChild(); // check next loop and scan siblings if (TryNextLoop(actualNode, delta, fps) || TrySibling()) { foundNode = true; break; } } if (!foundNode && nodeStack.empty()) { // there is no node to animate ended = true; return; } } // do it until an animatable node is found } while (!context.GetActualChild()->IsAnimatable()); }