mirror of
https://github.com/rbreaves/kinto.git
synced 2025-08-05 18:38:26 +02:00
- Updated kintox11 to streamline debug output more
This commit is contained in:
Binary file not shown.
@@ -13,6 +13,7 @@
|
|||||||
// gcc -L/usr/local/lib/ kintox11.c -ljson-c -lXmu -lXt -lX11 -O2 -o kintox11
|
// gcc -L/usr/local/lib/ kintox11.c -ljson-c -lXmu -lXt -lX11 -O2 -o kintox11
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#define _GNU_SOURCE 1
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
@@ -27,6 +28,13 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
char * append(char * string1, char * string2)
|
||||||
|
{
|
||||||
|
char * result = NULL;
|
||||||
|
asprintf(&result, "%s,%s", string1, string2);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
long long timeInMilliseconds(void) {
|
long long timeInMilliseconds(void) {
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
|
||||||
@@ -213,6 +221,11 @@ Window get_top_window(Display* d, Window start, int etype, char const *eventName
|
|||||||
Window *children;
|
Window *children;
|
||||||
unsigned int nchildren;
|
unsigned int nchildren;
|
||||||
Status s;
|
Status s;
|
||||||
|
char * ws;
|
||||||
|
char * wstr;
|
||||||
|
ws = malloc(sizeof(char)*4096);
|
||||||
|
wstr = malloc(sizeof(char)*100);
|
||||||
|
// strcpy(wstr,"test,");
|
||||||
|
|
||||||
if(debug == true){
|
if(debug == true){
|
||||||
printf("\n get top window\n");
|
printf("\n get top window\n");
|
||||||
@@ -225,8 +238,12 @@ Window get_top_window(Display* d, Window start, int etype, char const *eventName
|
|||||||
|
|
||||||
s = XQueryTree(d, w, &root, &parent, &children, &nchildren); // see man
|
s = XQueryTree(d, w, &root, &parent, &children, &nchildren); // see man
|
||||||
|
|
||||||
if(debug == true){
|
sprintf(wstr, "%ld", w);
|
||||||
printf(" -%s: event: %d, window_id: %ld\n",current_app,etype,w);
|
if ((ws != NULL) && (ws[0] == '\0')) {
|
||||||
|
strcpy(ws,wstr);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
ws = append(ws, wstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s)
|
if (s)
|
||||||
@@ -236,12 +253,11 @@ Window get_top_window(Display* d, Window start, int etype, char const *eventName
|
|||||||
printf("*fail to get top window: %ld, e.type: %d, current_app: %s\n",w,etype,current_app);
|
printf("*fail to get top window: %ld, e.type: %d, current_app: %s\n",w,etype,current_app);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf(" get parent (window: %d)\n", (int)w);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("success (window: %d)\n", (int)w);
|
if(debug == true){
|
||||||
// printf("hello\n");
|
printf(" -%s: event: %d, window_id: %s\n",current_app,etype,ws);
|
||||||
|
}
|
||||||
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user