6 #include <X11/Xlocale.h>
9 _WINGsConfiguration WINGsConfiguration
;
13 #define SYSTEM_FONT "sans:pixelsize=12"
15 #define BOLD_SYSTEM_FONT "sans:bold:pixelsize=12"
17 #define FLOPPY_PATH "/floppy"
21 getButtonWithName(const char *name
, unsigned defaultButton
)
23 if (strncmp(name
, "Button", 6)==0 && strlen(name
)==7) {
46 missingOrInvalidXLFD(char *xlfd
)
58 if ((*ptr
=='d' || *ptr
=='i') && count
==0) {
64 } else if (*ptr
==',') {
71 if (xlfd
== WINGsConfiguration
.systemFont
) {
73 } else if (xlfd
== WINGsConfiguration
.boldSystemFont
) {
74 ptr
= "bold system font";
76 ptr
= "Unknown System Font";
78 wwarning(_("Invalid %s specification: '%s' (only %%d is allowed and "
79 "at most once for each font in a fontset)."), ptr
, xlfd
);
87 W_ReadConfigurations(void)
89 WMUserDefaults
*defaults
;
91 memset(&WINGsConfiguration
, 0, sizeof(_WINGsConfiguration
));
93 defaults
= WMGetStandardUserDefaults();
100 WINGsConfiguration
.systemFont
=
101 WMGetUDStringForKey(defaults
, "SystemFont");
103 WINGsConfiguration
.boldSystemFont
=
104 WMGetUDStringForKey(defaults
, "BoldSystemFont");
106 WINGsConfiguration
.antialiasedText
=
107 WMGetUDBoolForKey(defaults
, "AntialiasedText");
109 WINGsConfiguration
.doubleClickDelay
=
110 WMGetUDIntegerForKey(defaults
, "DoubleClickTime");
112 WINGsConfiguration
.floppyPath
=
113 WMGetUDStringForKey(defaults
, "FloppyPath");
115 buttonName
= WMGetUDStringForKey(defaults
, "MouseWheelUp");
117 button
= getButtonWithName(buttonName
, Button4
);
122 WINGsConfiguration
.mouseWheelUp
= button
;
124 buttonName
= WMGetUDStringForKey(defaults
, "MouseWheelDown");
126 button
= getButtonWithName(buttonName
, Button5
);
131 WINGsConfiguration
.mouseWheelDown
= button
;
133 if (WINGsConfiguration
.mouseWheelDown
==WINGsConfiguration
.mouseWheelUp
) {
134 WINGsConfiguration
.mouseWheelUp
= Button4
;
135 WINGsConfiguration
.mouseWheelDown
= Button5
;
138 WINGsConfiguration
.defaultFontSize
=
139 WMGetUDIntegerForKey(defaults
, "DefaultFontSize");
142 if (missingOrInvalidXLFD(WINGsConfiguration
.systemFont
)) {
143 WINGsConfiguration
.systemFont
= SYSTEM_FONT
;
145 if (missingOrInvalidXLFD(WINGsConfiguration
.boldSystemFont
)) {
146 WINGsConfiguration
.boldSystemFont
= BOLD_SYSTEM_FONT
;
148 if (!WINGsConfiguration
.floppyPath
) {
149 WINGsConfiguration
.floppyPath
= FLOPPY_PATH
;
151 if (WINGsConfiguration
.doubleClickDelay
== 0) {
152 WINGsConfiguration
.doubleClickDelay
= 250;
154 if (WINGsConfiguration
.mouseWheelUp
== 0) {
155 WINGsConfiguration
.mouseWheelUp
= Button4
;
157 if (WINGsConfiguration
.mouseWheelDown
== 0) {
158 WINGsConfiguration
.mouseWheelDown
= Button5
;
160 if (WINGsConfiguration
.defaultFontSize
== 0) {
161 WINGsConfiguration
.defaultFontSize
= 12;