Re: [PATCH] libweston-desktop: add signal title/app-id changes

2017-08-08 Thread Matt Hoosier
Okay, this one should be ready to review. Sorry for the noise on the first
attempt.

On Tue, Aug 8, 2017 at 10:56 AM, Matt Hoosier 
wrote:

> It's useful for the shell implementation to know when these change,
> for example to relay the information on to taskbars or similar.
>
> To avoid ABI changes or the need to make the weston_desktop_surface
> definition public, new functions are introduced for attaching
> listeners to these signals.
>
> Signed-off-by: Matt Hoosier 
> ---
>  libweston-desktop/libweston-desktop.h |  3 +++
>  libweston-desktop/surface.c   | 12 
>  2 files changed, 15 insertions(+)
>
> diff --git a/libweston-desktop/libweston-desktop.h
> b/libweston-desktop/libweston-desktop.h
> index 03b04c7b..c43568ac 100644
> --- a/libweston-desktop/libweston-desktop.h
> +++ b/libweston-desktop/libweston-desktop.h
> @@ -164,6 +164,9 @@ weston_desktop_surface_set_size(struct
> weston_desktop_surface *surface,
> int32_t width, int32_t height);
>  void
>  weston_desktop_surface_close(struct weston_desktop_surface *surface);
> +void
> +weston_desktop_surface_add_title_listener(struct weston_desktop_surface
> *surface,
> + struct wl_listener *listener);
>
>  void *
>  weston_desktop_surface_get_user_data(struct weston_desktop_surface
> *surface);
> diff --git a/libweston-desktop/surface.c b/libweston-desktop/surface.c
> index d3be9364..d00ba5d6 100644
> --- a/libweston-desktop/surface.c
> +++ b/libweston-desktop/surface.c
> @@ -64,6 +64,7 @@ struct weston_desktop_surface {
> char *title;
> char *app_id;
> pid_t pid;
> +   struct wl_signal title_signal;
> };
> struct {
> struct weston_desktop_surface *parent;
> @@ -287,6 +288,8 @@ weston_desktop_surface_create(struct weston_desktop
> *desktop,
> wl_list_init(>view_list);
> wl_list_init(>grab_link);
>
> +   wl_signal_init(>title_signal);
> +
> return surface;
>  }
>
> @@ -511,6 +514,13 @@ weston_desktop_surface_close(struct
> weston_desktop_surface *surface)
>
>  surface->implementation_data);
>  }
>
> +WL_EXPORT void
> +weston_desktop_surface_add_title_listener(struct weston_desktop_surface
> *surface,
> + struct wl_listener *listener)
> +{
> +   wl_signal_add(>title_signal, listener);
> +}
> +
>  struct weston_desktop_surface *
>  weston_desktop_surface_from_client_link(struct wl_list *link)
>  {
> @@ -687,6 +697,7 @@ weston_desktop_surface_set_title(struct
> weston_desktop_surface *surface,
>
> free(surface->title);
> surface->title = tmp;
> +   wl_signal_emit(>title_signal, surface);
>  }
>
>  void
> @@ -701,6 +712,7 @@ weston_desktop_surface_set_app_id(struct
> weston_desktop_surface *surface,
>
> free(surface->app_id);
> surface->app_id = tmp;
> +   wl_signal_emit(>title_signal, surface);
>  }
>
>  void
> --
> 2.13.3
>
>
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] libweston-desktop: add signal title/app-id changes

2017-08-08 Thread Matt Hoosier
This revision was broken. Disregard, I'm re-sending.

On Tue, Aug 8, 2017 at 10:45 AM, Matt Hoosier 
wrote:

> It's useful for the shell implementation to know when these change,
> for example to relay the information on to taskbars or similar.
>
> To avoid ABI changes or the need to make the weston_desktop_surface
> definition public, new functions are introduced for attaching
> listeners to these signals.
>
> Signed-off-by: Matt Hoosier 
> ---
>  libweston-desktop/libweston-desktop.h |  6 ++
>  libweston-desktop/surface.c   | 21 +
>  2 files changed, 27 insertions(+)
>
> diff --git a/libweston-desktop/libweston-desktop.h
> b/libweston-desktop/libweston-desktop.h
> index 03b04c7b..e38257e5 100644
> --- a/libweston-desktop/libweston-desktop.h
> +++ b/libweston-desktop/libweston-desktop.h
> @@ -164,6 +164,12 @@ weston_desktop_surface_set_size(struct
> weston_desktop_surface *surface,
> int32_t width, int32_t height);
>  void
>  weston_desktop_surface_close(struct weston_desktop_surface *surface);
> +void
> +weston_desktop_surface_add_title_listener(struct weston_desktop_surface
> *surface,
> + struct wl_listener *listener);
> +void
> +weston_desktop_surface_add_app_id_listener(struct weston_desktop_surface
> *surface,
> +  struct wl_listener *listener);
>
>  void *
>  weston_desktop_surface_get_user_data(struct weston_desktop_surface
> *surface);
> diff --git a/libweston-desktop/surface.c b/libweston-desktop/surface.c
> index d3be9364..97a455c6 100644
> --- a/libweston-desktop/surface.c
> +++ b/libweston-desktop/surface.c
> @@ -64,6 +64,8 @@ struct weston_desktop_surface {
> char *title;
> char *app_id;
> pid_t pid;
> +   struct wl_signal title_signal;
> +   struct wl_signal app_id_signal;
> };
> struct {
> struct weston_desktop_surface *parent;
> @@ -287,6 +289,9 @@ weston_desktop_surface_create(struct weston_desktop
> *desktop,
> wl_list_init(>view_list);
> wl_list_init(>grab_link);
>
> +   wl_signal_init(>title_signal);
> +   wl_signal_init(>app_id_signal);
> +
> return surface;
>  }
>
> @@ -511,6 +516,20 @@ weston_desktop_surface_close(struct
> weston_desktop_surface *surface)
>
>  surface->implementation_data);
>  }
>
> +WL_EXPORT void
> +weston_desktop_surface_add_title_listener(struct weston_desktop_surface
> *surface,
> + struct wl_listener *listener)
> +{
> +   wl_signal_add(>title_signal, listener);
> +}
> +
> +WL_EXPORT void
> +weston_desktop_surface_add_app_id_listener(struct weston_desktop_surface
> *surface,
> +  struct wl_listener *listener)
> +{
> +   wl_signal_add(>app_id_signal, listener);
> +}
> +
>  struct weston_desktop_surface *
>  weston_desktop_surface_from_client_link(struct wl_list *link)
>  {
> @@ -687,6 +706,7 @@ weston_desktop_surface_set_title(struct
> weston_desktop_surface *surface,
>
> free(surface->title);
> surface->title = tmp;
> +   wl_signal_emit(>title_signal, surface->title);
>  }
>
>  void
> @@ -701,6 +721,7 @@ weston_desktop_surface_set_app_id(struct
> weston_desktop_surface *surface,
>
> free(surface->app_id);
> surface->app_id = tmp;
> +   wl_signal_emit(>app_id_signal, surface->app_id);
>  }
>
>  void
> --
> 2.13.3
>
>
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel