5 #include <X11/Xlocale.h>
8 _WINGsConfiguration WINGsConfiguration
;
12 #define SYSTEM_FONT "-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-medium-r-*-*-%d-*-*-*-*-*-*-*"
14 #define BOLD_SYSTEM_FONT "-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-bold-r-*-*-%d-*-*-*-*-*-*-*"
16 #define FLOPPY_PATH "/floppy"
20 getButtonWithName(const char *name
, unsigned defaultButton
)
22 if (strncmp(name
, "Button", 6)==0 && strlen(name
)==7) {
44 W_ReadConfigurations(void)
46 WMUserDefaults
*defaults
;
48 memset(&WINGsConfiguration
, 0, sizeof(_WINGsConfiguration
));
50 defaults
= WMGetStandardUserDefaults();
57 WINGsConfiguration
.systemFont
=
58 WMGetUDStringForKey(defaults
, "SystemFont");
60 WINGsConfiguration
.boldSystemFont
=
61 WMGetUDStringForKey(defaults
, "BoldSystemFont");
63 WINGsConfiguration
.useMultiByte
= False
;
64 str
= WMGetUDStringForKey(defaults
, "MultiByteText");
66 if (strcasecmp(str
, "YES") == 0) {
67 WINGsConfiguration
.useMultiByte
= True
;
68 } else if (strcasecmp(str
, "AUTO") == 0) {
71 /* if it's a multibyte language (japanese, chinese or korean)
72 * then set it to True */
73 locale
= setlocale(LC_CTYPE
, NULL
);
75 && (strncmp(locale
, "ja", 2) == 0
76 || strncmp(locale
, "zh", 2) == 0
77 || strncmp(locale
, "ko", 2) == 0)) {
79 WINGsConfiguration
.useMultiByte
= True
;
84 WINGsConfiguration
.doubleClickDelay
=
85 WMGetUDIntegerForKey(defaults
, "DoubleClickTime");
87 WINGsConfiguration
.floppyPath
=
88 WMGetUDStringForKey(defaults
, "FloppyPath");
90 buttonName
= WMGetUDStringForKey(defaults
, "MouseWheelUp");
92 button
= getButtonWithName(buttonName
, Button4
);
97 WINGsConfiguration
.mouseWheelUp
= button
;
99 buttonName
= WMGetUDStringForKey(defaults
, "MouseWheelDown");
101 button
= getButtonWithName(buttonName
, Button5
);
106 WINGsConfiguration
.mouseWheelDown
= button
;
108 if (WINGsConfiguration
.mouseWheelDown
==WINGsConfiguration
.mouseWheelUp
) {
109 WINGsConfiguration
.mouseWheelUp
= Button4
;
110 WINGsConfiguration
.mouseWheelDown
= Button5
;
113 WINGsConfiguration
.defaultFontSize
=
114 WMGetUDIntegerForKey(defaults
, "DefaultFontSize");
118 if (!WINGsConfiguration
.systemFont
) {
119 WINGsConfiguration
.systemFont
= SYSTEM_FONT
;
121 if (!WINGsConfiguration
.boldSystemFont
) {
122 WINGsConfiguration
.boldSystemFont
= BOLD_SYSTEM_FONT
;
124 if (!WINGsConfiguration
.floppyPath
) {
125 WINGsConfiguration
.floppyPath
= FLOPPY_PATH
;
127 if (WINGsConfiguration
.doubleClickDelay
== 0) {
128 WINGsConfiguration
.doubleClickDelay
= 250;
130 if (WINGsConfiguration
.mouseWheelUp
== 0) {
131 WINGsConfiguration
.mouseWheelUp
= Button4
;
133 if (WINGsConfiguration
.mouseWheelDown
== 0) {
134 WINGsConfiguration
.mouseWheelDown
= Button5
;
136 if (WINGsConfiguration
.defaultFontSize
== 0) {
137 WINGsConfiguration
.defaultFontSize
= 12;