[PATCH v2] shell: don't abuse link_layer for keeping track of input panel surfaces
Pekka Paalanen
ppaalanen at gmail.com
Mon Aug 6 04:12:30 PDT 2012
On Mon, 6 Aug 2012 12:39:31 +0200
Philipp Brüschweiler <blei42 at gmail.com> wrote:
> Input panel surfaces were kept in a list by using layer_link of
> weston_surface. This was pretty hacky and resulted in the bug that
> an input panel surface was not removed from the list if it was unmapped
> at the time of destruction.
>
> This patch properly keeps track of input panel surfaces. Destruction is
> handled by intercepting the destruction of the underlying surface.
> ---
> src/shell.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++------------
> 1 Datei geändert, 56 Zeilen hinzugefügt(+), 13 Zeilen entfernt(-)
>
> diff --git a/src/shell.c b/src/shell.c
> index 6c810ff..b3e731a 100644
> --- a/src/shell.c
> +++ b/src/shell.c
> @@ -63,6 +63,12 @@ struct workspace {
> struct wl_listener seat_destroyed_listener;
> };
>
> +struct input_panel_surface {
> + struct wl_list link;
> + struct weston_surface *surface;
> + void (*original_destroy)(struct wl_resource *resource);
Hi,
can't you use the wl_resource::destroy_signal instead of this hack?
...
> @@ -2907,10 +2936,24 @@ input_panel_set_surface(struct wl_client *client,
> struct weston_surface *surface = surface_resource->data;
> struct weston_output *output = output_resource->data;
>
> + struct input_panel_surface *input_panel_surface;
> +
> surface->configure = input_panel_configure;
> surface->private = shell;
> surface->output = output;
> - wl_list_insert(shell->input_panel.surfaces.prev, &surface->layer_link);
> +
> + input_panel_surface = malloc(sizeof *input_panel_surface);
> + if (input_panel_surface == NULL) {
> + wl_resource_post_no_memory(resource);
> + return;
> + }
> +
> + input_panel_surface->original_destroy = surface_resource->destroy;
> + input_panel_surface->surface = surface;
> +
> + surface_resource->destroy = destroy_input_panel_surface;
> +
> + wl_list_insert(&shell->input_panel.surfaces, &input_panel_surface->link);
> }
>
> static const struct input_panel_interface input_panel_implementation = {
Thanks,
pq
More information about the wayland-devel
mailing list