5 #include <X11/Xlocale.h>
10 _WINGsConfiguration WINGsConfiguration
;
14 #define SYSTEM_FONT "-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-medium-r-*-*-%d-*-*-*-*-*-*-*"
16 #define BOLD_SYSTEM_FONT "-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-bold-r-*-*-%d-*-*-*-*-*-*-*"
18 #define FLOPPY_PATH "/floppy"
22 getButtonWithName(const char *name
, unsigned defaultButton
)
24 if (strncmp(name
, "Button", 6)==0 && strlen(name
)==7) {
46 W_ReadConfigurations(void)
48 WMUserDefaults
*defaults
;
50 memset(&WINGsConfiguration
, 0, sizeof(_WINGsConfiguration
));
52 defaults
= WMGetStandardUserDefaults();
59 WINGsConfiguration
.systemFont
=
60 WMGetUDStringForKey(defaults
, "SystemFont");
62 WINGsConfiguration
.boldSystemFont
=
63 WMGetUDStringForKey(defaults
, "BoldSystemFont");
65 WINGsConfiguration
.useMultiByte
= False
;
66 str
= WMGetUDStringForKey(defaults
, "MultiByteText");
68 if (strcasecmp(str
, "YES") == 0) {
69 WINGsConfiguration
.useMultiByte
= True
;
70 } else if (strcasecmp(str
, "AUTO") == 0) {
73 /* if it's a multibyte language (japanese, chinese or korean)
74 * then set it to True */
75 locale
= setlocale(LC_CTYPE
, NULL
);
77 && (strncmp(locale
, "ja", 2) == 0
78 || strncmp(locale
, "zh", 2) == 0
79 || strncmp(locale
, "ko", 2) == 0)) {
81 WINGsConfiguration
.useMultiByte
= True
;
86 WINGsConfiguration
.doubleClickDelay
=
87 WMGetUDIntegerForKey(defaults
, "DoubleClickTime");
89 WINGsConfiguration
.floppyPath
=
90 WMGetUDStringForKey(defaults
, "FloppyPath");
92 buttonName
= WMGetUDStringForKey(defaults
, "MouseWheelUp");
94 button
= getButtonWithName(buttonName
, Button4
);
99 WINGsConfiguration
.mouseWheelUp
= button
;
101 buttonName
= WMGetUDStringForKey(defaults
, "MouseWheelDown");
103 button
= getButtonWithName(buttonName
, Button5
);
108 WINGsConfiguration
.mouseWheelDown
= button
;
110 if (WINGsConfiguration
.mouseWheelDown
==WINGsConfiguration
.mouseWheelUp
) {
111 WINGsConfiguration
.mouseWheelUp
= Button4
;
112 WINGsConfiguration
.mouseWheelDown
= Button5
;
115 WINGsConfiguration
.defaultFontSize
=
116 WMGetUDIntegerForKey(defaults
, "DefaultFontSize");
120 if (!WINGsConfiguration
.systemFont
) {
121 WINGsConfiguration
.systemFont
= SYSTEM_FONT
;
123 if (!WINGsConfiguration
.boldSystemFont
) {
124 WINGsConfiguration
.boldSystemFont
= BOLD_SYSTEM_FONT
;
126 if (!WINGsConfiguration
.floppyPath
) {
127 WINGsConfiguration
.floppyPath
= FLOPPY_PATH
;
129 if (WINGsConfiguration
.doubleClickDelay
== 0) {
130 WINGsConfiguration
.doubleClickDelay
= 250;
132 if (WINGsConfiguration
.mouseWheelUp
== 0) {
133 WINGsConfiguration
.mouseWheelUp
= Button4
;
135 if (WINGsConfiguration
.mouseWheelDown
== 0) {
136 WINGsConfiguration
.mouseWheelDown
= Button5
;
138 if (WINGsConfiguration
.defaultFontSize
== 0) {
139 WINGsConfiguration
.defaultFontSize
= 12;