From 6d7b1321db54155cf78305dbafdcfc7de9b78415 Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Tue, 21 Nov 2023 19:51:57 -0500 Subject: scene_graph: Port container server side decorations --- sway/commands/client.c | 7 +++---- sway/commands/mark.c | 2 +- sway/commands/reload.c | 7 +++---- sway/commands/show_marks.c | 6 +++--- sway/commands/title_align.c | 6 ++++++ sway/commands/unmark.c | 11 +++++++---- 6 files changed, 23 insertions(+), 16 deletions(-) (limited to 'sway/commands') diff --git a/sway/commands/client.c b/sway/commands/client.c index 77263145..7a9cff2c 100644 --- a/sway/commands/client.c +++ b/sway/commands/client.c @@ -5,9 +5,8 @@ #include "sway/tree/container.h" #include "util.h" -static void rebuild_textures_iterator(struct sway_container *con, void *data) { - container_update_marks_textures(con); - container_update_title_textures(con); +static void container_update_iterator(struct sway_container *con, void *data) { + container_update(con); } static struct cmd_results *handle_command(int argc, char **argv, char *cmd_name, @@ -51,7 +50,7 @@ static struct cmd_results *handle_command(int argc, char **argv, char *cmd_name, memcpy(class, &colors, sizeof(struct border_colors)); if (config->active) { - root_for_each_container(rebuild_textures_iterator, NULL); + root_for_each_container(container_update_iterator, NULL); for (int i = 0; i < root->outputs->length; ++i) { struct sway_output *output = root->outputs->items[i]; diff --git a/sway/commands/mark.c b/sway/commands/mark.c index aa5f185c..30cf458c 100644 --- a/sway/commands/mark.c +++ b/sway/commands/mark.c @@ -59,7 +59,7 @@ struct cmd_results *cmd_mark(int argc, char **argv) { } free(mark); - container_update_marks_textures(container); + container_update_marks(container); if (container->view) { view_execute_criteria(container->view); } diff --git a/sway/commands/reload.c b/sway/commands/reload.c index 76f14bba..82967ca7 100644 --- a/sway/commands/reload.c +++ b/sway/commands/reload.c @@ -9,9 +9,8 @@ #include "list.h" #include "log.h" -static void rebuild_textures_iterator(struct sway_container *con, void *data) { - container_update_marks_textures(con); - container_update_title_textures(con); +static void title_bar_update_iterator(struct sway_container *con, void *data) { + container_update_title_bar(con); } static void do_reload(void *data) { @@ -48,7 +47,7 @@ static void do_reload(void *data) { } list_free_items_and_destroy(bar_ids); - root_for_each_container(rebuild_textures_iterator, NULL); + root_for_each_container(title_bar_update_iterator, NULL); arrange_root(); } diff --git a/sway/commands/show_marks.c b/sway/commands/show_marks.c index 0d373b80..f738144f 100644 --- a/sway/commands/show_marks.c +++ b/sway/commands/show_marks.c @@ -10,8 +10,8 @@ #include "stringop.h" #include "util.h" -static void rebuild_marks_iterator(struct sway_container *con, void *data) { - container_update_marks_textures(con); +static void title_bar_update_iterator(struct sway_container *con, void *data) { + container_update_marks(con); } struct cmd_results *cmd_show_marks(int argc, char **argv) { @@ -23,7 +23,7 @@ struct cmd_results *cmd_show_marks(int argc, char **argv) { config->show_marks = parse_boolean(argv[0], config->show_marks); if (config->show_marks) { - root_for_each_container(rebuild_marks_iterator, NULL); + root_for_each_container(title_bar_update_iterator, NULL); } for (int i = 0; i < root->outputs->length; ++i) { diff --git a/sway/commands/title_align.c b/sway/commands/title_align.c index c30355de..7f5dd3ae 100644 --- a/sway/commands/title_align.c +++ b/sway/commands/title_align.c @@ -4,6 +4,10 @@ #include "sway/tree/container.h" #include "sway/tree/root.h" +static void arrange_title_bar_iterator(struct sway_container *con, void *data) { + container_arrange_title_bar(con); +} + struct cmd_results *cmd_title_align(int argc, char **argv) { struct cmd_results *error = NULL; if ((error = checkarg(argc, "title_align", EXPECTED_AT_LEAST, 1))) { @@ -21,6 +25,8 @@ struct cmd_results *cmd_title_align(int argc, char **argv) { "Expected 'title_align left|center|right'"); } + root_for_each_container(arrange_title_bar_iterator, NULL); + for (int i = 0; i < root->outputs->length; ++i) { struct sway_output *output = root->outputs->items[i]; output_damage_whole(output); diff --git a/sway/commands/unmark.c b/sway/commands/unmark.c index 19274dfb..c3a6ac4b 100644 --- a/sway/commands/unmark.c +++ b/sway/commands/unmark.c @@ -8,9 +8,13 @@ #include "log.h" #include "stringop.h" -static void remove_all_marks_iterator(struct sway_container *con, void *data) { +static void remove_mark(struct sway_container *con) { container_clear_marks(con); - container_update_marks_textures(con); + container_update_marks(con); +} + +static void remove_all_marks_iterator(struct sway_container *con, void *data) { + remove_mark(con); } // unmark Remove all marks from all views @@ -38,8 +42,7 @@ struct cmd_results *cmd_unmark(int argc, char **argv) { } } else if (con && !mark) { // Clear all marks from the given container - container_clear_marks(con); - container_update_marks_textures(con); + remove_mark(con); } else if (!con && mark) { // Remove mark from whichever container has it container_find_and_unmark(mark); -- cgit v1.2.3