module/i3: add more debug logging

This commit is contained in:
Daniel Eklöf 2019-01-07 18:31:47 +01:00
parent 552739fa20
commit 072a508291

View file

@ -18,6 +18,7 @@
#include <json-c/linkhash.h> #include <json-c/linkhash.h>
#define LOG_MODULE "i3" #define LOG_MODULE "i3"
#define LOG_ENABLE_DBG 0
#include "../log.h" #include "../log.h"
#include "../bar.h" #include "../bar.h"
@ -313,6 +314,7 @@ handle_workspace_event(struct private *m, const struct json_object *json)
struct workspace *w = workspace_lookup( struct workspace *w = workspace_lookup(
m, json_object_get_string(current_name)); m, json_object_get_string(current_name));
LOG_DBG("w: %s", w->name);
assert(w != NULL); assert(w != NULL);
/* Mark all workspaces on current's output invisible */ /* Mark all workspaces on current's output invisible */
@ -436,14 +438,17 @@ run(struct module_run_context *ctx)
size_t total_size = sizeof(i3_ipc_header_t) + hdr->size; size_t total_size = sizeof(i3_ipc_header_t) + hdr->size;
if (total_size > buf_idx) if (total_size > buf_idx) {
LOG_DBG("got %zd bytes, need %zu", bytes, total_size);
break; break;
}
/* Json-c expects a NULL-terminated string */ /* Json-c expects a NULL-terminated string */
char json_str[hdr->size + 1]; char json_str[hdr->size + 1];
memcpy(json_str, &buf[sizeof(*hdr)], hdr->size); memcpy(json_str, &buf[sizeof(*hdr)], hdr->size);
json_str[hdr->size] = '\0'; json_str[hdr->size] = '\0';
//printf("raw: %s\n", json_str); //printf("raw: %s\n", json_str);
LOG_DBG("raw: %s\n", json_str);
json_tokener *tokener = json_tokener_new(); json_tokener *tokener = json_tokener_new();
struct json_object *json = json_tokener_parse(json_str); struct json_object *json = json_tokener_parse(json_str);