fix winclient death signalling

This commit is contained in:
rathnor 2003-07-04 14:06:20 +00:00
parent e82122eb44
commit 16c567638c
9 changed files with 139 additions and 129 deletions

View file

@ -1,5 +1,9 @@
(Format: Year/Month/Day) (Format: Year/Month/Day)
Changes for 0.9.4: 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: *03/07/04:
* Add support in remember for grouping apps (Simon) * Add support in remember for grouping apps (Simon)
Achieved by using [group], e.g. Achieved by using [group], e.g.

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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 #ifndef ATOMHANDLER_HH
#define ATOMHANDLER_HH #define ATOMHANDLER_HH
@ -43,7 +43,8 @@ public:
virtual void updateCurrentWorkspace(BScreen &screen) = 0; virtual void updateCurrentWorkspace(BScreen &screen) = 0;
virtual void updateWorkspaceCount(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 updateWorkspace(FluxboxWindow &win) = 0;
virtual void updateState(FluxboxWindow &win) = 0; virtual void updateState(FluxboxWindow &win) = 0;
virtual void updateHints(FluxboxWindow &win) = 0; virtual void updateHints(FluxboxWindow &win) = 0;

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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" #include "AtomHandler.hh"
@ -51,7 +51,8 @@ public:
bool propertyNotify(FluxboxWindow &win, Atom the_property); bool propertyNotify(FluxboxWindow &win, Atom the_property);
//ignore these ones //ignore these ones
void updateWindowClose(FluxboxWindow &win) {} void updateFrameClose(FluxboxWindow &win) {}
void updateClientClose(WinClient &winclient) {}
private: private:

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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 #ifndef GNOME_HH
#define GNOME_HH #define GNOME_HH
@ -81,7 +81,8 @@ public:
bool checkClientMessage(const XClientMessageEvent &ce, BScreen * screen, FluxboxWindow * const win); bool checkClientMessage(const XClientMessageEvent &ce, BScreen * screen, FluxboxWindow * const win);
// ignore these ones // ignore these ones
void updateWindowClose(FluxboxWindow &win) {} void updateFrameClose(FluxboxWindow &win) {}
void updateClientClose(WinClient &winclient) {}
bool propertyNotify(FluxboxWindow &win, Atom the_property) { return false; } bool propertyNotify(FluxboxWindow &win, Atom the_property) { return false; }
private: private:

View file

@ -21,7 +21,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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 "Remember.hh"
#include "ClientPattern.hh" #include "ClientPattern.hh"
@ -216,94 +216,94 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) {
} }
row++; row++;
if (line[0] != '#') { //the line is commented if (line[0] == '#')
int parse_pos = 0, err = 0; continue; //the line is commented
string str_key, str_label; int parse_pos = 0, err = 0;
err = FbTk::StringUtil::getStringBetween(str_key, string str_key, str_label;
line.c_str(), err = FbTk::StringUtil::getStringBetween(str_key,
'[', ']'); line.c_str(),
if (err > 0 ) { '[', ']');
if (err > 0 ) {
parse_pos += err;
err = FbTk::StringUtil::getStringBetween(str_label,
line.c_str() + parse_pos,
'{', '}');
if (err>0) {
parse_pos += err; 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
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;
} else {
cerr << "Unsupported apps key = " << str_key << endl;
} }
} 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;
} else {
cerr << "Unsupported apps key = " << str_key << endl;
} }
} }
} }
@ -684,35 +684,35 @@ void Remember::setupClient(WinClient &winclient) {
} }
} }
void Remember::updateWindowClose(FluxboxWindow &win) { void Remember::updateClientClose(WinClient &winclient) {
// This doesn't work at present since fluxbox.cc is missing the windowclose stuff. Application *app = find(winclient);
// I don't trust it (particularly winClient()) while this is the case
// scan all winclients and remove this fbw if (app && (app->save_on_close_remember && app->save_on_close)) {
for (int attrib = 0; attrib <= REM_LASTATTRIB; attrib++) {
if (isRemembered(winclient, (Attribute) attrib)) {
rememberAttrib(winclient, (Attribute) attrib);
}
}
save();
}
// 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);
}
}
void Remember::updateFrameClose(FluxboxWindow &win) {
// scan all applications and remove this fbw if it is a recorded group
Patterns::iterator it = m_pats.begin(); Patterns::iterator it = m_pats.begin();
while (it != m_pats.end()) { while (it != m_pats.end()) {
if (&win == it->second->group) if (&win == it->second->group)
it->second->group = 0; it->second->group = 0;
++it; ++it;
} }
return;
WinClient &winclient = win.winClient();
Application *app = find(winclient);
Clients::iterator wc_it = m_clients.find(&win.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);
}
}
save();
} }

