Skip to content

Commit

Permalink
chromium creates 1px wide top-level windows, skip past them
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick committed Sep 19, 2013
1 parent dbd9712 commit ac02af4
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions x-alt-tab.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ac02af4

Please sign in to comment.