diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-03-29 17:06:29 -0400 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-03-29 17:06:29 -0400 |
commit | eca029f218fbb54ddf7316845be5d296e834358e (patch) | |
tree | 76bf346c980ad94c68797cefbd2ec4a9302dd53f | |
parent | rename container functions (diff) | |
download | sway-eca029f218fbb54ddf7316845be5d296e834358e.tar.gz sway-eca029f218fbb54ddf7316845be5d296e834358e.tar.zst sway-eca029f218fbb54ddf7316845be5d296e834358e.zip |
more renaming things
-rw-r--r-- | include/sway/tree/container.h | 21 | ||||
-rw-r--r-- | include/sway/tree/layout.h | 16 | ||||
-rw-r--r-- | sway/commands/layout.c | 16 | ||||
-rw-r--r-- | sway/commands/reload.c | 2 | ||||
-rw-r--r-- | sway/commands/workspace.c | 6 | ||||
-rw-r--r-- | sway/config/output.c | 2 | ||||
-rw-r--r-- | sway/desktop/layer_shell.c | 2 | ||||
-rw-r--r-- | sway/desktop/output.c | 12 | ||||
-rw-r--r-- | sway/desktop/wl_shell.c | 8 | ||||
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 8 | ||||
-rw-r--r-- | sway/desktop/xwayland.c | 22 | ||||
-rw-r--r-- | sway/input/seat.c | 2 | ||||
-rw-r--r-- | sway/tree/container.c | 58 | ||||
-rw-r--r-- | sway/tree/layout.c | 34 | ||||
-rw-r--r-- | sway/tree/workspace.c | 22 | ||||
-rw-r--r-- | swaybar/ipc.c | 2 |
16 files changed, 115 insertions, 118 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 0dfed455..572dd8e3 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -88,41 +88,38 @@ struct sway_container { | |||
88 | }; | 88 | }; |
89 | 89 | ||
90 | // TODO only one container create function and pass the type? | 90 | // TODO only one container create function and pass the type? |
91 | struct sway_container *sway_container_output_create( | 91 | struct sway_container *container_output_create( |
92 | struct sway_output *sway_output); | 92 | struct sway_output *sway_output); |
93 | 93 | ||
94 | struct sway_container *sway_container_workspace_create( | 94 | struct sway_container *container_workspace_create( |
95 | struct sway_container *output, const char *name); | 95 | struct sway_container *output, const char *name); |
96 | 96 | ||
97 | struct sway_container *sway_container_view_create( | 97 | struct sway_container *container_view_create( |
98 | struct sway_container *sibling, struct sway_view *sway_view); | 98 | struct sway_container *sibling, struct sway_view *sway_view); |
99 | 99 | ||
100 | struct sway_container *sway_container_output_destroy( | 100 | struct sway_container *container_output_destroy( |
101 | struct sway_container *output); | 101 | struct sway_container *output); |
102 | 102 | ||
103 | struct sway_container *sway_container_view_destroy(struct sway_container *view); | 103 | struct sway_container *container_view_destroy(struct sway_container *view); |
104 | 104 | ||
105 | struct sway_container *sway_container_set_layout( | 105 | struct sway_container *container_set_layout( |
106 | struct sway_container *container, enum sway_container_layout layout); | 106 | struct sway_container *container, enum sway_container_layout layout); |
107 | 107 | ||
108 | void sway_container_descendents(struct sway_container *root, | 108 | void container_descendents(struct sway_container *root, |
109 | enum sway_container_type type, | 109 | enum sway_container_type type, |
110 | void (*func)(struct sway_container *item, void *data), void *data); | 110 | void (*func)(struct sway_container *item, void *data), void *data); |
111 | 111 | ||
112 | // XXX: what is this? | ||
113 | struct sway_container *next_view_sibling(struct sway_seat *seat); | ||
114 | |||
115 | /** | 112 | /** |
116 | * Finds a container based on test criteria. Returns the first container that | 113 | * Finds a container based on test criteria. Returns the first container that |
117 | * passes the test. | 114 | * passes the test. |
118 | */ | 115 | */ |
119 | struct sway_container *sway_container_find(struct sway_container *container, | 116 | struct sway_container *container_find(struct sway_container *container, |
120 | bool (*test)(struct sway_container *view, void *data), void *data); | 117 | bool (*test)(struct sway_container *view, void *data), void *data); |
121 | 118 | ||
122 | /** | 119 | /** |
123 | * Finds a parent container with the given struct sway_containerype. | 120 | * Finds a parent container with the given struct sway_containerype. |
124 | */ | 121 | */ |
125 | struct sway_container *sway_container_parent(struct sway_container *container, | 122 | struct sway_container *container_parent(struct sway_container *container, |
126 | enum sway_container_type type); | 123 | enum sway_container_type type); |
127 | 124 | ||
128 | /** | 125 | /** |
diff --git a/include/sway/tree/layout.h b/include/sway/tree/layout.h index f73b3880..6980ec9e 100644 --- a/include/sway/tree/layout.h +++ b/include/sway/tree/layout.h | |||
@@ -30,23 +30,23 @@ struct sway_root { | |||
30 | } events; | 30 | } events; |
31 | }; | 31 | }; |
32 | 32 | ||
33 | void init_layout(void); | 33 | void layout_init(void); |
34 | 34 | ||
35 | void add_child(struct sway_container *parent, struct sway_container *child); | 35 | void container_add_child(struct sway_container *parent, struct sway_container *child); |
36 | 36 | ||
37 | struct sway_container *add_sibling(struct sway_container *parent, | 37 | struct sway_container *container_add_sibling(struct sway_container *parent, |
38 | struct sway_container *child); | 38 | struct sway_container *child); |
39 | 39 | ||
40 | struct sway_container *remove_child(struct sway_container *child); | 40 | struct sway_container *container_remove_child(struct sway_container *child); |
41 | 41 | ||
42 | enum sway_container_layout default_layout(struct sway_container *output); | 42 | enum sway_container_layout container_get_default_layout(struct sway_container *output); |
43 | 43 | ||
44 | void sort_workspaces(struct sway_container *output); | 44 | void container_sort_workspaces(struct sway_container *output); |
45 | 45 | ||
46 | void arrange_windows(struct sway_container *container, | 46 | void container_arrange_windows(struct sway_container *container, |
47 | double width, double height); | 47 | double width, double height); |
48 | 48 | ||
49 | struct sway_container *get_swayc_in_direction(struct sway_container | 49 | struct sway_container *container_get_in_direction(struct sway_container |
50 | *container, struct sway_seat *seat, enum movement_direction dir); | 50 | *container, struct sway_seat *seat, enum movement_direction dir); |
51 | 51 | ||
52 | #endif | 52 | #endif |
diff --git a/sway/commands/layout.c b/sway/commands/layout.c index e10334e2..e9cfeb8f 100644 --- a/sway/commands/layout.c +++ b/sway/commands/layout.c | |||
@@ -26,10 +26,10 @@ struct cmd_results *cmd_layout(int argc, char **argv) { | |||
26 | // TODO: stacks and tabs | 26 | // TODO: stacks and tabs |
27 | 27 | ||
28 | if (strcasecmp(argv[0], "default") == 0) { | 28 | if (strcasecmp(argv[0], "default") == 0) { |
29 | swayc_change_layout(parent, parent->prev_layout); | 29 | container_set_layout(parent, parent->prev_layout); |
30 | if (parent->layout == L_NONE) { | 30 | if (parent->layout == L_NONE) { |
31 | struct sway_container *output = sway_container_parent(parent, C_OUTPUT); | 31 | struct sway_container *output = container_parent(parent, C_OUTPUT); |
32 | swayc_change_layout(parent, default_layout(output)); | 32 | container_set_layout(parent, container_get_default_layout(output)); |
33 | } | 33 | } |
34 | } else { | 34 | } else { |
35 | if (parent->layout != L_TABBED && parent->layout != L_STACKED) { | 35 | if (parent->layout != L_TABBED && parent->layout != L_STACKED) { |
@@ -37,20 +37,20 @@ struct cmd_results *cmd_layout(int argc, char **argv) { | |||
37 | } | 37 | } |
38 | 38 | ||
39 | if (strcasecmp(argv[0], "splith") == 0) { | 39 | if (strcasecmp(argv[0], "splith") == 0) { |
40 | swayc_change_layout(parent, L_HORIZ); | 40 | container_set_layout(parent, L_HORIZ); |
41 | } else if (strcasecmp(argv[0], "splitv") == 0) { | 41 | } else if (strcasecmp(argv[0], "splitv") == 0) { |
42 | swayc_change_layout(parent, L_VERT); | 42 | container_set_layout(parent, L_VERT); |
43 | } else if (strcasecmp(argv[0], "toggle") == 0 && argc == 2 && strcasecmp(argv[1], "split") == 0) { | 43 | } else if (strcasecmp(argv[0], "toggle") == 0 && argc == 2 && strcasecmp(argv[1], "split") == 0) { |
44 | if (parent->layout == L_HORIZ && (parent->workspace_layout == L_NONE | 44 | if (parent->layout == L_HORIZ && (parent->workspace_layout == L_NONE |
45 | || parent->workspace_layout == L_HORIZ)) { | 45 | || parent->workspace_layout == L_HORIZ)) { |
46 | swayc_change_layout(parent, L_VERT); | 46 | container_set_layout(parent, L_VERT); |
47 | } else { | 47 | } else { |
48 | swayc_change_layout(parent, L_HORIZ); | 48 | container_set_layout(parent, L_HORIZ); |
49 | } | 49 | } |
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | arrange_windows(parent, parent->width, parent->height); | 53 | container_arrange_windows(parent, parent->width, parent->height); |
54 | 54 | ||
55 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 55 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
56 | } | 56 | } |
diff --git a/sway/commands/reload.c b/sway/commands/reload.c index 8cef789b..83ecd75b 100644 --- a/sway/commands/reload.c +++ b/sway/commands/reload.c | |||
@@ -13,6 +13,6 @@ struct cmd_results *cmd_reload(int argc, char **argv) { | |||
13 | 13 | ||
14 | /* load_swaybars(); -- for when it's implemented */ | 14 | /* load_swaybars(); -- for when it's implemented */ |
15 | 15 | ||
16 | arrange_windows(&root_container, -1, -1); | 16 | container_arrange_windows(&root_container, -1, -1); |
17 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 17 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
18 | } | 18 | } |
diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c index 8b7139a9..8f39e5fc 100644 --- a/sway/commands/workspace.c +++ b/sway/commands/workspace.c | |||
@@ -23,9 +23,9 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { | |||
23 | if (current_container->type == C_WORKSPACE) { | 23 | if (current_container->type == C_WORKSPACE) { |
24 | old_workspace = current_container; | 24 | old_workspace = current_container; |
25 | } else { | 25 | } else { |
26 | old_workspace = sway_container_parent(current_container, C_WORKSPACE); | 26 | old_workspace = container_parent(current_container, C_WORKSPACE); |
27 | } | 27 | } |
28 | old_output = sway_container_parent(current_container, C_OUTPUT); | 28 | old_output = container_parent(current_container, C_OUTPUT); |
29 | } | 29 | } |
30 | 30 | ||
31 | for (int i = 0; i < argc; ++i) { | 31 | for (int i = 0; i < argc; ++i) { |
@@ -92,7 +92,7 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { | |||
92 | workspace_switch(ws); | 92 | workspace_switch(ws); |
93 | current_container = | 93 | current_container = |
94 | sway_seat_get_focus(config->handler_context.seat); | 94 | sway_seat_get_focus(config->handler_context.seat); |
95 | struct sway_container *new_output = sway_container_parent(current_container, C_OUTPUT); | 95 | struct sway_container *new_output = container_parent(current_container, C_OUTPUT); |
96 | 96 | ||
97 | if (config->mouse_warping && old_output != new_output) { | 97 | if (config->mouse_warping && old_output != new_output) { |
98 | // TODO: Warp mouse | 98 | // TODO: Warp mouse |
diff --git a/sway/config/output.c b/sway/config/output.c index 5763bd21..7fc79739 100644 --- a/sway/config/output.c +++ b/sway/config/output.c | |||
@@ -127,7 +127,7 @@ void apply_output_config(struct output_config *oc, struct sway_container *output | |||
127 | if (oc && oc->enabled == 0) { | 127 | if (oc && oc->enabled == 0) { |
128 | wlr_output_layout_remove(root_container.sway_root->output_layout, | 128 | wlr_output_layout_remove(root_container.sway_root->output_layout, |
129 | wlr_output); | 129 | wlr_output); |
130 | sway_container_output_destroy(output); | 130 | container_output_destroy(output); |
131 | return; | 131 | return; |
132 | } | 132 | } |
133 | 133 | ||
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index 137b3260..4bfd1c45 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c | |||
@@ -172,7 +172,7 @@ void arrange_layers(struct sway_output *output) { | |||
172 | if (memcmp(&usable_area_before, | 172 | if (memcmp(&usable_area_before, |
173 | &usable_area, sizeof(struct wlr_box)) != 0) { | 173 | &usable_area, sizeof(struct wlr_box)) != 0) { |
174 | wlr_log(L_DEBUG, "arrange"); | 174 | wlr_log(L_DEBUG, "arrange"); |
175 | arrange_windows(output->swayc, -1, -1); | 175 | container_arrange_windows(output->swayc, -1, -1); |
176 | } | 176 | } |
177 | 177 | ||
178 | // Arrange non-exlusive surfaces from top->bottom | 178 | // Arrange non-exlusive surfaces from top->bottom |
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 3e7d8509..fa1b0680 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -221,13 +221,13 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { | |||
221 | struct sway_container *focus = sway_seat_get_focus_inactive(seat, soutput->swayc); | 221 | struct sway_container *focus = sway_seat_get_focus_inactive(seat, soutput->swayc); |
222 | struct sway_container *workspace = (focus->type == C_WORKSPACE ? | 222 | struct sway_container *workspace = (focus->type == C_WORKSPACE ? |
223 | focus : | 223 | focus : |
224 | sway_container_parent(focus, C_WORKSPACE)); | 224 | container_parent(focus, C_WORKSPACE)); |
225 | 225 | ||
226 | struct render_data rdata = { | 226 | struct render_data rdata = { |
227 | .output = soutput, | 227 | .output = soutput, |
228 | .now = &now, | 228 | .now = &now, |
229 | }; | 229 | }; |
230 | sway_container_descendents(workspace, C_VIEW, output_frame_view, &rdata); | 230 | container_descendents(workspace, C_VIEW, output_frame_view, &rdata); |
231 | 231 | ||
232 | // render unmanaged views on top | 232 | // render unmanaged views on top |
233 | struct sway_view *view; | 233 | struct sway_view *view; |
@@ -258,13 +258,13 @@ static void handle_output_destroy(struct wl_listener *listener, void *data) { | |||
258 | struct wlr_output *wlr_output = data; | 258 | struct wlr_output *wlr_output = data; |
259 | wlr_log(L_DEBUG, "Output %p %s removed", wlr_output, wlr_output->name); | 259 | wlr_log(L_DEBUG, "Output %p %s removed", wlr_output, wlr_output->name); |
260 | 260 | ||
261 | sway_container_output_destroy(output->swayc); | 261 | container_output_destroy(output->swayc); |
262 | } | 262 | } |
263 | 263 | ||
264 | static void handle_output_mode(struct wl_listener *listener, void *data) { | 264 | static void handle_output_mode(struct wl_listener *listener, void *data) { |
265 | struct sway_output *output = wl_container_of(listener, output, mode); | 265 | struct sway_output *output = wl_container_of(listener, output, mode); |
266 | arrange_layers(output); | 266 | arrange_layers(output); |
267 | arrange_windows(output->swayc, -1, -1); | 267 | container_arrange_windows(output->swayc, -1, -1); |
268 | } | 268 | } |
269 | 269 | ||
270 | void handle_new_output(struct wl_listener *listener, void *data) { | 270 | void handle_new_output(struct wl_listener *listener, void *data) { |
@@ -286,7 +286,7 @@ void handle_new_output(struct wl_listener *listener, void *data) { | |||
286 | wlr_output_set_mode(wlr_output, mode); | 286 | wlr_output_set_mode(wlr_output, mode); |
287 | } | 287 | } |
288 | 288 | ||
289 | output->swayc = sway_container_output_create(output); | 289 | output->swayc = container_output_create(output); |
290 | if (!output->swayc) { | 290 | if (!output->swayc) { |
291 | free(output); | 291 | free(output); |
292 | return; | 292 | return; |
@@ -307,5 +307,5 @@ void handle_new_output(struct wl_listener *listener, void *data) { | |||
307 | output->mode.notify = handle_output_mode; | 307 | output->mode.notify = handle_output_mode; |
308 | 308 | ||
309 | arrange_layers(output); | 309 | arrange_layers(output); |
310 | arrange_windows(&root_container, -1, -1); | 310 | container_arrange_windows(&root_container, -1, -1); |
311 | } | 311 | } |
diff --git a/sway/desktop/wl_shell.c b/sway/desktop/wl_shell.c index bf41d7bf..ac1c7f26 100644 --- a/sway/desktop/wl_shell.c +++ b/sway/desktop/wl_shell.c | |||
@@ -74,10 +74,10 @@ static void handle_destroy(struct wl_listener *listener, void *data) { | |||
74 | wl_container_of(listener, sway_surface, destroy); | 74 | wl_container_of(listener, sway_surface, destroy); |
75 | wl_list_remove(&sway_surface->commit.link); | 75 | wl_list_remove(&sway_surface->commit.link); |
76 | wl_list_remove(&sway_surface->destroy.link); | 76 | wl_list_remove(&sway_surface->destroy.link); |
77 | struct sway_container *parent = sway_container_view_destroy(sway_surface->view->swayc); | 77 | struct sway_container *parent = container_view_destroy(sway_surface->view->swayc); |
78 | free(sway_surface->view); | 78 | free(sway_surface->view); |
79 | free(sway_surface); | 79 | free(sway_surface); |
80 | arrange_windows(parent, -1, -1); | 80 | container_arrange_windows(parent, -1, -1); |
81 | } | 81 | } |
82 | 82 | ||
83 | void handle_wl_shell_surface(struct wl_listener *listener, void *data) { | 83 | void handle_wl_shell_surface(struct wl_listener *listener, void *data) { |
@@ -133,9 +133,9 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) { | |||
133 | 133 | ||
134 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 134 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
135 | struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container); | 135 | struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container); |
136 | struct sway_container *cont = sway_container_view_create(focus, sway_view); | 136 | struct sway_container *cont = container_view_create(focus, sway_view); |
137 | sway_view->swayc = cont; | 137 | sway_view->swayc = cont; |
138 | 138 | ||
139 | arrange_windows(cont->parent, -1, -1); | 139 | container_arrange_windows(cont->parent, -1, -1); |
140 | sway_input_manager_set_focus(input_manager, cont); | 140 | sway_input_manager_set_focus(input_manager, cont); |
141 | } | 141 | } |
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 6b50d470..616cb88f 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c | |||
@@ -83,10 +83,10 @@ static void handle_destroy(struct wl_listener *listener, void *data) { | |||
83 | wl_container_of(listener, sway_xdg_surface, destroy); | 83 | wl_container_of(listener, sway_xdg_surface, destroy); |
84 | wl_list_remove(&sway_xdg_surface->commit.link); | 84 | wl_list_remove(&sway_xdg_surface->commit.link); |
85 | wl_list_remove(&sway_xdg_surface->destroy.link); | 85 | wl_list_remove(&sway_xdg_surface->destroy.link); |
86 | struct sway_container *parent = sway_container_view_destroy(sway_xdg_surface->view->swayc); | 86 | struct sway_container *parent = container_view_destroy(sway_xdg_surface->view->swayc); |
87 | free(sway_xdg_surface->view); | 87 | free(sway_xdg_surface->view); |
88 | free(sway_xdg_surface); | 88 | free(sway_xdg_surface); |
89 | arrange_windows(parent, -1, -1); | 89 | container_arrange_windows(parent, -1, -1); |
90 | } | 90 | } |
91 | 91 | ||
92 | void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { | 92 | void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { |
@@ -137,10 +137,10 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { | |||
137 | 137 | ||
138 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 138 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
139 | struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container); | 139 | struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container); |
140 | struct sway_container *cont = sway_container_view_create(focus, sway_view); | 140 | struct sway_container *cont = container_view_create(focus, sway_view); |
141 | sway_view->swayc = cont; | 141 | sway_view->swayc = cont; |
142 | 142 | ||
143 | arrange_windows(cont->parent, -1, -1); | 143 | container_arrange_windows(cont->parent, -1, -1); |
144 | 144 | ||
145 | sway_input_manager_set_focus(input_manager, cont); | 145 | sway_input_manager_set_focus(input_manager, cont); |
146 | } | 146 | } |
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 96edab51..fa1054f2 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -49,11 +49,11 @@ static void set_position(struct sway_view *view, double ox, double oy) { | |||
49 | if (!assert_xwayland(view)) { | 49 | if (!assert_xwayland(view)) { |
50 | return; | 50 | return; |
51 | } | 51 | } |
52 | struct sway_container *output = sway_container_parent(view->swayc, C_OUTPUT); | 52 | struct sway_container *output = container_parent(view->swayc, C_OUTPUT); |
53 | if (!sway_assert(output, "view must be within tree to set position")) { | 53 | if (!sway_assert(output, "view must be within tree to set position")) { |
54 | return; | 54 | return; |
55 | } | 55 | } |
56 | struct sway_container *root = sway_container_parent(output, C_ROOT); | 56 | struct sway_container *root = container_parent(output, C_ROOT); |
57 | if (!sway_assert(root, "output must be within tree to set position")) { | 57 | if (!sway_assert(root, "output must be within tree to set position")) { |
58 | return; | 58 | return; |
59 | } | 59 | } |
@@ -114,9 +114,9 @@ static void handle_destroy(struct wl_listener *listener, void *data) { | |||
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | struct sway_container *parent = sway_container_view_destroy(sway_surface->view->swayc); | 117 | struct sway_container *parent = container_view_destroy(sway_surface->view->swayc); |
118 | if (parent) { | 118 | if (parent) { |
119 | arrange_windows(parent, -1, -1); | 119 | container_arrange_windows(parent, -1, -1); |
120 | } | 120 | } |
121 | 121 | ||
122 | free(sway_surface->view); | 122 | free(sway_surface->view); |
@@ -132,9 +132,9 @@ static void handle_unmap_notify(struct wl_listener *listener, void *data) { | |||
132 | } | 132 | } |
133 | 133 | ||
134 | // take it out of the tree | 134 | // take it out of the tree |
135 | struct sway_container *parent = sway_container_view_destroy(sway_surface->view->swayc); | 135 | struct sway_container *parent = container_view_destroy(sway_surface->view->swayc); |
136 | if (parent) { | 136 | if (parent) { |
137 | arrange_windows(parent, -1, -1); | 137 | container_arrange_windows(parent, -1, -1); |
138 | } | 138 | } |
139 | 139 | ||
140 | sway_surface->view->swayc = NULL; | 140 | sway_surface->view->swayc = NULL; |
@@ -155,15 +155,15 @@ static void handle_map_notify(struct wl_listener *listener, void *data) { | |||
155 | &sway_surface->view->unmanaged_view_link); | 155 | &sway_surface->view->unmanaged_view_link); |
156 | } else { | 156 | } else { |
157 | struct sway_view *view = sway_surface->view; | 157 | struct sway_view *view = sway_surface->view; |
158 | sway_container_view_destroy(view->swayc); | 158 | container_view_destroy(view->swayc); |
159 | 159 | ||
160 | struct sway_container *parent = root_container.children->items[0]; | 160 | struct sway_container *parent = root_container.children->items[0]; |
161 | parent = parent->children->items[0]; // workspace | 161 | parent = parent->children->items[0]; // workspace |
162 | 162 | ||
163 | struct sway_container *cont = sway_container_view_create(parent, view); | 163 | struct sway_container *cont = container_view_create(parent, view); |
164 | view->swayc = cont; | 164 | view->swayc = cont; |
165 | 165 | ||
166 | arrange_windows(cont->parent, -1, -1); | 166 | container_arrange_windows(cont->parent, -1, -1); |
167 | sway_input_manager_set_focus(input_manager, cont); | 167 | sway_input_manager_set_focus(input_manager, cont); |
168 | } | 168 | } |
169 | } | 169 | } |
@@ -239,9 +239,9 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) { | |||
239 | 239 | ||
240 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 240 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
241 | struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container); | 241 | struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container); |
242 | struct sway_container *cont = sway_container_view_create(focus, sway_view); | 242 | struct sway_container *cont = container_view_create(focus, sway_view); |
243 | sway_view->swayc = cont; | 243 | sway_view->swayc = cont; |
244 | 244 | ||
245 | arrange_windows(cont->parent, -1, -1); | 245 | container_arrange_windows(cont->parent, -1, -1); |
246 | sway_input_manager_set_focus(input_manager, cont); | 246 | sway_input_manager_set_focus(input_manager, cont); |
247 | } | 247 | } |
diff --git a/sway/input/seat.c b/sway/input/seat.c index f03a03b4..8e2189de 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -365,7 +365,7 @@ struct sway_container *sway_seat_get_focus_by_type(struct sway_seat *seat, | |||
365 | return focus; | 365 | return focus; |
366 | } | 366 | } |
367 | 367 | ||
368 | return sway_container_parent(focus, type); | 368 | return container_parent(focus, type); |
369 | } | 369 | } |
370 | 370 | ||
371 | void sway_seat_set_config(struct sway_seat *seat, | 371 | void sway_seat_set_config(struct sway_seat *seat, |
diff --git a/sway/tree/container.c b/sway/tree/container.c index d31966b3..b41626e1 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -67,7 +67,7 @@ static void free_swayc(struct sway_container *cont) { | |||
67 | 67 | ||
68 | if (cont->children) { | 68 | if (cont->children) { |
69 | // remove children until there are no more, free_swayc calls | 69 | // remove children until there are no more, free_swayc calls |
70 | // remove_child, which removes child from this container | 70 | // container_remove_child, which removes child from this container |
71 | while (cont->children->length) { | 71 | while (cont->children->length) { |
72 | free_swayc(cont->children->items[0]); | 72 | free_swayc(cont->children->items[0]); |
73 | } | 73 | } |
@@ -78,7 +78,7 @@ static void free_swayc(struct sway_container *cont) { | |||
78 | list_free(cont->marks); | 78 | list_free(cont->marks); |
79 | } | 79 | } |
80 | if (cont->parent) { | 80 | if (cont->parent) { |
81 | remove_child(cont); | 81 | container_remove_child(cont); |
82 | } | 82 | } |
83 | if (cont->name) { | 83 | if (cont->name) { |
84 | free(cont->name); | 84 | free(cont->name); |
@@ -86,7 +86,7 @@ static void free_swayc(struct sway_container *cont) { | |||
86 | free(cont); | 86 | free(cont); |
87 | } | 87 | } |
88 | 88 | ||
89 | struct sway_container *sway_container_output_create(struct sway_output *sway_output) { | 89 | struct sway_container *container_output_create(struct sway_output *sway_output) { |
90 | struct wlr_box size; | 90 | struct wlr_box size; |
91 | wlr_output_effective_resolution(sway_output->wlr_output, &size.width, | 91 | wlr_output_effective_resolution(sway_output->wlr_output, &size.width, |
92 | &size.height); | 92 | &size.height); |
@@ -131,12 +131,12 @@ struct sway_container *sway_container_output_create(struct sway_output *sway_out | |||
131 | 131 | ||
132 | apply_output_config(oc, output); | 132 | apply_output_config(oc, output); |
133 | 133 | ||
134 | add_child(&root_container, output); | 134 | container_add_child(&root_container, output); |
135 | 135 | ||
136 | // Create workspace | 136 | // Create workspace |
137 | char *ws_name = workspace_next_name(output->name); | 137 | char *ws_name = workspace_next_name(output->name); |
138 | wlr_log(L_DEBUG, "Creating default workspace %s", ws_name); | 138 | wlr_log(L_DEBUG, "Creating default workspace %s", ws_name); |
139 | struct sway_container *ws = sway_container_workspace_create(output, ws_name); | 139 | struct sway_container *ws = container_workspace_create(output, ws_name); |
140 | // Set each seat's focus if not already set | 140 | // Set each seat's focus if not already set |
141 | struct sway_seat *seat = NULL; | 141 | struct sway_seat *seat = NULL; |
142 | wl_list_for_each(seat, &input_manager->seats, link) { | 142 | wl_list_for_each(seat, &input_manager->seats, link) { |
@@ -150,8 +150,8 @@ struct sway_container *sway_container_output_create(struct sway_output *sway_out | |||
150 | return output; | 150 | return output; |
151 | } | 151 | } |
152 | 152 | ||
153 | struct sway_container *sway_container_workspace_create(struct sway_container *output, const char *name) { | 153 | struct sway_container *container_workspace_create(struct sway_container *output, const char *name) { |
154 | if (!sway_assert(output, "sway_container_workspace_create called with null output")) { | 154 | if (!sway_assert(output, "container_workspace_create called with null output")) { |
155 | return NULL; | 155 | return NULL; |
156 | } | 156 | } |
157 | wlr_log(L_DEBUG, "Added workspace %s for output %s", name, output->name); | 157 | wlr_log(L_DEBUG, "Added workspace %s for output %s", name, output->name); |
@@ -163,17 +163,17 @@ struct sway_container *sway_container_workspace_create(struct sway_container *ou | |||
163 | workspace->height = output->height; | 163 | workspace->height = output->height; |
164 | workspace->name = !name ? NULL : strdup(name); | 164 | workspace->name = !name ? NULL : strdup(name); |
165 | workspace->prev_layout = L_NONE; | 165 | workspace->prev_layout = L_NONE; |
166 | workspace->layout = default_layout(output); | 166 | workspace->layout = container_get_default_layout(output); |
167 | workspace->workspace_layout = default_layout(output); | 167 | workspace->workspace_layout = container_get_default_layout(output); |
168 | 168 | ||
169 | add_child(output, workspace); | 169 | container_add_child(output, workspace); |
170 | sort_workspaces(output); | 170 | container_sort_workspaces(output); |
171 | notify_new_container(workspace); | 171 | notify_new_container(workspace); |
172 | return workspace; | 172 | return workspace; |
173 | } | 173 | } |
174 | 174 | ||
175 | struct sway_container *sway_container_view_create(struct sway_container *sibling, struct sway_view *sway_view) { | 175 | struct sway_container *container_view_create(struct sway_container *sibling, struct sway_view *sway_view) { |
176 | if (!sway_assert(sibling, "sway_container_view_create called with NULL sibling/parent")) { | 176 | if (!sway_assert(sibling, "container_view_create called with NULL sibling/parent")) { |
177 | return NULL; | 177 | return NULL; |
178 | } | 178 | } |
179 | const char *title = view_get_title(sway_view); | 179 | const char *title = view_get_title(sway_view); |
@@ -188,17 +188,17 @@ struct sway_container *sway_container_view_create(struct sway_container *sibling | |||
188 | 188 | ||
189 | if (sibling->type == C_WORKSPACE) { | 189 | if (sibling->type == C_WORKSPACE) { |
190 | // Case of focused workspace, just create as child of it | 190 | // Case of focused workspace, just create as child of it |
191 | add_child(sibling, swayc); | 191 | container_add_child(sibling, swayc); |
192 | } else { | 192 | } else { |
193 | // Regular case, create as sibling of current container | 193 | // Regular case, create as sibling of current container |
194 | add_sibling(sibling, swayc); | 194 | container_add_sibling(sibling, swayc); |
195 | } | 195 | } |
196 | notify_new_container(swayc); | 196 | notify_new_container(swayc); |
197 | return swayc; | 197 | return swayc; |
198 | } | 198 | } |
199 | 199 | ||
200 | struct sway_container *sway_container_output_destroy(struct sway_container *output) { | 200 | struct sway_container *container_output_destroy(struct sway_container *output) { |
201 | if (!sway_assert(output, "null output passed to sway_container_output_destroy")) { | 201 | if (!sway_assert(output, "null output passed to container_output_destroy")) { |
202 | return NULL; | 202 | return NULL; |
203 | } | 203 | } |
204 | 204 | ||
@@ -211,11 +211,11 @@ struct sway_container *sway_container_output_destroy(struct sway_container *outp | |||
211 | // Move workspace from this output to another output | 211 | // Move workspace from this output to another output |
212 | while (output->children->length) { | 212 | while (output->children->length) { |
213 | struct sway_container *child = output->children->items[0]; | 213 | struct sway_container *child = output->children->items[0]; |
214 | remove_child(child); | 214 | container_remove_child(child); |
215 | add_child(root_container.children->items[p], child); | 215 | container_add_child(root_container.children->items[p], child); |
216 | } | 216 | } |
217 | sort_workspaces(root_container.children->items[p]); | 217 | container_sort_workspaces(root_container.children->items[p]); |
218 | arrange_windows(root_container.children->items[p], -1, -1); | 218 | container_arrange_windows(root_container.children->items[p], -1, -1); |
219 | } | 219 | } |
220 | } | 220 | } |
221 | 221 | ||
@@ -229,7 +229,7 @@ struct sway_container *sway_container_output_destroy(struct sway_container *outp | |||
229 | return &root_container; | 229 | return &root_container; |
230 | } | 230 | } |
231 | 231 | ||
232 | struct sway_container *sway_container_view_destroy(struct sway_container *view) { | 232 | struct sway_container *container_view_destroy(struct sway_container *view) { |
233 | if (!view) { | 233 | if (!view) { |
234 | return NULL; | 234 | return NULL; |
235 | } | 235 | } |
@@ -246,7 +246,7 @@ struct sway_container *sway_container_view_destroy(struct sway_container *view) | |||
246 | return parent; | 246 | return parent; |
247 | } | 247 | } |
248 | 248 | ||
249 | struct sway_container *swayc_change_layout(struct sway_container *container, enum sway_container_layout layout) { | 249 | struct sway_container *container_set_layout(struct sway_container *container, enum sway_container_layout layout) { |
250 | if (container->type == C_WORKSPACE) { | 250 | if (container->type == C_WORKSPACE) { |
251 | container->workspace_layout = layout; | 251 | container->workspace_layout = layout; |
252 | if (layout == L_HORIZ || layout == L_VERT) { | 252 | if (layout == L_HORIZ || layout == L_VERT) { |
@@ -258,7 +258,7 @@ struct sway_container *swayc_change_layout(struct sway_container *container, enu | |||
258 | return container; | 258 | return container; |
259 | } | 259 | } |
260 | 260 | ||
261 | void sway_container_descendents(struct sway_container *root, enum sway_container_type type, | 261 | void container_descendents(struct sway_container *root, enum sway_container_type type, |
262 | void (*func)(struct sway_container *item, void *data), void *data) { | 262 | void (*func)(struct sway_container *item, void *data), void *data) { |
263 | for (int i = 0; i < root->children->length; ++i) { | 263 | for (int i = 0; i < root->children->length; ++i) { |
264 | struct sway_container *item = root->children->items[i]; | 264 | struct sway_container *item = root->children->items[i]; |
@@ -266,12 +266,12 @@ void sway_container_descendents(struct sway_container *root, enum sway_container | |||
266 | func(item, data); | 266 | func(item, data); |
267 | } | 267 | } |
268 | if (item->children && item->children->length) { | 268 | if (item->children && item->children->length) { |
269 | sway_container_descendents(item, type, func, data); | 269 | container_descendents(item, type, func, data); |
270 | } | 270 | } |
271 | } | 271 | } |
272 | } | 272 | } |
273 | 273 | ||
274 | struct sway_container *sway_container_find(struct sway_container *container, | 274 | struct sway_container *container_find(struct sway_container *container, |
275 | bool (*test)(struct sway_container *view, void *data), void *data) { | 275 | bool (*test)(struct sway_container *view, void *data), void *data) { |
276 | if (!container->children) { | 276 | if (!container->children) { |
277 | return NULL; | 277 | return NULL; |
@@ -282,7 +282,7 @@ struct sway_container *sway_container_find(struct sway_container *container, | |||
282 | if (test(child, data)) { | 282 | if (test(child, data)) { |
283 | return child; | 283 | return child; |
284 | } else { | 284 | } else { |
285 | struct sway_container *res = sway_container_find(child, test, data); | 285 | struct sway_container *res = container_find(child, test, data); |
286 | if (res) { | 286 | if (res) { |
287 | return res; | 287 | return res; |
288 | } | 288 | } |
@@ -291,7 +291,7 @@ struct sway_container *sway_container_find(struct sway_container *container, | |||
291 | return NULL; | 291 | return NULL; |
292 | } | 292 | } |
293 | 293 | ||
294 | struct sway_container *sway_container_parent(struct sway_container *container, enum sway_container_type type) { | 294 | struct sway_container *container_parent(struct sway_container *container, enum sway_container_type type) { |
295 | if (!sway_assert(container, "container is NULL")) { | 295 | if (!sway_assert(container, "container is NULL")) { |
296 | return NULL; | 296 | return NULL; |
297 | } | 297 | } |
@@ -341,7 +341,7 @@ struct sway_container *sway_container_at(struct sway_container *parent, double l | |||
341 | list_del(queue, 0); | 341 | list_del(queue, 0); |
342 | if (swayc->type == C_VIEW) { | 342 | if (swayc->type == C_VIEW) { |
343 | struct sway_view *sview = swayc->sway_view; | 343 | struct sway_view *sview = swayc->sway_view; |
344 | struct sway_container *soutput = sway_container_parent(swayc, C_OUTPUT); | 344 | struct sway_container *soutput = container_parent(swayc, C_OUTPUT); |
345 | struct wlr_box *output_box = | 345 | struct wlr_box *output_box = |
346 | wlr_output_layout_get_box( | 346 | wlr_output_layout_get_box( |
347 | root_container.sway_root->output_layout, | 347 | root_container.sway_root->output_layout, |
diff --git a/sway/tree/layout.c b/sway/tree/layout.c index 068fb39c..07534620 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c | |||
@@ -40,7 +40,7 @@ static void output_layout_change_notify(struct wl_listener *listener, void *data | |||
40 | output_container->height = output_box->height; | 40 | output_container->height = output_box->height; |
41 | } | 41 | } |
42 | 42 | ||
43 | arrange_windows(&root_container, -1, -1); | 43 | container_arrange_windows(&root_container, -1, -1); |
44 | } | 44 | } |
45 | 45 | ||
46 | void init_layout(void) { | 46 | void init_layout(void) { |
@@ -79,7 +79,7 @@ static int index_child(const struct sway_container *child) { | |||
79 | return i; | 79 | return i; |
80 | } | 80 | } |
81 | 81 | ||
82 | struct sway_container *add_sibling(struct sway_container *fixed, struct sway_container *active) { | 82 | struct sway_container *container_add_sibling(struct sway_container *fixed, struct sway_container *active) { |
83 | // TODO handle floating | 83 | // TODO handle floating |
84 | struct sway_container *parent = fixed->parent; | 84 | struct sway_container *parent = fixed->parent; |
85 | int i = index_child(fixed); | 85 | int i = index_child(fixed); |
@@ -88,7 +88,7 @@ struct sway_container *add_sibling(struct sway_container *fixed, struct sway_con | |||
88 | return active->parent; | 88 | return active->parent; |
89 | } | 89 | } |
90 | 90 | ||
91 | void add_child(struct sway_container *parent, struct sway_container *child) { | 91 | void container_add_child(struct sway_container *parent, struct sway_container *child) { |
92 | wlr_log(L_DEBUG, "Adding %p (%d, %fx%f) to %p (%d, %fx%f)", | 92 | wlr_log(L_DEBUG, "Adding %p (%d, %fx%f) to %p (%d, %fx%f)", |
93 | child, child->type, child->width, child->height, | 93 | child, child->type, child->width, child->height, |
94 | parent, parent->type, parent->width, parent->height); | 94 | parent, parent->type, parent->width, parent->height); |
@@ -102,7 +102,7 @@ void add_child(struct sway_container *parent, struct sway_container *child) { | |||
102 | */ | 102 | */ |
103 | } | 103 | } |
104 | 104 | ||
105 | struct sway_container *remove_child(struct sway_container *child) { | 105 | struct sway_container *container_remove_child(struct sway_container *child) { |
106 | int i; | 106 | int i; |
107 | struct sway_container *parent = child->parent; | 107 | struct sway_container *parent = child->parent; |
108 | for (i = 0; i < parent->children->length; ++i) { | 108 | for (i = 0; i < parent->children->length; ++i) { |
@@ -115,7 +115,7 @@ struct sway_container *remove_child(struct sway_container *child) { | |||
115 | return parent; | 115 | return parent; |
116 | } | 116 | } |
117 | 117 | ||
118 | enum sway_container_layout default_layout(struct sway_container *output) { | 118 | enum sway_container_layout container_get_default_layout(struct sway_container *output) { |
119 | /* TODO WLR | 119 | /* TODO WLR |
120 | if (config->default_layout != L_NONE) { | 120 | if (config->default_layout != L_NONE) { |
121 | //return config->default_layout; | 121 | //return config->default_layout; |
@@ -146,7 +146,7 @@ static int sort_workspace_cmp_qsort(const void *_a, const void *_b) { | |||
146 | return retval; | 146 | return retval; |
147 | } | 147 | } |
148 | 148 | ||
149 | void sort_workspaces(struct sway_container *output) { | 149 | void container_sort_workspaces(struct sway_container *output) { |
150 | list_stable_sort(output->children, sort_workspace_cmp_qsort); | 150 | list_stable_sort(output->children, sort_workspace_cmp_qsort); |
151 | } | 151 | } |
152 | 152 | ||
@@ -160,7 +160,7 @@ static void apply_vert_layout(struct sway_container *container, const double x, | |||
160 | const double height, const int start, | 160 | const double height, const int start, |
161 | const int end); | 161 | const int end); |
162 | 162 | ||
163 | void arrange_windows(struct sway_container *container, double width, double height) { | 163 | void container_arrange_windows(struct sway_container *container, double width, double height) { |
164 | int i; | 164 | int i; |
165 | if (width == -1 || height == -1) { | 165 | if (width == -1 || height == -1) { |
166 | width = container->width; | 166 | width = container->width; |
@@ -184,7 +184,7 @@ void arrange_windows(struct sway_container *container, double width, double heig | |||
184 | struct sway_container *output = container->children->items[i]; | 184 | struct sway_container *output = container->children->items[i]; |
185 | wlr_log(L_DEBUG, "Arranging output '%s' at %f,%f", | 185 | wlr_log(L_DEBUG, "Arranging output '%s' at %f,%f", |
186 | output->name, output->x, output->y); | 186 | output->name, output->x, output->y); |
187 | arrange_windows(output, -1, -1); | 187 | container_arrange_windows(output, -1, -1); |
188 | } | 188 | } |
189 | return; | 189 | return; |
190 | case C_OUTPUT: | 190 | case C_OUTPUT: |
@@ -198,12 +198,12 @@ void arrange_windows(struct sway_container *container, double width, double heig | |||
198 | // arrange all workspaces: | 198 | // arrange all workspaces: |
199 | for (i = 0; i < container->children->length; ++i) { | 199 | for (i = 0; i < container->children->length; ++i) { |
200 | struct sway_container *child = container->children->items[i]; | 200 | struct sway_container *child = container->children->items[i]; |
201 | arrange_windows(child, -1, -1); | 201 | container_arrange_windows(child, -1, -1); |
202 | } | 202 | } |
203 | return; | 203 | return; |
204 | case C_WORKSPACE: | 204 | case C_WORKSPACE: |
205 | { | 205 | { |
206 | struct sway_container *output = sway_container_parent(container, C_OUTPUT); | 206 | struct sway_container *output = container_parent(container, C_OUTPUT); |
207 | struct wlr_box *area = &output->sway_output->usable_area; | 207 | struct wlr_box *area = &output->sway_output->usable_area; |
208 | wlr_log(L_DEBUG, "Usable area for ws: %dx%d@%d,%d", | 208 | wlr_log(L_DEBUG, "Usable area for ws: %dx%d@%d,%d", |
209 | area->width, area->height, area->x, area->y); | 209 | area->width, area->height, area->x, area->y); |
@@ -284,9 +284,9 @@ static void apply_horiz_layout(struct sway_container *container, | |||
284 | 284 | ||
285 | if (i == end - 1) { | 285 | if (i == end - 1) { |
286 | double remaining_width = x + width - child_x; | 286 | double remaining_width = x + width - child_x; |
287 | arrange_windows(child, remaining_width, height); | 287 | container_arrange_windows(child, remaining_width, height); |
288 | } else { | 288 | } else { |
289 | arrange_windows(child, child->width * scale, height); | 289 | container_arrange_windows(child, child->width * scale, height); |
290 | } | 290 | } |
291 | child_x += child->width; | 291 | child_x += child->width; |
292 | } | 292 | } |
@@ -334,9 +334,9 @@ void apply_vert_layout(struct sway_container *container, | |||
334 | 334 | ||
335 | if (i == end - 1) { | 335 | if (i == end - 1) { |
336 | double remaining_height = y + height - child_y; | 336 | double remaining_height = y + height - child_y; |
337 | arrange_windows(child, width, remaining_height); | 337 | container_arrange_windows(child, width, remaining_height); |
338 | } else { | 338 | } else { |
339 | arrange_windows(child, width, child->height * scale); | 339 | container_arrange_windows(child, width, child->height * scale); |
340 | } | 340 | } |
341 | child_y += child->height; | 341 | child_y += child->height; |
342 | } | 342 | } |
@@ -362,7 +362,7 @@ static struct sway_container *get_swayc_in_output_direction(struct sway_containe | |||
362 | 362 | ||
363 | struct sway_container *ws = sway_seat_get_focus_inactive(seat, output); | 363 | struct sway_container *ws = sway_seat_get_focus_inactive(seat, output); |
364 | if (ws->type != C_WORKSPACE) { | 364 | if (ws->type != C_WORKSPACE) { |
365 | ws = sway_container_parent(ws, C_WORKSPACE); | 365 | ws = container_parent(ws, C_WORKSPACE); |
366 | } | 366 | } |
367 | 367 | ||
368 | if (ws == NULL) { | 368 | if (ws == NULL) { |
@@ -410,7 +410,7 @@ static void get_layout_center_position(struct sway_container *container, int *x, | |||
410 | *x = container->x + container->width/2; | 410 | *x = container->x + container->width/2; |
411 | *y = container->y + container->height/2; | 411 | *y = container->y + container->height/2; |
412 | } else { | 412 | } else { |
413 | struct sway_container *output = sway_container_parent(container, C_OUTPUT); | 413 | struct sway_container *output = container_parent(container, C_OUTPUT); |
414 | if (container->type == C_WORKSPACE) { | 414 | if (container->type == C_WORKSPACE) { |
415 | // Workspace coordinates are actually wrong/arbitrary, but should | 415 | // Workspace coordinates are actually wrong/arbitrary, but should |
416 | // be same as output. | 416 | // be same as output. |
@@ -496,7 +496,7 @@ static struct sway_container *get_swayc_in_direction_under(struct sway_container | |||
496 | /* | 496 | /* |
497 | if (container->type == C_VIEW && swayc_is_fullscreen(container)) { | 497 | if (container->type == C_VIEW && swayc_is_fullscreen(container)) { |
498 | wlr_log(L_DEBUG, "Moving from fullscreen view, skipping to output"); | 498 | wlr_log(L_DEBUG, "Moving from fullscreen view, skipping to output"); |
499 | container = sway_container_parent(container, C_OUTPUT); | 499 | container = container_parent(container, C_OUTPUT); |
500 | get_layout_center_position(container, &abs_pos); | 500 | get_layout_center_position(container, &abs_pos); |
501 | struct sway_container *output = swayc_adjacent_output(container, dir, &abs_pos, true); | 501 | struct sway_container *output = swayc_adjacent_output(container, dir, &abs_pos, true); |
502 | return get_swayc_in_output_direction(output, dir); | 502 | return get_swayc_in_output_direction(output, dir); |
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 32e82845..0fdd9975 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c | |||
@@ -52,7 +52,7 @@ struct sway_container *workspace_by_number(const char* name) { | |||
52 | if (wbnd.len <= 0) { | 52 | if (wbnd.len <= 0) { |
53 | return NULL; | 53 | return NULL; |
54 | } | 54 | } |
55 | return sway_container_find(&root_container, _workspace_by_number, (void *) &wbnd); | 55 | return container_find(&root_container, _workspace_by_number, (void *) &wbnd); |
56 | } | 56 | } |
57 | 57 | ||
58 | static bool _workspace_by_name(struct sway_container *view, void *data) { | 58 | static bool _workspace_by_name(struct sway_container *view, void *data) { |
@@ -65,8 +65,8 @@ struct sway_container *workspace_by_name(const char *name) { | |||
65 | struct sway_container *current_workspace = NULL, *current_output = NULL; | 65 | struct sway_container *current_workspace = NULL, *current_output = NULL; |
66 | struct sway_container *focus = sway_seat_get_focus(seat); | 66 | struct sway_container *focus = sway_seat_get_focus(seat); |
67 | if (focus) { | 67 | if (focus) { |
68 | current_workspace = sway_container_parent(focus, C_WORKSPACE); | 68 | current_workspace = container_parent(focus, C_WORKSPACE); |
69 | current_output = sway_container_parent(focus, C_OUTPUT); | 69 | current_output = container_parent(focus, C_OUTPUT); |
70 | } | 70 | } |
71 | if (strcmp(name, "prev") == 0) { | 71 | if (strcmp(name, "prev") == 0) { |
72 | return workspace_prev(current_workspace); | 72 | return workspace_prev(current_workspace); |
@@ -79,7 +79,7 @@ struct sway_container *workspace_by_name(const char *name) { | |||
79 | } else if (strcmp(name, "current") == 0) { | 79 | } else if (strcmp(name, "current") == 0) { |
80 | return current_workspace; | 80 | return current_workspace; |
81 | } else { | 81 | } else { |
82 | return sway_container_find(&root_container, _workspace_by_name, (void *) name); | 82 | return container_find(&root_container, _workspace_by_name, (void *) name); |
83 | } | 83 | } |
84 | } | 84 | } |
85 | 85 | ||
@@ -95,7 +95,7 @@ struct sway_container *workspace_create(const char *name) { | |||
95 | for (i = 0; i < e; ++i) { | 95 | for (i = 0; i < e; ++i) { |
96 | parent = root_container.children->items[i]; | 96 | parent = root_container.children->items[i]; |
97 | if (strcmp(parent->name, wso->output) == 0) { | 97 | if (strcmp(parent->name, wso->output) == 0) { |
98 | return sway_container_workspace_create(parent, name); | 98 | return container_workspace_create(parent, name); |
99 | } | 99 | } |
100 | } | 100 | } |
101 | break; | 101 | break; |
@@ -105,8 +105,8 @@ struct sway_container *workspace_create(const char *name) { | |||
105 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 105 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
106 | struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container); | 106 | struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container); |
107 | parent = focus; | 107 | parent = focus; |
108 | parent = sway_container_parent(parent, C_OUTPUT); | 108 | parent = container_parent(parent, C_OUTPUT); |
109 | return sway_container_workspace_create(parent, name); | 109 | return container_workspace_create(parent, name); |
110 | } | 110 | } |
111 | 111 | ||
112 | /** | 112 | /** |
@@ -124,7 +124,7 @@ struct sway_container *workspace_output_prev_next_impl(struct sway_container *ou | |||
124 | struct sway_container *focus = sway_seat_get_focus_inactive(seat, output); | 124 | struct sway_container *focus = sway_seat_get_focus_inactive(seat, output); |
125 | struct sway_container *workspace = (focus->type == C_WORKSPACE ? | 125 | struct sway_container *workspace = (focus->type == C_WORKSPACE ? |
126 | focus : | 126 | focus : |
127 | sway_container_parent(focus, C_WORKSPACE)); | 127 | container_parent(focus, C_WORKSPACE)); |
128 | 128 | ||
129 | int i; | 129 | int i; |
130 | for (i = 0; i < output->children->length; i++) { | 130 | for (i = 0; i < output->children->length; i++) { |
@@ -207,7 +207,7 @@ bool workspace_switch(struct sway_container *workspace) { | |||
207 | } | 207 | } |
208 | struct sway_container *active_ws = focus; | 208 | struct sway_container *active_ws = focus; |
209 | if (active_ws->type != C_WORKSPACE) { | 209 | if (active_ws->type != C_WORKSPACE) { |
210 | sway_container_parent(focus, C_WORKSPACE); | 210 | container_parent(focus, C_WORKSPACE); |
211 | } | 211 | } |
212 | 212 | ||
213 | if (config->auto_back_and_forth | 213 | if (config->auto_back_and_forth |
@@ -236,7 +236,7 @@ bool workspace_switch(struct sway_container *workspace) { | |||
236 | next = workspace; | 236 | next = workspace; |
237 | } | 237 | } |
238 | sway_seat_set_focus(seat, next); | 238 | sway_seat_set_focus(seat, next); |
239 | struct sway_container *output = sway_container_parent(workspace, C_OUTPUT); | 239 | struct sway_container *output = container_parent(workspace, C_OUTPUT); |
240 | arrange_windows(output, -1, -1); | 240 | container_arrange_windows(output, -1, -1); |
241 | return true; | 241 | return true; |
242 | } | 242 | } |
diff --git a/swaybar/ipc.c b/swaybar/ipc.c index f9df0d10..2d2b3b69 100644 --- a/swaybar/ipc.c +++ b/swaybar/ipc.c | |||
@@ -352,7 +352,7 @@ void ipc_bar_init(struct bar *bar, const char *bar_id) { | |||
352 | } | 352 | } |
353 | 353 | ||
354 | // add bar to the output | 354 | // add bar to the output |
355 | struct output *bar_output = sway_container_output_create(name); | 355 | struct output *bar_output = container_output_create(name); |
356 | bar_output->idx = i; | 356 | bar_output->idx = i; |
357 | list_add(bar->outputs, bar_output); | 357 | list_add(bar->outputs, bar_output); |
358 | } | 358 | } |