[PATCH 2/2 weston v6] desktop-shell: Implement panel window list.

Scott Moreau oreaus at gmail.com
Thu Oct 4 17:14:34 PDT 2012


On Thu, Oct 4, 2012 at 5:07 PM, Scott Moreau <oreaus at gmail.com> wrote:

> This patch uses the special surface_data interface to send surface_data to
> the
> shell. The shell then uses this information to render a window list in the
> panel.
>
> ---
>
> v6:
>
> * Rebased on latest master
> * Clean up window list when desktop-shell exits
> * Renamed some functions to better fit their arguments
>

<snip>


>
> +static void
> +panel_list_item_remove(struct list_item *item)
> +{
> +       item->panel->surface_count--;
> +       wl_list_remove(&item->link);
> +       wl_list_remove(&item->surface_link);
> +       widget_destroy(item->widget);
> +       panel_window_list_schedule_redraw(item->panel);
> +       free(item);
> +}
>

<snip>


> +
> +static void
> +desktop_destroy_surface(struct surface *surface)
> +{
> +       struct list_item *item, *next;
> +
> +       wl_list_for_each_safe(item, next, &surface->item_list,
> surface_link)
> +               panel_list_item_remove(item);
> +
> +       wl_list_remove(&surface->link);
> +       free(surface->title);
> +       free(surface);
> +}
> +
>

<snip>


>  static void
> +desktop_destroy_surfaces(struct desktop *desktop)
> +{
> +       struct surface *surface, *next;
> +
> +       wl_list_for_each_safe(surface, next, &desktop->surfaces, link)
> +               desktop_destroy_surface(surface);
> +}
> +
>

<snip>


> @@ -1126,6 +1610,7 @@ int main(int argc, char *argv[])
>         /* Cleanup */
>         grab_surface_destroy(&desktop);
>         desktop_destroy_outputs(&desktop);
> +       desktop_destroy_surfaces(&desktop);
>         if (desktop.unlock_dialog)
>                 unlock_dialog_destroy(desktop.unlock_dialog);
>         desktop_shell_destroy(desktop.shell);
>
>
<snip>

I noticed that this cleanup sequence fails, blocking on widget_destroy().
It seems we need a way to know if toytoolkits display->running is true,
from the client. I created an int display_is_running(struct display
*display) {return display->running;}, and then check this is true before
calling widget_destroy() and panel_window_list_schedule_redraw() in
panel_list_item_remove(). Is there a better way or is this a good solution?
Should all toytoolkit functions check for display->running? Seems like that
might look messy.


Thanks,

Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20121004/f0fc924b/attachment-0001.html>


More information about the wayland-devel mailing list