diff options
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r-- | sway/tree/container.c | 58 |
1 files changed, 29 insertions, 29 deletions
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, |