aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-07-04 14:06:20 (GMT)
committerrathnor <rathnor>2003-07-04 14:06:20 (GMT)
commit16c567638cad8b0fdd5afb08ae7a185f5259e4c1 (patch)
tree03a5b1e59b630516d05a6f81fd82f026b69a2a5b
parente82122eb44f3ed758f804c97da08d11196e42510 (diff)
downloadfluxbox-16c567638cad8b0fdd5afb08ae7a185f5259e4c1.zip
fluxbox-16c567638cad8b0fdd5afb08ae7a185f5259e4c1.tar.bz2
fix winclient death signalling
-rw-r--r--ChangeLog4
-rw-r--r--src/AtomHandler.hh5
-rw-r--r--src/Ewmh.hh5
-rw-r--r--src/Gnome.hh5
-rw-r--r--src/Remember.cc218
-rw-r--r--src/Remember.hh5
-rw-r--r--src/ToolbarHandler.cc4
-rw-r--r--src/ToolbarHandler.hh5
-rw-r--r--src/fluxbox.cc13
9 files changed, 137 insertions, 127 deletions
diff --git a/ChangeLog b/ChangeLog
index 2779cc5..b465e17 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
1(Format: Year/Month/Day) 1(Format: Year/Month/Day)
2Changes for 0.9.4: 2Changes for 0.9.4:
3*03/07/05:
4 * Fix winclient death signalling - fixes remember issues with applying
5 attributes to wrong windows (Simon)
6 Remember.hh/cc AtomHandler.hh fluxbox.cc ToolbarHandler.hh/cc Ewmh.hh Gnome.hh
3*03/07/04: 7*03/07/04:
4 * Add support in remember for grouping apps (Simon) 8 * Add support in remember for grouping apps (Simon)
5 Achieved by using [group], e.g. 9 Achieved by using [group], e.g.
diff --git a/src/AtomHandler.hh b/src/AtomHandler.hh
index 4b47e15..7212ff7 100644
--- a/src/AtomHandler.hh
+++ b/src/AtomHandler.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: AtomHandler.hh,v 1.9 2003/07/04 01:03:40 rathnor Exp $ 22// $Id: AtomHandler.hh,v 1.10 2003/07/04 14:06:20 rathnor Exp $
23 23
24#ifndef ATOMHANDLER_HH 24#ifndef ATOMHANDLER_HH
25#define ATOMHANDLER_HH 25#define ATOMHANDLER_HH
@@ -43,7 +43,8 @@ public:
43 virtual void updateCurrentWorkspace(BScreen &screen) = 0; 43 virtual void updateCurrentWorkspace(BScreen &screen) = 0;
44 virtual void updateWorkspaceCount(BScreen &screen) = 0; 44 virtual void updateWorkspaceCount(BScreen &screen) = 0;
45 45
46 virtual void updateWindowClose(FluxboxWindow &win) = 0; 46 virtual void updateFrameClose(FluxboxWindow &win) = 0;
47 virtual void updateClientClose(WinClient &winclient) = 0;
47 virtual void updateWorkspace(FluxboxWindow &win) = 0; 48 virtual void updateWorkspace(FluxboxWindow &win) = 0;
48 virtual void updateState(FluxboxWindow &win) = 0; 49 virtual void updateState(FluxboxWindow &win) = 0;
49 virtual void updateHints(FluxboxWindow &win) = 0; 50 virtual void updateHints(FluxboxWindow &win) = 0;
diff --git a/src/Ewmh.hh b/src/Ewmh.hh
index ff508e5..206f36e 100644
--- a/src/Ewmh.hh
+++ b/src/Ewmh.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Ewmh.hh,v 1.8 2003/07/04 01:03:40 rathnor Exp $ 22// $Id: Ewmh.hh,v 1.9 2003/07/04 14:06:20 rathnor Exp $
23 23
24#include "AtomHandler.hh" 24#include "AtomHandler.hh"
25 25
@@ -51,7 +51,8 @@ public:
51 51
52 bool propertyNotify(FluxboxWindow &win, Atom the_property); 52 bool propertyNotify(FluxboxWindow &win, Atom the_property);
53 //ignore these ones 53 //ignore these ones
54 void updateWindowClose(FluxboxWindow &win) {} 54 void updateFrameClose(FluxboxWindow &win) {}
55 void updateClientClose(WinClient &winclient) {}
55 56
56private: 57private:
57 58
diff --git a/src/Gnome.hh b/src/Gnome.hh
index 35e25c8..a9a63f5 100644
--- a/src/Gnome.hh
+++ b/src/Gnome.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Gnome.hh,v 1.8 2003/07/04 01:03:40 rathnor Exp $ 22// $Id: Gnome.hh,v 1.9 2003/07/04 14:06:20 rathnor Exp $
23 23
24#ifndef GNOME_HH 24#ifndef GNOME_HH
25#define GNOME_HH 25#define GNOME_HH
@@ -81,7 +81,8 @@ public:
81 bool checkClientMessage(const XClientMessageEvent &ce, BScreen * screen, FluxboxWindow * const win); 81 bool checkClientMessage(const XClientMessageEvent &ce, BScreen * screen, FluxboxWindow * const win);
82 82
83 // ignore these ones 83 // ignore these ones
84 void updateWindowClose(FluxboxWindow &win) {} 84 void updateFrameClose(FluxboxWindow &win) {}
85 void updateClientClose(WinClient &winclient) {}
85 bool propertyNotify(FluxboxWindow &win, Atom the_property) { return false; } 86 bool propertyNotify(FluxboxWindow &win, Atom the_property) { return false; }
86 87
87private: 88private:
diff --git a/src/Remember.cc b/src/Remember.cc
index 97d1e35..0b4b248 100644
--- a/src/Remember.cc
+++ b/src/Remember.cc
@@ -21,7 +21,7 @@
21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22// DEALINGS IN THE SOFTWARE. 22// DEALINGS IN THE SOFTWARE.
23 23
24// $Id: Remember.cc,v 1.25 2003/07/04 01:03:40 rathnor Exp $ 24// $Id: Remember.cc,v 1.26 2003/07/04 14:06:20 rathnor Exp $
25 25
26#include "Remember.hh" 26#include "Remember.hh"
27#include "ClientPattern.hh" 27#include "ClientPattern.hh"
@@ -216,94 +216,94 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) {
216 } 216 }
217 217
218 row++; 218 row++;
219 if (line[0] != '#') { //the line is commented 219 if (line[0] == '#')
220 int parse_pos = 0, err = 0; 220 continue; //the line is commented
221 string str_key, str_label; 221 int parse_pos = 0, err = 0;
222 err = FbTk::StringUtil::getStringBetween(str_key, 222 string str_key, str_label;
223 line.c_str(), 223 err = FbTk::StringUtil::getStringBetween(str_key,
224 '[', ']'); 224 line.c_str(),
225 if (err > 0 ) { 225 '[', ']');
226 if (err > 0 ) {
227 parse_pos += err;
228 err = FbTk::StringUtil::getStringBetween(str_label,
229 line.c_str() + parse_pos,
230 '{', '}');
231 if (err>0) {
226 parse_pos += err; 232 parse_pos += err;
227 err = FbTk::StringUtil::getStringBetween(str_label, 233 }
228 line.c_str() + parse_pos, 234 } else
229 '{', '}'); 235 continue; //read next line
230 if (err>0) { 236
231 parse_pos += err; 237 if (!str_key.size())
232 } 238 continue; //read next line
233 } else 239 if (str_key == "Workspace") {
234 continue; //read next line 240 unsigned int w;
235 241 istringstream iss(str_label.c_str());
236 if (!str_key.size()) 242 iss >> w;
237 continue; //read next line 243 app.rememberWorkspace(w);
238 if (str_key == "Workspace") { 244 } else if (str_key == "Layer") {
239 unsigned int w; 245 unsigned int l;
240 istringstream iss(str_label.c_str()); 246 istringstream iss(str_label.c_str());
241 iss >> w; 247 iss >> l;
242 app.rememberWorkspace(w); 248 app.rememberLayer(l);
243 } else if (str_key == "Layer") { 249 } else if (str_key == "Dimensions") {
244 unsigned int l; 250 unsigned int h,w;
245 istringstream iss(str_label.c_str()); 251 istringstream iss(str_label.c_str());
246 iss >> l; 252 iss >> w >> h;
247 app.rememberLayer(l); 253 app.rememberDimensions(w,h);
248 } else if (str_key == "Dimensions") { 254 } else if (str_key == "Position") {
249 unsigned int h,w; 255 unsigned int x,y;
250 istringstream iss(str_label.c_str()); 256 istringstream iss(str_label);
251 iss >> w >> h; 257 iss >> x >> y;
252 app.rememberDimensions(w,h); 258 app.rememberPosition(x,y);
253 } else if (str_key == "Position") { 259 } else if (str_key == "Shaded") {
254 unsigned int x,y; 260 app.rememberShadedstate((str_label=="yes"));
255 istringstream iss(str_label); 261 } else if (str_key == "Tab") {
256 iss >> x >> y; 262 app.rememberTabstate((str_label=="yes"));
257 app.rememberPosition(x,y); 263 } else if (str_key == "Deco") {
258 } else if (str_key == "Shaded") { 264 if (str_label == "NONE") {
259 app.rememberShadedstate((str_label=="yes")); 265 app.rememberDecostate((unsigned int) 0);
260 } else if (str_key == "Tab") { 266 } else if (str_label == "NORMAL") {
261 app.rememberTabstate((str_label=="yes")); 267 app.rememberDecostate((unsigned int) 0xfffffff);
262 } else if (str_key == "Deco") { 268 } else if (str_label == "TINY") {
263 if (str_label == "NONE") { 269 app.rememberDecostate((unsigned int)
264 app.rememberDecostate((unsigned int) 0); 270 FluxboxWindow::DECORM_TITLEBAR
265 } else if (str_label == "NORMAL") { 271 | FluxboxWindow::DECORM_ICONIFY
266 app.rememberDecostate((unsigned int) 0xfffffff); 272 | FluxboxWindow::DECORM_MENU
267 } else if (str_label == "TINY") { 273 );
268 app.rememberDecostate((unsigned int) 274 } else if (str_label == "TOOL") {
269 FluxboxWindow::DECORM_TITLEBAR 275 app.rememberDecostate((unsigned int)
270 | FluxboxWindow::DECORM_ICONIFY 276 FluxboxWindow::DECORM_TITLEBAR
271 | FluxboxWindow::DECORM_MENU 277 | FluxboxWindow::DECORM_MENU
272 ); 278 );
273 } else if (str_label == "TOOL") { 279 } else if (str_label == "BORDER") {
274 app.rememberDecostate((unsigned int) 280 app.rememberDecostate((unsigned int)
275 FluxboxWindow::DECORM_TITLEBAR 281 FluxboxWindow::DECORM_BORDER
276 | FluxboxWindow::DECORM_MENU 282 | FluxboxWindow::DECORM_MENU
277 ); 283 );
278 } else if (str_label == "BORDER") {
279 app.rememberDecostate((unsigned int)
280 FluxboxWindow::DECORM_BORDER
281 | FluxboxWindow::DECORM_MENU
282 );
283 } else {
284 unsigned int mask;
285 const char * str = str_label.c_str();
286 // it'll have at least one char and \0, so this is safe
287 istringstream iss(str);
288 // check for hex
289 if (str[0] == '0' && str[1] == 'x') {
290 iss.seekg(2);
291 iss >> hex;
292 }
293 iss >> mask ;
294 app.rememberDecostate(mask);
295 }
296 } else if (str_key == "Sticky") {
297 app.rememberStuckstate((str_label=="yes"));
298 } else if (str_key == "Jump") {
299 app.rememberJumpworkspace((str_label=="yes"));
300 } else if (str_key == "Close") {
301 app.rememberSaveOnClose((str_label=="yes"));
302 } else if (str_key == "end") {
303 return row;
304 } else { 284 } else {
305 cerr << "Unsupported apps key = " << str_key << endl; 285 unsigned int mask;
286 const char * str = str_label.c_str();
287 // it'll have at least one char and \0, so this is safe
288 istringstream iss(str);
289 // check for hex
290 if (str[0] == '0' && str[1] == 'x') {
291 iss.seekg(2);
292 iss >> hex;
293 }
294 iss >> mask ;
295 app.rememberDecostate(mask);
306 } 296 }
297 } else if (str_key == "Sticky") {
298 app.rememberStuckstate((str_label=="yes"));
299 } else if (str_key == "Jump") {
300 app.rememberJumpworkspace((str_label=="yes"));
301 } else if (str_key == "Close") {
302 app.rememberSaveOnClose((str_label=="yes"));
303 } else if (str_key == "end") {
304 return row;
305 } else {
306 cerr << "Unsupported apps key = " << str_key << endl;
307 } 307 }
308 } 308 }
309 } 309 }
@@ -684,35 +684,35 @@ void Remember::setupClient(WinClient &winclient) {
684 } 684 }
685} 685}
686 686
687void Remember::updateWindowClose(FluxboxWindow &win) { 687void Remember::updateClientClose(WinClient &winclient) {
688 // This doesn't work at present since fluxbox.cc is missing the windowclose stuff. 688 Application *app = find(winclient);
689 // I don't trust it (particularly winClient()) while this is the case 689
690 if (app && (app->save_on_close_remember && app->save_on_close)) {
690 691
691 // scan all winclients and remove this fbw 692 for (int attrib = 0; attrib <= REM_LASTATTRIB; attrib++) {
692 Patterns::iterator it = m_pats.begin(); 693 if (isRemembered(winclient, (Attribute) attrib)) {
693 while (it != m_pats.end()) { 694 rememberAttrib(winclient, (Attribute) attrib);
694 if (&win == it->second->group) 695 }
695 it->second->group = 0; 696 }
696 ++it;
697 }
698 697
699 return; 698 save();
699 }
700 700
701 WinClient &winclient = win.winClient(); 701 // we need to get rid of references to this client
702 Application *app = find(winclient); 702 Clients::iterator wc_it = m_clients.find(&winclient);
703 Clients::iterator wc_it = m_clients.find(&win.winClient());
704 703
705 if (wc_it != m_clients.end()) 704 if (wc_it != m_clients.end()) {
706 m_clients.erase(wc_it); 705 m_clients.erase(wc_it);
706 }
707 707
708 if (!app || !(app->save_on_close_remember && app->save_on_close)) 708}
709 return;
710 709
711 for (int attrib = 0; attrib <= REM_LASTATTRIB; attrib++) { 710void Remember::updateFrameClose(FluxboxWindow &win) {
712 if (isRemembered(winclient, (Attribute) attrib)) { 711 // scan all applications and remove this fbw if it is a recorded group
713 rememberAttrib(winclient, (Attribute) attrib); 712 Patterns::iterator it = m_pats.begin();
714 } 713 while (it != m_pats.end()) {
714 if (&win == it->second->group)
715 it->second->group = 0;
716 ++it;
715 } 717 }
716
717 save();
718} 718}
diff --git a/src/Remember.hh b/src/Remember.hh
index 756bc7f..c687137 100644
--- a/src/Remember.hh
+++ b/src/Remember.hh
@@ -21,7 +21,7 @@
21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22// DEALINGS IN THE SOFTWARE. 22// DEALINGS IN THE SOFTWARE.
23 23
24// $Id: Remember.hh,v 1.9 2003/07/04 01:03:40 rathnor Exp $ 24// $Id: Remember.hh,v 1.10 2003/07/04 14:06:20 rathnor Exp $
25 25
26/* Based on the original "Remember patch" by Xavier Brouckaert */ 26/* Based on the original "Remember patch" by Xavier Brouckaert */
27 27
@@ -166,7 +166,8 @@ public:
166 // Functions we actually use 166 // Functions we actually use
167 void setupFrame(FluxboxWindow &win); 167 void setupFrame(FluxboxWindow &win);
168 void setupClient(WinClient &winclient); 168 void setupClient(WinClient &winclient);
169 void updateWindowClose(FluxboxWindow &win); 169 void updateFrameClose(FluxboxWindow &win);
170 void updateClientClose(WinClient &winclient);
170 171
171 // Functions we ignore (zero from AtomHandler) 172 // Functions we ignore (zero from AtomHandler)
172 // Leaving here in case they might be useful later 173 // Leaving here in case they might be useful later
diff --git a/src/ToolbarHandler.cc b/src/ToolbarHandler.cc
index 61949ce..152ed67 100644
--- a/src/ToolbarHandler.cc
+++ b/src/ToolbarHandler.cc
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: ToolbarHandler.cc,v 1.20 2003/07/04 01:03:40 rathnor Exp $ 23// $Id: ToolbarHandler.cc,v 1.21 2003/07/04 14:06:20 rathnor Exp $
24 24
25/** 25/**
26 * The ToolbarHandler class acts as a rough interface to the toolbar. 26 * The ToolbarHandler class acts as a rough interface to the toolbar.
@@ -295,7 +295,7 @@ void ToolbarHandler::setupFrame(FluxboxWindow &win) {
295 } 295 }
296} 296}
297 297
298void ToolbarHandler::updateWindowClose(FluxboxWindow &win) { 298void ToolbarHandler::updateFrameClose(FluxboxWindow &win) {
299 if (&win.screen() != &m_screen) 299 if (&win.screen() != &m_screen)
300 return; 300 return;
301 301
diff --git a/src/ToolbarHandler.hh b/src/ToolbarHandler.hh
index f0c470d..a8b31cf 100644
--- a/src/ToolbarHandler.hh
+++ b/src/ToolbarHandler.hh
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: ToolbarHandler.hh,v 1.5 2003/07/04 01:03:40 rathnor Exp $ 23// $Id: ToolbarHandler.hh,v 1.6 2003/07/04 14:06:20 rathnor Exp $
24 24
25#ifndef TOOLBARHANDLER_HH 25#ifndef TOOLBARHANDLER_HH
26#define TOOLBARHANDLER_HH 26#define TOOLBARHANDLER_HH
@@ -61,7 +61,8 @@ public:
61 void setupClient(WinClient &winclient) {} 61 void setupClient(WinClient &winclient) {}
62 62
63 void updateState(FluxboxWindow &win); 63 void updateState(FluxboxWindow &win);
64 void updateWindowClose(FluxboxWindow &win); 64 void updateFrameClose(FluxboxWindow &win);
65 void updateClientClose(WinClient &winclient) {}
65 void updateWorkspace(FluxboxWindow &win); 66 void updateWorkspace(FluxboxWindow &win);
66 void updateCurrentWorkspace(BScreen &screen); 67 void updateCurrentWorkspace(BScreen &screen);
67 68
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index cb5cb68..75a6502 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: fluxbox.cc,v 1.168 2003/07/04 01:03:41 rathnor Exp $ 25// $Id: fluxbox.cc,v 1.169 2003/07/04 14:06:20 rathnor Exp $
26 26
27#include "fluxbox.hh" 27#include "fluxbox.hh"
28 28
@@ -1262,7 +1262,7 @@ void Fluxbox::update(FbTk::Subject *changedsub) {
1262 } else if ((&(win.dieSig())) == changedsub) { // window death signal 1262 } else if ((&(win.dieSig())) == changedsub) { // window death signal
1263 for (size_t i=0; i<m_atomhandler.size(); ++i) { 1263 for (size_t i=0; i<m_atomhandler.size(); ++i) {
1264 if (m_atomhandler[i]->update()) 1264 if (m_atomhandler[i]->update())
1265 m_atomhandler[i]->updateWindowClose(win); 1265 m_atomhandler[i]->updateFrameClose(win);
1266 } 1266 }
1267 // make sure each workspace get this 1267 // make sure each workspace get this
1268 BScreen &scr = win.screen(); 1268 BScreen &scr = win.screen();
@@ -1309,15 +1309,16 @@ void Fluxbox::update(FbTk::Subject *changedsub) {
1309 WinClient::WinClientSubj *subj = dynamic_cast<WinClient::WinClientSubj *>(changedsub); 1309 WinClient::WinClientSubj *subj = dynamic_cast<WinClient::WinClientSubj *>(changedsub);
1310 WinClient &client = subj->winClient(); 1310 WinClient &client = subj->winClient();
1311 1311
1312 // TODO: don't assume it is diesig (need to fix as soon as another signal appears)
1313 for (size_t i=0; i<m_atomhandler.size(); ++i) {
1314 if (m_atomhandler[i]->update())
1315 m_atomhandler[i]->updateClientClose(client);
1316 }
1312 BScreen &screen = client.screen(); 1317 BScreen &screen = client.screen();
1313 screen.updateNetizenWindowDel(client.window()); 1318 screen.updateNetizenWindowDel(client.window());
1314 screen.removeClient(client); 1319 screen.removeClient(client);
1315 1320
1316 removeWindowSearch(client.window()); 1321 removeWindowSearch(client.window());
1317 //!! TODO
1318#ifdef DEBUG
1319 cerr<<__FILE__<<"("<<__FUNCTION__<<") TODO: signal stuff for client death!!"<<endl;
1320#endif // DEBUG
1321 } 1322 }
1322} 1323}
1323 1324