aboutsummaryrefslogtreecommitdiff
path: root/src/fluxbox.cc
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/fluxbox.cc
parent0775350fee345e37fb59835dda4d85664346b606 (diff)
downloadfluxbox-129bac1e0f0979c80902edc8e092596b81fe14f6.zip
fluxbox-129bac1e0f0979c80902edc8e092596b81fe14f6.tar.bz2
Convert Focusable::dieSig to FbTk::Signal
Diffstat (limited to 'src/fluxbox.cc')
-rw-r--r--src/fluxbox.cc69
1 files changed, 37 insertions, 32 deletions
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}