From 6296055b03839a50c8f0ae00fc1584b627ec86e2 Mon Sep 17 00:00:00 2001 From: Patrick Date: Fri, 9 Jun 2017 18:12:18 +0800 Subject: apply window viewability heuristic from x-window-list --- x-alt-tab.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/x-alt-tab.c b/x-alt-tab.c index c5acc16..619c302 100644 --- a/x-alt-tab.c +++ b/x-alt-tab.c @@ -19,11 +19,18 @@ void x_alt_tab(Rotation r, Display *dpy, Window *wins, unsigned int nwins) { unsigned int vc = 0; // make list of viewable windows - XWindowAttributes attr; for (w = wins; w - wins < nwins; w++) { - XGetWindowAttributes(dpy, *w, &attr); - if (attr.map_state == IsViewable) - viewables[vc++] = w; + XWindowAttributes attr; + + if (! XGetWMHints(dpy, *w)) + continue; + if (! XGetWindowAttributes(dpy, *w, &attr)) + continue; + if (attr.override_redirect) + continue; + if (attr.map_state != IsViewable) + continue; + viewables[vc++] = w; } viewables[vc] = NULL; -- cgit v1.2.3