scene_graph: Port container server side decorations

This commit is contained in:
Alexander Orzechowski 2023-11-21 19:51:57 -05:00 committed by Kirill Primak
parent 188811f808
commit 6d7b1321db
9 changed files with 378 additions and 253 deletions

View file

@ -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];

View file

@ -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);
}

View file

@ -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();
}

View file

@ -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) {

View file

@ -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);

View file

@ -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);