diff options
| author | Patrick <phaller@localhost.localdomain> | 2013-09-21 00:43:07 +0800 |
|---|---|---|
| committer | Patrick <phaller@localhost.localdomain> | 2013-09-21 00:43:07 +0800 |
| commit | f195f6a89839b837a4305c3146620afcff9a886a (patch) | |
| tree | 66938afc534c57315d8375be0250ec2cbe0d9217 /x-alt-tab.c | |
| parent | 26ae9fb80ae9a03854cf23530ecefbbaf7080221 (diff) | |
even with sync still have occasional spin-outs, so use a count to limit circulates
Diffstat (limited to 'x-alt-tab.c')
| -rw-r--r-- | x-alt-tab.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/x-alt-tab.c b/x-alt-tab.c index 2ec5ab7..9987a3c 100644 --- a/x-alt-tab.c +++ b/x-alt-tab.c @@ -15,13 +15,13 @@ 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; - unsigned int nwins; XTextProperty name; XClassHint hint; @@ -30,14 +30,15 @@ int main(int argc, char **argv) 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; XGetClassHint(dpy, *w, &hint); XGetWMName(dpy, *w, &name); XGetWindowAttributes(dpy, *w, &attr); - } while (attr.width <= 1); + count++; + } while (attr.width <= 1 && count <= nwins+1); - XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); return 0; } |
