diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-05-25 08:41:01 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-25 08:41:01 -0400 |
commit | a268a0c2ae9dcad918eae44bd325dc21977ac3fc (patch) | |
tree | 40eca41d98740ba8aa0065c50712c33b32a44595 /sway/tree/view.c | |
parent | 95cc84bd950f7c057a15f65d477462b5cc9527d2 (diff) | |
parent | db38b9bbf3cce4083c538209a7ce5ef1a1cf5f3f (diff) |
Merge pull request #2034 from RyanDwyer/cleanup-container-titles
Clean up container title functions
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r-- | sway/tree/view.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index 07157818..2f718a73 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -17,6 +17,7 @@ #include "sway/tree/workspace.h" #include "sway/config.h" #include "pango.h" +#include "stringop.h" void view_init(struct sway_view *view, enum sway_view_type type, const struct sway_view_impl *impl) { @@ -470,7 +471,7 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) { input_manager_set_focus(input_manager, cont); view_update_title(view, false); - container_notify_child_title_changed(view->swayc->parent); + container_notify_subtree_changed(view->swayc->parent); view_execute_criteria(view); container_damage_whole(cont); @@ -661,49 +662,35 @@ static size_t parse_title_format(struct sway_view *view, char *buffer) { char *format = view->title_format; char *next = strchr(format, '%'); while (next) { - if (buffer) { - // Copy everything up to the % - strncat(buffer, format, next - format); - } + // Copy everything up to the % + lenient_strncat(buffer, format, next - format); len += next - format; format = next; if (strncmp(next, "%title", 6) == 0) { - if (buffer && title) { - strcat(buffer, title); - } + lenient_strcat(buffer, title); len += title_len; format += 6; } else if (strncmp(next, "%class", 6) == 0) { - if (buffer && class) { - strcat(buffer, class); - } + lenient_strcat(buffer, class); len += class_len; format += 6; } else if (strncmp(next, "%instance", 9) == 0) { - if (buffer && instance) { - strcat(buffer, instance); - } + lenient_strcat(buffer, instance); len += instance_len; format += 9; } else if (strncmp(next, "%shell", 6) == 0) { - if (buffer) { - strcat(buffer, shell); - } + lenient_strcat(buffer, shell); len += shell_len; format += 6; } else { - if (buffer) { - strcat(buffer, "%"); - } + lenient_strcat(buffer, "%"); ++format; ++len; } next = strchr(format, '%'); } - if (buffer) { - strcat(buffer, format); - } + lenient_strcat(buffer, format); len += strlen(format); return len; @@ -759,7 +746,6 @@ void view_update_title(struct sway_view *view, bool force) { } container_calculate_title_height(view->swayc); container_update_title_textures(view->swayc); - container_notify_child_title_changed(view->swayc->parent); config_update_font_height(false); } |