]> Dogcows Code - chaz/openbox/commitdiff
a more proper fix for the client list menu trying to activate a closed client, no...
authorMikael Magnusson <mikachu@comhem.se>
Sat, 19 Aug 2006 20:34:27 +0000 (20:34 +0000)
committerMikael Magnusson <mikachu@comhem.se>
Sat, 19 Aug 2006 20:34:27 +0000 (20:34 +0000)
openbox/client.c
openbox/client_list_menu.c
openbox/client_list_menu.h
openbox/menu.c

index f1a295299d1724656c951b411939531295f3341b..e80b84f182f9d06e2c62b877792db1df8c544d0a 100644 (file)
@@ -2856,9 +2856,6 @@ void client_unfocus(ObClient *self)
 
 void client_activate(ObClient *self, gboolean here)
 {
-    /* This check is for the client_list_menu trying to activate
-     * a closed client. */
-    if (!g_list_find(client_list, self)) return;
     if (client_normal(self) && screen_showing_desktop)
         screen_show_desktop(FALSE);
     if (self->iconic)
index e2d00bb5e96276120f11a24c591c8b1cdd9eb078..dd8cad8bcf01e672a90dc823b2f6c7c7df44fcfe 100644 (file)
@@ -154,10 +154,40 @@ static void self_update(ObMenuFrame *frame, gpointer data)
     }
 }
 
-void client_list_menu_startup()
+static void client_dest(ObClient *client, gpointer data)
+{
+    /* This concise function removes all references to a closed
+     * client in the client_list_menu, so we don't have to check
+     * in client.c */
+    GSList *it;
+    for (it = desktop_menus; it; it = g_slist_next(it)) {
+        ObMenu *mit = it->data;
+        GList *eit;
+        for (eit = mit->entries; eit; eit = g_list_next(eit)) {
+            ObMenuEntry *meit = eit->data;
+            if (meit->type == OB_MENU_ENTRY_TYPE_NORMAL) {
+                ObAction *a = meit->data.normal.actions->data;
+                ObClient *c = a->data.any.c;
+                if (c == client)
+                    a->data.any.c = NULL;
+            }
+        }
+    }
+}
+
+void client_list_menu_startup(gboolean reconfig)
 {
     ObMenu *menu;
 
+    if (!reconfig)
+        client_add_destructor(client_dest, NULL);
+
     menu = menu_new(MENU_NAME, _("Desktops"), NULL);
     menu_set_update_func(menu, self_update);
 }
+
+void client_list_menu_shutdown(gboolean reconfig)
+{
+    if (!reconfig)
+        client_remove_destructor(client_dest);
+}
index bcd7729b9cdd1a4a87cbe2841baf695ee4137d2a..eac2bc91667de9d062116139b39f99427e90bd44 100644 (file)
@@ -19,6 +19,7 @@
 #ifndef ob__client_list_menu_h
 #define ob__client_list_menu_h
 
-void client_list_menu_startup();
+void client_list_menu_startup(gboolean reconfig);
+void client_list_menu_shutdown(gboolean reconfig);
 
 #endif
index c1d1138be270ad8652a0bc9501f7336b5eec0828..69a5fe5aa4010d6da5bdbdeb95830a6070c9c2f6 100644 (file)
@@ -69,7 +69,7 @@ void menu_startup(gboolean reconfig)
     menu_hash = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
                                       (GDestroyNotify)menu_destroy_hash_value);
 
-    client_list_menu_startup();
+    client_list_menu_startup(reconfig);
     client_menu_startup();
 
     menu_parse_inst = parse_startup();
@@ -110,6 +110,8 @@ void menu_shutdown(gboolean reconfig)
     parse_shutdown(menu_parse_inst);
     menu_parse_inst = NULL;
 
+    client_list_menu_shutdown(reconfig);
+
     menu_frame_hide_all();
     g_hash_table_destroy(menu_hash);
     menu_hash = NULL;
This page took 0.031296 seconds and 4 git commands to generate.