View file

@ -21,7 +21,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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 */ /* Based on the original "Remember patch" by Xavier Brouckaert */
@ -166,7 +166,8 @@ public:
// Functions we actually use // Functions we actually use
void setupFrame(FluxboxWindow &win); void setupFrame(FluxboxWindow &win);
void setupClient(WinClient &winclient); void setupClient(WinClient &winclient);
void updateWindowClose(FluxboxWindow &win); void updateFrameClose(FluxboxWindow &win);
void updateClientClose(WinClient &winclient);
// Functions we ignore (zero from AtomHandler) // Functions we ignore (zero from AtomHandler)
// Leaving here in case they might be useful later // Leaving here in case they might be useful later

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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. * The ToolbarHandler class acts as a rough interface to the toolbar.
@ -295,7 +295,7 @@ void ToolbarHandler::setupFrame(FluxboxWindow &win) {
} }
} }
void ToolbarHandler::updateWindowClose(FluxboxWindow &win) { void ToolbarHandler::updateFrameClose(FluxboxWindow &win) {
if (&win.screen() != &m_screen) if (&win.screen() != &m_screen)
return; return;

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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 #ifndef TOOLBARHANDLER_HH
#define TOOLBARHANDLER_HH #define TOOLBARHANDLER_HH
@ -61,7 +61,8 @@ public:
void setupClient(WinClient &winclient) {} void setupClient(WinClient &winclient) {}
void updateState(FluxboxWindow &win); void updateState(FluxboxWindow &win);
void updateWindowClose(FluxboxWindow &win); void updateFrameClose(FluxboxWindow &win);
void updateClientClose(WinClient &winclient) {}
void updateWorkspace(FluxboxWindow &win); void updateWorkspace(FluxboxWindow &win);
void updateCurrentWorkspace(BScreen &screen); void updateCurrentWorkspace(BScreen &screen);

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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" #include "fluxbox.hh"
@ -1262,7 +1262,7 @@ void Fluxbox::update(FbTk::Subject *changedsub) {
} else if ((&(win.dieSig())) == changedsub) { // window death signal } else if ((&(win.dieSig())) == changedsub) { // window death signal
for (size_t i=0; i<m_atomhandler.size(); ++i) { for (size_t i=0; i<m_atomhandler.size(); ++i) {
if (m_atomhandler[i]->update()) if (m_atomhandler[i]->update())
m_atomhandler[i]->updateWindowClose(win); m_atomhandler[i]->updateFrameClose(win);
} }
// make sure each workspace get this // make sure each workspace get this
BScreen &scr = win.screen(); BScreen &scr = win.screen();
@ -1309,15 +1309,16 @@ void Fluxbox::update(FbTk::Subject *changedsub) {
WinClient::WinClientSubj *subj = dynamic_cast<WinClient::WinClientSubj *>(changedsub); WinClient::WinClientSubj *subj = dynamic_cast<WinClient::WinClientSubj *>(changedsub);
WinClient &client = subj->winClient(); 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(); BScreen &screen = client.screen();
screen.updateNetizenWindowDel(client.window()); screen.updateNetizenWindowDel(client.window());
screen.removeClient(client); screen.removeClient(client);
removeWindowSearch(client.window()); removeWindowSearch(client.window());
//!! TODO
#ifdef DEBUG
cerr<<__FILE__<<"("<<__FUNCTION__<<") TODO: signal stuff for client death!!"<<endl;
#endif // DEBUG
} }
} }