aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
authormathias <mathias>2005-04-27 09:52:30 (GMT)
committermathias <mathias>2005-04-27 09:52:30 (GMT)
commitb97c3db25193c3b549e46910604d27e5ff92baa2 (patch)
treee0625ab80a5dd1f814e58d3d680cc78d9f5cc53b /src/Screen.cc
parent6df9d6ed54a299c0897cdd2d8aa380dc02b15a41 (diff)
downloadfluxbox_pavel-b97c3db25193c3b549e46910604d27e5ff92baa2.zip
fluxbox_pavel-b97c3db25193c3b549e46910604d27e5ff92baa2.tar.bz2
close #1182770
if someone changed the session.screen0.workspaces:<int> value and fired a "reload config"/reconfigure-Command fluxbox crashed. changes: - cleaner way of reading in the workspacenames - cleaner way of initialize the workspaces in BScreen() - on BScreen::reconfigure we add/delete Workspaces to the current screen until init-file and fluxbox are in sync -> the user changed the initfile and pressed reload, so imho he wants to have the changes in the init-file realized.
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc42
1 files changed, 24 insertions, 18 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index fae0aff..45f9693 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -328,22 +328,12 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
328 renderPosWindow(); 328 renderPosWindow();
329 329
330 // setup workspaces and workspace menu 330 // setup workspaces and workspace menu
331 331 int nr_ws = *resource.workspaces;
332 if (*resource.workspaces != 0) { 332 addWorkspace(); // at least one
333 for (int i = 0; i < *resource.workspaces; ++i) { 333 for (int i = 1; i < nr_ws; ++i) {
334 Workspace *wkspc = new Workspace(*this, m_layermanager, 334 addWorkspace();
335 getNameOfWorkspace(m_workspaces_list.size()),
336 m_workspaces_list.size());
337 m_workspaces_list.push_back(wkspc);
338 }
339 } else { // create at least one workspace
340 Workspace *wkspc = new Workspace(*this, m_layermanager,
341 getNameOfWorkspace(m_workspaces_list.size()),
342 m_workspaces_list.size());
343 m_workspaces_list.push_back(wkspc);
344 } 335 }
345 336
346
347 m_current_workspace = m_workspaces_list.front(); 337 m_current_workspace = m_workspaces_list.front();
348 338
349 339
@@ -656,6 +646,7 @@ void BScreen::hideWindowMenus(const FluxboxWindow* except) {
656 646
657 647
658void BScreen::reconfigure() { 648void BScreen::reconfigure() {
649
659 m_windowtheme->setFocusedAlpha(*resource.focused_alpha); 650 m_windowtheme->setFocusedAlpha(*resource.focused_alpha);
660 m_windowtheme->setUnfocusedAlpha(*resource.unfocused_alpha); 651 m_windowtheme->setUnfocusedAlpha(*resource.unfocused_alpha);
661 m_menutheme->setAlpha(*resource.menu_alpha); 652 m_menutheme->setAlpha(*resource.menu_alpha);
@@ -688,6 +679,18 @@ void BScreen::reconfigure() {
688 renderGeomWindow(); 679 renderGeomWindow();
689 renderPosWindow(); 680 renderPosWindow();
690 681
682 // realize the number of workspaces from the init-file
683 const int nr_ws = *resource.workspaces;
684 if (nr_ws > m_workspaces_list.size()) {
685 while(nr_ws != m_workspaces_list.size()) {
686 addWorkspace();
687 }
688 } else if (nr_ws < m_workspaces_list.size()) {
689 while(nr_ws != m_workspaces_list.size()) {
690 removeLastWorkspace();
691 }
692 }
693
691 //reconfigure menus 694 //reconfigure menus
692 m_workspacemenu->reconfigure(); 695 m_workspacemenu->reconfigure();
693 m_configmenu->reconfigure(); 696 m_configmenu->reconfigure();
@@ -851,11 +854,16 @@ void BScreen::setAntialias(bool value) {
851} 854}
852 855
853int BScreen::addWorkspace() { 856int BScreen::addWorkspace() {
857
858 bool save_name = getNameOfWorkspace(m_workspaces_list.size()) != "" ? false : true;
854 Workspace *wkspc = new Workspace(*this, m_layermanager, 859 Workspace *wkspc = new Workspace(*this, m_layermanager,
855 "", 860 getNameOfWorkspace(m_workspaces_list.size()),
856 m_workspaces_list.size()); 861 m_workspaces_list.size());
857 m_workspaces_list.push_back(wkspc); 862 m_workspaces_list.push_back(wkspc);
858 addWorkspaceName(wkspc->name().c_str()); // update names 863
864 if (save_name)
865 addWorkspaceName(wkspc->name().c_str()); //update names
866
859 saveWorkspaces(m_workspaces_list.size()); 867 saveWorkspaces(m_workspaces_list.size());
860 868
861 updateNetizenWorkspaceCount(); 869 updateNetizenWorkspaceCount();
@@ -879,8 +887,6 @@ int BScreen::removeLastWorkspace() {
879 //remove last workspace 887 //remove last workspace
880 m_workspaces_list.pop_back(); 888 m_workspaces_list.pop_back();
881 889
882
883
884 updateNetizenWorkspaceCount(); 890 updateNetizenWorkspaceCount();
885 saveWorkspaces(m_workspaces_list.size()); 891 saveWorkspaces(m_workspaces_list.size());
886 // must be deleted after we send notify!! 892 // must be deleted after we send notify!!