[PATCH 5/7] fullscreen-shell: Add helpers for managing surfaces on zero outputs

Pekka Paalanen ppaalanen at gmail.com
Wed Aug 10 14:08:34 UTC 2016


On Fri, 29 Jul 2016 13:26:26 +0200
Armin Krezović <krezovic.armin at gmail.com> wrote:

> This adds helper functions for managing fullscreen surfaces outside
> of fullscreen outputs.
> 
> Signed-off-by: Armin Krezović <krezovic.armin at gmail.com>
> ---
>  fullscreen-shell/fullscreen-shell.c | 55 +++++++++++++++++++++++++++++++++++++
>  1 file changed, 55 insertions(+)
> 
> diff --git a/fullscreen-shell/fullscreen-shell.c b/fullscreen-shell/fullscreen-shell.c
> index 2ec2d02..3dbd0d9 100644
> --- a/fullscreen-shell/fullscreen-shell.c
> +++ b/fullscreen-shell/fullscreen-shell.c
> @@ -46,6 +46,16 @@ struct fullscreen_shell {
>  	struct wl_listener output_created_listener;
>  
>  	struct wl_listener seat_created_listener;
> +
> +	/* List of surfaces that need to be mapped after an output
> +	 * gets created.
> +	 *
> +	 * At the moment, only one surface can be created on an output.
> +	 *
> +	 * This is implemented as a list in case someone fixes the shell
> +	 * implementation to support more than one client.
> +	 */
> +	struct wl_list unmapped_surfaces; /* struct fs_client_surface::link */
>  };
>  
>  struct fs_output {
> @@ -83,6 +93,50 @@ struct pointer_focus_listener {
>  	struct wl_listener seat_destroyed;
>  };
>  
> +struct fs_client_surface {
> +	struct weston_surface *surface;
> +	enum zwp_fullscreen_shell_v1_present_method method;
> +	struct wl_list link; /* struct fullscreen_shell::unmapped_surfaces */
> +	struct wl_listener surface_destroyed;
> +};
> +
> +static void
> +remove_unmapped_surface(struct fs_client_surface *surf)
> +{
> +	wl_list_remove(&surf->surface_destroyed.link);
> +	wl_list_remove(&surf->link);
> +	free(surf);
> +}
> +
> +static void
> +unmapped_surface_destroy_listener(struct wl_listener *listener, void *data)
> +{
> +	struct fs_client_surface *surf;
> +
> +	surf = container_of(listener, struct fs_client_surface, surface_destroyed);
> +
> +	remove_unmapped_surface(surf);
> +}
> +
> +static void
> +add_unmapped_surface(struct fullscreen_shell *shell, struct weston_surface *surface,
> +		     enum zwp_fullscreen_shell_v1_present_method method)
> +{
> +	struct fs_client_surface *surf;
> +
> +	surf = zalloc(sizeof *surf);
> +	if (!surf)
> +		return;
> +
> +	surf->surface = surface;
> +	surf->method = method;
> +
> +	wl_list_insert(shell->unmapped_surfaces.prev, &surf->link);
> +
> +	surf->surface_destroyed.notify = unmapped_surface_destroy_listener;
> +	wl_signal_add(&surface->destroy_signal, &surf->surface_destroyed);
> +}
> +
>  static void
>  pointer_focus_changed(struct wl_listener *listener, void *data)
>  {
> @@ -831,6 +885,7 @@ module_init(struct weston_compositor *compositor,
>  		return -1;
>  
>  	shell->compositor = compositor;
> +	wl_list_init(&shell->unmapped_surfaces);
>  
>  	shell->client_destroyed.notify = client_destroyed;
>  

Hi Armin,

the code looks correct in this patch, but its purpose is impossible to
review by this patch alone, as there are no users of this code. The
commit message is terse, and the code comments don't quite match my
recollection on what this might have been needed for.

More comments in the review of the following patch.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20160810/05016cc9/attachment.sig>


More information about the wayland-devel mailing list