fix winclient death signalling
This commit is contained in:
parent
e82122eb44
commit
16c567638c
9 changed files with 139 additions and 129 deletions
|
@ -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.
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
// 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 @@ public:
|
|||
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;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
// 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 @@ public:
|
|||
|
||||
bool propertyNotify(FluxboxWindow &win, Atom the_property);
|
||||
//ignore these ones
|
||||
void updateWindowClose(FluxboxWindow &win) {}
|
||||
void updateFrameClose(FluxboxWindow &win) {}
|
||||
void updateClientClose(WinClient &winclient) {}
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
// 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 @@ public:
|
|||
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:
|
||||
|
|
222
src/Remember.cc
222
src/Remember.cc
|
@ -21,7 +21,7 @@
|
|||
// 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 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) {
|
|||
}
|
||||
|
||||
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
|
||||
|
||||
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) {
|
||||
// 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
|
||||
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();
|
||||
while (it != m_pats.end()) {
|
||||
if (&win == it->second->group)
|
||||
it->second->group = 0;
|
||||
++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();
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
// 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 @@ public:
|
|||
// 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
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
// 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 @@ void ToolbarHandler::setupFrame(FluxboxWindow &win) {
|
|||
}
|
||||
}
|
||||
|
||||
void ToolbarHandler::updateWindowClose(FluxboxWindow &win) {
|
||||
void ToolbarHandler::updateFrameClose(FluxboxWindow &win) {
|
||||
if (&win.screen() != &m_screen)
|
||||
return;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
// 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 @@ public:
|
|||
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);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
// 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 @@ void Fluxbox::update(FbTk::Subject *changedsub) {
|
|||
} 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 @@ void Fluxbox::update(FbTk::Subject *changedsub) {
|
|||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue