observe title signal

This commit is contained in:
fluxgen 2003-12-07 17:49:07 +00:00
parent b8c1d3e5ee
commit e9be87766b
2 changed files with 13 additions and 29 deletions

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Workspace.cc,v 1.84 2003/12/03 23:05:29 fluxgen Exp $
// $Id: Workspace.cc,v 1.85 2003/12/07 17:49:07 fluxgen Exp $
#include "Workspace.hh"
@ -157,6 +157,8 @@ void Workspace::addWindow(FluxboxWindow &w, bool place) {
return;
w.setWorkspace(m_id);
// attach signals
w.titleSig().attach(this);
if (place)
placeWindow(w);
@ -181,6 +183,9 @@ int Workspace::removeWindow(FluxboxWindow *w) {
if (w == 0)
return -1;
// detach from signals
w->titleSig().detach(this);
if (m_lastfocus == w) {
m_lastfocus = 0;
}
@ -231,20 +236,6 @@ int Workspace::removeWindow(FluxboxWindow *w) {
return m_windowlist.size();
}
void Workspace::removeWindow(WinClient &client) {
if (client.m_win == 0)
return;
if (client.m_win->numClients() == 0) {
Windows::iterator erase_it = remove(m_windowlist.begin(),
m_windowlist.end(), client.m_win);
if (erase_it != m_windowlist.end())
m_windowlist.erase(erase_it);
}
updateClientmenu();
}
void Workspace::showAll() {
Windows::iterator it = m_windowlist.begin();
Windows::iterator it_end = m_windowlist.end();
@ -378,7 +369,7 @@ bool Workspace::loadGroups(const std::string &filename) {
return true;
}
void Workspace::update() {
void Workspace::update(FbTk::Subject *subj) {
m_clientmenu.update();
}
@ -407,13 +398,6 @@ void Workspace::setName(const std::string &name) {
clears the m_windowlist
*/
void Workspace::shutdown() {
#ifdef DEBUG
cerr<<__FILE__<<"("<<__FUNCTION__<<"): scr "<<screen().screenNumber()<<", ws "<<
m_id<<", windowlist:"<<endl;
copy(m_windowlist.begin(), m_windowlist.end(),
ostream_iterator<FluxboxWindow *>(cerr, " \n"));
cerr<<endl;
#endif // DEBUG
// note: when the window dies it'll remove it self from the list
while (!m_windowlist.empty()) {
// restore with remap on all clients in that window

View file

@ -25,12 +25,13 @@
#ifndef WORKSPACE_HH
#define WORKSPACE_HH
#include "NotCopyable.hh"
#include "FbMenu.hh"
#include "MultLayers.hh"
#include <X11/Xlib.h>
#include "FbTk/MultLayers.hh"
#include "FbTk/Observer.hh"
#include "FbTk/NotCopyable.hh"
#include <string>
#include <vector>
@ -43,7 +44,7 @@ class WinClient;
/**
Handles a single workspace
*/
class Workspace:private FbTk::NotCopyable {
class Workspace:private FbTk::NotCopyable, private FbTk::Observer {
public:
typedef std::vector<FluxboxWindow *> Windows;
@ -59,11 +60,9 @@ public:
void hideAll();
void removeAll();
void reconfigure();
void update();
void shutdown();
void addWindow(FluxboxWindow &win, bool place = false);
int removeWindow(FluxboxWindow *win);
void removeWindow(WinClient &client);
void updateClientmenu();
BScreen &screen() { return m_screen; }
@ -90,6 +89,7 @@ public:
static bool loadGroups(const std::string &filename);
private:
void update(FbTk::Subject *subj);
void placeWindow(FluxboxWindow &win);
BScreen &m_screen;