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

2016-08-10 Thread Pekka Paalanen
On Fri, 29 Jul 2016 13:26:26 +0200
Armin Krezović  wrote:

> This adds helper functions for managing fullscreen surfaces outside
> of fullscreen outputs.
> 
> Signed-off-by: Armin Krezović 
> ---
>  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(>surface_destroyed.link);
> + wl_list_remove(>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, >link);
> +
> + surf->surface_destroyed.notify = unmapped_surface_destroy_listener;
> + wl_signal_add(>destroy_signal, >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(>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


pgp9h7rOyNT7K.pgp
Description: OpenPGP digital signature
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


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

2016-07-29 Thread Armin Krezović
This adds helper functions for managing fullscreen surfaces outside
of fullscreen outputs.

Signed-off-by: Armin Krezović 
---
 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(>surface_destroyed.link);
+   wl_list_remove(>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, >link);
+
+   surf->surface_destroyed.notify = unmapped_surface_destroy_listener;
+   wl_signal_add(>destroy_signal, >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(>unmapped_surfaces);
 
shell->client_destroyed.notify = client_destroyed;
 
-- 
2.9.2

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel