On 02/04/15 12:10 AM, Mario Kleiner wrote:
> Initialize output->native_mode with the initially chosen
> mode for an output, so restore_output_mode() has something
> to work with and can switch back from temporary selected modes
> to the outputs native mode. Before, this was a no-op.
> 
> This allows an output to switch back to its default mode if
> a former toplevel fullscreen shell surface created via method
> WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER gets destroyed, or
> demoted to non-fullscreen, or if modesetting on the output
> failed.
> 
> Also fix desktop-shell's activate method to only restore
> output mode on the output on which a shell surface gets
> activated. This way fullscreen windows can mode switch their
> output, but window switching and exposay still works in the
> expected way.
> 
> Signed-off-by: Mario Kleiner <mario.kleiner...@gmail.com>
> ---
>  desktop-shell/shell.c | 3 ++-
>  src/compositor-drm.c  | 4 ++++
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
> index 7d0e403..68846ed 100644
> --- a/desktop-shell/shell.c
> +++ b/desktop-shell/shell.c
> @@ -2962,6 +2962,7 @@ shell_configure_fullscreen(struct shell_surface *shsurf)
>                                                        output->y - surf_y);
>                               break;
>                       } else {
> +                             weston_log("shell: Can't switch to temporary 
> mode.\n");
>                               restore_output_mode(output);
>                               center_on_output(shsurf->view, output);
>                       }
> @@ -5089,7 +5090,7 @@ activate(struct desktop_shell *shell, struct 
> weston_surface *es,
>       if (shsurf->state.fullscreen && configure)
>               shell_configure_fullscreen(shsurf);
>       else
> -             restore_all_output_modes(shell->compositor);
> +             restore_output_mode(shsurf->output);
>  
>       /* Update the surface’s layer. This brings it to the top of the stacking
>        * order as appropriate. */

I think above and below this point should be two separate patches.

> diff --git a/src/compositor-drm.c b/src/compositor-drm.c
> index 4a7baa1..9ddb6d6 100644
> --- a/src/compositor-drm.c
> +++ b/src/compositor-drm.c
> @@ -2209,6 +2209,10 @@ create_output_for_connector(struct drm_compositor *ec,
>                                   connector->count_modes == 0 ?
>                                   ", built-in" : "");
>  
> +     /* Initialize output->native_mode field, so restore_output_mode() 
> works. */
> +     weston_output_mode_set_native(&output->base, output->base.current_mode,
> +                                                               
> output->base.current_scale);
> +
>       return 0;
>  
>  err_output:
> 

I'm not sure this is right - I think just setting
output->base.native_mode = output->base.current_mode would have the same
end result without triggering all the mode switch related machinery?

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to