summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHenrik Kinnunen <fluxgen@fluxbox.org>2008-09-21 13:25:47 (GMT)
committerHenrik Kinnunen <fluxgen@fluxbox.org>2008-09-21 13:25:47 (GMT)
commit71674739ec6de376273cb3c5b938da132e7035c5 (patch)
treeabd6e295067347b6f95622c9ed1a00c6396dc314 /src
parent86819abab91cf3ea20540278d00bad6a6b86d4b0 (diff)
downloadfluxbox_lack-71674739ec6de376273cb3c5b938da132e7035c5.zip
fluxbox_lack-71674739ec6de376273cb3c5b938da132e7035c5.tar.bz2
Changed workspace names signal in BScreen to use the new signal system
Diffstat (limited to 'src')
-rw-r--r--src/Screen.cc5
-rw-r--r--src/Screen.hh6
-rw-r--r--src/SendToMenu.cc15
-rw-r--r--src/SendToMenu.hh2
-rw-r--r--src/WorkspaceMenu.cc17
-rw-r--r--src/WorkspaceMenu.hh3
-rw-r--r--src/WorkspaceNameTool.cc4
-rw-r--r--src/fluxbox.cc19
-rw-r--r--src/fluxbox.hh2
9 files changed, 31 insertions, 42 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 06f3146..7c372bc 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -341,7 +341,6 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
341 int scrn, int num_layers) : 341 int scrn, int num_layers) :
342 m_clientlist_sig(*this), // client signal 342 m_clientlist_sig(*this), // client signal
343 m_iconlist_sig(*this), // icon list signal 343 m_iconlist_sig(*this), // icon list signal
344 m_workspacenames_sig(*this), // workspace names signal
345 m_workspace_area_sig(*this), // workspace area signal 344 m_workspace_area_sig(*this), // workspace area signal
346 m_focusedwindow_sig(*this), // focused window signal 345 m_focusedwindow_sig(*this), // focused window signal
347 m_reconfigure_sig(*this), // reconfigure signal 346 m_reconfigure_sig(*this), // reconfigure signal
@@ -1017,7 +1016,7 @@ void BScreen::updateWorkspaceName(unsigned int w) {
1017 Workspace *space = getWorkspace(w); 1016 Workspace *space = getWorkspace(w);
1018 if (space) { 1017 if (space) {
1019 m_workspace_names[w] = space->name(); 1018 m_workspace_names[w] = space->name();
1020 m_workspacenames_sig.notify(); 1019 m_workspacenames_sig.emit(*this);
1021 Fluxbox::instance()->save_rc(); 1020 Fluxbox::instance()->save_rc();
1022 } 1021 }
1023} 1022}
@@ -1104,7 +1103,7 @@ int BScreen::addWorkspace() {
1104 1103
1105 if (save_name) { 1104 if (save_name) {
1106 addWorkspaceName(wkspc->name().c_str()); //update names 1105 addWorkspaceName(wkspc->name().c_str()); //update names
1107 m_workspacenames_sig.notify(); 1106 m_workspacenames_sig.emit(*this);
1108 } 1107 }
1109 1108
1110 saveWorkspaces(m_workspaces_list.size()); 1109 saveWorkspaces(m_workspaces_list.size());
diff --git a/src/Screen.hh b/src/Screen.hh
index bbfe70b..7bafead 100644
--- a/src/Screen.hh
+++ b/src/Screen.hh
@@ -216,7 +216,7 @@ public:
216 /// workspace count signal 216 /// workspace count signal
217 FbTk::Signal<void, BScreen&> &workspaceCountSig() { return m_workspacecount_sig; } 217 FbTk::Signal<void, BScreen&> &workspaceCountSig() { return m_workspacecount_sig; }
218 /// workspace names signal 218 /// workspace names signal
219 FbTk::Subject &workspaceNamesSig() { return m_workspacenames_sig; } 219 FbTk::Signal<void, BScreen&> &workspaceNamesSig() { return m_workspacenames_sig; }
220 /// workspace area signal 220 /// workspace area signal
221 FbTk::Subject &workspaceAreaSig() { return m_workspace_area_sig; } 221 FbTk::Subject &workspaceAreaSig() { return m_workspace_area_sig; }
222 /// current workspace signal 222 /// current workspace signal
@@ -494,7 +494,7 @@ private:
494 ScreenSubject 494 ScreenSubject
495 m_clientlist_sig, ///< client signal 495 m_clientlist_sig, ///< client signal
496 m_iconlist_sig, ///< notify if a window gets iconified/deiconified 496 m_iconlist_sig, ///< notify if a window gets iconified/deiconified
497 m_workspacenames_sig, ///< workspace names signal 497
498 m_workspace_area_sig, ///< workspace area changed signal 498 m_workspace_area_sig, ///< workspace area changed signal
499 m_focusedwindow_sig, ///< focused window signal 499 m_focusedwindow_sig, ///< focused window signal
500 m_reconfigure_sig, ///< reconfigure signal 500 m_reconfigure_sig, ///< reconfigure signal
@@ -503,6 +503,8 @@ private:
503 503
504 FbTk::Signal<void, BScreen&> m_workspacecount_sig; ///< workspace count signal 504 FbTk::Signal<void, BScreen&> m_workspacecount_sig; ///< workspace count signal
505 FbTk::Signal<void, BScreen&> m_currentworkspace_sig; ///< current workspace signal 505 FbTk::Signal<void, BScreen&> m_currentworkspace_sig; ///< current workspace signal
506 FbTk::Signal<void, BScreen&> m_workspacenames_sig; ///< workspace names signal
507
506 FbTk::MultLayers m_layermanager; 508 FbTk::MultLayers m_layermanager;
507 509
508 bool root_colormap_installed, managed; 510 bool root_colormap_installed, managed;
diff --git a/src/SendToMenu.cc b/src/SendToMenu.cc
index ac7612b..0aa1c31 100644
--- a/src/SendToMenu.cc
+++ b/src/SendToMenu.cc
@@ -55,17 +55,16 @@ SendToMenu::SendToMenu(BScreen &screen):
55 // workspace count signal 55 // workspace count signal
56 // workspace names signal 56 // workspace names signal
57 // current workspace signal 57 // current workspace signal
58 m_rebuildObs = makeObserver(*this, &SendToMenu::rebuildMenu);
59 58
60 screen.workspaceNamesSig().attach(m_rebuildObs); 59 join(screen.workspaceNamesSig(),
60 FbTk::MemFun(*this, &SendToMenu::rebuildMenuForScreen));
61 61
62 // setup new signal system 62 join(screen.currentWorkspaceSig(),
63 join( screen.currentWorkspaceSig(), 63 FbTk::MemFun(*this, &SendToMenu::rebuildMenuForScreen));
64 FbTk::MemFun(*this, &SendToMenu::rebuildMenuForScreen));
65 64
66 // setup new signal system 65 // setup new signal system
67 join( screen.workspaceCountSig(), 66 join(screen.workspaceCountSig(),
68 FbTk::MemFun(*this, &SendToMenu::rebuildMenuForScreen)); 67 FbTk::MemFun(*this, &SendToMenu::rebuildMenuForScreen));
69 68
70 // no title for this menu, it should be a submenu in the window menu. 69 // no title for this menu, it should be a submenu in the window menu.
71 disableTitle(); 70 disableTitle();
@@ -74,7 +73,7 @@ SendToMenu::SendToMenu(BScreen &screen):
74} 73}
75 74
76SendToMenu::~SendToMenu() { 75SendToMenu::~SendToMenu() {
77 delete m_rebuildObs; 76
78} 77}
79 78
80void SendToMenu::rebuildMenu() { 79void SendToMenu::rebuildMenu() {
diff --git a/src/SendToMenu.hh b/src/SendToMenu.hh
index a217b5f..37f45fc 100644
--- a/src/SendToMenu.hh
+++ b/src/SendToMenu.hh
@@ -52,8 +52,6 @@ private:
52 52
53 /// Rebuild the menu from scratch. 53 /// Rebuild the menu from scratch.
54 void rebuildMenu(); 54 void rebuildMenu();
55 /// listens to signals that makes this instance need to rebuild menu
56 FbTk::Observer *m_rebuildObs;
57}; 55};
58 56
59#endif // SENDTOMENU_HH 57#endif // SENDTOMENU_HH
diff --git a/src/WorkspaceMenu.cc b/src/WorkspaceMenu.cc
index dd7b96e..c343920 100644
--- a/src/WorkspaceMenu.cc
+++ b/src/WorkspaceMenu.cc
@@ -97,27 +97,14 @@ void WorkspaceMenu::workspaceChanged(BScreen& screen) {
97 updateMenu(screen.currentWorkspace()->workspaceID() + IDX_AFTER_ICONS); 97 updateMenu(screen.currentWorkspace()->workspaceID() + IDX_AFTER_ICONS);
98} 98}
99 99
100void WorkspaceMenu::update(FbTk::Subject *subj) {
101
102 if (subj != 0 && typeid(*subj) == typeid(BScreen::ScreenSubject)) {
103 BScreen::ScreenSubject &screen_subj = *static_cast<BScreen::ScreenSubject *>(subj);
104 BScreen &screen = screen_subj.screen();
105 if ( subj == &screen.workspaceNamesSig() ) {
106 workspaceInfoChanged( screen );
107 }
108 } else {
109 FbTk::Menu::update(subj);
110 }
111}
112
113void WorkspaceMenu::init(BScreen &screen) { 100void WorkspaceMenu::init(BScreen &screen) {
114 101
115 screen.workspaceNamesSig().attach(this);
116
117 join(screen.currentWorkspaceSig(), 102 join(screen.currentWorkspaceSig(),
118 FbTk::MemFun(*this, &WorkspaceMenu::workspaceChanged)); 103 FbTk::MemFun(*this, &WorkspaceMenu::workspaceChanged));
119 join(screen.workspaceCountSig(), 104 join(screen.workspaceCountSig(),
120 FbTk::MemFun(*this, &WorkspaceMenu::workspaceInfoChanged)); 105 FbTk::MemFun(*this, &WorkspaceMenu::workspaceInfoChanged));
106 join(screen.workspaceNamesSig(),
107 FbTk::MemFun(*this, &WorkspaceMenu::workspaceInfoChanged));
121 108
122 using namespace FbTk; 109 using namespace FbTk;
123 _FB_USES_NLS; 110 _FB_USES_NLS;
diff --git a/src/WorkspaceMenu.hh b/src/WorkspaceMenu.hh
index 19cf0f8..fef576c 100644
--- a/src/WorkspaceMenu.hh
+++ b/src/WorkspaceMenu.hh
@@ -38,8 +38,7 @@ class WorkspaceMenu: public FbMenu, private FbTk::SignalTracker {
38public: 38public:
39 explicit WorkspaceMenu(BScreen &screen); 39 explicit WorkspaceMenu(BScreen &screen);
40 virtual ~WorkspaceMenu() { } 40 virtual ~WorkspaceMenu() { }
41 /// called when a subject is sending a signal 41
42 void update(FbTk::Subject *subj);
43private: 42private:
44 /// initialize menu for the screen 43 /// initialize menu for the screen
45 void init(BScreen &screen); 44 void init(BScreen &screen);
diff --git a/src/WorkspaceNameTool.cc b/src/WorkspaceNameTool.cc
index b6afad8..579592f 100644
--- a/src/WorkspaceNameTool.cc
+++ b/src/WorkspaceNameTool.cc
@@ -43,10 +43,10 @@ WorkspaceNameTool::WorkspaceNameTool(const FbTk::FbWindow &parent,
43 m_button.setText(m_screen.currentWorkspace()->name()); 43 m_button.setText(m_screen.currentWorkspace()->name());
44 44
45 // setup signals 45 // setup signals
46 screen.workspaceNamesSig().attach(this);
47
48 join(screen.currentWorkspaceSig(), 46 join(screen.currentWorkspaceSig(),
49 FbTk::MemFun(*this, &WorkspaceNameTool::updateForScreen)); 47 FbTk::MemFun(*this, &WorkspaceNameTool::updateForScreen));
48 join(screen.workspaceNamesSig(),
49 FbTk::MemFun(*this, &WorkspaceNameTool::updateForScreen));
50 50
51 theme.reconfigSig().attach(this); 51 theme.reconfigSig().attach(this);
52} 52}
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index acbb55d..e9c548c 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -454,10 +454,11 @@ void Fluxbox::initScreen(BScreen *screen) {
454 454
455 // attach screen signals to this 455 // attach screen signals to this
456 screen->focusedWindowSig().attach(this); 456 screen->focusedWindowSig().attach(this);
457 screen->workspaceNamesSig().attach(this);
458 screen->workspaceAreaSig().attach(this); 457 screen->workspaceAreaSig().attach(this);
459 screen->clientListSig().attach(this); 458 screen->clientListSig().attach(this);
460 459
460 join(screen->workspaceNamesSig(),
461 FbTk::MemFun(*this, &Fluxbox::workspaceNamesChanged));
461 join(screen->currentWorkspaceSig(), 462 join(screen->currentWorkspaceSig(),
462 FbTk::MemFun(*this, &Fluxbox::workspaceChanged)); 463 FbTk::MemFun(*this, &Fluxbox::workspaceChanged));
463 464
@@ -1102,13 +1103,7 @@ void Fluxbox::update(FbTk::Subject *changedsub) {
1102 } else if (typeid(*changedsub) == typeid(BScreen::ScreenSubject)) { 1103 } else if (typeid(*changedsub) == typeid(BScreen::ScreenSubject)) {
1103 BScreen::ScreenSubject *subj = dynamic_cast<BScreen::ScreenSubject *>(changedsub); 1104 BScreen::ScreenSubject *subj = dynamic_cast<BScreen::ScreenSubject *>(changedsub);
1104 BScreen &screen = subj->screen(); 1105 BScreen &screen = subj->screen();
1105 if ((&(screen.workspaceNamesSig())) == changedsub) { 1106 if ((&(screen.focusedWindowSig())) == changedsub) {
1106 for (AtomHandlerContainerIt it= m_atomhandler.begin();
1107 it != m_atomhandler.end(); ++it) {
1108 if ((*it).first->update())
1109 (*it).first->updateWorkspaceNames(screen);
1110 }
1111 } else if ((&(screen.focusedWindowSig())) == changedsub) {
1112 for (AtomHandlerContainerIt it= m_atomhandler.begin(); 1107 for (AtomHandlerContainerIt it= m_atomhandler.begin();
1113 it != m_atomhandler.end(); it++) { 1108 it != m_atomhandler.end(); it++) {
1114 (*it).first->updateFocusedWindow(screen, 1109 (*it).first->updateFocusedWindow(screen,
@@ -1530,3 +1525,11 @@ void Fluxbox::workspaceChanged( BScreen& screen ) {
1530 (*it).first->updateCurrentWorkspace(screen); 1525 (*it).first->updateCurrentWorkspace(screen);
1531 } 1526 }
1532} 1527}
1528
1529void Fluxbox::workspaceNamesChanged(BScreen &screen) {
1530 for (AtomHandlerContainerIt it= m_atomhandler.begin();
1531 it != m_atomhandler.end(); ++it) {
1532 if ((*it).first->update())
1533 (*it).first->updateWorkspaceNames(screen);
1534 }
1535}
diff --git a/src/fluxbox.hh b/src/fluxbox.hh
index 36208b6..82740d4 100644
--- a/src/fluxbox.hh
+++ b/src/fluxbox.hh
@@ -205,6 +205,8 @@ private:
205 void workspaceCountChanged( BScreen& screen ); 205 void workspaceCountChanged( BScreen& screen );
206 /// Called when workspace was switched 206 /// Called when workspace was switched
207 void workspaceChanged(BScreen& screen); 207 void workspaceChanged(BScreen& screen);
208 /// Called when workspace names changed
209 void workspaceNamesChanged(BScreen &screen);
208 210
209 std::auto_ptr<FbAtoms> m_fbatoms; 211 std::auto_ptr<FbAtoms> m_fbatoms;
210 212