diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-06-16 20:36:18 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2013-02-17 00:05:25 (GMT) |
commit | 90f38a5a2d90af45059dd022d38214068e1b0ebd (patch) | |
tree | 75268600a34c6a952aa5dbd1fe854df3ee17a30d /src/Screen.cc | |
parent | 38e455148c19de101abcb7696b28f109f42aec6b (diff) | |
download | fluxbox_pavel-90f38a5a2d90af45059dd022d38214068e1b0ebd.zip fluxbox_pavel-90f38a5a2d90af45059dd022d38214068e1b0ebd.tar.bz2 |
Make session.screenX.workspace_names a real FbTk::Resource
instead of the add-on hack it was.
This also fixes a lot of problems with saving of config.
Diffstat (limited to 'src/Screen.cc')
-rw-r--r-- | src/Screen.cc | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/Screen.cc b/src/Screen.cc index 027f542..24e086c 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -261,8 +261,11 @@ const EnumTraits<FbWinFrame::TabPlacement>::Pair EnumTraits<FbWinFrame::TabPlace | |||
261 | } // end namespace FbTk | 261 | } // end namespace FbTk |
262 | 262 | ||
263 | 263 | ||
264 | const char BScreen::ScreenResource::workspace_names_delim[] = ","; | ||
265 | |||
264 | BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager_base &rm, | 266 | BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager_base &rm, |
265 | const string &scrname): | 267 | const string &scrname): |
268 | workspace_names(rm, std::vector<std::string>(), scrname + ".workspaceNames"), | ||
266 | opaque_move(rm, true, scrname + ".opaqueMove"), | 269 | opaque_move(rm, true, scrname + ".opaqueMove"), |
267 | full_max(rm, false, scrname+".fullMaximization"), | 270 | full_max(rm, false, scrname+".fullMaximization"), |
268 | max_ignore_inc(rm, true, scrname+".maxIgnoreIncrement"), | 271 | max_ignore_inc(rm, true, scrname+".maxIgnoreIncrement"), |
@@ -414,9 +417,6 @@ BScreen::BScreen(FbTk::ResourceManager_base &rm, | |||
414 | Keys::GLOBAL|Keys::ON_DESKTOP); | 417 | Keys::GLOBAL|Keys::ON_DESKTOP); |
415 | rootWindow().setCursor(XCreateFontCursor(disp, XC_left_ptr)); | 418 | rootWindow().setCursor(XCreateFontCursor(disp, XC_left_ptr)); |
416 | 419 | ||
417 | // load this screens resources | ||
418 | fluxbox->load_rc(*this); | ||
419 | |||
420 | // setup image cache engine | 420 | // setup image cache engine |
421 | m_image_control.reset(new FbTk::ImageControl(scrn, | 421 | m_image_control.reset(new FbTk::ImageControl(scrn, |
422 | fluxbox->colorsPerChannel(), | 422 | fluxbox->colorsPerChannel(), |
@@ -879,15 +879,14 @@ void BScreen::reconfigure() { | |||
879 | 879 | ||
880 | // realize the number of workspaces from the init-file | 880 | // realize the number of workspaces from the init-file |
881 | const unsigned int nr_ws = *resource.workspaces; | 881 | const unsigned int nr_ws = *resource.workspaces; |
882 | if (nr_ws > m_workspaces_list.size()) { | 882 | while(nr_ws > m_workspaces_list.size()) |
883 | while(nr_ws != m_workspaces_list.size()) { | 883 | addWorkspace(); |
884 | addWorkspace(); | 884 | while(nr_ws < m_workspaces_list.size()) |
885 | } | 885 | removeLastWorkspace(); |
886 | } else if (nr_ws < m_workspaces_list.size()) { | 886 | |
887 | while(nr_ws != m_workspaces_list.size()) { | 887 | // and update their names |
888 | removeLastWorkspace(); | 888 | for(size_t i = 0; i < std::min(m_workspaces_list.size(), resource.workspace_names->size()); ++i) |
889 | } | 889 | m_workspaces_list[i]->setName( (*resource.workspace_names)[i] ); |
890 | } | ||
891 | 890 | ||
892 | // update menu filenames | 891 | // update menu filenames |
893 | m_rootmenu->reloadHelper()->setMainFile(fluxbox->getMenuFilename()); | 892 | m_rootmenu->reloadHelper()->setMainFile(fluxbox->getMenuFilename()); |
@@ -927,14 +926,14 @@ void BScreen::reconfigureTabs() { | |||
927 | void BScreen::updateWorkspaceName(unsigned int w) { | 926 | void BScreen::updateWorkspaceName(unsigned int w) { |
928 | Workspace *space = getWorkspace(w); | 927 | Workspace *space = getWorkspace(w); |
929 | if (space) { | 928 | if (space) { |
930 | m_workspace_names[w] = space->name(); | 929 | (*resource.workspace_names)[w] = space->name(); |
931 | m_workspacenames_sig.emit(*this); | 930 | m_workspacenames_sig.emit(*this); |
932 | Fluxbox::instance()->save_rc(); | 931 | Fluxbox::instance()->save_rc(); |
933 | } | 932 | } |
934 | } | 933 | } |
935 | 934 | ||
936 | void BScreen::removeWorkspaceNames() { | 935 | void BScreen::removeWorkspaceNames() { |
937 | m_workspace_names.clear(); | 936 | resource.workspace_names->clear(); |
938 | } | 937 | } |
939 | 938 | ||
940 | void BScreen::addIcon(FluxboxWindow *w) { | 939 | void BScreen::addIcon(FluxboxWindow *w) { |
@@ -1364,17 +1363,17 @@ void BScreen::updateAvailableWorkspaceArea() { | |||
1364 | m_workspace_area_sig.emit(*this); | 1363 | m_workspace_area_sig.emit(*this); |
1365 | } | 1364 | } |
1366 | 1365 | ||
1367 | void BScreen::addWorkspaceName(const char *name) { | 1366 | void BScreen::addWorkspaceName(const std::string &name) { |
1368 | m_workspace_names.push_back(FbTk::FbStringUtil::LocaleStrToFb(name)); | 1367 | resource.workspace_names->push_back(name); |
1369 | Workspace *wkspc = getWorkspace(m_workspace_names.size()-1); | 1368 | Workspace *wkspc = getWorkspace(resource.workspace_names->size()-1); |
1370 | if (wkspc) | 1369 | if (wkspc) |
1371 | wkspc->setName(m_workspace_names.back()); | 1370 | wkspc->setName(name); |
1372 | } | 1371 | } |
1373 | 1372 | ||
1374 | 1373 | ||
1375 | string BScreen::getNameOfWorkspace(unsigned int workspace) const { | 1374 | string BScreen::getNameOfWorkspace(unsigned int workspace) const { |
1376 | if (workspace < m_workspace_names.size()) | 1375 | if (workspace < resource.workspace_names->size()) |
1377 | return m_workspace_names[workspace]; | 1376 | return (*resource.workspace_names)[workspace]; |
1378 | else | 1377 | else |
1379 | return ""; | 1378 | return ""; |
1380 | } | 1379 | } |