diff options
author | Harish Krupo <harishkrupo@gmail.com> | 2019-04-20 17:50:18 +0530 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2019-06-11 10:11:35 +0000 |
commit | dc3edc04aa301d63e97e80fe8e2cc5227cb6baca (patch) | |
tree | 61d6e8e73b608dcac360ab90013f21151df6cf09 /desktop-shell | |
parent | 2dff4dd6950f371dcb94553c5cc724f535ef4f12 (diff) | |
download | weston-dc3edc04aa301d63e97e80fe8e2cc5227cb6baca.tar.gz |
desktop-shell: Re-position views when outputs change
When the last output is destroyed or when a new output is created after
the last output is destroyed, we need to re-position the views to ensure
that all the views are displayed on the output.
Fixes: https://gitlab.freedesktop.org/wayland/weston/issues/210
Signed-off-by: Harish Krupo <harishkrupo@gmail.com>
Diffstat (limited to 'desktop-shell')
-rw-r--r-- | desktop-shell/shell.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 187be799..07a6856b 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -4724,7 +4724,7 @@ workspace_move_surface_down_binding(struct weston_keyboard *keyboard, } static void -shell_reposition_view_on_output_destroy(struct weston_view *view) +shell_reposition_view_on_output_change(struct weston_view *view) { struct weston_output *output, *first_output; struct weston_compositor *ec = view->surface->compositor; @@ -4789,14 +4789,15 @@ shell_for_each_layer(struct desktop_shell *shell, } static void -shell_output_destroy_move_layer(struct desktop_shell *shell, +shell_output_changed_move_layer(struct desktop_shell *shell, struct weston_layer *layer, void *data) { struct weston_view *view; wl_list_for_each(view, &layer->view_list.link, layer_link.link) - shell_reposition_view_on_output_destroy(view); + shell_reposition_view_on_output_change(view); + } static void @@ -4806,7 +4807,7 @@ handle_output_destroy(struct wl_listener *listener, void *data) container_of(listener, struct shell_output, destroy_listener); struct desktop_shell *shell = output_listener->shell; - shell_for_each_layer(shell, shell_output_destroy_move_layer, NULL); + shell_for_each_layer(shell, shell_output_changed_move_layer, NULL); if (output_listener->panel_surface) wl_list_remove(&output_listener->panel_surface_listener.link); @@ -4860,6 +4861,10 @@ create_shell_output(struct desktop_shell *shell, wl_signal_add(&output->destroy_signal, &shell_output->destroy_listener); wl_list_insert(shell->output_list.prev, &shell_output->link); + + if (wl_list_length(&shell->output_list) == 1) + shell_for_each_layer(shell, + shell_output_changed_move_layer, NULL); } static void |