[openbox] put client-list-combined-menu in alphabetical order

Dana Jansens danakj at orodu.net
Sat Jan 24 20:27:54 EST 2015


On Sat, Jan 24, 2015 at 10:50 AM, Jim Rees <rees at umich.edu> wrote:

> Here is a patch I have found useful. It puts the client list menu in
> alphabetical order. To finish this, you would have to make it configurable,
> and also do the non-combined menu.
>
> From: Jim Rees <rees at umich.edu>
> Date: Sat, 24 Jan 2015 13:39:18 -0500
> Subject: [PATCH 6/6] put client-list-combined-menu in alphabetical order
>
> Signed-off-by: Jim Rees <rees at umich.edu>
> ---
>  openbox/client_list_combined_menu.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/openbox/client_list_combined_menu.c
> b/openbox/client_list_combined_menu.c
> index c26b6fa..2a3e083 100644
> --- a/openbox/client_list_combined_menu.c
> +++ b/openbox/client_list_combined_menu.c
> @@ -42,6 +42,13 @@ static void self_cleanup(ObMenu *menu, gpointer data)
>      menu_clear_entries(menu);
>  }
>
> +static gint
> +compfunc(gconstpointer a, gconstpointer b)
> +{
> +    ObClient *c1 = (ObClient *) a, *c2 = (ObClient *) b;
> +    return strcmp(c1->title, c2->title);
> +}
> +
>  static gboolean self_update(ObMenuFrame *frame, gpointer data)
>  {
>      ObMenu *menu = frame->menu;
> @@ -55,8 +62,10 @@ static gboolean self_update(ObMenuFrame *frame,
> gpointer data)
>          gboolean empty = TRUE;
>          gboolean onlyiconic = TRUE;
>
> +        it = g_list_sort(g_list_copy(focus_order), compfunc);
>

You need a matching g_list_free to avoid a memory leak, right?


> +
>          menu_add_separator(menu, SEPARATOR,
> screen_desktop_names[desktop]);
> -        for (it = focus_order; it; it = g_list_next(it)) {
> +        for (; it; it = g_list_next(it)) {
>              ObClient *c = it->data;
>              if (focus_valid_target(c, desktop,
>                                     TRUE, TRUE,
> --
> 2.2.2
> _______________________________________________
> openbox mailing list
> openbox at icculus.org
> http://icculus.org/mailman/listinfo/openbox
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/openbox/attachments/20150124/4fd99b28/attachment.html>


More information about the openbox mailing list