From 82081c70ea570719f8ce4c5c0e92fd0eb5db9c93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Wed, 12 Apr 2006 20:55:36 +0000 Subject: [PATCH] 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 --- src/servers/app/Desktop.cpp | 20 ++++++++------------ src/servers/app/Desktop.h | 4 ++-- src/servers/app/Workspace.cpp | 2 +- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index 4927d63a15..68b3d7d9fa 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -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); } diff --git a/src/servers/app/Desktop.h b/src/servers/app/Desktop.h index ba9ac4bf3a..73fd2a0bc5 100644 --- a/src/servers/app/Desktop.h +++ b/src/servers/app/Desktop.h @@ -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; diff --git a/src/servers/app/Workspace.cpp b/src/servers/app/Workspace.cpp index 1a7dc144e6..87e43642f1 100644 --- a/src/servers/app/Workspace.cpp +++ b/src/servers/app/Workspace.cpp @@ -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()); }