]> Dogcows Code - chaz/openbox/commitdiff
Update the send-to window only if the workspaces have changed.
authorScott Moynes <smoynes@nexus.carleton.ca>
Sun, 29 Jun 2003 01:45:32 +0000 (01:45 +0000)
committerScott Moynes <smoynes@nexus.carleton.ca>
Sun, 29 Jun 2003 01:45:32 +0000 (01:45 +0000)
plugins/menu/client_menu.c

index aa09495ba5bd7fed3f5e5f8c8176914a7d04d249..67c17acd2c73088f32fa740075f87a61644898fa 100644 (file)
@@ -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)
This page took 0.023406 seconds and 4 git commands to generate.