when workspace_num > 1, the surface on hiden workspace is moved beyond any output through animation, but surface->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.zh...@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 c67c3b4..9702471 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -647,6 +647,8 @@ weston_surface_assign_output(struct weston_surface *es) pixman_region32_fini(®ion); es->output = new_output; + if (mask != 0) + es->restore_output = new_output; weston_surface_update_output_mask(es, mask); } diff --git a/src/compositor.h b/src/compositor.h index ae7008d..ec52870 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -775,6 +775,12 @@ struct weston_surface { */ 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 0a95243..5198b67 100644 --- a/src/shell.c +++ b/src/shell.c @@ -4569,7 +4569,7 @@ handle_output_destroy(struct wl_listener *listener, void *data) for (i = 0; i < shell->workspaces.num; i++) { ws = get_workspace(shell, i); wl_list_for_each(surface, &ws->layer.surface_list, layer_link) { - if (surface->output == output) { + if (surface->restore_output == output) { surface_type = get_shell_surface_type(surface); handle_surface_on_destroyed_output(surface, target_output); /*if surface is maximized, resize it to target output*/ -- 1.8.3.2 _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel