diff options
| author | Patrick <phaller@localhost.localdomain> | 2013-09-19 22:35:08 +0800 |
|---|---|---|
| committer | Patrick <phaller@localhost.localdomain> | 2013-09-19 22:35:08 +0800 |
| commit | ac02af4b4087f178820fdbf54fddafd799c53fef (patch) | |
| tree | 92d71f183da7119e4bc5669ddf745dc4dd13d481 /x-alt-tab.c | |
| parent | dbd971217db7a2634a44e3318aa7bcbd8acd0230 (diff) | |
chromium creates 1px wide top-level windows, skip past them
Diffstat (limited to 'x-alt-tab.c')
| -rw-r--r-- | x-alt-tab.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/x-alt-tab.c b/x-alt-tab.c index efdc887..29a96a0 100644 --- a/x-alt-tab.c +++ b/x-alt-tab.c @@ -9,18 +9,33 @@ received a copy of the CC0 Public Domain Dedication along with this software. If not, see http://creativecommons.org/publicdomain/zero/1.0/ */ #include <X11/Xlib.h> +#include <X11/Xutil.h> int main(int argc, char **argv) { Display *dpy; + XWindowAttributes attr; if ( (dpy = XOpenDisplay(NULL)) == NULL) return 1; - if (argc > 1) - XCirculateSubwindowsDown(dpy, DefaultRootWindow(dpy)); - else - XCirculateSubwindowsUp(dpy, DefaultRootWindow(dpy)); + do { + Window root, parent, *wins, *w; + unsigned int nwins; + XTextProperty name; + XClassHint hint; + + if (argc > 1) + XCirculateSubwindowsDown(dpy, DefaultRootWindow(dpy)); + else + XCirculateSubwindowsUp(dpy, DefaultRootWindow(dpy)); + + 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); XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); XSync(dpy, True); |
