[PATCH 02/12] shell.c: Restore maximized and fullscreen window on destroyed output

Zhang, Xiong Y xiong.y.zhang at intel.com
Tue Mar 18 02:17:21 PDT 2014


On Tue, 2014-03-18 at 10:21 +0200, Conselvan De Oliveira, Ander wrote:
> On 03/18/2014 07:39 AM, Zhang, Xiong Y wrote:
> > On Mon, 2014-03-17 at 19:17 +0200, Ander Conselvan de Oliveira wrote:
> >> On 03/07/2014 10:27 AM, Xiong Zhang wrote:
> >> > 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.
> >>
> >> I'm not sure about this. xdg-shell lets us handle this properly and
> >> wl_shell should be deprecated at some point, so I'm more inclined to
> >> keep the current behavior.
> >
> >>
> >> Cheers,
> >> Ander
> >>
> > yes, using xdg-shell, maximize icon and F11 button can take effect after
> > output unplug.
> > But server secretly changes window's state from maximized to unmaximized
> > without notifying client, it's unreasonable.
> 
> What I meant is that xdg-shell provides mechanism to notify the client 
> if it looses the maximized or fullscreen state. If I understand 
> correctly, xdg-shell is an attempt to do wl_shell right and once it is 
> finished wl_shell will be deprecated. So in my understanding, as long as 
> we do the right thing with xdg-shell we are OK.
> 
> But as I said, I'm not sure. I don't like the behavior of taking a 
> fullscreen surface from an unplugged output and making it fullscreen in 
> another output. I'd prefer to unfullscreen it. But if we must do 
> something sensible with wl_shell, then I guess this is the way to go.
> 
> Cheers,
> Ander
I like your ideal that restore maximized and full screen window to
normal , the patch should be like this:

shell.c: Restore maximized and fullscreen window on destroyed output
    
    Signed-off-by: Xiong Zhang <xiong.y.zhang at intel.com>

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 2cc9407..4c2b409 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -5529,7 +5529,7 @@ workspace_move_surface_down_binding(struct
weston_seat *seat, uint32_t time,
 static void
 shell_reposition_view_on_output_destroy(struct weston_view *view)
 {
-       struct weston_output *output, *first_output;
+       struct weston_output *output;
        struct weston_compositor *ec = view->surface->compositor;
        struct shell_surface *shsurf;
        float x, y;
@@ -5566,9 +5566,18 @@ 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;
+
+               /* Restore maxmized window */
+               if (shsurf->state.maximized)
+                       xdg_surface_change_state(shsurf,
+
XDG_SURFACE_STATE_MAXIMIZED,
+                                                0, 0);
+
+               /* Restore fullscreen window */
+               if (shsurf->state.fullscreen)
+                       xdg_surface_change_state(shsurf,
+
XDG_SURFACE_STATE_FULLSCREEN,
+                                                0, 0);
        }
 }

thanks






More information about the wayland-devel mailing list