[PATCH 6/6] src/shell.c: restore app when workspace_num > 1 on unplugged output
Xiong Zhang
xiong.y.zhang at intel.com
Thu Oct 17 04:10:53 CEST 2013
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.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 155cfa3..71c02ea 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -651,6 +651,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 bb00c79..96eaba3 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -776,6 +776,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 a32c37b..ab31da2 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -4559,7 +4559,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
More information about the wayland-devel
mailing list