/* 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)
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;
}
}
CFGFUN(fake_outputs, const char *outputs) {
+ free(config.fake_outputs);
config.fake_outputs = sstrdup(outputs);
}
}
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);
}
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);