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