1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

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
2017-03-20 01:09:55 -04:00
committed by Carlos R. Mafra
parent 30cd22859a
commit 8fba9945e0

View File

@@ -569,6 +569,9 @@ static void showData(_Panel * panel)
{ {
int i; int i;
WMMenuItem *item; WMMenuItem *item;
WMScreen *scr;
scr = WMWidgetScreen(panel->parent);
for (i = 0; i < WMGetPopUpButtonNumberOfItems(panel->optionP); i++) { for (i = 0; i < WMGetPopUpButtonNumberOfItems(panel->optionP); i++) {
char *ofont, *font; char *ofont, *font;
@@ -579,19 +582,12 @@ static void showData(_Panel * panel)
if (ofont) if (ofont)
wfree(ofont); wfree(ofont);
if (strcmp(fontOptions[i].option, "SystemFont") == 0 || if (strcmp(fontOptions[i].option, "SystemFont") == 0)
strcmp(fontOptions[i].option, "BoldSystemFont") == 0) { font = WMGetFontName(WMDefaultSystemFont(scr));
char *path; else if (strcmp(fontOptions[i].option, "BoldSystemFont") == 0)
WMUserDefaults *defaults; font = WMGetFontName(WMDefaultBoldSystemFont(scr));
else
path = wdefaultspathfordomain("WMGLOBAL");
defaults = WMGetDefaultsFromPath(path);
wfree(path);
font = WMGetUDStringForKey(defaults,
fontOptions[i].option);
} else {
font = GetStringForKey(fontOptions[i].option); font = GetStringForKey(fontOptions[i].option);
}
if (font) if (font)
font = wstrdup(font); font = wstrdup(font);
WMSetMenuItemRepresentedObject(item, font); WMSetMenuItemRepresentedObject(item, font);