Don't send never-ending transactions when a focused layer surface commits

This moves the arrange_windows call into the arrange_layers function,
where we know the output actually needs to be arranged.

Additionally, we shouldn't set focus to the parent of an unknown
container type, because the parent may be an output and this causes a
crash because outputs can't have direct focus.

Fixes #2543
This commit is contained in:
Ryan Dwyer 2018-08-31 21:34:16 +10:00
parent de9e80459a
commit dce549c537
2 changed files with 2 additions and 3 deletions

View file

@ -176,7 +176,7 @@ void arrange_layers(struct sway_output *output) {
sizeof(struct wlr_box)) != 0) { sizeof(struct wlr_box)) != 0) {
wlr_log(WLR_DEBUG, "Usable area changed, rearranging output"); wlr_log(WLR_DEBUG, "Usable area changed, rearranging output");
memcpy(&output->usable_area, &usable_area, sizeof(struct wlr_box)); memcpy(&output->usable_area, &usable_area, sizeof(struct wlr_box));
container_set_dirty(output->swayc); arrange_output(output->swayc);
} }
// Arrange non-exlusive surfaces from top->bottom // Arrange non-exlusive surfaces from top->bottom
@ -247,7 +247,6 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
layer_surface->surface, false); layer_surface->surface, false);
} }
arrange_windows(output->swayc);
transaction_commit_dirty(); transaction_commit_dirty();
} }

View file

@ -779,7 +779,7 @@ void seat_set_focus_layer(struct sway_seat *seat,
wlr_log(WLR_DEBUG, "Returning focus to %p %s '%s'", previous, wlr_log(WLR_DEBUG, "Returning focus to %p %s '%s'", previous,
container_type_to_str(previous->type), previous->name); container_type_to_str(previous->type), previous->name);
// Hack to get seat to re-focus the return value of get_focus // Hack to get seat to re-focus the return value of get_focus
seat_set_focus(seat, previous->parent); seat_set_focus(seat, NULL);
seat_set_focus(seat, previous); seat_set_focus(seat, previous);
} }
return; return;