mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 18:01:29 +00:00
arrange windows
This commit is contained in:
parent
92c58b1e63
commit
2778edef97
|
@ -43,7 +43,7 @@ enum sway_container_layout container_get_default_layout(struct sway_container *o
|
|||
|
||||
void container_sort_workspaces(struct sway_container *output);
|
||||
|
||||
void container_arrange_windows(struct sway_container *container,
|
||||
void arrange_windows(struct sway_container *container,
|
||||
double width, double height);
|
||||
|
||||
struct sway_container *container_get_in_direction(struct sway_container
|
||||
|
|
|
@ -50,7 +50,7 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
|
|||
}
|
||||
}
|
||||
|
||||
container_arrange_windows(parent, parent->width, parent->height);
|
||||
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 */
|
||||
|
||||
container_arrange_windows(&root_container, -1, -1);
|
||||
arrange_windows(&root_container, -1, -1);
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
container_arrange_windows(output->swayc, -1, -1);
|
||||
arrange_windows(output->swayc, -1, -1);
|
||||
}
|
||||
|
||||
// Arrange non-exlusive surfaces from top->bottom
|
||||
|
|
|
@ -264,7 +264,7 @@ static void handle_output_destroy(struct wl_listener *listener, void *data) {
|
|||
static void handle_output_mode(struct wl_listener *listener, void *data) {
|
||||
struct sway_output *output = wl_container_of(listener, output, mode);
|
||||
arrange_layers(output);
|
||||
container_arrange_windows(output->swayc, -1, -1);
|
||||
arrange_windows(output->swayc, -1, -1);
|
||||
}
|
||||
|
||||
void handle_new_output(struct wl_listener *listener, void *data) {
|
||||
|
@ -307,5 +307,5 @@ void handle_new_output(struct wl_listener *listener, void *data) {
|
|||
output->mode.notify = handle_output_mode;
|
||||
|
||||
arrange_layers(output);
|
||||
container_arrange_windows(&root_container, -1, -1);
|
||||
arrange_windows(&root_container, -1, -1);
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
|
|||
struct sway_container *parent = container_view_destroy(sway_surface->view->swayc);
|
||||
free(sway_surface->view);
|
||||
free(sway_surface);
|
||||
container_arrange_windows(parent, -1, -1);
|
||||
arrange_windows(parent, -1, -1);
|
||||
}
|
||||
|
||||
void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
|
||||
|
@ -136,6 +136,6 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
|
|||
struct sway_container *cont = container_view_create(focus, sway_view);
|
||||
sway_view->swayc = cont;
|
||||
|
||||
container_arrange_windows(cont->parent, -1, -1);
|
||||
arrange_windows(cont->parent, -1, -1);
|
||||
sway_input_manager_set_focus(input_manager, cont);
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
|
|||
struct sway_container *parent = container_view_destroy(sway_xdg_surface->view->swayc);
|
||||
free(sway_xdg_surface->view);
|
||||
free(sway_xdg_surface);
|
||||
container_arrange_windows(parent, -1, -1);
|
||||
arrange_windows(parent, -1, -1);
|
||||
}
|
||||
|
||||
void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
|
||||
|
@ -140,7 +140,7 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
|
|||
struct sway_container *cont = container_view_create(focus, sway_view);
|
||||
sway_view->swayc = cont;
|
||||
|
||||
container_arrange_windows(cont->parent, -1, -1);
|
||||
arrange_windows(cont->parent, -1, -1);
|
||||
|
||||
sway_input_manager_set_focus(input_manager, cont);
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
|
|||
|
||||
struct sway_container *parent = container_view_destroy(sway_surface->view->swayc);
|
||||
if (parent) {
|
||||
container_arrange_windows(parent, -1, -1);
|
||||
arrange_windows(parent, -1, -1);
|
||||
}
|
||||
|
||||
free(sway_surface->view);
|
||||
|
@ -134,7 +134,7 @@ static void handle_unmap_notify(struct wl_listener *listener, void *data) {
|
|||
// take it out of the tree
|
||||
struct sway_container *parent = container_view_destroy(sway_surface->view->swayc);
|
||||
if (parent) {
|
||||
container_arrange_windows(parent, -1, -1);
|
||||
arrange_windows(parent, -1, -1);
|
||||
}
|
||||
|
||||
sway_surface->view->swayc = NULL;
|
||||
|
@ -163,7 +163,7 @@ static void handle_map_notify(struct wl_listener *listener, void *data) {
|
|||
struct sway_container *cont = container_view_create(parent, view);
|
||||
view->swayc = cont;
|
||||
|
||||
container_arrange_windows(cont->parent, -1, -1);
|
||||
arrange_windows(cont->parent, -1, -1);
|
||||
sway_input_manager_set_focus(input_manager, cont);
|
||||
}
|
||||
}
|
||||
|
@ -242,6 +242,6 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
|
|||
struct sway_container *cont = container_view_create(focus, sway_view);
|
||||
sway_view->swayc = cont;
|
||||
|
||||
container_arrange_windows(cont->parent, -1, -1);
|
||||
arrange_windows(cont->parent, -1, -1);
|
||||
sway_input_manager_set_focus(input_manager, cont);
|
||||
}
|
||||
|
|
|
@ -221,7 +221,7 @@ struct sway_container *container_output_destroy(struct sway_container *output) {
|
|||
container_add_child(root_container.children->items[p], child);
|
||||
}
|
||||
container_sort_workspaces(root_container.children->items[p]);
|
||||
container_arrange_windows(root_container.children->items[p],
|
||||
arrange_windows(root_container.children->items[p],
|
||||
-1, -1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ static void output_layout_change_notify(struct wl_listener *listener,
|
|||
output_container->height = output_box->height;
|
||||
}
|
||||
|
||||
container_arrange_windows(&root_container, -1, -1);
|
||||
arrange_windows(&root_container, -1, -1);
|
||||
}
|
||||
|
||||
void layout_init(void) {
|
||||
|
@ -167,7 +167,7 @@ static void apply_vert_layout(struct sway_container *container, const double x,
|
|||
const double height, const int start,
|
||||
const int end);
|
||||
|
||||
void container_arrange_windows(struct sway_container *container,
|
||||
void arrange_windows(struct sway_container *container,
|
||||
double width, double height) {
|
||||
int i;
|
||||
if (width == -1 || height == -1) {
|
||||
|
@ -192,7 +192,7 @@ void container_arrange_windows(struct sway_container *container,
|
|||
struct sway_container *output = container->children->items[i];
|
||||
wlr_log(L_DEBUG, "Arranging output '%s' at %f,%f",
|
||||
output->name, output->x, output->y);
|
||||
container_arrange_windows(output, -1, -1);
|
||||
arrange_windows(output, -1, -1);
|
||||
}
|
||||
return;
|
||||
case C_OUTPUT:
|
||||
|
@ -206,7 +206,7 @@ void container_arrange_windows(struct sway_container *container,
|
|||
// arrange all workspaces:
|
||||
for (i = 0; i < container->children->length; ++i) {
|
||||
struct sway_container *child = container->children->items[i];
|
||||
container_arrange_windows(child, -1, -1);
|
||||
arrange_windows(child, -1, -1);
|
||||
}
|
||||
return;
|
||||
case C_WORKSPACE:
|
||||
|
@ -294,9 +294,9 @@ static void apply_horiz_layout(struct sway_container *container,
|
|||
|
||||
if (i == end - 1) {
|
||||
double remaining_width = x + width - child_x;
|
||||
container_arrange_windows(child, remaining_width, height);
|
||||
arrange_windows(child, remaining_width, height);
|
||||
} else {
|
||||
container_arrange_windows(child, child->width * scale, height);
|
||||
arrange_windows(child, child->width * scale, height);
|
||||
}
|
||||
child_x += child->width;
|
||||
}
|
||||
|
@ -345,9 +345,9 @@ void apply_vert_layout(struct sway_container *container,
|
|||
|
||||
if (i == end - 1) {
|
||||
double remaining_height = y + height - child_y;
|
||||
container_arrange_windows(child, width, remaining_height);
|
||||
arrange_windows(child, width, remaining_height);
|
||||
} else {
|
||||
container_arrange_windows(child, width, child->height * scale);
|
||||
arrange_windows(child, width, child->height * scale);
|
||||
}
|
||||
child_y += child->height;
|
||||
}
|
||||
|
|
|
@ -247,6 +247,6 @@ bool workspace_switch(struct sway_container *workspace) {
|
|||
}
|
||||
sway_seat_set_focus(seat, next);
|
||||
struct sway_container *output = container_parent(workspace, C_OUTPUT);
|
||||
container_arrange_windows(output, -1, -1);
|
||||
arrange_windows(output, -1, -1);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue