Changed workspace names signal in BScreen to use the new signal system
This commit is contained in:
parent
86819abab9
commit
71674739ec
10 changed files with 35 additions and 43 deletions
|
@ -1,6 +1,9 @@
|
|||
(Format: Year/Month/Day)
|
||||
Changes for 1.1.2
|
||||
*08/09/21:
|
||||
* Changed workspace names signal in BScreen to use the new signal
|
||||
system (Henrik)
|
||||
Screen.hh/cc, SendToMenu.hh/cc, WorkspaceMenu.hh/cc, WorkspaceNameTool.hh/cc
|
||||
* Changed current workspace signal in Bscreen to use the new signal
|
||||
system (Henrik)
|
||||
FocusableList.hh/cc, Screen.hh/cc, SendToMenu.hh/cc,
|
||||
|
|
|
@ -341,7 +341,6 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
|
|||
int scrn, int num_layers) :
|
||||
m_clientlist_sig(*this), // client signal
|
||||
m_iconlist_sig(*this), // icon list signal
|
||||
m_workspacenames_sig(*this), // workspace names signal
|
||||
m_workspace_area_sig(*this), // workspace area signal
|
||||
m_focusedwindow_sig(*this), // focused window signal
|
||||
m_reconfigure_sig(*this), // reconfigure signal
|
||||
|
@ -1017,7 +1016,7 @@ void BScreen::updateWorkspaceName(unsigned int w) {
|
|||
Workspace *space = getWorkspace(w);
|
||||
if (space) {
|
||||
m_workspace_names[w] = space->name();
|
||||
m_workspacenames_sig.notify();
|
||||
m_workspacenames_sig.emit(*this);
|
||||
Fluxbox::instance()->save_rc();
|
||||
}
|
||||
}
|
||||
|
@ -1104,7 +1103,7 @@ int BScreen::addWorkspace() {
|
|||
|
||||
if (save_name) {
|
||||
addWorkspaceName(wkspc->name().c_str()); //update names
|
||||
m_workspacenames_sig.notify();
|
||||
m_workspacenames_sig.emit(*this);
|
||||
}
|
||||
|
||||
saveWorkspaces(m_workspaces_list.size());
|
||||
|
|
|
@ -216,7 +216,7 @@ public:
|
|||
/// workspace count signal
|
||||
FbTk::Signal<void, BScreen&> &workspaceCountSig() { return m_workspacecount_sig; }
|
||||
/// workspace names signal
|
||||
FbTk::Subject &workspaceNamesSig() { return m_workspacenames_sig; }
|
||||
FbTk::Signal<void, BScreen&> &workspaceNamesSig() { return m_workspacenames_sig; }
|
||||
/// workspace area signal
|
||||
FbTk::Subject &workspaceAreaSig() { return m_workspace_area_sig; }
|
||||
/// current workspace signal
|
||||
|
@ -494,7 +494,7 @@ private:
|
|||
ScreenSubject
|
||||
m_clientlist_sig, ///< client signal
|
||||
m_iconlist_sig, ///< notify if a window gets iconified/deiconified
|
||||
m_workspacenames_sig, ///< workspace names signal
|
||||
|
||||
m_workspace_area_sig, ///< workspace area changed signal
|
||||
m_focusedwindow_sig, ///< focused window signal
|
||||
m_reconfigure_sig, ///< reconfigure signal
|
||||
|
@ -503,6 +503,8 @@ private:
|
|||
|
||||
FbTk::Signal<void, BScreen&> m_workspacecount_sig; ///< workspace count signal
|
||||
FbTk::Signal<void, BScreen&> m_currentworkspace_sig; ///< current workspace signal
|
||||
FbTk::Signal<void, BScreen&> m_workspacenames_sig; ///< workspace names signal
|
||||
|
||||
FbTk::MultLayers m_layermanager;
|
||||
|
||||
bool root_colormap_installed, managed;
|
||||
|
|
|
@ -55,17 +55,16 @@ SendToMenu::SendToMenu(BScreen &screen):
|
|||
// workspace count signal
|
||||
// workspace names signal
|
||||
// current workspace signal
|
||||
m_rebuildObs = makeObserver(*this, &SendToMenu::rebuildMenu);
|
||||
|
||||
screen.workspaceNamesSig().attach(m_rebuildObs);
|
||||
join(screen.workspaceNamesSig(),
|
||||
FbTk::MemFun(*this, &SendToMenu::rebuildMenuForScreen));
|
||||
|
||||
join(screen.currentWorkspaceSig(),
|
||||
FbTk::MemFun(*this, &SendToMenu::rebuildMenuForScreen));
|
||||
|
||||
// setup new signal system
|
||||
join( screen.currentWorkspaceSig(),
|
||||
FbTk::MemFun(*this, &SendToMenu::rebuildMenuForScreen));
|
||||
|
||||
// setup new signal system
|
||||
join( screen.workspaceCountSig(),
|
||||
FbTk::MemFun(*this, &SendToMenu::rebuildMenuForScreen));
|
||||
join(screen.workspaceCountSig(),
|
||||
FbTk::MemFun(*this, &SendToMenu::rebuildMenuForScreen));
|
||||
|
||||
// no title for this menu, it should be a submenu in the window menu.
|
||||
disableTitle();
|
||||
|
@ -74,7 +73,7 @@ SendToMenu::SendToMenu(BScreen &screen):
|
|||
}
|
||||
|
||||
SendToMenu::~SendToMenu() {
|
||||
delete m_rebuildObs;
|
||||
|
||||
}
|
||||
|
||||
void SendToMenu::rebuildMenu() {
|
||||
|
|
|
@ -52,8 +52,6 @@ private:
|
|||
|
||||
/// Rebuild the menu from scratch.
|
||||
void rebuildMenu();
|
||||
/// listens to signals that makes this instance need to rebuild menu
|
||||
FbTk::Observer *m_rebuildObs;
|
||||
};
|
||||
|
||||
#endif // SENDTOMENU_HH
|
||||
|
|
|
@ -97,27 +97,14 @@ void WorkspaceMenu::workspaceChanged(BScreen& screen) {
|
|||
updateMenu(screen.currentWorkspace()->workspaceID() + IDX_AFTER_ICONS);
|
||||
}
|
||||
|
||||
void WorkspaceMenu::update(FbTk::Subject *subj) {
|
||||
|
||||
if (subj != 0 && typeid(*subj) == typeid(BScreen::ScreenSubject)) {
|
||||
BScreen::ScreenSubject &screen_subj = *static_cast<BScreen::ScreenSubject *>(subj);
|
||||
BScreen &screen = screen_subj.screen();
|
||||
if ( subj == &screen.workspaceNamesSig() ) {
|
||||
workspaceInfoChanged( screen );
|
||||
}
|
||||
} else {
|
||||
FbTk::Menu::update(subj);
|
||||
}
|
||||
}
|
||||
|
||||
void WorkspaceMenu::init(BScreen &screen) {
|
||||
|
||||
screen.workspaceNamesSig().attach(this);
|
||||
|
||||
join(screen.currentWorkspaceSig(),
|
||||
FbTk::MemFun(*this, &WorkspaceMenu::workspaceChanged));
|
||||
join(screen.workspaceCountSig(),
|
||||
FbTk::MemFun(*this, &WorkspaceMenu::workspaceInfoChanged));
|
||||
join(screen.workspaceNamesSig(),
|
||||
FbTk::MemFun(*this, &WorkspaceMenu::workspaceInfoChanged));
|
||||
|
||||
using namespace FbTk;
|
||||
_FB_USES_NLS;
|
||||
|
|
|
@ -38,8 +38,7 @@ class WorkspaceMenu: public FbMenu, private FbTk::SignalTracker {
|
|||
public:
|
||||
explicit WorkspaceMenu(BScreen &screen);
|
||||
virtual ~WorkspaceMenu() { }
|
||||
/// called when a subject is sending a signal
|
||||
void update(FbTk::Subject *subj);
|
||||
|
||||
private:
|
||||
/// initialize menu for the screen
|
||||
void init(BScreen &screen);
|
||||
|
|
|
@ -43,10 +43,10 @@ WorkspaceNameTool::WorkspaceNameTool(const FbTk::FbWindow &parent,
|
|||
m_button.setText(m_screen.currentWorkspace()->name());
|
||||
|
||||
// setup signals
|
||||
screen.workspaceNamesSig().attach(this);
|
||||
|
||||
join(screen.currentWorkspaceSig(),
|
||||
FbTk::MemFun(*this, &WorkspaceNameTool::updateForScreen));
|
||||
join(screen.workspaceNamesSig(),
|
||||
FbTk::MemFun(*this, &WorkspaceNameTool::updateForScreen));
|
||||
|
||||
theme.reconfigSig().attach(this);
|
||||
}
|
||||
|
|
|
@ -454,10 +454,11 @@ void Fluxbox::initScreen(BScreen *screen) {
|
|||
|
||||
// attach screen signals to this
|
||||
screen->focusedWindowSig().attach(this);
|
||||
screen->workspaceNamesSig().attach(this);
|
||||
screen->workspaceAreaSig().attach(this);
|
||||
screen->clientListSig().attach(this);
|
||||
|
||||
join(screen->workspaceNamesSig(),
|
||||
FbTk::MemFun(*this, &Fluxbox::workspaceNamesChanged));
|
||||
join(screen->currentWorkspaceSig(),
|
||||
FbTk::MemFun(*this, &Fluxbox::workspaceChanged));
|
||||
|
||||
|
@ -1102,13 +1103,7 @@ void Fluxbox::update(FbTk::Subject *changedsub) {
|
|||
} else if (typeid(*changedsub) == typeid(BScreen::ScreenSubject)) {
|
||||
BScreen::ScreenSubject *subj = dynamic_cast<BScreen::ScreenSubject *>(changedsub);
|
||||
BScreen &screen = subj->screen();
|
||||
if ((&(screen.workspaceNamesSig())) == changedsub) {
|
||||
for (AtomHandlerContainerIt it= m_atomhandler.begin();
|
||||
it != m_atomhandler.end(); ++it) {
|
||||
if ((*it).first->update())
|
||||
(*it).first->updateWorkspaceNames(screen);
|
||||
}
|
||||
} else if ((&(screen.focusedWindowSig())) == changedsub) {
|
||||
if ((&(screen.focusedWindowSig())) == changedsub) {
|
||||
for (AtomHandlerContainerIt it= m_atomhandler.begin();
|
||||
it != m_atomhandler.end(); it++) {
|
||||
(*it).first->updateFocusedWindow(screen,
|
||||
|
@ -1530,3 +1525,11 @@ void Fluxbox::workspaceChanged( BScreen& screen ) {
|
|||
(*it).first->updateCurrentWorkspace(screen);
|
||||
}
|
||||
}
|
||||
|
||||
void Fluxbox::workspaceNamesChanged(BScreen &screen) {
|
||||
for (AtomHandlerContainerIt it= m_atomhandler.begin();
|
||||
it != m_atomhandler.end(); ++it) {
|
||||
if ((*it).first->update())
|
||||
(*it).first->updateWorkspaceNames(screen);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -205,6 +205,8 @@ private:
|
|||
void workspaceCountChanged( BScreen& screen );
|
||||
/// Called when workspace was switched
|
||||
void workspaceChanged(BScreen& screen);
|
||||
/// Called when workspace names changed
|
||||
void workspaceNamesChanged(BScreen &screen);
|
||||
|
||||
std::auto_ptr<FbAtoms> m_fbatoms;
|
||||
|
||||
|
|
Loading…
Reference in a new issue