5 #include <X11/Xlocale.h>
7 _WINGsConfiguration WINGsConfiguration
;
9 #define SYSTEM_FONT "Trebuchet MS,Luxi Sans"
10 #define BOLD_SYSTEM_FONT "Trebuchet MS,Luxi Sans:bold"
11 #define DEFAULT_FONT_SIZE 12
13 #define FLOPPY_PATH "/floppy"
15 static unsigned getButtonWithName(const char *name
, unsigned defaultButton
)
17 if (strncmp(name
, "Button", 6) == 0 && strlen(name
) == 7) {
37 void W_ReadConfigurations(void)
39 WMUserDefaults
*defaults
;
41 memset(&WINGsConfiguration
, 0, sizeof(_WINGsConfiguration
));
43 defaults
= WMGetStandardUserDefaults();
49 WINGsConfiguration
.systemFont
= WMGetUDStringForKey(defaults
, "SystemFont");
51 WINGsConfiguration
.boldSystemFont
= WMGetUDStringForKey(defaults
, "BoldSystemFont");
53 WINGsConfiguration
.antialiasedText
= WMGetUDBoolForKey(defaults
, "AntialiasedText");
55 WINGsConfiguration
.doubleClickDelay
= WMGetUDIntegerForKey(defaults
, "DoubleClickTime");
57 WINGsConfiguration
.floppyPath
= WMGetUDStringForKey(defaults
, "FloppyPath");
59 buttonName
= WMGetUDStringForKey(defaults
, "MouseWheelUp");
61 button
= getButtonWithName(buttonName
, Button4
);
66 WINGsConfiguration
.mouseWheelUp
= button
;
68 buttonName
= WMGetUDStringForKey(defaults
, "MouseWheelDown");
70 button
= getButtonWithName(buttonName
, Button5
);
75 WINGsConfiguration
.mouseWheelDown
= button
;
77 if (WINGsConfiguration
.mouseWheelDown
== WINGsConfiguration
.mouseWheelUp
) {
78 WINGsConfiguration
.mouseWheelUp
= Button4
;
79 WINGsConfiguration
.mouseWheelDown
= Button5
;
82 WINGsConfiguration
.defaultFontSize
= WMGetUDIntegerForKey(defaults
, "DefaultFontSize");
85 if (!WINGsConfiguration
.systemFont
) {
86 WINGsConfiguration
.systemFont
= SYSTEM_FONT
;
88 if (!WINGsConfiguration
.boldSystemFont
) {
89 WINGsConfiguration
.boldSystemFont
= BOLD_SYSTEM_FONT
;
91 if (WINGsConfiguration
.defaultFontSize
== 0) {
92 WINGsConfiguration
.defaultFontSize
= DEFAULT_FONT_SIZE
;
94 if (!WINGsConfiguration
.floppyPath
) {
95 WINGsConfiguration
.floppyPath
= FLOPPY_PATH
;
97 if (WINGsConfiguration
.doubleClickDelay
== 0) {
98 WINGsConfiguration
.doubleClickDelay
= 250;
100 if (WINGsConfiguration
.mouseWheelUp
== 0) {
101 WINGsConfiguration
.mouseWheelUp
= Button4
;
103 if (WINGsConfiguration
.mouseWheelDown
== 0) {
104 WINGsConfiguration
.mouseWheelDown
= Button5
;