From dc3edc04aa301d63e97e80fe8e2cc5227cb6baca Mon Sep 17 00:00:00 2001 From: Harish Krupo Date: Sat, 20 Apr 2019 17:50:18 +0530 Subject: [PATCH] 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 --- desktop-shell/shell.c | 13 +++++++++---- 1 file 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