diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-25 21:07:59 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-25 21:07:59 +1000 |
commit | db38b9bbf3cce4083c538209a7ce5ef1a1cf5f3f (patch) | |
tree | 3ee9f0c2bf76907b2854bf6ba2be8ab124b74fb9 /include | |
parent | Merge pull request #2028 from RyanDwyer/fix-move-workspace (diff) | |
download | sway-db38b9bbf3cce4083c538209a7ce5ef1a1cf5f3f.tar.gz sway-db38b9bbf3cce4083c538209a7ce5ef1a1cf5f3f.tar.zst sway-db38b9bbf3cce4083c538209a7ce5ef1a1cf5f3f.zip |
Clean up container title functions
* Add and use lenient_strcat and lenient_strncat functions
* Rename `concatenate_child_titles` function as that's no longer what it
does
* Rename `container_notify_child_title_changed` because we only need to
notify that the tree structure has changed, not titles
* Don't notify parents when a child changes its title
* Update ancestor titles when changing a container's layout
* Eg. create nested tabs and change the inner container to stacking
* No need to store tree presentation in both container->name and
formatted_title
Diffstat (limited to 'include')
-rw-r--r-- | include/stringop.h | 5 | ||||
-rw-r--r-- | include/sway/tree/container.h | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/include/stringop.h b/include/stringop.h index 7c29a745..e7f58011 100644 --- a/include/stringop.h +++ b/include/stringop.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _SWAY_STRINGOP_H | 1 | #ifndef _SWAY_STRINGOP_H |
2 | #define _SWAY_STRINGOP_H | 2 | #define _SWAY_STRINGOP_H |
3 | #include <stdlib.h> | ||
3 | #include "list.h" | 4 | #include "list.h" |
4 | 5 | ||
5 | #if !HAVE_DECL_SETENV | 6 | #if !HAVE_DECL_SETENV |
@@ -14,6 +15,10 @@ char *strip_whitespace(char *str); | |||
14 | char *strip_comments(char *str); | 15 | char *strip_comments(char *str); |
15 | void strip_quotes(char *str); | 16 | void strip_quotes(char *str); |
16 | 17 | ||
18 | // strcat that does nothing if dest or src is NULL | ||
19 | char *lenient_strcat(char *dest, const char *src); | ||
20 | char *lenient_strncat(char *dest, const char *src, size_t len); | ||
21 | |||
17 | // strcmp that also handles null pointers. | 22 | // strcmp that also handles null pointers. |
18 | int lenient_strcmp(char *a, char *b); | 23 | int lenient_strcmp(char *a, char *b); |
19 | 24 | ||
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 493c70e2..a5f591ce 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -216,7 +216,11 @@ void container_update_title_textures(struct sway_container *container); | |||
216 | */ | 216 | */ |
217 | void container_calculate_title_height(struct sway_container *container); | 217 | void container_calculate_title_height(struct sway_container *container); |
218 | 218 | ||
219 | void container_notify_child_title_changed(struct sway_container *container); | 219 | /** |
220 | * Notify a container that a tree modification has changed in its children, | ||
221 | * so the container can update its tree representation. | ||
222 | */ | ||
223 | void container_notify_subtree_changed(struct sway_container *container); | ||
220 | 224 | ||
221 | /** | 225 | /** |
222 | * Return the height of a regular title bar. | 226 | * Return the height of a regular title bar. |