all repos — openbox @ 8de13a41b6e3a8fb57c6ea1c8d769ac029654c9a

openbox fork - make it a bit more like ryudo

Update the send-to window only if the workspaces have changed.
Scott Moynes smoynes@nexus.carleton.ca
commit

8de13a41b6e3a8fb57c6ea1c8d769ac029654c9a

parent

71b7b043a2ca6fc99a41a1e47e76f96eb7218ad9

1 files changed, 25 insertions(+), 10 deletions(-)

jump to
M plugins/menu/client_menu.cplugins/menu/client_menu.c

@@ -21,24 +21,39 @@

#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)