Skip to content

Commit

Permalink
- Updated kintox11 binary to handle errors better in the get top wind…
Browse files Browse the repository at this point in the history
…ow function
  • Loading branch information
rbreaves committed Feb 11, 2020
1 parent 0ff7a42 commit f4cef73
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Binary file modified kintox11/binary/kintox11
Binary file not shown.
8 changes: 4 additions & 4 deletions kintox11/src/kintox11.c
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit f4cef73

Please sign in to comment.