Arrange backgrounds only when required

This commit is contained in:
Mykyta Holubakha 2016-07-21 22:47:35 +03:00
parent 464239f7ac
commit a2bc6f3bfd
4 changed files with 7 additions and 1 deletions

View File

@ -59,6 +59,7 @@ void move_workspace_to(swayc_t* workspace, swayc_t* destination);
void update_layout_geometry(swayc_t *parent, enum swayc_layouts prev_layout);
void update_geometry(swayc_t *view);
void arrange_windows(swayc_t *container, double width, double height);
void arrange_backgrounds(void);
swayc_t *get_focused_container(swayc_t *parent);
swayc_t *get_swayc_in_direction(swayc_t *container, enum movement_direction dir);

View File

@ -158,6 +158,7 @@ bool set_focused_container(swayc_t *c) {
// rearrange if parent container is tabbed/stacked
swayc_t *parent = swayc_tabbed_stacked_ancestor(p);
if (parent != NULL) {
arrange_backgrounds();
arrange_windows(parent, -1, -1);
}
} else if (p->type == C_WORKSPACE) {

View File

@ -961,9 +961,12 @@ void arrange_windows(swayc_t *container, double width, double height) {
update_visibility(container);
arrange_windows_r(container, width, height);
layout_log(&root_container, 0);
}
void arrange_backgrounds(void) {
struct background_config *bg;
for (int i = 0; i < desktop_shell.backgrounds->length; ++i) {
struct background_config *bg = desktop_shell.backgrounds->items[i];
bg = desktop_shell.backgrounds->items[i];
wlc_view_send_to_back(bg->handle);
}
}

View File

@ -308,6 +308,7 @@ bool workspace_switch(swayc_t *workspace) {
return false;
}
swayc_t *output = swayc_parent_by_type(workspace, C_OUTPUT);
arrange_backgrounds();
arrange_windows(output, -1, -1);
return true;
}