diff --git a/include/config/rcxml.h b/include/config/rcxml.h index 94eb6ebe..edfb9e55 100644 --- a/include/config/rcxml.h +++ b/include/config/rcxml.h @@ -177,16 +177,18 @@ struct rcxml { /* Window Switcher */ struct { - bool show; bool preview; bool outlines; bool unshade; - enum lab_view_criteria criteria; - struct wl_list fields; /* struct window_switcher_field.link */ - enum cycle_osd_style style; - enum cycle_osd_output_criteria output_criteria; - char *thumbnail_label_format; enum window_switcher_order order; + enum lab_view_criteria criteria; + struct { + bool show; + enum cycle_osd_style style; + enum cycle_osd_output_criteria output_criteria; + char *thumbnail_label_format; + struct wl_list fields; /* struct cycle_osd_field.link */ + } osd; } window_switcher; struct wl_list window_rules; /* struct window_rule.link */ diff --git a/include/cycle.h b/include/cycle.h index aaecff50..ba58b88d 100644 --- a/include/cycle.h +++ b/include/cycle.h @@ -39,7 +39,7 @@ struct cycle_osd_field { enum cycle_osd_field_content content; int width; char *format; - struct wl_list link; /* struct rcxml.window_switcher.fields */ + struct wl_list link; /* struct rcxml.window_switcher.osd.fields */ }; struct buf; diff --git a/src/config/rcxml.c b/src/config/rcxml.c index cc744228..bb868fb2 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -324,7 +324,7 @@ static void clear_window_switcher_fields(void) { struct cycle_osd_field *field, *field_tmp; - wl_list_for_each_safe(field, field_tmp, &rc.window_switcher.fields, link) { + wl_list_for_each_safe(field, field_tmp, &rc.window_switcher.osd.fields, link) { wl_list_remove(&field->link); cycle_osd_field_free(field); } @@ -334,7 +334,7 @@ static void fill_window_switcher_field(xmlNode *node) { struct cycle_osd_field *field = znew(*field); - wl_list_append(&rc.window_switcher.fields, &field->link); + wl_list_append(&rc.window_switcher.osd.fields, &field->link); xmlNode *child; char *key, *content; @@ -1071,7 +1071,7 @@ entry(xmlNode *node, char *nodename, char *content) } else if (!strcasecmp(nodename, "prefix.desktops")) { xstrdup_replace(rc.workspace_config.prefix, content); } else if (!strcasecmp(nodename, "thumbnailLabelFormat.osd.windowSwitcher")) { - xstrdup_replace(rc.window_switcher.thumbnail_label_format, content); + xstrdup_replace(rc.window_switcher.osd.thumbnail_label_format, content); } else if (!lab_xml_node_is_leaf(node)) { /* parse children of nested nodes other than above */ @@ -1219,23 +1219,23 @@ entry(xmlNode *node, char *nodename, char *content) * thumnailLabelFormat is handled above to allow for an empty value */ } else if (!strcasecmp(nodename, "show.osd.windowSwitcher")) { - set_bool(content, &rc.window_switcher.show); + set_bool(content, &rc.window_switcher.osd.show); } else if (!strcasecmp(nodename, "style.osd.windowSwitcher")) { if (!strcasecmp(content, "classic")) { - rc.window_switcher.style = CYCLE_OSD_STYLE_CLASSIC; + rc.window_switcher.osd.style = CYCLE_OSD_STYLE_CLASSIC; } else if (!strcasecmp(content, "thumbnail")) { - rc.window_switcher.style = CYCLE_OSD_STYLE_THUMBNAIL; + rc.window_switcher.osd.style = CYCLE_OSD_STYLE_THUMBNAIL; } else { wlr_log(WLR_ERROR, "Invalid windowSwitcher style '%s': " "should be one of classic|thumbnail", content); } } else if (!strcasecmp(nodename, "output.osd.windowSwitcher")) { if (!strcasecmp(content, "all")) { - rc.window_switcher.output_criteria = CYCLE_OSD_OUTPUT_ALL; + rc.window_switcher.osd.output_criteria = CYCLE_OSD_OUTPUT_ALL; } else if (!strcasecmp(content, "cursor")) { - rc.window_switcher.output_criteria = CYCLE_OSD_OUTPUT_CURSOR; + rc.window_switcher.osd.output_criteria = CYCLE_OSD_OUTPUT_CURSOR; } else if (!strcasecmp(content, "focused")) { - rc.window_switcher.output_criteria = CYCLE_OSD_OUTPUT_FOCUSED; + rc.window_switcher.osd.output_criteria = CYCLE_OSD_OUTPUT_FOCUSED; } else { wlr_log(WLR_ERROR, "Invalid windowSwitcher output '%s': " "should be one of all|focused|cursor", content); @@ -1252,14 +1252,14 @@ entry(xmlNode *node, char *nodename, char *content) /* The following two are for backward compatibility only. */ } else if (!strcasecmp(nodename, "show.windowSwitcher")) { - set_bool(content, &rc.window_switcher.show); + set_bool(content, &rc.window_switcher.osd.show); wlr_log(WLR_ERROR, " is deprecated." " Use "); } else if (!strcasecmp(nodename, "style.windowSwitcher")) { if (!strcasecmp(content, "classic")) { - rc.window_switcher.style = CYCLE_OSD_STYLE_CLASSIC; + rc.window_switcher.osd.style = CYCLE_OSD_STYLE_CLASSIC; } else if (!strcasecmp(content, "thumbnail")) { - rc.window_switcher.style = CYCLE_OSD_STYLE_THUMBNAIL; + rc.window_switcher.osd.style = CYCLE_OSD_STYLE_THUMBNAIL; } wlr_log(WLR_ERROR, " is deprecated." " Use "); @@ -1282,7 +1282,7 @@ entry(xmlNode *node, char *nodename, char *content) /* The following three are for backward compatibility only */ } else if (!strcasecmp(nodename, "show.windowSwitcher.core")) { - set_bool(content, &rc.window_switcher.show); + set_bool(content, &rc.window_switcher.osd.show); } else if (!strcasecmp(nodename, "preview.windowSwitcher.core")) { set_bool(content, &rc.window_switcher.preview); } else if (!strcasecmp(nodename, "outlines.windowSwitcher.core")) { @@ -1290,7 +1290,7 @@ entry(xmlNode *node, char *nodename, char *content) /* The following three are for backward compatibility only */ } else if (!strcasecmp(nodename, "cycleViewOSD.core")) { - set_bool(content, &rc.window_switcher.show); + set_bool(content, &rc.window_switcher.osd.show); wlr_log(WLR_ERROR, " is deprecated." " Use "); } else if (!strcasecmp(nodename, "cycleViewPreview.core")) { @@ -1419,7 +1419,7 @@ rcxml_init(void) wl_list_init(&rc.libinput_categories); wl_list_init(&rc.workspace_config.workspaces); wl_list_init(&rc.regions); - wl_list_init(&rc.window_switcher.fields); + wl_list_init(&rc.window_switcher.osd.fields); wl_list_init(&rc.window_rules); wl_list_init(&rc.touch_configs); } @@ -1484,10 +1484,10 @@ rcxml_init(void) rc.snap_top_maximize = true; rc.snap_tiling_events_mode = LAB_TILING_EVENTS_ALWAYS; - rc.window_switcher.show = true; - rc.window_switcher.style = CYCLE_OSD_STYLE_CLASSIC; - rc.window_switcher.output_criteria = CYCLE_OSD_OUTPUT_ALL; - rc.window_switcher.thumbnail_label_format = xstrdup("%T"); + rc.window_switcher.osd.show = true; + rc.window_switcher.osd.style = CYCLE_OSD_STYLE_CLASSIC; + rc.window_switcher.osd.output_criteria = CYCLE_OSD_OUTPUT_ALL; + rc.window_switcher.osd.thumbnail_label_format = xstrdup("%T"); rc.window_switcher.preview = true; rc.window_switcher.outlines = true; rc.window_switcher.unshade = true; @@ -1673,7 +1673,7 @@ load_default_window_switcher_fields(void) struct cycle_osd_field *field = znew(*field); field->content = fields[i].content; field->width = fields[i].width; - wl_list_append(&rc.window_switcher.fields, &field->link); + wl_list_append(&rc.window_switcher.osd.fields, &field->link); } } @@ -1794,7 +1794,7 @@ post_processing(void) if (rc.workspace_config.popuptime == INT_MIN) { rc.workspace_config.popuptime = 1000; } - if (!wl_list_length(&rc.window_switcher.fields)) { + if (!wl_list_length(&rc.window_switcher.osd.fields)) { wlr_log(WLR_INFO, "load default window switcher fields"); load_default_window_switcher_fields(); } @@ -1888,7 +1888,7 @@ validate(void) /* OSD fields */ int field_width_sum = 0; struct cycle_osd_field *field, *field_tmp; - wl_list_for_each_safe(field, field_tmp, &rc.window_switcher.fields, link) { + wl_list_for_each_safe(field, field_tmp, &rc.window_switcher.osd.fields, link) { field_width_sum += field->width; if (!cycle_osd_field_is_valid(field) || field_width_sum > 100) { wlr_log(WLR_ERROR, "Deleting invalid window switcher field %p", field); @@ -1964,7 +1964,7 @@ rcxml_finish(void) zfree(rc.fallback_app_icon_name); zfree(rc.workspace_config.prefix); zfree(rc.tablet.output_name); - zfree(rc.window_switcher.thumbnail_label_format); + zfree(rc.window_switcher.osd.thumbnail_label_format); clear_title_layout(); diff --git a/src/cycle/cycle.c b/src/cycle/cycle.c index adf9b05e..a775f78c 100644 --- a/src/cycle/cycle.c +++ b/src/cycle/cycle.c @@ -257,7 +257,7 @@ preview_selected_view(struct view *view) static struct cycle_osd_impl * get_osd_impl(void) { - switch (rc.window_switcher.style) { + switch (rc.window_switcher.osd.style) { case CYCLE_OSD_STYLE_CLASSIC: return &cycle_osd_classic_impl; case CYCLE_OSD_STYLE_THUMBNAIL: @@ -307,9 +307,9 @@ init_cycle(struct server *server) return false; } - if (rc.window_switcher.show) { + if (rc.window_switcher.osd.show) { /* Create OSD */ - switch (rc.window_switcher.output_criteria) { + switch (rc.window_switcher.osd.output_criteria) { case CYCLE_OSD_OUTPUT_ALL: { struct output *output; wl_list_for_each(output, &server->outputs, link) { @@ -342,7 +342,7 @@ update_cycle(struct server *server) { struct cycle_state *cycle = &server->cycle; - if (rc.window_switcher.show) { + if (rc.window_switcher.osd.show) { struct output *output; wl_list_for_each(output, &server->outputs, link) { if (output->cycle_osd.tree) { diff --git a/src/cycle/osd-classic.c b/src/cycle/osd-classic.c index 944b9063..8e01dc24 100644 --- a/src/cycle/osd-classic.c +++ b/src/cycle/osd-classic.c @@ -36,7 +36,7 @@ create_fields_scene(struct server *server, struct view *view, &theme->osd_window_switcher_classic; struct cycle_osd_field *field; - wl_list_for_each(field, &rc.window_switcher.fields, link) { + wl_list_for_each(field, &rc.window_switcher.osd.fields, link) { int field_width = field_widths_sum * field->width / 100.0; struct wlr_scene_node *node = NULL; int height = -1; @@ -144,7 +144,7 @@ cycle_osd_classic_create(struct output *output) y += switcher_theme->item_height; } - int nr_fields = wl_list_length(&rc.window_switcher.fields); + int nr_fields = wl_list_length(&rc.window_switcher.osd.fields); /* This is the width of the area available for text fields */ int field_widths_sum = w - 2 * padding diff --git a/src/cycle/osd-thumbnail.c b/src/cycle/osd-thumbnail.c index 2245d1ad..d17b1aa0 100644 --- a/src/cycle/osd-thumbnail.c +++ b/src/cycle/osd-thumbnail.c @@ -103,7 +103,7 @@ create_label(struct wlr_scene_tree *parent, struct view *view, { struct buf buf = BUF_INIT; cycle_osd_field_set_custom(&buf, view, - rc.window_switcher.thumbnail_label_format); + rc.window_switcher.osd.thumbnail_label_format); struct scaled_font_buffer *buffer = scaled_font_buffer_create(parent); scaled_font_buffer_update(buffer, buf.data,