Skip to content

Commit

Permalink
Don't consider windows with WithdrawnState as top level windows.
Browse files Browse the repository at this point in the history
Fixes many bogus windows in auto-type window list when using gnome-shell.
  • Loading branch information
debfx committed Jul 31, 2016
1 parent 18e4dca commit 8ace3ab
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/autotype/x11/AutoTypeX11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,13 +363,21 @@ bool AutoTypePlatformX11::isTopLevelWindow(Window window)
unsigned long nitems;
unsigned long after;
unsigned char* data = Q_NULLPTR;
int retVal = XGetWindowProperty(m_dpy, window, m_atomWmState, 0, 0, False, AnyPropertyType, &type, &format,
int retVal = XGetWindowProperty(m_dpy, window, m_atomWmState, 0, 2, False, m_atomWmState, &type, &format,
&nitems, &after, &data);
if (data) {

bool result = false;

if (retVal == 0 && data) {
if (type == m_atomWmState && format == 32 && nitems > 0) {
qint32 state = static_cast<qint32>(*data);
result = (state != WithdrawnState);
}

XFree(data);
}

return (retVal == 0) && type;
return result;
}

KeySym AutoTypePlatformX11::charToKeySym(const QChar& ch)
Expand Down

0 comments on commit 8ace3ab

Please sign in to comment.