[PATCH 3/3] shell: restore app when workspace_num > 1 on unplugged output

Xiong Zhang xiong.y.zhang at intel.com
Mon Dec 2 19:25:06 PST 2013


when workspace_num > 1, the view on hiden workspace is moved
beyond any output through animation, but view->output point
to the last output of weston_compositor->output_list in
weston_surface_assign_output(). So surface->output may point to
a wrong output which isn't the output the surface belonged to.
Add a weston_surface->restore_output to save the correct output
in above situation, so that these surface on hiden workspace can
be restored correctly on destroyed output.

Signed-off-by: Xiong Zhang <xiong.y.zhang at intel.com>
---
 src/compositor.c | 2 ++
 src/compositor.h | 6 ++++++
 src/shell.c      | 2 +-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/compositor.c b/src/compositor.c
index 246b02b..bb00be7 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -794,6 +794,8 @@ weston_view_assign_output(struct weston_view *ev)
 	pixman_region32_fini(&region);
 
 	ev->output = new_output;
+	if (mask != 0)
+		ev->restore_output = new_output;
 	ev->output_mask = mask;
 
 	weston_surface_assign_output(ev->surface);
diff --git a/src/compositor.h b/src/compositor.h
index 9e1a825..108149f 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -799,6 +799,12 @@ struct weston_view {
 	 */
 	struct weston_output *output;
 
+	/* in animation, some surfaces are moved beyond any output,
+	 * but surface->output point to the last output in weston_composito->output_list,
+	 * in order to restore this surface to origin output, record the origin ouput
+	 */
+	struct weston_output *restore_output;
+
 	/*
 	 * A more complete representation of all outputs this surface is
 	 * displayed on.
diff --git a/src/shell.c b/src/shell.c
index 3cf87fd..5b0bbca 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -6135,7 +6135,7 @@ normal_view_on_destroyed_output(struct shell_output *shell_output,
 	for (i = 0; i < shell->workspaces.num; i++) {
 		ws = get_workspace(shell, i);
 		wl_list_for_each(view, &ws->layer.view_list, layer_link) {
-			if (view->output == del_output) {
+			if (view->restore_output == del_output) {
 				handle_view_on_destroyed_output(view, target_output);
 				surface_type = get_shell_surface_type(view->surface);
 				/*if surface is maximized, resize it to target output*/
-- 
1.8.3.2



More information about the wayland-devel mailing list