- Updated kintox11 binary to handle errors better in the get top window function

This commit is contained in:
Ben Reaves
2020-02-06 16:33:23 -06:00
parent 0ff7a42f9b
commit 26f70ccd31
2 changed files with 4 additions and 4 deletions

Binary file not shown.

View File

@@ -18,6 +18,7 @@
#include <locale.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include <X11/Xlib.h> // `apt-get install libx11-dev`
#include <X11/Xmu/WinUtil.h> // `apt-get install libxmu-dev`
#include <json-c/json.h> // `apt install libjson-c-dev`
@@ -100,16 +101,15 @@ Window get_top_window(Display* d, Window start){
unsigned int nchildren;
Status s;
// printf("getting top window ... \n");
while (parent != root) {
while (parent != root && parent != 0) {
w = parent;
s = XQueryTree(d, w, &root, &parent, &children, &nchildren); // see man
if (s)
XFree(children);
if(xerror || w == 0){
printf("fail\n");
if(xerror){
printf("fail to get top window: %d\n",w);
exit(1);
}