aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 0aaa718..77b7ca3 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -243,8 +243,11 @@ const EnumTraits<FbWinFrame::TabPlacement>::Pair EnumTraits<FbWinFrame::TabPlace
243} // end namespace FbTk 243} // end namespace FbTk
244 244
245 245
246const char BScreen::ScreenResource::workspace_names_delim[] = ",";
247
246BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager_base &rm, 248BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager_base &rm,
247 const string &scrname): 249 const string &scrname):
250 workspace_names(rm, std::vector<std::string>(), scrname + ".workspaceNames"),
248 opaque_move(rm, true, scrname + ".opaqueMove"), 251 opaque_move(rm, true, scrname + ".opaqueMove"),
249 full_max(rm, false, scrname+".fullMaximization"), 252 full_max(rm, false, scrname+".fullMaximization"),
250 max_ignore_inc(rm, true, scrname+".maxIgnoreIncrement"), 253 max_ignore_inc(rm, true, scrname+".maxIgnoreIncrement"),
@@ -388,9 +391,6 @@ BScreen::BScreen(FbTk::ResourceManager_base &rm,
388 Keys::GLOBAL|Keys::ON_DESKTOP); 391 Keys::GLOBAL|Keys::ON_DESKTOP);
389 rootWindow().setCursor(XCreateFontCursor(disp, XC_left_ptr)); 392 rootWindow().setCursor(XCreateFontCursor(disp, XC_left_ptr));
390 393
391 // load this screens resources
392 fluxbox->load_rc(*this);
393
394 // setup image cache engine 394 // setup image cache engine
395 m_image_control.reset(new FbTk::ImageControl(scrn, 395 m_image_control.reset(new FbTk::ImageControl(scrn,
396 fluxbox->colorsPerChannel(), 396 fluxbox->colorsPerChannel(),
@@ -856,15 +856,14 @@ void BScreen::reconfigure() {
856 856
857 // realize the number of workspaces from the init-file 857 // realize the number of workspaces from the init-file
858 const unsigned int nr_ws = *resource.workspaces; 858 const unsigned int nr_ws = *resource.workspaces;
859 if (nr_ws > m_workspaces_list.size()) { 859 while(nr_ws > m_workspaces_list.size())
860 while(nr_ws != m_workspaces_list.size()) { 860 addWorkspace();
861 addWorkspace(); 861 while(nr_ws < m_workspaces_list.size())
862 } 862 removeLastWorkspace();
863 } else if (nr_ws < m_workspaces_list.size()) { 863
864 while(nr_ws != m_workspaces_list.size()) { 864 // and update their names
865 removeLastWorkspace(); 865 for(size_t i = 0; i < std::min(m_workspaces_list.size(), resource.workspace_names->size()); ++i)
866 } 866 m_workspaces_list[i]->setName( (*resource.workspace_names)[i] );
867 }
868 867
869 // update menu filenames 868 // update menu filenames
870 m_rootmenu->reloadHelper()->setMainFile(fluxbox->getMenuFilename()); 869 m_rootmenu->reloadHelper()->setMainFile(fluxbox->getMenuFilename());
@@ -904,14 +903,14 @@ void BScreen::reconfigureTabs() {
904void BScreen::updateWorkspaceName(unsigned int w) { 903void BScreen::updateWorkspaceName(unsigned int w) {
905 Workspace *space = getWorkspace(w); 904 Workspace *space = getWorkspace(w);
906 if (space) { 905 if (space) {
907 m_workspace_names[w] = space->name(); 906 (*resource.workspace_names)[w] = space->name();
908 m_workspacenames_sig.emit(*this); 907 m_workspacenames_sig.emit(*this);
909 Fluxbox::instance()->save_rc(); 908 Fluxbox::instance()->save_rc();
910 } 909 }
911} 910}
912 911
913void BScreen::removeWorkspaceNames() { 912void BScreen::removeWorkspaceNames() {
914 m_workspace_names.clear(); 913 resource.workspace_names->clear();
915} 914}
916 915
917void BScreen::addIcon(FluxboxWindow *w) { 916void BScreen::addIcon(FluxboxWindow *w) {
@@ -1345,17 +1344,17 @@ void BScreen::updateAvailableWorkspaceArea() {
1345 m_workspace_area_sig.emit(*this); 1344 m_workspace_area_sig.emit(*this);
1346} 1345}
1347 1346
1348void BScreen::addWorkspaceName(const char *name) { 1347void BScreen::addWorkspaceName(const std::string &name) {
1349 m_workspace_names.push_back(FbTk::FbStringUtil::LocaleStrToFb(name)); 1348 resource.workspace_names->push_back(name);
1350 Workspace *wkspc = getWorkspace(m_workspace_names.size()-1); 1349 Workspace *wkspc = getWorkspace(resource.workspace_names->size()-1);
1351 if (wkspc) 1350 if (wkspc)
1352 wkspc->setName(m_workspace_names.back()); 1351 wkspc->setName(name);
1353} 1352}
1354 1353
1355 1354
1356string BScreen::getNameOfWorkspace(unsigned int workspace) const { 1355string BScreen::getNameOfWorkspace(unsigned int workspace) const {
1357 if (workspace < m_workspace_names.size()) 1356 if (workspace < resource.workspace_names->size())
1358 return m_workspace_names[workspace]; 1357 return (*resource.workspace_names)[workspace];
1359 else 1358 else
1360 return ""; 1359 return "";
1361} 1360}