Fix auto-type focused window protection when application has sub-windows

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@342 b624d157-de02-0410-bad0-e51aec6abb33
master
sniperbeamer 15 years ago
parent a515fd0038
commit 35e00ce897
  1. 15
      src/lib/AutoTypeX11.cpp

@ -62,6 +62,21 @@ Window AutoTypeX11::getFocusWindow() {
Window w;
int revert_to_return;
XGetInputFocus(dpy, &w, &revert_to_return);
int tree;
do {
XTextProperty textProp;
if (XGetWMName(dpy, w, &textProp) != 0) {
break;
}
Window root = 0;
Window parent = 0;
Window* children = NULL;
unsigned int num_children;
tree = XQueryTree(dpy, w, &root, &parent, &children, &num_children);
w = parent;
if (children) XFree(children);
} while (tree && w);
return w;
}