app_server: Granularize whether font settings were loaded in DesktopSettings.

As per axeld's review.

Change-Id: Idd817156d53ebf535f162285bfd08f0566ac3901
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5755
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This commit is contained in:
Augustin Cavalier 2022-10-22 23:05:45 -04:00 committed by waddlesplash
parent 689f8e9060
commit 56761ebfeb
3 changed files with 19 additions and 26 deletions

View File

@ -527,7 +527,7 @@ Desktop::Init()
// now that the mode is set, see if we should increase the default font size
if (fSettings->DefaultPlainFont() == *gFontManager->DefaultPlainFont()
&& !fSettings->DidLoadSettings()) {
&& !fSettings->DidLoadFontSettings()) {
float fontSize = fSettings->DefaultPlainFont().Size();
gScreenManager->Lock();
Screen* screen = gScreenManager->ScreenAt(0);

View File

@ -34,7 +34,7 @@ DesktopSettingsPrivate::DesktopSettingsPrivate(server_read_only_memory* shared)
{
// if the on-disk settings are not complete, the defaults will be kept
_SetDefaults();
fLoadStatus = _Load();
_Load();
}
@ -111,7 +111,6 @@ DesktopSettingsPrivate::_Load()
status_t status = _GetPath(basePath);
if (status < B_OK)
return status;
int32 loadFailures = 0;
// read workspaces settings
@ -138,10 +137,8 @@ DesktopSettingsPrivate::_Load()
i, &fWorkspaceMessages[i]) == B_OK) {
i++;
}
} else
loadFailures++;
} else
loadFailures++;
}
}
// read font settings
@ -152,7 +149,9 @@ DesktopSettingsPrivate::_Load()
if (status == B_OK) {
BMessage settings;
status = settings.Unflatten(&file);
if (status == B_OK && gFontManager->Lock()) {
if (status != B_OK) {
fFontSettingsLoadStatus = status;
} else if (gFontManager->Lock()) {
const char* family;
const char* style;
float size;
@ -189,9 +188,9 @@ DesktopSettingsPrivate::_Load()
gFontManager->Unlock();
} else
loadFailures++;
fFontSettingsLoadStatus = EWOULDBLOCK;
} else
loadFailures++;
fFontSettingsLoadStatus = status;
// read mouse settings
@ -219,10 +218,8 @@ DesktopSettingsPrivate::_Load()
== B_OK) {
fAcceptFirstClick = acceptFirstClick;
}
} else
loadFailures++;
} else
loadFailures++;
}
}
// read appearance settings
@ -315,10 +312,8 @@ DesktopSettingsPrivate::_Load()
fShared.colors[i] = B_TRANSPARENT_COLOR;
}
}
} else
loadFailures++;
} else
loadFailures++;
}
}
// read dragger settings
@ -332,12 +327,10 @@ DesktopSettingsPrivate::_Load()
if (status == B_OK) {
if (settings.FindBool("show", &fShowAllDraggers) != B_OK)
fShowAllDraggers = true;
} else
loadFailures++;
} else
loadFailures++;
}
}
return (loadFailures > 0) ? B_PARTIAL_READ : B_OK;
return B_OK;
}

View File

@ -27,8 +27,8 @@ public:
server_read_only_memory* shared);
~DesktopSettingsPrivate();
bool DidLoadSettings() const
{ return fLoadStatus == B_OK; }
bool DidLoadFontSettings() const
{ return fFontSettingsLoadStatus == B_OK; }
status_t Save(uint32 mask = kAllSettings);
void SetDefaultPlainFont(const ServerFont& font);
@ -104,7 +104,7 @@ private:
void _ValidateWorkspacesLayout(int32& columns,
int32& rows) const;
status_t fLoadStatus;
status_t fFontSettingsLoadStatus;
ServerFont fPlainFont;
ServerFont fBoldFont;