all repos — fluxbox @ 16c567638cad8b0fdd5afb08ae7a185f5259e4c1

custom fork of the fluxbox windowmanager

fix winclient death signalling
rathnor rathnor
commit

16c567638cad8b0fdd5afb08ae7a185f5259e4c1

parent

e82122eb44f3ed758f804c97da08d11196e42510

M ChangeLogChangeLog

@@ -1,5 +1,9 @@

(Format: Year/Month/Day) Changes for 0.9.4: +*03/07/05: + * Fix winclient death signalling - fixes remember issues with applying + attributes to wrong windows (Simon) + Remember.hh/cc AtomHandler.hh fluxbox.cc ToolbarHandler.hh/cc Ewmh.hh Gnome.hh *03/07/04: * Add support in remember for grouping apps (Simon) Achieved by using [group], e.g.
M src/AtomHandler.hhsrc/AtomHandler.hh

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: AtomHandler.hh,v 1.9 2003/07/04 01:03:40 rathnor Exp $ +// $Id: AtomHandler.hh,v 1.10 2003/07/04 14:06:20 rathnor Exp $ #ifndef ATOMHANDLER_HH #define ATOMHANDLER_HH

@@ -43,7 +43,8 @@ virtual void updateWorkspaceNames(BScreen &screen) = 0;

virtual void updateCurrentWorkspace(BScreen &screen) = 0; virtual void updateWorkspaceCount(BScreen &screen) = 0; - virtual void updateWindowClose(FluxboxWindow &win) = 0; + virtual void updateFrameClose(FluxboxWindow &win) = 0; + virtual void updateClientClose(WinClient &winclient) = 0; virtual void updateWorkspace(FluxboxWindow &win) = 0; virtual void updateState(FluxboxWindow &win) = 0; virtual void updateHints(FluxboxWindow &win) = 0;
M src/Ewmh.hhsrc/Ewmh.hh

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Ewmh.hh,v 1.8 2003/07/04 01:03:40 rathnor Exp $ +// $Id: Ewmh.hh,v 1.9 2003/07/04 14:06:20 rathnor Exp $ #include "AtomHandler.hh"

@@ -51,7 +51,8 @@ BScreen * screen, FluxboxWindow * const win);

bool propertyNotify(FluxboxWindow &win, Atom the_property); //ignore these ones - void updateWindowClose(FluxboxWindow &win) {} + void updateFrameClose(FluxboxWindow &win) {} + void updateClientClose(WinClient &winclient) {} private:
M src/Gnome.hhsrc/Gnome.hh

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Gnome.hh,v 1.8 2003/07/04 01:03:40 rathnor Exp $ +// $Id: Gnome.hh,v 1.9 2003/07/04 14:06:20 rathnor Exp $ #ifndef GNOME_HH #define GNOME_HH

@@ -81,7 +81,8 @@

bool checkClientMessage(const XClientMessageEvent &ce, BScreen * screen, FluxboxWindow * const win); // ignore these ones - void updateWindowClose(FluxboxWindow &win) {} + void updateFrameClose(FluxboxWindow &win) {} + void updateClientClose(WinClient &winclient) {} bool propertyNotify(FluxboxWindow &win, Atom the_property) { return false; } private:
M src/Remember.ccsrc/Remember.cc

@@ -21,7 +21,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Remember.cc,v 1.25 2003/07/04 01:03:40 rathnor Exp $ +// $Id: Remember.cc,v 1.26 2003/07/04 14:06:20 rathnor Exp $ #include "Remember.hh" #include "ClientPattern.hh"

