mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 09:51:29 +00:00
more renaming things
This commit is contained in:
parent
b90099b4b7
commit
eca029f218
|
@ -88,41 +88,38 @@ struct sway_container {
|
|||
};
|
||||
|
||||
// TODO only one container create function and pass the type?
|
||||
struct sway_container *sway_container_output_create(
|
||||
struct sway_container *container_output_create(
|
||||
struct sway_output *sway_output);
|
||||
|
||||
struct sway_container *sway_container_workspace_create(
|
||||
struct sway_container *container_workspace_create(
|
||||
struct sway_container *output, const char *name);
|
||||
|
||||
struct sway_container *sway_container_view_create(
|
||||
struct sway_container *container_view_create(
|
||||
struct sway_container *sibling, struct sway_view *sway_view);
|
||||
|
||||
struct sway_container *sway_container_output_destroy(
|
||||
struct sway_container *container_output_destroy(
|
||||
struct sway_container *output);
|
||||
|
||||
struct sway_container *sway_container_view_destroy(struct sway_container *view);
|
||||
struct sway_container *container_view_destroy(struct sway_container *view);
|
||||
|
||||
struct sway_container *sway_container_set_layout(
|
||||
struct sway_container *container_set_layout(
|
||||
struct sway_container *container, enum sway_container_layout layout);
|
||||
|
||||
void sway_container_descendents(struct sway_container *root,
|
||||
void container_descendents(struct sway_container *root,
|
||||
enum sway_container_type type,
|
||||
void (*func)(struct sway_container *item, void *data), void *data);
|
||||
|
||||
// XXX: what is this?
|
||||
struct sway_container *next_view_sibling(struct sway_seat *seat);
|
||||
|
||||
/**
|
||||
* Finds a container based on test criteria. Returns the first container that
|
||||
* passes the test.
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* Finds a parent container with the given struct sway_containerype.
|
||||
*/
|
||||
struct sway_container *sway_container_parent(struct sway_container *container,
|
||||
struct sway_container *container_parent(struct sway_container *container,
|
||||
enum sway_container_type type);
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,23 +30,23 @@ struct sway_root {
|
|||
} events;
|
||||
};
|
||||
|
||||
void init_layout(void);
|
||||
void layout_init(void);
|
||||
|
||||
void add_child(struct sway_container *parent, struct sway_container *child);
|
||||
void container_add_child(struct sway_container *parent, struct sway_container *child);
|
||||
|
||||
struct sway_container *add_sibling(struct sway_container *parent,
|
||||
struct sway_container *container_add_sibling(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);
|
||||
|
||||
enum sway_container_layout default_layout(struct sway_container *output);
|
||||
enum sway_container_layout container_get_default_layout(struct sway_container *output);
|
||||
|
||||
void sort_workspaces(struct sway_container *output);
|
||||
void container_sort_workspaces(struct sway_container *output);
|
||||
|
||||
void arrange_windows(struct sway_container *container,
|
||||
void container_arrange_windows(struct sway_container *container,
|
||||
double width, double height);
|
||||
|
||||
struct sway_container *get_swayc_in_direction(struct sway_container
|
||||
struct sway_container *container_get_in_direction(struct sway_container
|
||||
*container, struct sway_seat *seat, enum movement_direction dir);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,10 +26,10 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
|
|||
// TODO: stacks and tabs
|
||||
|
||||
if (strcasecmp(argv[0], "default") == 0) {
|
||||
swayc_change_layout(parent, parent->prev_layout);
|
||||
container_set_layout(parent, parent->prev_layout);
|
||||
if (parent->layout == L_NONE) {
|
||||
struct sway_container *output = sway_container_parent(parent, C_OUTPUT);
|
||||
swayc_change_layout(parent, default_layout(output));
|
||||
struct sway_container *output = container_parent(parent, C_OUTPUT);
|
||||
container_set_layout(parent, container_get_default_layout(output));
|
||||
}
|
||||
} else {
|
||||
if (parent->layout != L_TABBED && parent->layout != L_STACKED) {
|
||||
|
@ -37,20 +37,20 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
|
|||
}
|
||||
|
||||
if (strcasecmp(argv[0], "splith") == 0) {
|
||||
swayc_change_layout(parent, L_HORIZ);
|
||||
container_set_layout(parent, L_HORIZ);
|
||||
} else if (strcasecmp(argv[0], "splitv") == 0) {
|
||||
swayc_change_layout(parent, L_VERT);
|
||||
container_set_layout(parent, L_VERT);
|
||||
} else if (strcasecmp(argv[0], "toggle") == 0 && argc == 2 && strcasecmp(argv[1], "split") == 0) {
|
||||
if (parent->layout == L_HORIZ && (parent->workspace_layout == L_NONE
|
||||
|| parent->workspace_layout == L_HORIZ)) {
|
||||
swayc_change_layout(parent, L_VERT);
|
||||
container_set_layout(parent, L_VERT);
|
||||
} else {
|
||||
swayc_change_layout(parent, L_HORIZ);
|
||||
container_set_layout(parent, L_HORIZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
arrange_windows(parent, parent->width, parent->height);
|
||||
container_arrange_windows(parent, parent->width, parent->height);
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
|
|
@ -13,6 +13,6 @@ struct cmd_results *cmd_reload(int argc, char **argv) {
|
|||
|
||||
/* load_swaybars(); -- for when it's implemented */
|
||||
|
||||
arrange_windows(&root_container, -1, -1);
|
||||
container_arrange_windows(&root_container, -1, -1);
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
|
|
@ -23,9 +23,9 @@ struct cmd_results *cmd_workspace(int argc, char **argv) {
|
|||
if (current_container->type == C_WORKSPACE) {
|
||||
old_workspace = current_container;
|
||||
} else {
|
||||
old_workspace = sway_container_parent(current_container, C_WORKSPACE);
|
||||
old_workspace = container_parent(current_container, C_WORKSPACE);
|
||||
}
|
||||
old_output = sway_container_parent(current_container, C_OUTPUT);
|
||||
old_output = container_parent(current_container, C_OUTPUT);
|
||||
}
|
||||
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
|
@ -92,7 +92,7 @@ struct cmd_results *cmd_workspace(int argc, char **argv) {
|
|||
workspace_switch(ws);
|
||||
current_container =
|
||||
sway_seat_get_focus(config->handler_context.seat);
|
||||
struct sway_container *new_output = sway_container_parent(current_container, C_OUTPUT);
|
||||
struct sway_container *new_output = container_parent(current_container, C_OUTPUT);
|
||||
|
||||
if (config->mouse_warping && old_output != new_output) {
|
||||
// TODO: Warp mouse
|
||||
|
|
|
@ -127,7 +127,7 @@ void apply_output_config(struct output_config *oc, struct sway_container *output
|
|||
if (oc && oc->enabled == 0) {
|
||||
wlr_output_layout_remove(root_container.sway_root->output_layout,
|
||||
wlr_output);
|
||||
sway_container_output_destroy(output);
|
||||
container_output_destroy(output);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ void arrange_layers(struct sway_output *output) {
|
|||
if (memcmp(&usable_area_before,
|
||||
&usable_area, sizeof(struct wlr_box)) != 0) {
|
||||
wlr_log(L_DEBUG, "arrange");
|
||||
arrange_windows(output->swayc, -1, -1);
|
||||
container_arrange_windows(output->swayc, -1, -1);
|
||||
}
|
||||
|
||||
// Arrange non-exlusive surfaces from top->bottom
|
||||
|
|
|
@ -221,13 +221,13 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
|
|||
struct sway_container *focus = sway_seat_get_focus_inactive(seat, soutput->swayc);
|
||||
struct sway_container *workspace = (focus->type == C_WORKSPACE ?
|
||||
focus :
|
||||
sway_container_parent(focus, C_WORKSPACE));
|
||||
container_parent(focus, C_WORKSPACE));
|
||||
|
||||
struct render_data rdata = {
|
||||
.output = soutput,
|
||||
.now = &now,
|
||||
};
|
||||
sway_container_descendents(workspace, C_VIEW, output_frame_view, &rdata);
|
||||
container_descendents(workspace, C_VIEW, output_frame_view, &rdata);
|
||||
|
||||
// render unmanaged views on top
|
||||
struct sway_view *view;
|
||||
|
@ -258,13 +258,13 @@ static void handle_output_destroy(struct wl_listener *listener, void *data) {
|
|||
struct wlr_output *wlr_output = data;
|
||||
wlr_log(L_DEBUG, "Output %p %s removed", wlr_output, wlr_output->name);
|
||||
|
||||
sway_container_output_destroy(output->swayc);
|
||||
container_output_destroy(output->swayc);
|
||||
}
|
||||
|
||||
static void handle_output_mode(struct wl_listener *listener, void *data) {
|
||||
struct sway_output *output = wl_container_of(listener, output, mode);
|
||||
arrange_layers(output);
|
||||
arrange_windows(output->swayc, -1, -1);
|
||||
container_arrange_windows(output->swayc, -1, -1);
|
||||
}
|
||||
|
||||
void handle_new_output(struct wl_listener *listener, void *data) {
|
||||
|
@ -286,7 +286,7 @@ void handle_new_output(struct wl_listener *listener, void *data) {
|
|||
wlr_output_set_mode(wlr_output, mode);
|
||||
}
|
||||
|
||||
output->swayc = sway_container_output_create(output);
|
||||
output->swayc = container_output_create(output);
|
||||
if (!output->swayc) {
|
||||
free(output);
|
||||
return;
|
||||
|
@ -307,5 +307,5 @@ void handle_new_output(struct wl_listener *listener, void *data) {
|
|||
output->mode.notify = handle_output_mode;
|
||||
|
||||
arrange_layers(output);
|
||||
arrange_windows(&root_container, -1, -1);
|
||||
container_arrange_windows(&root_container, -1, -1);
|
||||
}
|
||||
|
|
|
@ -74,10 +74,10 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
|
|||
wl_container_of(listener, sway_surface, destroy);
|
||||
wl_list_remove(&sway_surface->commit.link);
|
||||
wl_list_remove(&sway_surface->destroy.link);
|
||||
struct sway_container *parent = sway_container_view_destroy(sway_surface->view->swayc);
|
||||
struct sway_container *parent = container_view_destroy(sway_surface->view->swayc);
|
||||
free(sway_surface->view);
|
||||
free(sway_surface);
|
||||
arrange_windows(parent, -1, -1);
|
||||
container_arrange_windows(parent, -1, -1);
|
||||
}
|
||||
|
||||
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) {
|
|||
|
||||
struct sway_seat *seat = input_manager_current_seat(input_manager);
|
||||
struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container);
|
||||
struct sway_container *cont = sway_container_view_create(focus, sway_view);
|
||||
struct sway_container *cont = container_view_create(focus, sway_view);
|
||||
sway_view->swayc = cont;
|
||||
|
||||
arrange_windows(cont->parent, -1, -1);
|
||||
container_arrange_windows(cont->parent, -1, -1);
|
||||
sway_input_manager_set_focus(input_manager, cont);
|
||||
}
|
||||
|
|
|
@ -83,10 +83,10 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
|
|||
wl_container_of(listener, sway_xdg_surface, destroy);
|
||||
wl_list_remove(&sway_xdg_surface->commit.link);
|
||||
wl_list_remove(&sway_xdg_surface->destroy.link);
|
||||
struct sway_container *parent = sway_container_view_destroy(sway_xdg_surface->view->swayc);
|
||||
struct sway_container *parent = container_view_destroy(sway_xdg_surface->view->swayc);
|
||||
free(sway_xdg_surface->view);
|
||||
free(sway_xdg_surface);
|
||||
arrange_windows(parent, -1, -1);
|
||||
container_arrange_windows(parent, -1, -1);
|
||||
}
|
||||
|
||||
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) {
|
|||
|
||||
struct sway_seat *seat = input_manager_current_seat(input_manager);
|
||||
struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container);
|
||||
struct sway_container *cont = sway_container_view_create(focus, sway_view);
|
||||
struct sway_container *cont = container_view_create(focus, sway_view);
|
||||
sway_view->swayc = cont;
|
||||
|
||||
arrange_windows(cont->parent, -1, -1);
|
||||
container_arrange_windows(cont->parent, -1, -1);
|
||||
|
||||
sway_input_manager_set_focus(input_manager, cont);
|
||||
}
|
||||
|
|
|
@ -49,11 +49,11 @@ static void set_position(struct sway_view *view, double ox, double oy) {
|
|||
if (!assert_xwayland(view)) {
|
||||
return;
|
||||
}
|
||||
struct sway_container *output = sway_container_parent(view->swayc, C_OUTPUT);
|
||||
struct sway_container *output = container_parent(view->swayc, C_OUTPUT);
|
||||
if (!sway_assert(output, "view must be within tree to set position")) {
|
||||
return;
|
||||
}
|
||||
struct sway_container *root = sway_container_parent(output, C_ROOT);
|
||||
struct sway_container *root = container_parent(output, C_ROOT);
|
||||
if (!sway_assert(root, "output must be within tree to set position")) {
|
||||
return;
|
||||
}
|
||||
|
@ -114,9 +114,9 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
|
|||
}
|
||||
}
|
||||
|
||||
struct sway_container *parent = sway_container_view_destroy(sway_surface->view->swayc);
|
||||
struct sway_container *parent = container_view_destroy(sway_surface->view->swayc);
|
||||
if (parent) {
|
||||
arrange_windows(parent, -1, -1);
|
||||
container_arrange_windows(parent, -1, -1);
|
||||
}
|
||||
|
||||
free(sway_surface->view);
|
||||
|
@ -132,9 +132,9 @@ static void handle_unmap_notify(struct wl_listener *listener, void *data) {
|
|||
}
|
||||
|
||||
// take it out of the tree
|
||||
struct sway_container *parent = sway_container_view_destroy(sway_surface->view->swayc);
|
||||
struct sway_container *parent = container_view_destroy(sway_surface->view->swayc);
|
||||
if (parent) {
|
||||
arrange_windows(parent, -1, -1);
|
||||
container_arrange_windows(parent, -1, -1);
|
||||
}
|
||||
|
||||
sway_surface->view->swayc = NULL;
|
||||
|
@ -155,15 +155,15 @@ static void handle_map_notify(struct wl_listener *listener, void *data) {
|
|||
&sway_surface->view->unmanaged_view_link);
|
||||
} else {
|
||||
struct sway_view *view = sway_surface->view;
|
||||
sway_container_view_destroy(view->swayc);
|
||||
container_view_destroy(view->swayc);
|
||||
|
||||
struct sway_container *parent = root_container.children->items[0];
|
||||
parent = parent->children->items[0]; // workspace
|
||||
|
||||
struct sway_container *cont = sway_container_view_create(parent, view);
|
||||
struct sway_container *cont = container_view_create(parent, view);
|
||||
view->swayc = cont;
|
||||
|
||||
arrange_windows(cont->parent, -1, -1);
|
||||
container_arrange_windows(cont->parent, -1, -1);
|
||||
sway_input_manager_set_focus(input_manager, cont);
|
||||
}
|
||||
}
|
||||
|
@ -239,9 +239,9 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
|
|||
|
||||
struct sway_seat *seat = input_manager_current_seat(input_manager);
|
||||
struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container);
|
||||
struct sway_container *cont = sway_container_view_create(focus, sway_view);
|
||||
struct sway_container *cont = container_view_create(focus, sway_view);
|
||||
sway_view->swayc = cont;
|
||||
|
||||
arrange_windows(cont->parent, -1, -1);
|
||||
container_arrange_windows(cont->parent, -1, -1);
|
||||
sway_input_manager_set_focus(input_manager, cont);
|
||||
}
|
||||
|
|
|
@ -365,7 +365,7 @@ struct sway_container *sway_seat_get_focus_by_type(struct sway_seat *seat,
|
|||
return focus;
|
||||
}
|
||||
|
||||
return sway_container_parent(focus, type);
|
||||
return container_parent(focus, type);
|
||||
}
|
||||
|
||||
void sway_seat_set_config(struct sway_seat *seat,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -352,7 +352,7 @@ void ipc_bar_init(struct bar *bar, const char *bar_id) {
|
|||
}
|
||||
|
||||
// add bar to the output
|
||||
struct output *bar_output = sway_container_output_create(name);
|
||||
struct output *bar_output = container_output_create(name);
|
||||
bar_output->idx = i;
|
||||
list_add(bar->outputs, bar_output);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue