[PATCH] Add wl_display_remove_global.
Kristian Høgsberg
krh at bitplanet.net
Fri Jun 10 08:55:11 PDT 2011
Hi Laszlo,
Thanks, this is definitely needed. However, we'll also need to send
an event to all clients to indicate that the object is no longer
available, so they can take it out of their global list. That is, the
opposite of display_handle_global:
http://cgit.freedesktop.org/wayland/wayland/tree/wayland/wayland-client.c#n234
Kristian
On Fri, Jun 10, 2011 at 6:43 AM, Laszlo Agocs <laszlo.p.agocs at nokia.com> wrote:
>
> From 9306be3637fd36aca936cfd797298a8e22c88c56 Mon Sep 17 00:00:00 2001
> From: Laszlo Agocs <laszlo.p.agocs at nokia.com>
> Date: Fri, 10 Jun 2011 11:17:51 +0200
> Subject: [PATCH] Add wl_display_remove_global.
>
> Change 4453ba084aae5a00318b9dfdeda95e8eaa17494c disallows using
> post_global with objects not on the global list. Therefore selection
> and drag offers have to be added to the global list from now on.
> However these may often get replaced by a newer object and thus need a
> way to remove a global from the global list.
> ---
> wayland/wayland-server.c | 18 ++++++++++++++++++
> wayland/wayland-server.h | 3 +++
> 2 files changed, 21 insertions(+), 0 deletions(-)
>
> diff --git a/wayland/wayland-server.c b/wayland/wayland-server.c
> index 886ec69..043343a 100644
> --- a/wayland/wayland-server.c
> +++ b/wayland/wayland-server.c
> @@ -656,6 +656,24 @@ wl_display_add_global(struct wl_display *display,
> return 0;
> }
>
> +WL_EXPORT int
> +wl_display_remove_global(struct wl_display *display,
> + struct wl_object *object)
> +{
> + struct wl_global *global = NULL, *p;
> + wl_list_for_each(p, &display->global_list, link)
> + if (p->object == object) {
> + global = p;
> + break;
> + }
> + if (global) {
> + wl_list_remove(&global->link);
> + free(global);
> + return 0;
> + }
> + return -1;
> +}
> +
> WL_EXPORT void
> wl_display_post_frame(struct wl_display *display, struct wl_surface
> *surface,
> uint32_t time)
> diff --git a/wayland/wayland-server.h b/wayland/wayland-server.h
> index 6a042cd..d1c655a 100644
> --- a/wayland/wayland-server.h
> +++ b/wayland/wayland-server.h
> @@ -93,6 +93,9 @@ int wl_display_add_global(struct wl_display *display,
> struct wl_object *object,
> wl_global_bind_func_t func);
>
> +int wl_display_remove_global(struct wl_display *display,
> + struct wl_object *object);
> +
> struct wl_client *wl_client_create(struct wl_display *display, int fd);
> void wl_client_destroy(struct wl_client *client);
> void wl_client_post_error(struct wl_client *client, struct wl_object
> *object,
> --
> 1.7.1
>
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
More information about the wayland-devel
mailing list