#include "common.h"
-ev_io *i3_connection;
+ev_io *i3_connection;
const char *sock_path;
-typedef void(*handler_t)(char*);
+typedef void (*handler_t)(char *);
/*
* Called, when we get a reply to a command from i3.
char *found_id = strstr(event, expected_id);
FREE(expected_id);
if (found_id == NULL)
- return;
+ return;
+
+ free_colors(&(config.colors));
/* update the configuration with the received settings */
DLOG("Received bar config update \"%s\"\n", event);
- int old_mode = config.hide_on_modifier;
+ bar_display_mode_t old_mode = config.hide_on_modifier;
parse_config_json(event);
if (old_mode != config.hide_on_modifier) {
reconfig_windows(true);
}
+ init_colors(&(config.colors));
+ realloc_sl_buffer();
+
draw_bars(false);
}
int fd = watcher->fd;
/* First we only read the header, because we know its length */
- uint32_t header_len = strlen(I3_IPC_MAGIC) + sizeof(uint32_t)*2;
+ uint32_t header_len = strlen(I3_IPC_MAGIC) + sizeof(uint32_t) * 2;
char *header = smalloc(header_len);
/* We first parse the fixed-length IPC-header, to know, how much data
if (strncmp(header, I3_IPC_MAGIC, strlen(I3_IPC_MAGIC))) {
ELOG("Wrong magic code: %.*s\n Expected: %s\n",
- (int) strlen(I3_IPC_MAGIC),
+ (int)strlen(I3_IPC_MAGIC),
header,
I3_IPC_MAGIC);
exit(EXIT_FAILURE);
char *walk = header + strlen(I3_IPC_MAGIC);
uint32_t size;
- memcpy(&size, (uint32_t*)walk, sizeof(uint32_t));
+ memcpy(&size, (uint32_t *)walk, sizeof(uint32_t));
walk += sizeof(uint32_t);
uint32_t type;
- memcpy(&type, (uint32_t*)walk, sizeof(uint32_t));
+ memcpy(&type, (uint32_t *)walk, sizeof(uint32_t));
/* Now that we know, what to expect, we can start read()ing the rest
* of the message */
}
/* We are a wellbehaved client and send a proper header first */
- uint32_t to_write = strlen (I3_IPC_MAGIC) + sizeof(uint32_t)*2 + len;
+ uint32_t to_write = strlen(I3_IPC_MAGIC) + sizeof(uint32_t) * 2 + len;
/* TODO: I'm not entirely sure if this buffer really has to contain more
* than the pure header (why not just write() the payload from *payload?),
* but we leave it for now */