diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-10-31 21:27:38 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-11-01 18:09:51 +1000 |
commit | 9fc736f4e1804b06538191786500f927ba0cda13 (patch) | |
tree | 8399de2ba00a8a0dd57f49dfc30455c330500b54 /sway/commands/unmark.c | |
parent | Merge pull request #3040 from RyanDwyer/border-props-to-container (diff) | |
download | sway-9fc736f4e1804b06538191786500f927ba0cda13.tar.gz sway-9fc736f4e1804b06538191786500f927ba0cda13.tar.zst sway-9fc736f4e1804b06538191786500f927ba0cda13.zip |
Move view marks properties to container struct
Like border properties, this will be needed to implement layout saving
and restoring.
Diffstat (limited to 'sway/commands/unmark.c')
-rw-r--r-- | sway/commands/unmark.c | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/sway/commands/unmark.c b/sway/commands/unmark.c index c671ed4e..98ac6ff2 100644 --- a/sway/commands/unmark.c +++ b/sway/commands/unmark.c | |||
@@ -9,10 +9,8 @@ | |||
9 | #include "stringop.h" | 9 | #include "stringop.h" |
10 | 10 | ||
11 | static void remove_all_marks_iterator(struct sway_container *con, void *data) { | 11 | static void remove_all_marks_iterator(struct sway_container *con, void *data) { |
12 | if (con->view) { | 12 | container_clear_marks(con); |
13 | view_clear_marks(con->view); | 13 | container_update_marks_textures(con); |
14 | view_update_marks_textures(con->view); | ||
15 | } | ||
16 | } | 14 | } |
17 | 15 | ||
18 | // unmark Remove all marks from all views | 16 | // unmark Remove all marks from all views |
@@ -21,15 +19,10 @@ static void remove_all_marks_iterator(struct sway_container *con, void *data) { | |||
21 | // [criteria] unmark foo Remove single mark from matched view | 19 | // [criteria] unmark foo Remove single mark from matched view |
22 | 20 | ||
23 | struct cmd_results *cmd_unmark(int argc, char **argv) { | 21 | struct cmd_results *cmd_unmark(int argc, char **argv) { |
24 | // Determine the view | 22 | // Determine the container |
25 | struct sway_view *view = NULL; | 23 | struct sway_container *con = NULL; |
26 | if (config->handler_context.using_criteria) { | 24 | if (config->handler_context.using_criteria) { |
27 | struct sway_container *container = config->handler_context.container; | 25 | con = config->handler_context.container; |
28 | if (!container || !container->view) { | ||
29 | return cmd_results_new(CMD_INVALID, "unmark", | ||
30 | "Only views can have marks"); | ||
31 | } | ||
32 | view = container->view; | ||
33 | } | 26 | } |
34 | 27 | ||
35 | // Determine the mark | 28 | // Determine the mark |
@@ -38,20 +31,20 @@ struct cmd_results *cmd_unmark(int argc, char **argv) { | |||
38 | mark = join_args(argv, argc); | 31 | mark = join_args(argv, argc); |
39 | } | 32 | } |
40 | 33 | ||
41 | if (view && mark) { | 34 | if (con && mark) { |
42 | // Remove the mark from the given view | 35 | // Remove the mark from the given container |
43 | if (view_has_mark(view, mark)) { | 36 | if (container_has_mark(con, mark)) { |
44 | view_find_and_unmark(mark); | 37 | container_find_and_unmark(mark); |
45 | } | 38 | } |
46 | } else if (view && !mark) { | 39 | } else if (con && !mark) { |
47 | // Clear all marks from the given view | 40 | // Clear all marks from the given container |
48 | view_clear_marks(view); | 41 | container_clear_marks(con); |
49 | view_update_marks_textures(view); | 42 | container_update_marks_textures(con); |
50 | } else if (!view && mark) { | 43 | } else if (!con && mark) { |
51 | // Remove mark from whichever view has it | 44 | // Remove mark from whichever container has it |
52 | view_find_and_unmark(mark); | 45 | container_find_and_unmark(mark); |
53 | } else { | 46 | } else { |
54 | // Remove all marks from all views | 47 | // Remove all marks from all containers |
55 | root_for_each_container(remove_all_marks_iterator, NULL); | 48 | root_for_each_container(remove_all_marks_iterator, NULL); |
56 | } | 49 | } |
57 | free(mark); | 50 | free(mark); |