move container_set_layout to layout.h

master
Tony Crisci 7 years ago
parent fcbcbf34ad
commit 065887bb7b

@ -132,10 +132,6 @@ struct sway_container *container_destroy(struct sway_container *container);
struct sway_container *container_close(struct sway_container *container);
// TODO move to layout.c
struct sway_container *container_set_layout(struct sway_container *container,
enum sway_container_layout layout);
// TODO rename to container_descendants_for_each()
void container_descendants(struct sway_container *root,
enum sway_container_type type,

@ -41,10 +41,13 @@ struct sway_container *container_add_sibling(struct sway_container *parent,
struct sway_container *container_remove_child(struct sway_container *child);
// TODO PRIVATE in tree.h
struct sway_container *container_replace_child(struct sway_container *child,
struct sway_container *new_child);
// TODO move to layout.c
struct sway_container *container_set_layout(struct sway_container *container,
enum sway_container_layout layout);
// TODO move to tree.h
void container_move_to(struct sway_container* container,
struct sway_container* destination);

@ -441,19 +441,6 @@ struct sway_container *container_view_create(struct sway_container *sibling,
return swayc;
}
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) {
container->layout = layout;
}
} else {
container->layout = layout;
}
return container;
}
void container_descendants(struct sway_container *root,
enum sway_container_type type,
void (*func)(struct sway_container *item, void *data), void *data) {

@ -47,6 +47,19 @@ static void output_layout_change_notify(struct wl_listener *listener,
arrange_windows(&root_container, -1, -1);
}
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) {
container->layout = layout;
}
} else {
container->layout = layout;
}
return container;
}
void layout_init(void) {
root_container.id = 0; // normally assigned in new_swayc()
root_container.type = C_ROOT;

Loading…
Cancel
Save