[PATCH 6/7] fullscreen-shell: Remap surfaces when attaching a primary output

Armin Krezović krezovic.armin at gmail.com
Fri Jul 29 11:26:27 UTC 2016


When no outputs are present, and no output resource was given,
a fullscreen surface won't get configured because the default
behavior when there is no output resource given is to create
the same surface on all fullscreen outputs.

This patch makes the shell reconfigure the surface as soon
as an output gets plugged in and configured, so it can properly
be displayed if it was started when no outputs were present.

Signed-off-by: Armin Krezović <krezovic.armin at gmail.com>
---
 fullscreen-shell/fullscreen-shell.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/fullscreen-shell/fullscreen-shell.c b/fullscreen-shell/fullscreen-shell.c
index 3dbd0d9..71d609c 100644
--- a/fullscreen-shell/fullscreen-shell.c
+++ b/fullscreen-shell/fullscreen-shell.c
@@ -299,10 +299,15 @@ pending_surface_destroyed(struct wl_listener *listener, void *data)
 	fsout->pending.surface = NULL;
 }
 
+static void
+configure_presented_surface(struct weston_surface *surface, int32_t sx,
+			    int32_t sy);
+
 static struct fs_output *
 fs_output_create(struct fullscreen_shell *shell, struct weston_output *output)
 {
 	struct fs_output *fsout;
+	struct fs_client_surface *surf, *next;
 
 	fsout = zalloc(sizeof *fsout);
 	if (!fsout)
@@ -325,6 +330,13 @@ fs_output_create(struct fullscreen_shell *shell, struct weston_output *output)
 	weston_layer_entry_insert(&shell->layer.view_list,
 		       &fsout->black_view->layer_link);
 	wl_list_init(&fsout->transform.link);
+
+	wl_list_for_each_safe(surf, next, &shell->unmapped_surfaces, link) {
+		fs_output_set_surface(fsout, surf->surface, surf->method, 0, 0);
+		configure_presented_surface(surf->surface, 0, 0);
+		remove_unmapped_surface(surf);
+	}
+
 	return fsout;
 }
 
@@ -750,6 +762,8 @@ fullscreen_shell_present_surface(struct wl_client *client,
 		output = wl_resource_get_user_data(output_res);
 		fsout = fs_output_for_output(output);
 		fs_output_set_surface(fsout, surface, method, 0, 0);
+	} else if (wl_list_empty(&shell->output_list)) {
+		add_unmapped_surface(shell, surface, method);
 	} else {
 		wl_list_for_each(fsout, &shell->output_list, link)
 			fs_output_set_surface(fsout, surface, method, 0, 0);
-- 
2.9.2



More information about the wayland-devel mailing list