]> git.sur5r.net Git - i3/i3/blobdiff - i3bar/src/ipc.c
Merge branch 'master' into next
[i3/i3] / i3bar / src / ipc.c
index 9ec9100bfd63ac6765b144fd79d944011953d510..3eb50beb34bb817c231947f70b64f091d1e4b3d6 100644 (file)
 
 #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.
@@ -157,16 +157,21 @@ void got_bar_config_update(char *event) {
     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);
 }
 
@@ -188,7 +193,7 @@ void got_data(struct ev_loop *loop, ev_io *watcher, int events) {
     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
@@ -212,7 +217,7 @@ void got_data(struct ev_loop *loop, ev_io *watcher, int events) {
 
     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);
@@ -220,10 +225,10 @@ void got_data(struct ev_loop *loop, ev_io *watcher, int events) {
 
     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 */
@@ -269,7 +274,7 @@ int i3_send_msg(uint32_t type, const char *payload) {
     }
 
     /* 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 */