]> git.sur5r.net Git - i3/i3/blobdiff - src/config_directives.c
Merge branch 'next' into master
[i3/i3] / src / config_directives.c
index 419d663a9fb2ec53b00ef9ecc6b341509ccc94fa..ec99321a9849b8b708010c4848769c203e80cffe 100644 (file)
@@ -67,9 +67,8 @@ i3_event_state_mask_t event_state_from_str(const char *str) {
     /* It might be better to use strtok() here, but the simpler strstr() should
      * do for now. */
     i3_event_state_mask_t result = 0;
-    int group_bits_set = 0;
     if (str == NULL)
-        return (I3_XKB_GROUP_MASK_1 << 16);
+        return result;
     if (strstr(str, "Mod1") != NULL)
         result |= XCB_KEY_BUT_MASK_MOD_1;
     if (strstr(str, "Mod2") != NULL)
@@ -86,26 +85,15 @@ i3_event_state_mask_t event_state_from_str(const char *str) {
     if (strstr(str, "Shift") != NULL)
         result |= XCB_KEY_BUT_MASK_SHIFT;
 
-    if (strstr(str, "Group1") != NULL) {
+    if (strstr(str, "Group1") != NULL)
         result |= (I3_XKB_GROUP_MASK_1 << 16);
-        group_bits_set++;
-    }
     if (strstr(str, "Group2") != NULL ||
-        strstr(str, "Mode_switch") != NULL) {
+        strstr(str, "Mode_switch") != NULL)
         result |= (I3_XKB_GROUP_MASK_2 << 16);
-        group_bits_set++;
-    }
-    if (strstr(str, "Group3") != NULL) {
+    if (strstr(str, "Group3") != NULL)
         result |= (I3_XKB_GROUP_MASK_3 << 16);
-        group_bits_set++;
-    }
-    if (strstr(str, "Group4") != NULL) {
+    if (strstr(str, "Group4") != NULL)
         result |= (I3_XKB_GROUP_MASK_4 << 16);
-        group_bits_set++;
-    }
-    if (group_bits_set == 0) {
-        result |= (I3_XKB_GROUP_MASK_1 << 16);
-    }
     return result;
 }
 
@@ -273,6 +261,7 @@ CFGFUN(workspace_back_and_forth, const char *value) {
 }
 
 CFGFUN(fake_outputs, const char *outputs) {
+    free(config.fake_outputs);
     config.fake_outputs = sstrdup(outputs);
 }
 
@@ -325,10 +314,12 @@ CFGFUN(workspace, const char *workspace, const char *output) {
 }
 
 CFGFUN(ipc_socket, const char *path) {
+    free(config.ipc_socket_path);
     config.ipc_socket_path = sstrdup(path);
 }
 
 CFGFUN(restart_state, const char *path) {
+    free(config.restart_state_path);
     config.restart_state_path = sstrdup(path);
 }
 
@@ -344,20 +335,25 @@ CFGFUN(popup_during_fullscreen, const char *value) {
 
 CFGFUN(color_single, const char *colorclass, const char *color) {
     /* used for client.background only currently */
-    config.client.background = get_colorpixel(color);
-}
-
-CFGFUN(color, const char *colorclass, const char *border, const char *background, const char *text, const char *indicator) {
-#define APPLY_COLORS(classname)                                                \
-    do {                                                                       \
-        if (strcmp(colorclass, "client." #classname) == 0) {                   \
-            config.client.classname.border = get_colorpixel(border);           \
-            config.client.classname.background = get_colorpixel(background);   \
-            config.client.classname.text = get_colorpixel(text);               \
-            if (indicator != NULL) {                                           \
-                config.client.classname.indicator = get_colorpixel(indicator); \
-            }                                                                  \
-        }                                                                      \
+    config.client.background = draw_util_hex_to_color(color);
+}
+
+CFGFUN(color, const char *colorclass, const char *border, const char *background, const char *text, const char *indicator, const char *child_border) {
+#define APPLY_COLORS(classname)                                                              \
+    do {                                                                                     \
+        if (strcmp(colorclass, "client." #classname) == 0) {                                 \
+            config.client.classname.border = draw_util_hex_to_color(border);                 \
+            config.client.classname.background = draw_util_hex_to_color(background);         \
+            config.client.classname.text = draw_util_hex_to_color(text);                     \
+            if (indicator != NULL) {                                                         \
+                config.client.classname.indicator = draw_util_hex_to_color(indicator);       \
+            }                                                                                \
+            if (child_border != NULL) {                                                      \
+                config.client.classname.child_border = draw_util_hex_to_color(child_border); \
+            } else {                                                                         \
+                config.client.classname.child_border = config.client.classname.background;   \
+            }                                                                                \
+        }                                                                                    \
     } while (0)
 
     APPLY_COLORS(focused_inactive);
@@ -450,6 +446,9 @@ CFGFUN(bar_modifier, const char *modifier) {
         current_bar->modifier = M_CONTROL;
     else if (strcmp(modifier, "Shift") == 0)
         current_bar->modifier = M_SHIFT;
+    else if (strcmp(modifier, "none") == 0 ||
+             strcmp(modifier, "off") == 0)
+        current_bar->modifier = M_NONE;
 }
 
 static void bar_configure_binding(const char *button, const char *command) {
@@ -579,6 +578,7 @@ CFGFUN(bar_start) {
     TAILQ_INIT(&(current_bar->bar_bindings));
     TAILQ_INIT(&(current_bar->tray_outputs));
     current_bar->tray_padding = 2;
+    current_bar->modifier = M_MOD4;
 }
 
 CFGFUN(bar_finish) {