improved version

though the first workspace color isn't kept between boots


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17116 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2006-04-12 20:55:36 +00:00
parent 34ff238b88
commit 82081c70ea
3 changed files with 11 additions and 15 deletions

View File

@ -661,20 +661,16 @@ Desktop::RedrawBackground()
\brief Store the workspace configuration
*/
void
Desktop::StoreWorkspaceConfiguration(Workspace::Private *workspace)
Desktop::StoreWorkspaceConfiguration(int32 index)
{
// store settings
for (int32 index = 0; index < 32; index++) {
if (&fWorkspaces[index] == workspace) {
const BMessage *oldSettings = fSettings->WorkspacesMessage(index);
BMessage settings;
if (oldSettings)
settings = *oldSettings;
workspace->StoreConfiguration(settings);
fSettings->Save(kWorkspacesSettings);
break;
}
}
const BMessage *oldSettings = fSettings->WorkspacesMessage(index);
BMessage settings;
if (oldSettings)
settings = *oldSettings;
fWorkspaces[index].StoreConfiguration(settings);
fSettings->SetWorkspacesMessage(index, settings);
fSettings->Save(kWorkspacesSettings);
}

View File

@ -163,7 +163,7 @@ class Desktop : public MessageLooper, public ScreenOwner {
{ return fBackgroundRegion; }
void RedrawBackground();
void StoreWorkspaceConfiguration(Workspace::Private *workspace);
void StoreWorkspaceConfiguration(int32 index);
void MinimizeApplication(team_id team);
void BringApplicationToFront(team_id team);
@ -224,7 +224,7 @@ class Desktop : public MessageLooper, public ScreenOwner {
sem_id fShutdownSemaphore;
int32 fShutdownCount;
::Workspace::Private fWorkspaces[32];
::Workspace::Private fWorkspaces[kMaxWorkspaces];
int32 fCurrentWorkspace;
WindowList fAllWindows;

View File

@ -108,7 +108,7 @@ Workspace::SetColor(const RGBColor& color, bool makeDefault)
fWorkspace.SetColor(color);
fDesktop.RedrawBackground();
if (makeDefault)
fDesktop.StoreWorkspaceConfiguration(&fWorkspace);
fDesktop.StoreWorkspaceConfiguration(fWorkspace.Index());
}