[PATCH 02/12] shell.c: Restore maximized and fullscreen window on destroyed output
Ander Conselvan de Oliveira
conselvan2 at gmail.com
Mon Mar 17 10:17:34 PDT 2014
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
>
> Signed-off-by: Xiong Zhang <xiong.y.zhang at intel.com>
> ---
> 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..02dd1b8 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->surface;
> + 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;
> }
> }
>
>
More information about the wayland-devel
mailing list