From: Scott Moynes Date: Sun, 29 Jun 2003 01:45:32 +0000 (+0000) Subject: Update the send-to window only if the workspaces have changed. X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=8de13a41b6e3a8fb57c6ea1c8d769ac029654c9a;p=chaz%2Fopenbox Update the send-to window only if the workspaces have changed. --- diff --git a/plugins/menu/client_menu.c b/plugins/menu/client_menu.c index aa09495b..67c17acd 100644 --- a/plugins/menu/client_menu.c +++ b/plugins/menu/client_menu.c @@ -21,24 +21,39 @@ typedef struct { #define CLIENT_MENU(m) ((Menu *)m) #define CLIENT_MENU_DATA(m) ((Client_Menu_Data *)((Menu *)m)->plugin_data) - void client_menu_clean_up(Menu *m) { } void client_send_to_update(Menu *self) { - guint i; + guint i = 0; + GList *it = self->entries; - for (i = 0; i < screen_num_desktops; ++i) { - MenuEntry *e; - Action *a = action_from_string("sendtodesktop"); - a->data.sendto.desk = i; - a->data.sendto.follow = FALSE; - e = menu_entry_new(screen_desktop_names[i], a); - menu_add_entry(self, e); + /* check if we have to update. lame */ + while (it != NULL) { + if (i >= screen_num_desktops) + break; + if (strcmp(screen_desktop_names[i], + ((MenuEntry *)it->data)->label) != 0) + break; + ++i; + it = it->next; } - menu_render_full(self); + if (it != NULL || i != screen_num_desktops) { + menu_clear(self); + g_message("update"); + for (i = 0; i < screen_num_desktops; ++i) { + MenuEntry *e; + Action *a = action_from_string("sendtodesktop"); + a->data.sendto.desk = i; + a->data.sendto.follow = FALSE; + e = menu_entry_new(screen_desktop_names[i], a); + menu_add_entry(self, e); + } + + menu_render_full(self); + } } void client_menu_show(Menu *self, int x, int y, Client *client)