@@ -216,94 +216,94 @@ first_line = 0;

} row++; - if (line[0] != '#') { //the line is commented - int parse_pos = 0, err = 0; - string str_key, str_label; - err = FbTk::StringUtil::getStringBetween(str_key, - line.c_str(), - '[', ']'); - if (err > 0 ) { + if (line[0] == '#') + continue; //the line is commented + int parse_pos = 0, err = 0; + string str_key, str_label; + err = FbTk::StringUtil::getStringBetween(str_key, + line.c_str(), + '[', ']'); + if (err > 0 ) { + parse_pos += err; + err = FbTk::StringUtil::getStringBetween(str_label, + line.c_str() + parse_pos, + '{', '}'); + if (err>0) { parse_pos += err; - err = FbTk::StringUtil::getStringBetween(str_label, - line.c_str() + parse_pos, - '{', '}'); - if (err>0) { - parse_pos += err; - } - } else - continue; //read next line + } + } else + continue; //read next line - if (!str_key.size()) - continue; //read next line - if (str_key == "Workspace") { - unsigned int w; - istringstream iss(str_label.c_str()); - iss >> w; - app.rememberWorkspace(w); - } else if (str_key == "Layer") { - unsigned int l; - istringstream iss(str_label.c_str()); - iss >> l; - app.rememberLayer(l); - } else if (str_key == "Dimensions") { - unsigned int h,w; - istringstream iss(str_label.c_str()); - iss >> w >> h; - app.rememberDimensions(w,h); - } else if (str_key == "Position") { - unsigned int x,y; - istringstream iss(str_label); - iss >> x >> y; - app.rememberPosition(x,y); - } else if (str_key == "Shaded") { - app.rememberShadedstate((str_label=="yes")); - } else if (str_key == "Tab") { - app.rememberTabstate((str_label=="yes")); - } else if (str_key == "Deco") { - if (str_label == "NONE") { - app.rememberDecostate((unsigned int) 0); - } else if (str_label == "NORMAL") { - app.rememberDecostate((unsigned int) 0xfffffff); - } else if (str_label == "TINY") { - app.rememberDecostate((unsigned int) - FluxboxWindow::DECORM_TITLEBAR - | FluxboxWindow::DECORM_ICONIFY - | FluxboxWindow::DECORM_MENU - ); - } else if (str_label == "TOOL") { - app.rememberDecostate((unsigned int) - FluxboxWindow::DECORM_TITLEBAR - | FluxboxWindow::DECORM_MENU - ); - } else if (str_label == "BORDER") { - app.rememberDecostate((unsigned int) - FluxboxWindow::DECORM_BORDER - | FluxboxWindow::DECORM_MENU - ); - } else { - unsigned int mask; - const char * str = str_label.c_str(); - // it'll have at least one char and \0, so this is safe - istringstream iss(str); - // check for hex - if (str[0] == '0' && str[1] == 'x') { - iss.seekg(2); - iss >> hex; - } - iss >> mask ; - app.rememberDecostate(mask); - } - } else if (str_key == "Sticky") { - app.rememberStuckstate((str_label=="yes")); - } else if (str_key == "Jump") { - app.rememberJumpworkspace((str_label=="yes")); - } else if (str_key == "Close") { - app.rememberSaveOnClose((str_label=="yes")); - } else if (str_key == "end") { - return row; + if (!str_key.size()) + continue; //read next line + if (str_key == "Workspace") { + unsigned int w; + istringstream iss(str_label.c_str()); + iss >> w; + app.rememberWorkspace(w); + } else if (str_key == "Layer") { + unsigned int l; + istringstream iss(str_label.c_str()); + iss >> l; + app.rememberLayer(l); + } else if (str_key == "Dimensions") { + unsigned int h,w; + istringstream iss(str_label.c_str()); + iss >> w >> h; + app.rememberDimensions(w,h); + } else if (str_key == "Position") { + unsigned int x,y; + istringstream iss(str_label); + iss >> x >> y; + app.rememberPosition(x,y); + } else if (str_key == "Shaded") { + app.rememberShadedstate((str_label=="yes")); + } else if (str_key == "Tab") { + app.rememberTabstate((str_label=="yes")); + } else if (str_key == "Deco") { + if (str_label == "NONE") { + app.rememberDecostate((unsigned int) 0); + } else if (str_label == "NORMAL") { + app.rememberDecostate((unsigned int) 0xfffffff); + } else if (str_label == "TINY") { + app.rememberDecostate((unsigned int) + FluxboxWindow::DECORM_TITLEBAR + | FluxboxWindow::DECORM_ICONIFY + | FluxboxWindow::DECORM_MENU + ); + } else if (str_label == "TOOL") { + app.rememberDecostate((unsigned int) + FluxboxWindow::DECORM_TITLEBAR + | FluxboxWindow::DECORM_MENU + ); + } else if (str_label == "BORDER") { + app.rememberDecostate((unsigned int) + FluxboxWindow::DECORM_BORDER + | FluxboxWindow::DECORM_MENU + ); } else { - cerr << "Unsupported apps key = " << str_key << endl; + unsigned int mask; + const char * str = str_label.c_str(); + // it'll have at least one char and \0, so this is safe + istringstream iss(str); + // check for hex + if (str[0] == '0' && str[1] == 'x') { + iss.seekg(2); + iss >> hex; + } + iss >> mask ; + app.rememberDecostate(mask); } + } else if (str_key == "Sticky") { + app.rememberStuckstate((str_label=="yes")); + } else if (str_key == "Jump") { + app.rememberJumpworkspace((str_label=="yes")); + } else if (str_key == "Close") { + app.rememberSaveOnClose((str_label=="yes")); + } else if (str_key == "end") { + return row; + } else { + cerr << "Unsupported apps key = " << str_key << endl; } } }

@@ -684,35 +684,35 @@ app->group->attachClient(winclient);

} } -void Remember::updateWindowClose(FluxboxWindow &win) { - // This doesn't work at present since fluxbox.cc is missing the windowclose stuff. - // I don't trust it (particularly winClient()) while this is the case +void Remember::updateClientClose(WinClient &winclient) { + Application *app = find(winclient); - // scan all winclients and remove this fbw - Patterns::iterator it = m_pats.begin(); - while (it != m_pats.end()) { - if (&win == it->second->group) - it->second->group = 0; - ++it; - } + if (app && (app->save_on_close_remember && app->save_on_close)) { - return; + for (int attrib = 0; attrib <= REM_LASTATTRIB; attrib++) { + if (isRemembered(winclient, (Attribute) attrib)) { + rememberAttrib(winclient, (Attribute) attrib); + } + } - WinClient &winclient = win.winClient(); - Application *app = find(winclient); - Clients::iterator wc_it = m_clients.find(&win.winClient()); + save(); + } - if (wc_it != m_clients.end()) + // we need to get rid of references to this client + Clients::iterator wc_it = m_clients.find(&winclient); + + if (wc_it != m_clients.end()) { m_clients.erase(wc_it); + } - if (!app || !(app->save_on_close_remember && app->save_on_close)) - return; +} - for (int attrib = 0; attrib <= REM_LASTATTRIB; attrib++) { - if (isRemembered(winclient, (Attribute) attrib)) { - rememberAttrib(winclient, (Attribute) attrib); - } +void Remember::updateFrameClose(FluxboxWindow &win) { + // scan all applications and remove this fbw if it is a recorded group + Patterns::iterator it = m_pats.begin(); + while (it != m_pats.end()) { + if (&win == it->second->group) + it->second->group = 0; + ++it; } - - save(); }
M src/Remember.hhsrc/Remember.hh

@@ -21,7 +21,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Remember.hh,v 1.9 2003/07/04 01:03:40 rathnor Exp $ +// $Id: Remember.hh,v 1.10 2003/07/04 14:06:20 rathnor Exp $ /* Based on the original "Remember patch" by Xavier Brouckaert */

@@ -166,7 +166,8 @@

// Functions we actually use void setupFrame(FluxboxWindow &win); void setupClient(WinClient &winclient); - void updateWindowClose(FluxboxWindow &win); + void updateFrameClose(FluxboxWindow &win); + void updateClientClose(WinClient &winclient); // Functions we ignore (zero from AtomHandler) // Leaving here in case they might be useful later
M src/ToolbarHandler.ccsrc/ToolbarHandler.cc

@@ -20,7 +20,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: ToolbarHandler.cc,v 1.20 2003/07/04 01:03:40 rathnor Exp $ +// $Id: ToolbarHandler.cc,v 1.21 2003/07/04 14:06:20 rathnor Exp $ /** * The ToolbarHandler class acts as a rough interface to the toolbar.

@@ -295,7 +295,7 @@ break;

} } -void ToolbarHandler::updateWindowClose(FluxboxWindow &win) { +void ToolbarHandler::updateFrameClose(FluxboxWindow &win) { if (&win.screen() != &m_screen) return;
M src/ToolbarHandler.hhsrc/ToolbarHandler.hh

@@ -20,7 +20,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: ToolbarHandler.hh,v 1.5 2003/07/04 01:03:40 rathnor Exp $ +// $Id: ToolbarHandler.hh,v 1.6 2003/07/04 14:06:20 rathnor Exp $ #ifndef TOOLBARHANDLER_HH #define TOOLBARHANDLER_HH

@@ -61,7 +61,8 @@ // TODO: add setupClient and configure option to show groups or indiv. clients

void setupClient(WinClient &winclient) {} void updateState(FluxboxWindow &win); - void updateWindowClose(FluxboxWindow &win); + void updateFrameClose(FluxboxWindow &win); + void updateClientClose(WinClient &winclient) {} void updateWorkspace(FluxboxWindow &win); void updateCurrentWorkspace(BScreen &screen);
M src/fluxbox.ccsrc/fluxbox.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.cc,v 1.168 2003/07/04 01:03:41 rathnor Exp $ +// $Id: fluxbox.cc,v 1.169 2003/07/04 14:06:20 rathnor Exp $ #include "fluxbox.hh"

@@ -1262,7 +1262,7 @@ }

} else if ((&(win.dieSig())) == changedsub) { // window death signal for (size_t i=0; i<m_atomhandler.size(); ++i) { if (m_atomhandler[i]->update()) - m_atomhandler[i]->updateWindowClose(win); + m_atomhandler[i]->updateFrameClose(win); } // make sure each workspace get this BScreen &scr = win.screen();

@@ -1309,15 +1309,16 @@ } else if (typeid(*changedsub) == typeid(WinClient::WinClientSubj)) {

WinClient::WinClientSubj *subj = dynamic_cast<WinClient::WinClientSubj *>(changedsub); WinClient &client = subj->winClient(); + // TODO: don't assume it is diesig (need to fix as soon as another signal appears) + for (size_t i=0; i<m_atomhandler.size(); ++i) { + if (m_atomhandler[i]->update()) + m_atomhandler[i]->updateClientClose(client); + } BScreen &screen = client.screen(); screen.updateNetizenWindowDel(client.window()); screen.removeClient(client); removeWindowSearch(client.window()); - //!! TODO -#ifdef DEBUG - cerr<<__FILE__<<"("<<__FUNCTION__<<") TODO: signal stuff for client death!!"<<endl; -#endif // DEBUG } }