When maximized or fullscreen window is on destroyed output, compositor
can't change these windows to normal window without notify client,
otherwise maximize icon or F11 buttion lose its effect after output unplug.

Instead we keep these window as maximized or fullscreen, just change
it's size to target output.

Signed-off-by: Xiong Zhang <[email protected]>
---
 desktop-shell/shell.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index bee1b0b..d5d6eab 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -5534,6 +5534,7 @@ shell_reposition_view_on_output_destroy(struct 
weston_view *view)
        struct shell_surface *shsurf;
        float x, y;
        int visible;
+       struct weston_view *black_view;
 
        x = view->geometry.x;
        y = view->geometry.y;
@@ -5557,6 +5558,8 @@ shell_reposition_view_on_output_destroy(struct 
weston_view *view)
                x = first_output->x + first_output->width / 4;
                y = first_output->y + first_output->height / 4;
 
+               output = first_output;
+
                weston_view_set_position(view, x, y);
        } else
                weston_view_geometry_dirty(view);
@@ -5566,9 +5569,24 @@ shell_reposition_view_on_output_destroy(struct 
weston_view *view)
 
        if (shsurf) {
                shsurf->saved_position_valid = false;
-               shsurf->next_state.maximized = false;
-               shsurf->next_state.fullscreen = false;
-               shsurf->state_changed = true;
+
+               /* Resize maxmized window to target output. */
+               if (shsurf->state.maximized)
+                       set_maximized(shsurf, output);
+
+               /* Resize fullscreen window to target output. */
+               if (shsurf->state.fullscreen) {
+                       black_view = shsurf->fullscreen.black_view;
+                       weston_surface_destroy(black_view->surface);
+                       shsurf->fullscreen.black_view = NULL;
+
+                       set_fullscreen(shsurf,
+                                      shsurf->fullscreen.type,
+                                      shsurf->fullscreen.framerate,
+                                      output);
+               }
+
+               shsurf->state_changed = false;
        }
 }
 
-- 
1.8.3.2

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to