summaryrefslogtreecommitdiff
blob: 03207cc656b4e943207934a60caa908911a59ba4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
Index: src/Screen.cc
===================================================================
RCS file: /cvsroot/fluxbox/fluxbox/src/Screen.cc,v
retrieving revision 1.286
retrieving revision 1.288
diff -u -r1.286 -r1.288
--- src/Screen.cc	30 Aug 2004 11:33:23 -0000	1.286
+++ src/Screen.cc	6 Sep 2004 13:17:56 -0000	1.288
@@ -407,11 +407,17 @@
 }
 
 BScreen::~BScreen() {
+    
     if (! managed)
         return;
-
+    
     if (m_rootmenu.get() != 0)
         m_rootmenu->removeAll();
+    
+    // Since workspacemenu holds client list menus (from workspace)
+    // we need to destroy it before we destroy workspaces
+    m_workspacemenu.reset(0);
+
 
     if (geom_pixmap != None)
         imageControl().removeImage(geom_pixmap);
@@ -651,7 +657,7 @@
             const Workspace::Windows::iterator win_it_end = (*w_it)->windowList().end();
             for (; win_it != win_it_end; ++win_it) {
                 if (*win_it != except)
-                (*win_it)->menu().hide();
+                    (*win_it)->menu().hide();
             }
         }
     }
@@ -772,7 +778,12 @@
     if (w == 0) 
         return;
 
+    // make sure we have a unique list
+    if (find(getIconList().begin(), getIconList().end(), w) != getIconList().end())
+        return;
+
     m_icon_list.push_back(w);
+
     // notify listeners
     m_iconlist_sig.notify();
 }
@@ -782,20 +793,28 @@
     if (w == 0)
         return;
 	
-    Icons::iterator erase_it = remove_if(m_icon_list.begin(),
-                                         m_icon_list.end(),
+    Icons::iterator erase_it = remove_if(getIconList().begin(),
+                                         getIconList().end(),
                                          bind2nd(equal_to<FluxboxWindow *>(), w));
-    if (erase_it != m_icon_list.end())
-        m_icon_list.erase(erase_it);
-    
-    m_iconlist_sig.notify();
+    // no need to send iconlist signal if we didn't 
+    // change the iconlist
+    if (erase_it != m_icon_list.end()) {
+        getIconList().erase(erase_it);
+        m_iconlist_sig.notify();
+    }
 }
 
 void BScreen::removeWindow(FluxboxWindow *win) {
-    if (win->isIconic())
-        removeIcon(win);
-    else
-        getWorkspace(win->workspaceNumber())->removeWindow(win, false);
+#ifdef DEBUG
+    cerr<<"BScreen::removeWindow("<<win<<")"<<endl;
+#endif // DEBUG
+    // extra precaution, if for some reason, the 
+    // icon list should be out of sync
+    removeIcon(win);
+    // remove from workspace
+    Workspace *space = getWorkspace(win->workspaceNumber());
+    if (space != 0)
+        space->removeWindow(win, false);
 }