aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-05-03 21:48:24 (GMT)
committerPavel Labath <pavelo@centrum.sk>2011-05-10 11:00:45 (GMT)
commit129bac1e0f0979c80902edc8e092596b81fe14f6 (patch)
tree0624ee5da85ec2d1f758612cddae2e95a50249f9 /src
parent0775350fee345e37fb59835dda4d85664346b606 (diff)
downloadfluxbox-129bac1e0f0979c80902edc8e092596b81fe14f6.zip
fluxbox-129bac1e0f0979c80902edc8e092596b81fe14f6.tar.bz2
Convert Focusable::dieSig to FbTk::Signal
Diffstat (limited to 'src')
-rw-r--r--src/AttentionNoticeHandler.cc15
-rw-r--r--src/AttentionNoticeHandler.hh8
-rw-r--r--src/ClientMenu.cc22
-rw-r--r--src/ClientMenu.hh9
-rw-r--r--src/CurrentWindowCmd.cc8
-rw-r--r--src/Focusable.hh9
-rw-r--r--src/FocusableList.cc28
-rw-r--r--src/FocusableList.hh3
-rw-r--r--src/WinClient.cc2
-rw-r--r--src/Window.cc2
-rw-r--r--src/fluxbox.cc69
-rw-r--r--src/fluxbox.hh4
12 files changed, 77 insertions, 102 deletions
diff --git a/src/AttentionNoticeHandler.cc b/src/AttentionNoticeHandler.cc
index 88dd72a..9052319 100644
--- a/src/AttentionNoticeHandler.cc
+++ b/src/AttentionNoticeHandler.cc
@@ -88,9 +88,8 @@ void AttentionNoticeHandler::addAttention(Focusable &client) {
88 88
89 m_attentions[&client] = timer; 89 m_attentions[&client] = timer;
90 // attach signals that will make notice go away 90 // attach signals that will make notice go away
91 client.dieSig().attach(this); 91 join(client.dieSig(), MemFun(*this, &AttentionNoticeHandler::removeWindow));
92 92 join(client.focusSig(), MemFun(*this, &AttentionNoticeHandler::windowFocusChanged));
93 client.focusSig().connect(MemFun(*this, &AttentionNoticeHandler::windowFocusChanged));
94 93
95 // update _NET_WM_STATE atom 94 // update _NET_WM_STATE atom
96 if (client.fbwindow()) 95 if (client.fbwindow())
@@ -104,16 +103,6 @@ void AttentionNoticeHandler::removeWindow(Focusable& win) {
104 updateWindow(win, true); 103 updateWindow(win, true);
105} 104}
106 105
107void AttentionNoticeHandler::update(FbTk::Subject* subj) {
108 // we need to be able to get the window
109 if (!subj || typeid(*subj) != typeid(Focusable::FocusSubject))
110 return;
111 Focusable::FocusSubject *winsubj =
112 static_cast<Focusable::FocusSubject *>(subj);
113
114 removeWindow(winsubj->win());
115}
116
117void AttentionNoticeHandler::updateWindow(Focusable& win, bool died) { 106void AttentionNoticeHandler::updateWindow(Focusable& win, bool died) {
118 // all signals results in destruction of the notice 107 // all signals results in destruction of the notice
119 108
diff --git a/src/AttentionNoticeHandler.hh b/src/AttentionNoticeHandler.hh
index 27d3b43..ed319b4 100644
--- a/src/AttentionNoticeHandler.hh
+++ b/src/AttentionNoticeHandler.hh
@@ -22,10 +22,10 @@
22#ifndef ATTENTIONNOTICEHANDLER_HH 22#ifndef ATTENTIONNOTICEHANDLER_HH
23#define ATTENTIONNOTICEHANDLER_HH 23#define ATTENTIONNOTICEHANDLER_HH
24 24
25#include "FbTk/Observer.hh"
26
27#include <map> 25#include <map>
28 26
27#include "FbTk/Signal.hh"
28
29class Focusable; 29class Focusable;
30 30
31namespace FbTk { 31namespace FbTk {
@@ -36,7 +36,7 @@ class Timer;
36 * Makes the title and iconbutton flash when the window 36 * Makes the title and iconbutton flash when the window
37 * demands attention. 37 * demands attention.
38 */ 38 */
39class AttentionNoticeHandler: public FbTk::Observer { 39class AttentionNoticeHandler: private FbTk::SignalTracker {
40public: 40public:
41 ~AttentionNoticeHandler(); 41 ~AttentionNoticeHandler();
42 42
@@ -44,8 +44,6 @@ public:
44 /// Adds a client that requires attention, 44 /// Adds a client that requires attention,
45 /// will fail if the client is already active 45 /// will fail if the client is already active
46 void addAttention(Focusable &client); 46 void addAttention(Focusable &client);
47 /// removes the client from the attention map
48 void update(FbTk::Subject *subj);
49 47
50 bool isDemandingAttention(const Focusable &client); 48 bool isDemandingAttention(const Focusable &client);
51 49
diff --git a/src/ClientMenu.cc b/src/ClientMenu.cc
index 4a3dacd..96527ec 100644
--- a/src/ClientMenu.cc
+++ b/src/ClientMenu.cc
@@ -40,10 +40,7 @@ public:
40 m_client(client) { 40 m_client(client) {
41 m_signals.join(client.titleSig(), 41 m_signals.join(client.titleSig(),
42 FbTk::MemFunSelectArg1(menu, &ClientMenu::titleChanged)); 42 FbTk::MemFunSelectArg1(menu, &ClientMenu::titleChanged));
43 client.dieSig().attach(&menu); 43 m_signals.join(client.dieSig(), FbTk::MemFun(menu, &ClientMenu::clientDied));
44 }
45
46 ~ClientMenuItem() {
47 } 44 }
48 45
49 void click(int button, int time, unsigned int mods) { 46 void click(int button, int time, unsigned int mods) {
@@ -156,16 +153,11 @@ void ClientMenu::titleChanged(Focusable& win) {
156 themeReconfigured(); 153 themeReconfigured();
157} 154}
158 155
159void ClientMenu::update(FbTk::Subject *subj) { 156void ClientMenu::clientDied(Focusable &win) {
160 if (Focusable::FocusSubject *fsubj = dynamic_cast<Focusable::FocusSubject *>(subj)) { 157 // find correct menu item
161 Focusable &win = fsubj->win(); 158 ClientMenuItem* cl_item = getMenuItem(*this, win);
162
163 // find correct menu item
164 ClientMenuItem* cl_item = getMenuItem(*this, win);
165 159
166 // update accordingly 160 // update accordingly
167 if (cl_item && fsubj == &win.dieSig()) { 161 if (cl_item)
168 remove(cl_item->getIndex()); 162 remove(cl_item->getIndex());
169 }
170 }
171} 163}
diff --git a/src/ClientMenu.hh b/src/ClientMenu.hh
index 61fd198..b40e122 100644
--- a/src/ClientMenu.hh
+++ b/src/ClientMenu.hh
@@ -25,7 +25,6 @@
25#include "FbMenu.hh" 25#include "FbMenu.hh"
26 26
27#include "FbTk/Signal.hh" 27#include "FbTk/Signal.hh"
28#include "FbTk/Observer.hh"
29 28
30class BScreen; 29class BScreen;
31class FluxboxWindow; 30class FluxboxWindow;
@@ -35,7 +34,7 @@ class Focusable;
35 * A menu holding a set of client menus. 34 * A menu holding a set of client menus.
36 * @see WorkspaceMenu 35 * @see WorkspaceMenu
37 */ 36 */
38class ClientMenu: public FbMenu, public FbTk::Observer { 37class ClientMenu: public FbMenu {
39public: 38public:
40 39
41 typedef std::list<FluxboxWindow *> Focusables; 40 typedef std::list<FluxboxWindow *> Focusables;
@@ -54,15 +53,15 @@ public:
54 /// Called when window title changed. 53 /// Called when window title changed.
55 void titleChanged(Focusable& win); 54 void titleChanged(Focusable& win);
56 55
56 /// Called when a client dies. Removes the corresponding menu item
57 void clientDied(Focusable& win);
58
57private: 59private:
58 60
59 void updateClientList(BScreen& screen) { 61 void updateClientList(BScreen& screen) {
60 refreshMenu(); 62 refreshMenu();
61 } 63 }
62 64
63 /// called when receiving a subject signal
64 void update(FbTk::Subject *subj);
65
66 Focusables &m_list; ///< clients in the menu 65 Focusables &m_list; ///< clients in the menu
67 FbTk::SignalTracker m_slots; ///< track all the slots 66 FbTk::SignalTracker m_slots; ///< track all the slots
68}; 67};
diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc
index 1122e1f..8d27a3a 100644
--- a/src/CurrentWindowCmd.cc
+++ b/src/CurrentWindowCmd.cc
@@ -635,18 +635,18 @@ void ChangeLayerCmd::real_execute() {
635} 635}
636 636
637namespace { 637namespace {
638class SetTitleDialog: public TextDialog, public FbTk::Observer { 638class SetTitleDialog: public TextDialog, private FbTk::SignalTracker {
639public: 639public:
640 SetTitleDialog(FluxboxWindow &win, const string &title): 640 SetTitleDialog(FluxboxWindow &win, const string &title):
641 TextDialog(win.screen(), title), window(win) { 641 TextDialog(win.screen(), title), window(win) {
642 win.dieSig().attach(this); 642 join(win.dieSig(), FbTk::MemFunIgnoreArgs(*this, &SetTitleDialog::windowDied));
643 setText(win.title()); 643 setText(win.title());
644 } 644 }
645 645
646private:
646 // only attached signal is window destruction 647 // only attached signal is window destruction
647 void update(FbTk::Subject *subj) { delete this; } 648 void windowDied() { delete this; }
648 649
649private:
650 void exec(const std::string &text) { 650 void exec(const std::string &text) {
651 window.winClient().setTitle(text); 651 window.winClient().setTitle(text);
652 } 652 }
diff --git a/src/Focusable.hh b/src/Focusable.hh
index 72a1dcc..cf2169a 100644
--- a/src/Focusable.hh
+++ b/src/Focusable.hh
@@ -41,9 +41,9 @@ public:
41 m_screen(scr), m_fbwin(fbwin), 41 m_screen(scr), m_fbwin(fbwin),
42 m_instance_name("fluxbox"), m_class_name("fluxbox"), 42 m_instance_name("fluxbox"), m_class_name("fluxbox"),
43 m_focused(false), m_attention_state(false), 43 m_focused(false), m_attention_state(false),
44 m_diesig(*this),
45 m_attentionsig(*this), 44 m_attentionsig(*this),
46 m_focussig(), 45 m_focussig(),
46 m_diesig(),
47 m_titlesig() { } 47 m_titlesig() { }
48 virtual ~Focusable() { } 48 virtual ~Focusable() { }
49 49
@@ -125,9 +125,7 @@ public:
125 /// Used for both title and icon changes. 125 /// Used for both title and icon changes.
126 const TitleSignal &titleSig() const { return m_titlesig; } 126 const TitleSignal &titleSig() const { return m_titlesig; }
127 FbTk::Signal<Focusable&> &focusSig() { return m_focussig; } 127 FbTk::Signal<Focusable&> &focusSig() { return m_focussig; }
128 const FbTk::Signal<Focusable&> &focusSig() const { return m_focussig; } 128 FbTk::Signal<Focusable&> &dieSig() { return m_diesig; }
129 FbTk::Subject &dieSig() { return m_diesig; }
130 const FbTk::Subject &dieSig() const { return m_diesig; }
131 FbTk::Subject &attentionSig() { return m_attentionsig; } 129 FbTk::Subject &attentionSig() { return m_attentionsig; }
132 const FbTk::Subject &attentionSig() const { return m_attentionsig; } 130 const FbTk::Subject &attentionSig() const { return m_attentionsig; }
133 /** @} */ // end group signals 131 /** @} */ // end group signals
@@ -150,10 +148,11 @@ protected:
150 FbTk::PixmapWithMask m_icon; //< icon pixmap with mask 148 FbTk::PixmapWithMask m_icon; //< icon pixmap with mask
151 149
152 // state and hint signals 150 // state and hint signals
153 FocusSubject m_diesig, m_attentionsig; 151 FocusSubject m_attentionsig;
154 152
155private: 153private:
156 FbTk::Signal<Focusable&> m_focussig; 154 FbTk::Signal<Focusable&> m_focussig;
155 FbTk::Signal<Focusable&> m_diesig;
157 TitleSignal m_titlesig; 156 TitleSignal m_titlesig;
158}; 157};
159 158
diff --git a/src/FocusableList.cc b/src/FocusableList.cc
index 748e940..a130ec0 100644
--- a/src/FocusableList.cc
+++ b/src/FocusableList.cc
@@ -111,13 +111,6 @@ void FocusableList::update(FbTk::Subject *subj) {
111 if (subj == 0 || m_screen.isShuttingdown()) 111 if (subj == 0 || m_screen.isShuttingdown())
112 return; 112 return;
113 113
114 if (typeid(*subj) == typeid(Focusable::FocusSubject)) {
115 Focusable::FocusSubject *fsubj =
116 static_cast<Focusable::FocusSubject *>(subj);
117 if (fsubj == &fsubj->win().dieSig()) {
118 remove(fsubj->win());
119 }
120 }
121 if (typeid(*subj) == typeid(FluxboxWindow::WinSubject)) { 114 if (typeid(*subj) == typeid(FluxboxWindow::WinSubject)) {
122 FluxboxWindow::WinSubject *fsubj = 115 FluxboxWindow::WinSubject *fsubj =
123 static_cast<FluxboxWindow::WinSubject *>(subj); 116 static_cast<FluxboxWindow::WinSubject *>(subj);
@@ -254,15 +247,17 @@ void FocusableList::remove(Focusable &win) {
254void FocusableList::updateTitle(Focusable& win) { 247void FocusableList::updateTitle(Focusable& win) {
255 checkUpdate(win); 248 checkUpdate(win);
256} 249}
250#include "Debug.hh"
257 251
258void FocusableList::attachSignals(Focusable &win) { 252void FocusableList::attachSignals(Focusable &win) {
259 win.dieSig().attach(this);
260 if (m_parent) { 253 if (m_parent) {
261 // attach various signals for matching 254 // attach various signals for matching
262 if (m_signal_map.find(&win) == m_signal_map.end()) { 255 FbTk::RefCount<FbTk::SignalTracker> &tracker = m_signal_map[&win];
263 m_signal_map[&win] = join(win.titleSig(), 256 if (! tracker) {
264 MemFunSelectArg1(*this, 257 // we have not attached to this window yet
265 &FocusableList::updateTitle)); 258 tracker = new SignalTracker;
259 tracker->join(win.titleSig(), MemFunSelectArg1(*this, &FocusableList::updateTitle));
260 tracker->join(win.dieSig(), MemFun(*this, &FocusableList::remove));
266 } 261 }
267 262
268 FluxboxWindow *fbwin = win.fbwindow(); 263 FluxboxWindow *fbwin = win.fbwindow();
@@ -276,15 +271,8 @@ void FocusableList::attachSignals(Focusable &win) {
276} 271}
277 272
278void FocusableList::detachSignals(Focusable &win) { 273void FocusableList::detachSignals(Focusable &win) {
279 win.dieSig().detach(this); 274 m_signal_map.erase(&win);
280 if (m_parent) { 275 if (m_parent) {
281 // disconnect client
282 SignalMap::iterator sigIt = m_signal_map.find(&win);
283 if (sigIt != m_signal_map.end()) {
284 leave(sigIt->second);
285 m_signal_map.erase(sigIt);
286 }
287
288 // detach various signals for matching 276 // detach various signals for matching
289 FluxboxWindow *fbwin = win.fbwindow(); 277 FluxboxWindow *fbwin = win.fbwindow();
290 if (!fbwin) 278 if (!fbwin)
diff --git a/src/FocusableList.hh b/src/FocusableList.hh
index 1382da6..6e46db9 100644
--- a/src/FocusableList.hh
+++ b/src/FocusableList.hh
@@ -24,6 +24,7 @@
24 24
25#include "FbTk/NotCopyable.hh" 25#include "FbTk/NotCopyable.hh"
26#include "FbTk/Observer.hh" 26#include "FbTk/Observer.hh"
27#include "FbTk/RefCount.hh"
27#include "FbTk/Subject.hh" 28#include "FbTk/Subject.hh"
28#include "FbTk/Signal.hh" 29#include "FbTk/Signal.hh"
29 30
@@ -126,7 +127,7 @@ private:
126 std::list<Focusable *> m_list; 127 std::list<Focusable *> m_list;
127 128
128 mutable FocusableListSubject m_ordersig, m_addsig, m_removesig, m_resetsig; 129 mutable FocusableListSubject m_ordersig, m_addsig, m_removesig, m_resetsig;
129 typedef std::map<Focusable*, FbTk::SignalTracker::TrackID> SignalMap; 130 typedef std::map<Focusable*, FbTk::RefCount<FbTk::SignalTracker> > SignalMap;
130 SignalMap m_signal_map; 131 SignalMap m_signal_map;
131}; 132};
132 133
diff --git a/src/WinClient.cc b/src/WinClient.cc
index 4ef37ae..b73f27c 100644
--- a/src/WinClient.cc
+++ b/src/WinClient.cc
@@ -155,7 +155,7 @@ WinClient::~WinClient() {
155 fbwindow()->removeClient(*this); 155 fbwindow()->removeClient(*this);
156 156
157 // this takes care of any focus issues 157 // this takes care of any focus issues
158 m_diesig.notify(); 158 dieSig().emit(*this);
159 159
160 // This fixes issue 1 (see WinClient.hh): 160 // This fixes issue 1 (see WinClient.hh):
161 // If transients die before the transient_for is created 161 // If transients die before the transient_for is created
diff --git a/src/Window.cc b/src/Window.cc
index 756c358..ca63178 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -350,7 +350,7 @@ FluxboxWindow::~FluxboxWindow() {
350 m_timer.stop(); 350 m_timer.stop();
351 351
352 // notify die 352 // notify die
353 m_diesig.notify(); 353 dieSig().emit(*this);
354 354
355 if (m_client != 0 && !m_screen.isShuttingdown()) 355 if (m_client != 0 && !m_screen.isShuttingdown())
356 delete m_client; // this also removes client from our list 356 delete m_client; // this also removes client from our list
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 99b9ea9..0263de7 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -943,7 +943,6 @@ void Fluxbox::handleSignal(int signum) {
943void Fluxbox::update(FbTk::Subject *changedsub) { 943void Fluxbox::update(FbTk::Subject *changedsub) {
944 //TODO: fix signaling, this does not look good 944 //TODO: fix signaling, this does not look good
945 FluxboxWindow *fbwin = 0; 945 FluxboxWindow *fbwin = 0;
946 WinClient *client = 0;
947 946
948 if (typeid(*changedsub) == typeid(FluxboxWindow::WinSubject)) { 947 if (typeid(*changedsub) == typeid(FluxboxWindow::WinSubject)) {
949 FluxboxWindow::WinSubject *winsub = dynamic_cast<FluxboxWindow::WinSubject *>(changedsub); 948 FluxboxWindow::WinSubject *winsub = dynamic_cast<FluxboxWindow::WinSubject *>(changedsub);
@@ -951,8 +950,6 @@ void Fluxbox::update(FbTk::Subject *changedsub) {
951 } else if (typeid(*changedsub) == typeid(Focusable::FocusSubject)) { 950 } else if (typeid(*changedsub) == typeid(Focusable::FocusSubject)) {
952 Focusable::FocusSubject *winsub = dynamic_cast<Focusable::FocusSubject *>(changedsub); 951 Focusable::FocusSubject *winsub = dynamic_cast<Focusable::FocusSubject *>(changedsub);
953 fbwin = winsub->win().fbwindow(); 952 fbwin = winsub->win().fbwindow();
954 if (typeid(winsub->win()) == typeid(WinClient))
955 client = dynamic_cast<WinClient *>(&winsub->win());
956 } 953 }
957 954
958 if (fbwin && &fbwin->stateSig() == changedsub) { // state signal 955 if (fbwin && &fbwin->stateSig() == changedsub) { // state signal
@@ -981,41 +978,49 @@ void Fluxbox::update(FbTk::Subject *changedsub) {
981 } else if (fbwin && &fbwin->layerSig() == changedsub) { // layer signal 978 } else if (fbwin && &fbwin->layerSig() == changedsub) { // layer signal
982 STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update), 979 STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update),
983 CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateLayer, *fbwin)); 980 CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateLayer, *fbwin));
984 } else if (fbwin && &fbwin->dieSig() == changedsub) { // window death signal
985 STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update),
986 CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateFrameClose, *fbwin));
987
988 // make sure each workspace get this
989 BScreen &scr = fbwin->screen();
990 scr.removeWindow(fbwin);
991 if (FocusControl::focusedFbWindow() == fbwin)
992 FocusControl::setFocusedFbWindow(0);
993 } else if (fbwin && &fbwin->workspaceSig() == changedsub) { // workspace signal 981 } else if (fbwin && &fbwin->workspaceSig() == changedsub) { // workspace signal
994 STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update), 982 STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update),
995 CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateWorkspace, *fbwin)); 983 CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateWorkspace, *fbwin));
996 } else if (client && &client->dieSig() == changedsub) { // client death 984 }
997 STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update), 985}
998 CallMemFunWithRefArg<AtomHandler, WinClient&, void>(&AtomHandler::updateClientClose, *client));
999 986
1000 BScreen &screen = client->screen(); 987void Fluxbox::windowDied(Focusable &focusable) {
988 FluxboxWindow *fbwin = focusable.fbwindow();
1001 989
1002 // At this point, we trust that this client is no longer in the 990 STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update),
1003 // client list of its frame (but it still has reference to the frame) 991 CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateFrameClose, *focusable.fbwindow()));
1004 // We also assume that any remaining active one is the last focused one
1005 992
1006 // This is where we revert focus on window close 993 // make sure each workspace get this
1007 // NOWHERE ELSE!!! 994 BScreen &scr = focusable.screen();
1008 if (FocusControl::focusedWindow() == client) { 995 scr.removeWindow(fbwin);
1009 FocusControl::unfocusWindow(*client); 996 if (FocusControl::focusedFbWindow() == fbwin)
1010 // make sure nothing else uses this window before focus reverts 997 FocusControl::setFocusedFbWindow(0);
1011 FocusControl::setFocusedWindow(0); 998}
1012 } else if (FocusControl::expectingFocus() == client) { 999
1013 FocusControl::setExpectingFocus(0); 1000void Fluxbox::clientDied(Focusable &focusable) {
1014 revertFocus(); 1001 WinClient &client = dynamic_cast<WinClient &>(focusable);
1015 } 1002
1003 STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update),
1004 CallMemFunWithRefArg<AtomHandler, WinClient&, void>(&AtomHandler::updateClientClose, client));
1016 1005
1017 screen.removeClient(*client); 1006 BScreen &screen = client.screen();
1007
1008 // At this point, we trust that this client is no longer in the
1009 // client list of its frame (but it still has reference to the frame)
1010 // We also assume that any remaining active one is the last focused one
1011
1012 // This is where we revert focus on window close
1013 // NOWHERE ELSE!!!
1014 if (FocusControl::focusedWindow() == &client) {
1015 FocusControl::unfocusWindow(client);
1016 // make sure nothing else uses this window before focus reverts
1017 FocusControl::setFocusedWindow(0);
1018 } else if (FocusControl::expectingFocus() == &client) {
1019 FocusControl::setExpectingFocus(0);
1020 revertFocus();
1018 } 1021 }
1022
1023 screen.removeClient(client);
1019} 1024}
1020 1025
1021void Fluxbox::attachSignals(FluxboxWindow &win) { 1026void Fluxbox::attachSignals(FluxboxWindow &win) {
@@ -1023,13 +1028,13 @@ void Fluxbox::attachSignals(FluxboxWindow &win) {
1023 win.stateSig().attach(this); 1028 win.stateSig().attach(this);
1024 win.workspaceSig().attach(this); 1029 win.workspaceSig().attach(this);
1025 win.layerSig().attach(this); 1030 win.layerSig().attach(this);
1026 win.dieSig().attach(this); 1031 join(win.dieSig(), FbTk::MemFun(*this, &Fluxbox::windowDied));
1027 STLUtil::forAll(m_atomhandler, 1032 STLUtil::forAll(m_atomhandler,
1028 CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::setupFrame, win)); 1033 CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::setupFrame, win));
1029} 1034}
1030 1035
1031void Fluxbox::attachSignals(WinClient &winclient) { 1036void Fluxbox::attachSignals(WinClient &winclient) {
1032 winclient.dieSig().attach(this); 1037 join(winclient.dieSig(), FbTk::MemFun(*this, &Fluxbox::clientDied));
1033 STLUtil::forAll(m_atomhandler, 1038 STLUtil::forAll(m_atomhandler,
1034 CallMemFunWithRefArg<AtomHandler, WinClient&, void>(&AtomHandler::setupClient, winclient)); 1039 CallMemFunWithRefArg<AtomHandler, WinClient&, void>(&AtomHandler::setupClient, winclient));
1035} 1040}
diff --git a/src/fluxbox.hh b/src/fluxbox.hh
index 36b39ef..082297f 100644
--- a/src/fluxbox.hh
+++ b/src/fluxbox.hh
@@ -217,6 +217,10 @@ private:
217 217
218 /// Called when the workspace area changed. 218 /// Called when the workspace area changed.
219 void workspaceAreaChanged(BScreen &screen); 219 void workspaceAreaChanged(BScreen &screen);
220 /// Called when a window (FluxboxWindow) dies
221 void windowDied(Focusable &focusable);
222 /// Called when a client (WinClient) dies
223 void clientDied(Focusable &focusable);
220 224
221 std::auto_ptr<FbAtoms> m_fbatoms; 225 std::auto_ptr<FbAtoms> m_fbatoms;
222 226