aboutsummaryrefslogtreecommitdiff
path: root/sway/tree
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/container.c58
-rw-r--r--sway/tree/layout.c34
-rw-r--r--sway/tree/workspace.c22
3 files changed, 57 insertions, 57 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) {
if (cont->children) {
// remove children until there are no more, free_swayc calls
- // remove_child, which removes child from this container
+ // container_remove_child, which removes child from this container
while (cont->children->length) {
free_swayc(cont->children->items[0]);
}
@@ -78,7 +78,7 @@ static void free_swayc(struct sway_container *cont) {
list_free(cont->marks);
}
if (cont->parent) {
- remove_child(cont);
+ container_remove_child(cont);
}
if (cont->name) {
free(cont->name);
@@ -86,7 +86,7 @@ static void free_swayc(struct sway_container *cont) {
free(cont);
}
-struct sway_container *sway_container_output_create(struct sway_output *sway_output) {
+struct sway_container *container_output_create(struct sway_output *sway_output) {
struct wlr_box size;
wlr_output_effective_resolution(sway_output->wlr_output, &size.width,
&size.height);
@@ -131,12 +131,12 @@ struct sway_container *sway_container_output_create(struct sway_output *sway_out
apply_output_config(oc, output);
- add_child(&root_container, output);
+ container_add_child(&root_container, output);
// Create workspace
char *ws_name = workspace_next_name(output->name);
wlr_log(L_DEBUG, "Creating default workspace %s", ws_name);
- struct sway_container *ws = sway_container_workspace_create(output, ws_name);
+ struct sway_container *ws = container_workspace_create(output, ws_name);
// Set each seat's focus if not already set
struct sway_seat *seat = NULL;
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
return output;
}
-struct sway_container *sway_container_workspace_create(struct sway_container *output, const char *name) {
- if (!sway_assert(output, "sway_container_workspace_create called with null output")) {
+struct sway_container *container_workspace_create(struct sway_container *output, const char *name) {
+ if (!sway_assert(output, "container_workspace_create called with null output")) {
return NULL;
}
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
workspace->height = output->height;
workspace->name = !name ? NULL : strdup(name);
workspace->prev_layout = L_NONE;
- workspace->layout = default_layout(output);
- workspace->workspace_layout = default_layout(output);
+ workspace->layout = container_get_default_layout(output);
+ workspace->workspace_layout = container_get_default_layout(output);
- add_child(output, workspace);
- sort_workspaces(output);
+ container_add_child(output, workspace);
+ container_sort_workspaces(output);
notify_new_container(workspace);
return workspace;
}
-struct sway_container *sway_container_view_create(struct sway_container *sibling, struct sway_view *sway_view) {
- if (!sway_assert(sibling, "sway_container_view_create called with NULL sibling/parent")) {
+struct sway_container *container_view_create(struct sway_container *sibling, struct sway_view *sway_view) {
+ if (!sway_assert(sibling, "container_view_create called with NULL sibling/parent")) {
return NULL;
}
const char *title = view_get_title(sway_view);
@@ -188,17 +188,17 @@ struct sway_container *sway_container_view_create(struct sway_container *sibling
if (sibling->type == C_WORKSPACE) {
// Case of focused workspace, just create as child of it
- add_child(sibling, swayc);
+ container_add_child(sibling, swayc);
} else {
// Regular case, create as sibling of current container
- add_sibling(sibling, swayc);
+ container_add_sibling(sibling, swayc);
}
notify_new_container(swayc);
return swayc;
}
-struct sway_container *sway_container_output_destroy(struct sway_container *output) {
- if (!sway_assert(output, "null output passed to sway_container_output_destroy")) {
+struct sway_container *container_output_destroy(struct sway_container *output) {
+ if (!sway_assert(output, "null output passed to container_output_destroy")) {
return NULL;
}
@@ -211,11 +211,11 @@ struct sway_container *sway_container_output_destroy(struct sway_container *outp
// Move workspace from this output to another output
while (output->children->length) {
struct sway_container *child = output->children->items[0];
- remove_child(child);
- add_child(root_container.children->items[p], child);
+ container_remove_child(child);
+ container_add_child(root_container.children->items[p], child);
}
- sort_workspaces(root_container.children->items[p]);
- arrange_windows(root_container.children->items[p], -1, -1);
+ container_sort_workspaces(root_container.children->items[p]);
+ container_arrange_windows(root_container.children->items[p], -1, -1);
}
}
@@ -229,7 +229,7 @@ struct sway_container *sway_container_output_destroy(struct sway_container *outp
return &root_container;
}
-struct sway_container *sway_container_view_destroy(struct sway_container *view) {
+struct sway_container *container_view_destroy(struct sway_container *view) {
if (!view) {
return NULL;
}
@@ -246,7 +246,7 @@ struct sway_container *sway_container_view_destroy(struct sway_container *view)
return parent;
}
-struct sway_container *swayc_change_layout(struct sway_container *container, enum sway_container_layout layout) {
+struct sway_container *container_set_layout(struct sway_container *container, enum sway_container_layout layout) {
if (container->type == C_WORKSPACE) {
container->workspace_layout = layout;
if (layout == L_HORIZ || layout == L_VERT) {
@@ -258,7 +258,7 @@ struct sway_container *swayc_change_layout(struct sway_container *container, enu
return container;
}
-void sway_container_descendents(struct sway_container *root, enum sway_container_type type,
+void container_descendents(struct sway_container *root, enum sway_container_type type,
void (*func)(struct sway_container *item, void *data), void *data) {
for (int i = 0; i < root->children->length; ++i) {
struct sway_container *item = root->children->items[i];
@@ -266,12 +266,12 @@ void sway_container_descendents(struct sway_container *root, enum sway_container
func(item, data);
}
if (item->children && item->children->length) {
- sway_container_descendents(item, type, func, data);
+ container_descendents(item, type, func, data);
}
}
}
-struct sway_container *sway_container_find(struct sway_container *container,
+struct sway_container *container_find(struct sway_container *container,
bool (*test)(struct sway_container *view, void *data), void *data) {
if (!container->children) {
return NULL;
@@ -282,7 +282,7 @@ struct sway_container *sway_container_find(struct sway_container *container,
if (test(child, data)) {
return child;
} else {
- struct sway_container *res = sway_container_find(child, test, data);
+ struct sway_container *res = container_find(child, test, data);
if (res) {
return res;
}
@@ -291,7 +291,7 @@ struct sway_container *sway_container_find(struct sway_container *container,
return NULL;
}
-struct sway_container *sway_container_parent(struct sway_container *container, enum sway_container_type type) {
+struct sway_container *container_parent(struct sway_container *container, enum sway_container_type type) {
if (!sway_assert(container, "container is NULL")) {
return NULL;
}
@@ -341,7 +341,7 @@ struct sway_container *sway_container_at(struct sway_container *parent, double l
list_del(queue, 0);
if (swayc->type == C_VIEW) {
struct sway_view *sview = swayc->sway_view;
- struct sway_container *soutput = sway_container_parent(swayc, C_OUTPUT);
+ struct sway_container *soutput = container_parent(swayc, C_OUTPUT);
struct wlr_box *output_box =
wlr_output_layout_get_box(
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
output_container->height = output_box->height;
}
- arrange_windows(&root_container, -1, -1);
+ container_arrange_windows(&root_container, -1, -1);
}
void init_layout(void) {
@@ -79,7 +79,7 @@ static int index_child(const struct sway_container *child) {
return i;
}
-struct sway_container *add_sibling(struct sway_container *fixed, struct sway_container *active) {
+struct sway_container *container_add_sibling(struct sway_container *fixed, struct sway_container *active) {
// TODO handle floating
struct sway_container *parent = fixed->parent;
int i = index_child(fixed);
@@ -88,7 +88,7 @@ struct sway_container *add_sibling(struct sway_container *fixed, struct sway_con
return active->parent;
}
-void add_child(struct sway_container *parent, struct sway_container *child) {
+void container_add_child(struct sway_container *parent, struct sway_container *child) {
wlr_log(L_DEBUG, "Adding %p (%d, %fx%f) to %p (%d, %fx%f)",
child, child->type, child->width, child->height,
parent, parent->type, parent->width, parent->height);
@@ -102,7 +102,7 @@ void add_child(struct sway_container *parent, struct sway_container *child) {
*/
}
-struct sway_container *remove_child(struct sway_container *child) {
+struct sway_container *container_remove_child(struct sway_container *child) {
int i;
struct sway_container *parent = child->parent;
for (i = 0; i < parent->children->length; ++i) {
@@ -115,7 +115,7 @@ struct sway_container *remove_child(struct sway_container *child) {
return parent;
}
-enum sway_container_layout default_layout(struct sway_container *output) {
+enum sway_container_layout container_get_default_layout(struct sway_container *output) {
/* TODO WLR
if (config->default_layout != L_NONE) {
//return config->default_layout;
@@ -146,7 +146,7 @@ static int sort_workspace_cmp_qsort(const void *_a, const void *_b) {
return retval;
}
-void sort_workspaces(struct sway_container *output) {
+void container_sort_workspaces(struct sway_container *output) {
list_stable_sort(output->children, sort_workspace_cmp_qsort);
}
@@ -160,7 +160,7 @@ static void apply_vert_layout(struct sway_container *container, const double x,
const double height, const int start,
const int end);
-void arrange_windows(struct sway_container *container, double width, double height) {
+void container_arrange_windows(struct sway_container *container, double width, double height) {
int i;
if (width == -1 || height == -1) {
width = container->width;
@@ -184,7 +184,7 @@ void arrange_windows(struct sway_container *container, double width, double heig
struct sway_container *output = container->children->items[i];
wlr_log(L_DEBUG, "Arranging output '%s' at %f,%f",
output->name, output->x, output->y);
- arrange_windows(output, -1, -1);
+ container_arrange_windows(output, -1, -1);
}
return;
case C_OUTPUT:
@@ -198,12 +198,12 @@ void arrange_windows(struct sway_container *container, double width, double heig
// arrange all workspaces:
for (i = 0; i < container->children->length; ++i) {
struct sway_container *child = container->children->items[i];
- arrange_windows(child, -1, -1);
+ container_arrange_windows(child, -1, -1);
}
return;
case C_WORKSPACE:
{
- struct sway_container *output = sway_container_parent(container, C_OUTPUT);
+ struct sway_container *output = container_parent(container, C_OUTPUT);
struct wlr_box *area = &output->sway_output->usable_area;
wlr_log(L_DEBUG, "Usable area for ws: %dx%d@%d,%d",
area->width, area->height, area->x, area->y);
@@ -284,9 +284,9 @@ static void apply_horiz_layout(struct sway_container *container,
if (i == end - 1) {
double remaining_width = x + width - child_x;
- arrange_windows(child, remaining_width, height);
+ container_arrange_windows(child, remaining_width, height);
} else {
- arrange_windows(child, child->width * scale, height);
+ container_arrange_windows(child, child->width * scale, height);
}
child_x += child->width;
}
@@ -334,9 +334,9 @@ void apply_vert_layout(struct sway_container *container,
if (i == end - 1) {
double remaining_height = y + height - child_y;
- arrange_windows(child, width, remaining_height);
+ container_arrange_windows(child, width, remaining_height);
} else {
- arrange_windows(child, width, child->height * scale);
+ container_arrange_windows(child, width, child->height * scale);
}
child_y += child->height;
}
@@ -362,7 +362,7 @@ static struct sway_container *get_swayc_in_output_direction(struct sway_containe
struct sway_container *ws = sway_seat_get_focus_inactive(seat, output);
if (ws->type != C_WORKSPACE) {
- ws = sway_container_parent(ws, C_WORKSPACE);
+ ws = container_parent(ws, C_WORKSPACE);
}
if (ws == NULL) {
@@ -410,7 +410,7 @@ static void get_layout_center_position(struct sway_container *container, int *x,
*x = container->x + container->width/2;
*y = container->y + container->height/2;
} else {
- struct sway_container *output = sway_container_parent(container, C_OUTPUT);
+ struct sway_container *output = container_parent(container, C_OUTPUT);
if (container->type == C_WORKSPACE) {
// Workspace coordinates are actually wrong/arbitrary, but should
// be same as output.
@@ -496,7 +496,7 @@ static struct sway_container *get_swayc_in_direction_under(struct sway_container
/*
if (container->type == C_VIEW && swayc_is_fullscreen(container)) {
wlr_log(L_DEBUG, "Moving from fullscreen view, skipping to output");
- container = sway_container_parent(container, C_OUTPUT);
+ container = container_parent(container, C_OUTPUT);
get_layout_center_position(container, &abs_pos);
struct sway_container *output = swayc_adjacent_output(container, dir, &abs_pos, true);
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) {
if (wbnd.len <= 0) {
return NULL;
}
- return sway_container_find(&root_container, _workspace_by_number, (void *) &wbnd);
+ return container_find(&root_container, _workspace_by_number, (void *) &wbnd);
}
static bool _workspace_by_name(struct sway_container *view, void *data) {
@@ -65,8 +65,8 @@ struct sway_container *workspace_by_name(const char *name) {
struct sway_container *current_workspace = NULL, *current_output = NULL;
struct sway_container *focus = sway_seat_get_focus(seat);
if (focus) {
- current_workspace = sway_container_parent(focus, C_WORKSPACE);
- current_output = sway_container_parent(focus, C_OUTPUT);
+ current_workspace = container_parent(focus, C_WORKSPACE);
+ current_output = container_parent(focus, C_OUTPUT);
}
if (strcmp(name, "prev") == 0) {
return workspace_prev(current_workspace);
@@ -79,7 +79,7 @@ struct sway_container *workspace_by_name(const char *name) {
} else if (strcmp(name, "current") == 0) {
return current_workspace;
} else {
- return sway_container_find(&root_container, _workspace_by_name, (void *) name);
+ return container_find(&root_container, _workspace_by_name, (void *) name);
}
}
@@ -95,7 +95,7 @@ struct sway_container *workspace_create(const char *name) {
for (i = 0; i < e; ++i) {
parent = root_container.children->items[i];
if (strcmp(parent->name, wso->output) == 0) {
- return sway_container_workspace_create(parent, name);
+ return container_workspace_create(parent, name);
}
}
break;
@@ -105,8 +105,8 @@ struct sway_container *workspace_create(const char *name) {
struct sway_seat *seat = input_manager_current_seat(input_manager);
struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container);
parent = focus;
- parent = sway_container_parent(parent, C_OUTPUT);
- return sway_container_workspace_create(parent, name);
+ parent = container_parent(parent, C_OUTPUT);
+ return container_workspace_create(parent, name);
}
/**
@@ -124,7 +124,7 @@ struct sway_container *workspace_output_prev_next_impl(struct sway_container *ou
struct sway_container *focus = sway_seat_get_focus_inactive(seat, output);
struct sway_container *workspace = (focus->type == C_WORKSPACE ?
focus :
- sway_container_parent(focus, C_WORKSPACE));
+ container_parent(focus, C_WORKSPACE));
int i;
for (i = 0; i < output->children->length; i++) {
@@ -207,7 +207,7 @@ bool workspace_switch(struct sway_container *workspace) {
}
struct sway_container *active_ws = focus;
if (active_ws->type != C_WORKSPACE) {
- sway_container_parent(focus, C_WORKSPACE);
+ container_parent(focus, C_WORKSPACE);
}
if (config->auto_back_and_forth
@@ -236,7 +236,7 @@ bool workspace_switch(struct sway_container *workspace) {
next = workspace;
}
sway_seat_set_focus(seat, next);
- struct sway_container *output = sway_container_parent(workspace, C_OUTPUT);
- arrange_windows(output, -1, -1);
+ struct sway_container *output = container_parent(workspace, C_OUTPUT);
+ container_arrange_windows(output, -1, -1);
return true;
}