WPrefs: Properly read system fonts in font configuration panel.

Previously, only the user's WMGLOBAL file would be read to determine the
current WINGs fonts (System Font and Bold System Font) in the Font
Configuration panel.  It is quite possible that this information would
not be in the user's WMGLOBAL file, but instead in the system WMGLOBAL
file.

We instead use the WMDefaultSystemFont and WMBoldDefaultSystemFont
functions to get this information.
This commit is contained in:
Doug Torrance authored and Carlos R. Mafra committed 2017-03-20 18:06:12 +00:00
1 parent 30cd22859a
commit 8fba9945e0
1 file changed
+8 -12
+8 -12
View File
@@ -569,6 +569,9 @@ static void showData(_Panel * panel)
{
int i;
WMMenuItem *item;
WMScreen *scr;
scr = WMWidgetScreen(panel->parent);
for (i = 0; i < WMGetPopUpButtonNumberOfItems(panel->optionP); i++) {
char *ofont, *font;
@@ -579,19 +582,12 @@ static void showData(_Panel * panel)
if (ofont)
wfree(ofont);
if (strcmp(fontOptions[i].option, "SystemFont") == 0 ||
strcmp(fontOptions[i].option, "BoldSystemFont") == 0) {
char *path;
WMUserDefaults *defaults;
path = wdefaultspathfordomain("WMGLOBAL");
defaults = WMGetDefaultsFromPath(path);
wfree(path);
font = WMGetUDStringForKey(defaults,
fontOptions[i].option);
} else {
if (strcmp(fontOptions[i].option, "SystemFont") == 0)
font = WMGetFontName(WMDefaultSystemFont(scr));
else if (strcmp(fontOptions[i].option, "BoldSystemFont") == 0)
font = WMGetFontName(WMDefaultBoldSystemFont(scr));
else
font = GetStringForKey(fontOptions[i].option);
}
if (font)
font = wstrdup(font);
WMSetMenuItemRepresentedObject(item, font);