4 * Copyright 1994 Alexandre Julliard
11 /* #include <locale.h> */
12 #ifdef MALLOC_DEBUGGING
16 #include "ts_xresource.h"
18 #include <X11/Xlocale.h>
19 #include <X11/cursorfont.h>
32 #include "debugdefs.h"
37 /* when adding new languages look at ole/ole2nls.c
38 * for proper iso name and Windows code (add 0x0400
39 * to the code listed there)
41 const WINE_LANGUAGE_DEF Languages
[] =
43 {"En",0x0409}, /* LANG_En */
44 {"Es",0x040A}, /* LANG_Es */
45 {"De",0x0407}, /* LANG_De */
46 {"No",0x0414}, /* LANG_No */
47 {"Fr",0x040C}, /* LANG_Fr */
48 {"Fi",0x040B}, /* LANG_Fi */
49 {"Da",0x0406}, /* LANG_Da */
50 {"Cs",0x0405}, /* LANG_Cs */
51 {"Eo",0x048f}, /* LANG_Eo */
52 {"It",0x0410}, /* LANG_It */
53 {"Ko",0x0412}, /* LANG_Ko */
54 {"Hu",0x040e}, /* LANG_Hu */
55 {"Pl",0x0415}, /* LANG_Pl */
56 {"Pt",0x0416}, /* LANG_Pt */
57 {"Sv",0x041d}, /* LANG_Sv */
58 {"Ca",0x0403}, /* LANG_Ca */
59 /* for compatibility whith non-iso names previously used */
60 {"Sw",0x041d}, /* LANG_Sv */
61 {"Cz",0x0405}, /* LANG_Cs */
62 {"Po",0x0416}, /* LANG_Pt */
66 WORD WINE_LanguageId
= 0;
68 #define WINE_CLASS "Wine" /* Class name for resources */
70 #define WINE_APP_DEFAULTS "/usr/lib/X11/app-defaults/Wine"
75 int screenWidth
= 0, screenHeight
= 0; /* Desktop window dimensions */
76 int screenDepth
= 0; /* Screen depth to use */
78 struct options Options
=
79 { /* default options */
80 NULL
, /* desktopGeometry */
81 NULL
, /* programName */
84 FALSE
, /* usePrivateMap */
85 FALSE
, /* useFixedMap */
86 FALSE
, /* synchronous */
87 FALSE
, /* backing store */
88 SW_SHOWNORMAL
, /* cmdShow */
90 FALSE
, /* failReadOnly */
91 MODE_ENHANCED
, /* Enhanced mode */
93 DEFAULT_LANG
, /* Default language */
97 FALSE
, /* Managed windows */
98 FALSE
, /* Perfect graphics */
99 NULL
/* Alternate config file name */
103 static XrmOptionDescRec optionsTable
[] =
105 { "-backingstore", ".backingstore", XrmoptionNoArg
, (caddr_t
)"on" },
106 { "-desktop", ".desktop", XrmoptionSepArg
, (caddr_t
)NULL
},
107 { "-depth", ".depth", XrmoptionSepArg
, (caddr_t
)NULL
},
108 { "-display", ".display", XrmoptionSepArg
, (caddr_t
)NULL
},
109 { "-iconic", ".iconic", XrmoptionNoArg
, (caddr_t
)"on" },
110 { "-language", ".language", XrmoptionSepArg
, (caddr_t
)"En" },
111 { "-name", ".name", XrmoptionSepArg
, (caddr_t
)NULL
},
112 { "-perfect", ".perfect", XrmoptionNoArg
, (caddr_t
)"on" },
113 { "-privatemap", ".privatemap", XrmoptionNoArg
, (caddr_t
)"on" },
114 { "-fixedmap", ".fixedmap", XrmoptionNoArg
, (caddr_t
)"on" },
115 { "-synchronous", ".synchronous", XrmoptionNoArg
, (caddr_t
)"on" },
116 { "-debug", ".debug", XrmoptionNoArg
, (caddr_t
)"on" },
117 { "-debugmsg", ".debugmsg", XrmoptionSepArg
, (caddr_t
)NULL
},
118 { "-dll", ".dll", XrmoptionSepArg
, (caddr_t
)NULL
},
119 { "-failreadonly", ".failreadonly", XrmoptionNoArg
, (caddr_t
)"on" },
120 { "-mode", ".mode", XrmoptionSepArg
, (caddr_t
)NULL
},
121 { "-managed", ".managed", XrmoptionNoArg
, (caddr_t
)"off"},
122 { "-winver", ".winver", XrmoptionSepArg
, (caddr_t
)NULL
},
123 { "-config", ".config", XrmoptionSepArg
, (caddr_t
)NULL
}
126 #define NB_OPTIONS (sizeof(optionsTable) / sizeof(optionsTable[0]))
130 "Usage: %s [options] \"program_name [arguments]\"\n" \
133 " -backingstore Turn on backing store\n" \
134 " -config name Specify config file to use\n" \
135 " -debug Enter debugger before starting application\n" \
136 " -debugmsg name Turn debugging-messages on or off\n" \
137 " -depth n Change the depth to use for multiple-depth screens\n" \
138 " -desktop geom Use a desktop window of the given geometry\n" \
139 " -display name Use the specified display\n" \
140 " -dll name Enable or disable built-in DLLs\n" \
141 " -failreadonly Read only files may not be opened in write mode\n" \
142 " -fixedmap Use a \"standard\" color map\n" \
143 " -help Show this help message\n" \
144 " -iconic Start as an icon\n" \
145 " -language xx Set the language (one of Ca,Cs,Da,De,En,Eo,Es,Fi,Fr,Hu,It,\n Ko,No,Pl,Pt,Sv)\n" \
146 " -managed Allow the window manager to manage created windows\n" \
147 " -mode mode Start Wine in a particular mode (standard or enhanced)\n" \
148 " -name name Set the application name\n" \
149 " -perfect Favor correctness over speed for graphical operations\n" \
150 " -privatemap Use a private color map\n" \
151 " -synchronous Turn on synchronous display mode\n" \
152 " -version Display the Wine version\n" \
153 " -winver Version to imitate (one of win31,win95,nt351,nt40)\n"
157 /***********************************************************************
160 void MAIN_Usage( char *name
)
162 MSG( USAGE
, WINE_RELEASE_INFO
, name
);
167 /***********************************************************************
168 * MAIN_GetProgramName
170 * Get the program name. The name is specified by (in order of precedence):
171 * - the option '-name'.
172 * - the environment variable 'WINE_NAME'.
173 * - the last component of argv[0].
175 static char *MAIN_GetProgramName( int argc
, char *argv
[] )
180 for (i
= 1; i
< argc
-1; i
++)
181 if (!strcmp( argv
[i
], "-name" )) return argv
[i
+1];
182 if ((p
= getenv( "WINE_NAME" )) != NULL
) return p
;
183 if ((p
= strrchr( argv
[0], '/' )) != NULL
) return p
+1;
188 /***********************************************************************
191 * Fetch the value of resource 'name' using the correct instance name.
192 * 'name' must begin with '.' or '*'
194 static int MAIN_GetResource( XrmDatabase db
, char *name
, XrmValue
*value
)
196 char *buff_instance
, *buff_class
;
200 buff_instance
= (char *)xmalloc(strlen(Options
.programName
)+strlen(name
)+1);
201 buff_class
= (char *)xmalloc( strlen(WINE_CLASS
) + strlen(name
) + 1 );
203 strcpy( buff_instance
, Options
.programName
);
204 strcat( buff_instance
, name
);
205 strcpy( buff_class
, WINE_CLASS
);
206 strcat( buff_class
, name
);
207 retval
= TSXrmGetResource( db
, buff_instance
, buff_class
, &dummy
, value
);
208 free( buff_instance
);
214 /***********************************************************************
215 * MAIN_ParseDebugOptions
217 * Turns specific debug messages on or off, according to "options".
220 * TRUE if parsing was successful
222 static BOOL32
MAIN_ParseDebugOptions(char *options
)
224 /* defined in relay32/relay386.c */
225 extern char **debug_relay_includelist
;
226 extern char **debug_relay_excludelist
;
227 /* defined in relay32/snoop.c */
228 extern char **debug_snoop_includelist
;
229 extern char **debug_snoop_excludelist
;
232 if (strlen(options
)<3)
236 if ((*options
!='+')&&(*options
!='-')){
239 for(j
=0; j
<DEBUG_CLASS_COUNT
; j
++)
240 if(!lstrncmpi32A(options
, debug_cl_name
[j
], strlen(debug_cl_name
[j
])))
242 if(j
==DEBUG_CLASS_COUNT
)
244 options
+= strlen(debug_cl_name
[j
]);
245 if ((*options
!='+')&&(*options
!='-'))
250 cls
= -1; /* all classes */
252 if (strchr(options
,','))
253 l
=strchr(options
,',')-options
;
257 if (!lstrncmpi32A(options
+1,"all",l
-1))
260 for (i
=0; i
<DEBUG_CHANNEL_COUNT
; i
++)
261 for(j
=0; j
<DEBUG_CLASS_COUNT
; j
++)
262 if(cls
== -1 || cls
== j
)
263 debug_msg_enabled
[i
][j
]=(*options
=='+');
265 else if (!lstrncmpi32A(options
+1, "relay=", 6) ||
266 !lstrncmpi32A(options
+1, "snoop=", 6))
269 char *s
, *s2
, ***output
, c
;
271 for (i
=0; i
<DEBUG_CHANNEL_COUNT
; i
++)
272 if (debug_ch_name
&& (!lstrncmpi32A(debug_ch_name
[i
],options
+1,5))){
273 for(j
=0; j
<DEBUG_CLASS_COUNT
; j
++)
274 if(cls
== -1 || cls
== j
)
275 debug_msg_enabled
[i
][j
]=TRUE
;
278 /* should never happen, maybe assert(i!=DEBUG_CHANNEL_COUNT)? */
279 if (i
==DEBUG_CHANNEL_COUNT
)
281 output
= (*options
== '+') ?
282 ((*(options
+1) == 'r') ?
283 &debug_relay_includelist
:
284 &debug_snoop_includelist
) :
285 ((*(options
+1) == 'r') ?
286 &debug_relay_excludelist
:
287 &debug_snoop_excludelist
);
290 while((s
= strchr(s
, ':'))) i
++, s
++;
291 *output
= malloc(sizeof(char **) * i
+ 1);
294 while((s2
= strchr(s
, ':'))) {
297 *((*output
)+i
) = strdup(s
);
303 *(options
+ l
) = '\0';
304 *((*output
)+i
) = strdup(s
);
306 *((*output
)+i
+1) = NULL
;
311 for (i
=0; i
<DEBUG_CHANNEL_COUNT
; i
++)
312 if (debug_ch_name
&& (!lstrncmpi32A(options
+1,debug_ch_name
[i
],l
-1))){
313 for(j
=0; j
<DEBUG_CLASS_COUNT
; j
++)
314 if(cls
== -1 || cls
== j
)
315 debug_msg_enabled
[i
][j
]=(*options
=='+');
318 if (i
==DEBUG_CHANNEL_COUNT
)
323 while((*options
==',')&&(*(++options
)));
330 /***********************************************************************
334 * Lang: a string whose two first chars are the iso name of a language.
335 * Country: a string whose two first chars are the iso name of country
336 * Charset: a string defining the chossen charset encoding
337 * Dialect: a string defining a variation of the locale
339 * all those values are from the standardized format of locale
340 * name in unix which is: Lang[_Country][.Charset][@Dialect]
343 * the numeric code of the language used by Windows (or 0x00)
345 int MAIN_GetLanguageID(char *Lang
, char *Country
, char *Charset
, char *Dialect
)
347 char lang
[3]="??", country
[3]={0,0,0};
348 char *charset
=NULL
, *dialect
=NULL
;
351 if (Lang
==NULL
) return 0x00;
352 if (Lang
[0]) lang
[0]=tolower(Lang
[0]);
353 if (Lang
[1]) lang
[1]=tolower(Lang
[1]);
356 if (Country
[0]) country
[0]=toupper(Country
[0]);
357 if (Country
[1]) country
[1]=toupper(Country
[1]);
362 charset
=(char*)malloc(j
+1);
364 charset
[i
]=toupper(Charset
[i
]);
370 dialect
=(char*)malloc(j
+1);
372 dialect
[i
]=tolower(Dialect
[i
]);
376 #define LANG_ENTRY_BEGIN(x,y) if(!strcmp(lang, x )) { \
379 goto end_MAIN_GetLanguageID; \
381 #define LANG_SUB_ENTRY(x,y,z) if (!strcmp(country, x )) \
382 ret = MAKELANGID( LANG_##y , SUBLANG_##z ); \
383 goto end_MAIN_GetLanguageID;
384 #define LANG_DIALECT_ENTRY(x,y) { ret = MAKELANGID(LANG_##x , SUBLANG_##y ); \
385 goto end_MAIN_GetLanguageID; }
386 #define LANG_ENTRY_END(x) ret = MAKELANGID(LANG_##x , SUBLANG_DEFAULT); \
387 goto end_MAIN_GetLanguageID; \
390 /*x01*/ LANG_ENTRY_BEGIN( "ar", ARABIC
)
391 LANG_SUB_ENTRY( "SA", ARABIC
, ARABIC
)
392 LANG_SUB_ENTRY( "IQ", ARABIC
, ARABIC_IRAQ
)
393 LANG_SUB_ENTRY( "EG", ARABIC
, ARABIC_EGYPT
)
394 LANG_SUB_ENTRY( "LY", ARABIC
, ARABIC_LIBYA
)
395 LANG_SUB_ENTRY( "DZ", ARABIC
, ARABIC_ALGERIA
)
396 LANG_SUB_ENTRY( "MA", ARABIC
, ARABIC_MOROCCO
)
397 LANG_SUB_ENTRY( "TN", ARABIC
, ARABIC_TUNISIA
)
398 LANG_SUB_ENTRY( "OM", ARABIC
, ARABIC_OMAN
)
399 LANG_SUB_ENTRY( "YE", ARABIC
, ARABIC_YEMEN
)
400 LANG_SUB_ENTRY( "SY", ARABIC
, ARABIC_SYRIA
)
401 LANG_SUB_ENTRY( "JO", ARABIC
, ARABIC_JORDAN
)
402 LANG_SUB_ENTRY( "LB", ARABIC
, ARABIC_LEBANON
)
403 LANG_SUB_ENTRY( "KW", ARABIC
, ARABIC_KUWAIT
)
404 LANG_SUB_ENTRY( "AE", ARABIC
, ARABIC_UAE
)
405 LANG_SUB_ENTRY( "BH", ARABIC
, ARABIC_BAHRAIN
)
406 LANG_SUB_ENTRY( "QA", ARABIC
, ARABIC_QATAR
)
407 LANG_ENTRY_END( ARABIC
)
408 /*x02*/ LANG_ENTRY_BEGIN( "bu", BULGARIAN
)
409 LANG_ENTRY_END( BULGARIAN
)
410 /*x03*/ LANG_ENTRY_BEGIN( "ca", CATALAN
)
411 LANG_ENTRY_END( CATALAN
)
412 /*x04*/ LANG_ENTRY_BEGIN( "zh", CHINESE
)
413 LANG_SUB_ENTRY( "TW", CHINESE
, CHINESE_TRADITIONAL
)
414 LANG_SUB_ENTRY( "CN", CHINESE
, CHINESE_SIMPLIFIED
)
415 LANG_SUB_ENTRY( "HK", CHINESE
, CHINESE_HONGKONG
)
416 LANG_SUB_ENTRY( "SG", CHINESE
, CHINESE_SINGAPORE
)
417 LANG_SUB_ENTRY( "MO", CHINESE
, CHINESE_MACAU
)
418 LANG_ENTRY_END( CHINESE
)
419 /*x05*/ LANG_ENTRY_BEGIN( "cs", CZECH
)
420 LANG_ENTRY_END( CZECH
)
421 /*x06*/ LANG_ENTRY_BEGIN( "da", DANISH
)
422 LANG_ENTRY_END( DANISH
)
423 /*x07*/ LANG_ENTRY_BEGIN( "de", GERMAN
)
424 LANG_SUB_ENTRY( "DE", GERMAN
, GERMAN
)
425 LANG_SUB_ENTRY( "CH", GERMAN
, GERMAN_SWISS
)
426 LANG_SUB_ENTRY( "AT", GERMAN
, GERMAN_AUSTRIAN
)
427 LANG_SUB_ENTRY( "LU", GERMAN
, GERMAN_LUXEMBOURG
)
428 LANG_SUB_ENTRY( "LI", GERMAN
, GERMAN_LIECHTENSTEIN
)
429 LANG_ENTRY_END( GERMAN
)
430 /*x08*/ LANG_ENTRY_BEGIN( "el", GREEK
)
431 LANG_ENTRY_END( GREEK
)
432 /*x09*/ LANG_ENTRY_BEGIN( "en", ENGLISH
)
433 LANG_SUB_ENTRY( "US", ENGLISH
, ENGLISH_US
)
434 LANG_SUB_ENTRY( "UK", ENGLISH
, ENGLISH_UK
)
435 LANG_SUB_ENTRY( "AU", ENGLISH
, ENGLISH_AUS
)
436 LANG_SUB_ENTRY( "CA", ENGLISH
, ENGLISH_CAN
)
437 LANG_SUB_ENTRY( "NZ", ENGLISH
, ENGLISH_NZ
)
438 LANG_SUB_ENTRY( "EI", ENGLISH
, ENGLISH_EIRE
)
439 LANG_SUB_ENTRY( "ZA", ENGLISH
, ENGLISH_SAFRICA
)
440 LANG_SUB_ENTRY( "JM", ENGLISH
, ENGLISH_JAMAICA
)
441 /* LANG_SUB_ENTRY( "AG", ENGLISH, ENGLISH_CARIBBEAN ) */
442 LANG_SUB_ENTRY( "BZ", ENGLISH
, ENGLISH_BELIZE
)
443 LANG_SUB_ENTRY( "TT", ENGLISH
, ENGLISH_TRINIDAD
)
444 LANG_SUB_ENTRY( "ZW", ENGLISH
, ENGLISH_ZIMBABWE
)
445 LANG_SUB_ENTRY( "PH", ENGLISH
, ENGLISH_PHILIPPINES
)
446 LANG_ENTRY_END( ENGLISH
)
447 /*x0a*/ LANG_ENTRY_BEGIN( "es", SPANISH
)
448 /* traditional sorting */
449 if (!strcmp(dialect
,"tradicional"))
450 LANG_DIALECT_ENTRY( SPANISH
, SPANISH
)
451 LANG_SUB_ENTRY( "MX", SPANISH
, SPANISH_MEXICAN
)
452 LANG_SUB_ENTRY( "ES", SPANISH
, SPANISH_MODERN
)
453 LANG_SUB_ENTRY( "GT", SPANISH
, SPANISH_GUATEMALA
)
454 LANG_SUB_ENTRY( "CR", SPANISH
, SPANISH_COSTARICA
)
455 LANG_SUB_ENTRY( "PA", SPANISH
, SPANISH_PANAMA
)
456 LANG_SUB_ENTRY( "DO", SPANISH
, SPANISH_DOMINICAN
)
457 LANG_SUB_ENTRY( "VE", SPANISH
, SPANISH_VENEZUELA
)
458 LANG_SUB_ENTRY( "CO", SPANISH
, SPANISH_COLOMBIA
)
459 LANG_SUB_ENTRY( "PE", SPANISH
, SPANISH_PERU
)
460 LANG_SUB_ENTRY( "AR", SPANISH
, SPANISH_ARGENTINA
)
461 LANG_SUB_ENTRY( "EC", SPANISH
, SPANISH_ECUADOR
)
462 LANG_SUB_ENTRY( "CL", SPANISH
, SPANISH_CHILE
)
463 LANG_SUB_ENTRY( "UY", SPANISH
, SPANISH_URUGUAY
)
464 LANG_SUB_ENTRY( "PY", SPANISH
, SPANISH_PARAGUAY
)
465 LANG_SUB_ENTRY( "BO", SPANISH
, SPANISH_BOLIVIA
)
466 LANG_SUB_ENTRY( "HN", SPANISH
, SPANISH_HONDURAS
)
467 LANG_SUB_ENTRY( "NI", SPANISH
, SPANISH_NICARAGUA
)
468 LANG_SUB_ENTRY( "PR", SPANISH
, SPANISH_PUERTO_RICO
)
469 LANG_ENTRY_END( SPANISH
)
470 /*x0b*/ LANG_ENTRY_BEGIN( "fi", FINNISH
)
471 LANG_ENTRY_END( FINNISH
)
472 /*x0c*/ LANG_ENTRY_BEGIN( "fr", FRENCH
)
473 LANG_SUB_ENTRY( "FR", FRENCH
, FRENCH
)
474 LANG_SUB_ENTRY( "BE", FRENCH
, FRENCH_BELGIAN
)
475 LANG_SUB_ENTRY( "CA", FRENCH
, FRENCH_CANADIAN
)
476 LANG_SUB_ENTRY( "CH", FRENCH
, FRENCH_SWISS
)
477 LANG_SUB_ENTRY( "LU", FRENCH
, FRENCH_LUXEMBOURG
)
478 LANG_SUB_ENTRY( "MC", FRENCH
, FRENCH_MONACO
)
479 LANG_ENTRY_END( FRENCH
)
480 /*x0d*/ LANG_ENTRY_BEGIN( "iw", HEBREW
)
481 LANG_ENTRY_END( HEBREW
)
482 /*x0e*/ LANG_ENTRY_BEGIN( "hu", HUNGARIAN
)
483 LANG_ENTRY_END( HUNGARIAN
)
484 /*x0f*/ LANG_ENTRY_BEGIN( "ic", ICELANDIC
)
485 LANG_ENTRY_END( ICELANDIC
)
486 /*x10*/ LANG_ENTRY_BEGIN( "it", ITALIAN
)
487 LANG_SUB_ENTRY( "IT", ITALIAN
, ITALIAN
)
488 LANG_SUB_ENTRY( "CH", ITALIAN
, ITALIAN_SWISS
)
489 LANG_ENTRY_END( ITALIAN
)
490 /*x11*/ LANG_ENTRY_BEGIN( "ja", JAPANESE
)
491 LANG_ENTRY_END( JAPANESE
)
492 /*x12*/ LANG_ENTRY_BEGIN( "ko", KOREAN
)
494 if (!strcmp(charset
,"JOHAB"))
495 LANG_DIALECT_ENTRY( KOREAN
, KOREAN_JOHAB
)
497 LANG_DIALECT_ENTRY( KOREAN
, KOREAN
)
498 LANG_ENTRY_END( KOREAN
)
499 /*x13*/ LANG_ENTRY_BEGIN( "nl", DUTCH
)
500 LANG_SUB_ENTRY( "NL", DUTCH
, DUTCH
)
501 LANG_SUB_ENTRY( "BE", DUTCH
, DUTCH_BELGIAN
)
502 LANG_SUB_ENTRY( "SR", DUTCH
, DUTCH_SURINAM
)
503 LANG_ENTRY_END( DUTCH
)
504 /*x14*/ LANG_ENTRY_BEGIN( "no", NORWEGIAN
)
506 if (!strcmp(dialect
,"nynorsk"))
507 LANG_DIALECT_ENTRY( NORWEGIAN
, NORWEGIAN_NYNORSK
)
509 LANG_DIALECT_ENTRY( NORWEGIAN
, NORWEGIAN_BOKMAL
)
510 LANG_ENTRY_END( NORWEGIAN
)
511 /*x15*/ LANG_ENTRY_BEGIN( "pl", POLISH
)
512 LANG_ENTRY_END( POLISH
)
513 /*x16*/ LANG_ENTRY_BEGIN( "pt", PORTUGUESE
)
514 LANG_SUB_ENTRY( "BR", PORTUGUESE
, PORTUGUESE_BRAZILIAN
)
515 LANG_SUB_ENTRY( "PT", PORTUGUESE
, PORTUGUESE
)
516 LANG_ENTRY_END( PORTUGUESE
)
517 /*x17*/ LANG_ENTRY_BEGIN( "rm", RHAETO_ROMANCE
)
518 LANG_ENTRY_END( RHAETO_ROMANCE
)
519 /*x18*/ LANG_ENTRY_BEGIN( "ro", ROMANIAN
)
520 LANG_SUB_ENTRY( "RO", ROMANIAN
, ROMANIAN
)
521 LANG_SUB_ENTRY( "MD", ROMANIAN
, ROMANIAN_MOLDAVIA
)
522 LANG_ENTRY_END( ROMANIAN
)
523 /*x19*/ LANG_ENTRY_BEGIN( "ru", RUSSIAN
)
524 LANG_SUB_ENTRY( "RU", RUSSIAN
, RUSSIAN
)
525 LANG_SUB_ENTRY( "MD", RUSSIAN
, RUSSIAN_MOLDAVIA
)
526 LANG_ENTRY_END( RUSSIAN
)
527 /*x1a*/ if (!strcmp(lang
,"sh") || !strcmp(lang
,"hr") || !strcmp(lang
,"sr")) {
529 LANG_DIALECT_ENTRY( SERBO_CROATIAN
, NEUTRAL
)
530 if (!strcmp(charset
,"ISO-8859-5"))
531 LANG_DIALECT_ENTRY( SERBO_CROATIAN
, SERBIAN
)
532 LANG_SUB_ENTRY( "HR", SERBO_CROATIAN
, CROATIAN
)
533 if (!strcmp(country
,"YU") && !strcmp(charset
,"ISO-8859-2"))
534 LANG_DIALECT_ENTRY( SERBO_CROATIAN
, SERBIAN_LATIN
)
535 LANG_SUB_ENTRY( "YU", SERBO_CROATIAN
, SERBIAN
)
536 LANG_DIALECT_ENTRY( SERBO_CROATIAN
, SERBIAN_LATIN
)
538 /*x1b*/ LANG_ENTRY_BEGIN( "sk", SLOVAK
)
539 LANG_ENTRY_END( SLOVAK
)
540 /*x1c*/ LANG_ENTRY_BEGIN( "sq", ALBANIAN
)
541 LANG_ENTRY_END( ALBANIAN
)
542 /*x1d*/ LANG_ENTRY_BEGIN( "sv", SWEDISH
)
543 LANG_SUB_ENTRY( "SE", SWEDISH
, SWEDISH
)
544 LANG_SUB_ENTRY( "FI", SWEDISH
, SWEDISH_FINLAND
)
545 LANG_ENTRY_END( SWEDISH
)
546 /*x1e*/ LANG_ENTRY_BEGIN( "th", THAI
)
547 LANG_ENTRY_END( THAI
)
548 /*x1f*/ LANG_ENTRY_BEGIN( "tr", TURKISH
)
549 LANG_ENTRY_END( TURKISH
)
550 /*x20*/ LANG_ENTRY_BEGIN( "ur", URDU
)
551 LANG_ENTRY_END( URDU
)
552 /*x21*/ LANG_ENTRY_BEGIN( "in", INDONESIAN
)
553 LANG_ENTRY_END( INDONESIAN
)
554 /*x22*/ LANG_ENTRY_BEGIN( "uk", UKRAINIAN
)
555 LANG_ENTRY_END( UKRAINIAN
)
556 /*x23*/ LANG_ENTRY_BEGIN( "be", BYELORUSSIAN
)
557 LANG_ENTRY_END( BYELORUSSIAN
)
558 /*x24*/ LANG_ENTRY_BEGIN( "sl", SLOVENIAN
)
559 LANG_ENTRY_END( SLOVENIAN
)
560 /*x25*/ LANG_ENTRY_BEGIN( "et", ESTONIAN
)
561 LANG_ENTRY_END( ESTONIAN
)
562 /*x26*/ LANG_ENTRY_BEGIN( "lv", LATVIAN
)
563 LANG_ENTRY_END( LATVIAN
)
564 /*x27*/ LANG_ENTRY_BEGIN( "lt", LITHUANIAN
)
565 /* traditional sorting ? */
566 if (!strcmp(dialect
,"classic") || !strcmp(dialect
,"traditional"))
567 LANG_DIALECT_ENTRY( LITHUANIAN
, LITHUANIAN_CLASSIC
)
569 LANG_DIALECT_ENTRY( LITHUANIAN
, LITHUANIAN
)
570 LANG_ENTRY_END( LITHUANIAN
)
571 /*x28*/ LANG_ENTRY_BEGIN( "mi", MAORI
)
572 LANG_ENTRY_END( MAORI
)
573 /*x29*/ LANG_ENTRY_BEGIN( "fa", FARSI
)
574 LANG_ENTRY_END( FARSI
)
575 /*x2a*/ LANG_ENTRY_BEGIN( "vi", VIETNAMESE
)
576 LANG_ENTRY_END( VIETNAMESE
)
577 /*x2b*/ LANG_ENTRY_BEGIN( "hy", ARMENIAN
)
578 LANG_ENTRY_END( ARMENIAN
)
579 /*x2c*/ LANG_ENTRY_BEGIN( "az", AZERI
)
581 if (strstr(charset
,"KOI8") || !strcmp(charset
,"ISO-8859-5"))
582 LANG_DIALECT_ENTRY( AZERI
, AZERI_CYRILLIC
)
584 LANG_DIALECT_ENTRY( AZERI
, AZERI
)
585 LANG_ENTRY_END( AZERI
)
586 /*x2d*/ LANG_ENTRY_BEGIN( "eu", BASQUE
)
587 LANG_ENTRY_END( BASQUE
)
588 /*x2e*/ /*LANG_ENTRY_BEGIN( "??", SORBIAN )
589 LANG_ENTRY_END( SORBIAN ) */
590 /*x2f*/ LANG_ENTRY_BEGIN( "mk", MACEDONIAN
)
591 LANG_ENTRY_END( MACEDONIAN
)
592 /*x30*/ /*LANG_ENTRY_BEGIN( "??", SUTU )
593 LANG_ENTRY_END( SUTU ) */
594 /*x31*/ LANG_ENTRY_BEGIN( "ts", TSONGA
)
595 LANG_ENTRY_END( TSONGA
)
596 /*x32*/ /*LANG_ENTRY_BEGIN( "??", TSWANA )
597 LANG_ENTRY_END( TSWANA ) */
598 /*x33*/ /*LANG_ENTRY_BEGIN( "??", VENDA )
599 LANG_ENTRY_END( VENDA ) */
600 /*x34*/ LANG_ENTRY_BEGIN( "xh", XHOSA
)
601 LANG_ENTRY_END( XHOSA
)
602 /*x35*/ LANG_ENTRY_BEGIN( "zu", ZULU
)
603 LANG_ENTRY_END( ZULU
)
604 /*x36*/ LANG_ENTRY_BEGIN( "af", AFRIKAANS
)
605 LANG_ENTRY_END( AFRIKAANS
)
606 /*x37*/ LANG_ENTRY_BEGIN( "ka", GEORGIAN
)
607 LANG_ENTRY_END( GEORGIAN
)
608 /*x38*/ LANG_ENTRY_BEGIN( "fo", FAEROESE
)
609 LANG_ENTRY_END( FAEROESE
)
610 /*x39*/ LANG_ENTRY_BEGIN( "hi", HINDI
)
611 LANG_ENTRY_END( HINDI
)
612 /*x3a*/ LANG_ENTRY_BEGIN( "mt", MALTESE
)
613 LANG_ENTRY_END( MALTESE
)
614 /*x3b*/ /*LANG_ENTRY_BEGIN( "??", SAAMI )
615 LANG_ENTRY_END( SAAMI ) */
616 /*x3c*/ LANG_ENTRY_BEGIN( "ga", GAELIC
)
617 LANG_DIALECT_ENTRY( GAELIC
, GAELIC
)
618 LANG_ENTRY_END( GAELIC
)
619 /*x3c*/ LANG_ENTRY_BEGIN( "gd", GAELIC
)
620 LANG_DIALECT_ENTRY( GAELIC
, GAELIC_SCOTTISH
)
621 LANG_ENTRY_END( GAELIC
)
623 /*x3e*/ LANG_ENTRY_BEGIN( "ms", MALAY
)
624 LANG_SUB_ENTRY( "MY", MALAY
, MALAY
)
625 LANG_SUB_ENTRY( "BN", MALAY
, MALAY_BRUNEI_DARUSSALAM
)
626 LANG_ENTRY_END( MALAY
)
627 /*x3f*/ LANG_ENTRY_BEGIN( "kk", KAZAKH
)
628 LANG_ENTRY_END( KAZAKH
)
630 /*x41*/ LANG_ENTRY_BEGIN( "sw", SWAHILI
)
631 LANG_ENTRY_END( SWAHILI
)
633 /*x43*/ LANG_ENTRY_BEGIN( "uz", UZBEK
)
635 if (strstr(charset
,"KOI8") || !strcmp(charset
,"ISO-8859-5"))
636 LANG_DIALECT_ENTRY( UZBEK
, UZBEK_CYRILLIC
)
638 LANG_DIALECT_ENTRY( UZBEK
, UZBEK
)
639 LANG_ENTRY_END( UZBEK
)
640 /*x44*/ LANG_ENTRY_BEGIN( "tt", TATAR
)
641 LANG_ENTRY_END( TATAR
)
642 /*x45*/ LANG_ENTRY_BEGIN( "bn", BENGALI
)
643 LANG_ENTRY_END( BENGALI
)
644 /*x46*/ LANG_ENTRY_BEGIN( "pa", PUNJABI
)
645 LANG_ENTRY_END( PUNJABI
)
646 /*x47*/ LANG_ENTRY_BEGIN( "gu", GUJARATI
)
647 LANG_ENTRY_END( GUJARATI
)
648 /*x48*/ LANG_ENTRY_BEGIN( "or", ORIYA
)
649 LANG_ENTRY_END( ORIYA
)
650 /*x49*/ LANG_ENTRY_BEGIN( "ta", TAMIL
)
651 LANG_ENTRY_END( TAMIL
)
652 /*x4a*/ LANG_ENTRY_BEGIN( "te", TELUGU
)
653 LANG_ENTRY_END( TELUGU
)
654 /*x4b*/ LANG_ENTRY_BEGIN( "kn", KANNADA
)
655 LANG_ENTRY_END( KANNADA
)
656 /*x4c*/ LANG_ENTRY_BEGIN( "ml", MALAYALAM
)
657 LANG_ENTRY_END( MALAYALAM
)
658 /*x4d*/ LANG_ENTRY_BEGIN( "as", ASSAMESE
)
659 LANG_ENTRY_END( ASSAMESE
)
660 /*x4e*/ LANG_ENTRY_BEGIN( "mr", MARATHI
)
661 LANG_ENTRY_END( MARATHI
)
662 /*x4f*/ LANG_ENTRY_BEGIN( "sa", SANSKRIT
)
663 LANG_ENTRY_END( SANSKRIT
)
665 /*x57*/ /*LANG_ENTRY_BEGIN( "??", KONKANI )
666 LANG_ENTRY_END( KONKANI ) */
668 LANG_ENTRY_BEGIN( "eo", ESPERANTO
) /* not official */
669 LANG_ENTRY_END( ESPERANTO
)
673 end_MAIN_GetLanguageID
:
674 if (Charset
) free(Charset
);
675 if (Dialect
) free(Dialect
);
680 /***********************************************************************
681 * MAIN_ParseLanguageOption
683 * Parse -language option.
685 static void MAIN_ParseLanguageOption( char *arg
)
687 const WINE_LANGUAGE_DEF
*p
= Languages
;
689 Options
.language
= LANG_En
; /* First language */
692 if (!lstrcmpi32A( p
->name
, arg
))
694 WINE_LanguageId
= p
->langid
;
699 MSG( "Invalid language specified '%s'. Supported languages are: ", arg
);
700 for (p
= Languages
; p
->name
; p
++) MSG( "%s ", p
->name
);
706 /***********************************************************************
707 * MAIN_ParseModeOption
709 * Parse -mode option.
711 static void MAIN_ParseModeOption( char *arg
)
713 if (!lstrcmpi32A("enhanced", arg
)) Options
.mode
= MODE_ENHANCED
;
714 else if (!lstrcmpi32A("standard", arg
)) Options
.mode
= MODE_STANDARD
;
717 MSG( "Invalid mode '%s' specified.\n", arg
);
718 MSG( "Valid modes are: 'standard', 'enhanced' (default).\n");
723 /***********************************************************************
726 * Parse command line options and open display.
728 static void MAIN_ParseOptions( int *argc
, char *argv
[] )
730 char *display_name
= NULL
;
732 XrmDatabase db
= TSXrmGetFileDatabase(WINE_APP_DEFAULTS
);
736 Options
.programName
= MAIN_GetProgramName( *argc
, argv
);
737 Options
.argv0
= argv
[0];
739 /* Get display name from command line */
740 for (i
= 1; i
< *argc
; i
++)
742 if (!strcmp( argv
[i
], "-display" )) display_name
= argv
[i
+1];
743 if (!strcmp( argv
[i
], "-v" ) || !strcmp( argv
[i
], "-version" ))
745 MSG( "%s\n", WINE_RELEASE_INFO
);
748 if (!strcmp( argv
[i
], "-h" ) || !strcmp( argv
[i
], "-help" ))
757 if (display_name
== NULL
&&
758 MAIN_GetResource( db
, ".display", &value
)) display_name
= value
.addr
;
760 if (!(display
= TSXOpenDisplay( display_name
)))
762 MSG( "%s: Can't open display: %s\n",
763 argv
[0], display_name
? display_name
: "(none specified)" );
767 /* tell the libX11 that we will do input method handling ourselves
768 * that keep libX11 from doing anything whith dead keys, allowing Wine
769 * to have total control over dead keys, that is this line allows
770 * them to work in Wine, even whith a libX11 including the dead key
771 * patches from Th.Quinot (http://Web.FdN.FR/~tquinot/dead-keys.en.html)
773 TSXOpenIM(display
,NULL
,NULL
,NULL
);
775 /* Merge file and screen databases */
776 if ((xrm_string
= TSXResourceManagerString( display
)) != NULL
)
778 XrmDatabase display_db
= TSXrmGetStringDatabase( xrm_string
);
779 TSXrmMergeDatabases( display_db
, &db
);
782 /* Parse command line */
783 TSXrmParseCommand( &db
, optionsTable
, NB_OPTIONS
,
784 Options
.programName
, argc
, argv
);
786 /* Get all options */
787 if (MAIN_GetResource( db
, ".iconic", &value
))
788 Options
.cmdShow
= SW_SHOWMINIMIZED
;
789 if (MAIN_GetResource( db
, ".privatemap", &value
))
790 Options
.usePrivateMap
= TRUE
;
791 if (MAIN_GetResource( db
, ".fixedmap", &value
))
792 Options
.useFixedMap
= TRUE
;
793 if (MAIN_GetResource( db
, ".synchronous", &value
))
794 Options
.synchronous
= TRUE
;
795 if (MAIN_GetResource( db
, ".backingstore", &value
))
796 Options
.backingstore
= TRUE
;
797 if (MAIN_GetResource( db
, ".debug", &value
))
798 Options
.debug
= TRUE
;
799 if (MAIN_GetResource( db
, ".failreadonly", &value
))
800 Options
.failReadOnly
= TRUE
;
801 if (MAIN_GetResource( db
, ".perfect", &value
))
802 Options
.perfectGraphics
= TRUE
;
803 if (MAIN_GetResource( db
, ".depth", &value
))
804 screenDepth
= atoi( value
.addr
);
805 if (MAIN_GetResource( db
, ".desktop", &value
))
806 Options
.desktopGeometry
= value
.addr
;
807 if (MAIN_GetResource( db
, ".language", &value
))
808 MAIN_ParseLanguageOption( (char *)value
.addr
);
809 if (MAIN_GetResource( db
, ".managed", &value
))
810 Options
.managed
= TRUE
;
811 if (MAIN_GetResource( db
, ".mode", &value
))
812 MAIN_ParseModeOption( (char *)value
.addr
);
813 if (MAIN_GetResource( db
, ".debugoptions", &value
))
814 MAIN_ParseDebugOptions((char*)value
.addr
);
815 if (MAIN_GetResource( db
, ".debugmsg", &value
))
817 #ifndef DEBUG_RUNTIME
818 MSG("%s: Option \"-debugmsg\" not implemented.\n" \
819 " Recompile with DEBUG_RUNTIME in include/debugtools.h defined.\n",
823 if (MAIN_ParseDebugOptions((char*)value
.addr
)==FALSE
)
826 MSG("%s: Syntax: -debugmsg [class]+xxx,... or "
827 "-debugmsg [class]-xxx,...\n",argv
[0]);
828 MSG("Example: -debugmsg +all,warn-heap\n"
829 " turn on all messages except warning heap messages\n");
830 MSG("Special case: -debugmsg +relay=DLL:DLL.###:FuncName\n"
831 " turn on -debugmsg +relay only as specified\n"
832 "Special case: -debugmsg -relay=DLL:DLL.###:FuncName\n"
833 " turn on -debugmsg +relay except as specified\n"
834 "Also permitted, +snoop=..., -snoop=... as with relay.\n\n");
836 MSG("Available message classes:\n");
837 for(i
=0;i
<DEBUG_CLASS_COUNT
;i
++)
838 MSG( "%-9s", debug_cl_name
[i
]);
841 MSG("Available message types:\n");
843 for(i
=0;i
<DEBUG_CHANNEL_COUNT
;i
++)
845 MSG("%-9s%c",debug_ch_name
[i
],
846 (((i
+2)%8==0)?'\n':' '));
853 if (MAIN_GetResource( db
, ".dll", &value
))
855 /* Hack: store option value in Options to be retrieved */
856 /* later on inside the emulator code. */
857 if (!__winelib
) Options
.dllFlags
= xstrdup((char *)value
.addr
);
860 MSG("-dll not supported in Winelib\n" );
865 if (MAIN_GetResource( db
, ".winver", &value
))
866 VERSION_ParseVersion( (char*)value
.addr
);
867 if (MAIN_GetResource( db
, ".config", &value
))
868 Options
.configFileName
= xstrdup((char *)value
.addr
);
872 /***********************************************************************
875 static void MAIN_CreateDesktop( int argc
, char *argv
[] )
878 unsigned int width
= 640, height
= 480; /* Default size = 640x480 */
879 char *name
= "Wine desktop";
880 XSizeHints
*size_hints
;
882 XClassHint
*class_hints
;
883 XSetWindowAttributes win_attr
;
884 XTextProperty window_name
;
885 Atom XA_WM_DELETE_WINDOW
;
887 flags
= TSXParseGeometry( Options
.desktopGeometry
, &x
, &y
, &width
, &height
);
889 screenHeight
= height
;
893 win_attr
.background_pixel
= BlackPixel(display
,0);
894 win_attr
.event_mask
= ExposureMask
| KeyPressMask
| KeyReleaseMask
|
895 PointerMotionMask
| ButtonPressMask
|
896 ButtonReleaseMask
| EnterWindowMask
;
897 win_attr
.cursor
= TSXCreateFontCursor( display
, XC_top_left_arrow
);
899 rootWindow
= TSXCreateWindow( display
, DefaultRootWindow(display
),
900 x
, y
, width
, height
, 0,
901 CopyFromParent
, InputOutput
, CopyFromParent
,
902 CWBackPixel
| CWEventMask
| CWCursor
, &win_attr
);
904 /* Set window manager properties */
906 size_hints
= TSXAllocSizeHints();
907 wm_hints
= TSXAllocWMHints();
908 class_hints
= TSXAllocClassHint();
909 if (!size_hints
|| !wm_hints
|| !class_hints
)
911 MSG("Not enough memory for window manager hints.\n" );
914 size_hints
->min_width
= size_hints
->max_width
= width
;
915 size_hints
->min_height
= size_hints
->max_height
= height
;
916 size_hints
->flags
= PMinSize
| PMaxSize
;
917 if (flags
& (XValue
| YValue
)) size_hints
->flags
|= USPosition
;
918 if (flags
& (WidthValue
| HeightValue
)) size_hints
->flags
|= USSize
;
919 else size_hints
->flags
|= PSize
;
921 wm_hints
->flags
= InputHint
| StateHint
;
922 wm_hints
->input
= True
;
923 wm_hints
->initial_state
= NormalState
;
924 class_hints
->res_name
= argv
[0];
925 class_hints
->res_class
= "Wine";
927 TSXStringListToTextProperty( &name
, 1, &window_name
);
928 TSXSetWMProperties( display
, rootWindow
, &window_name
, &window_name
,
929 argv
, argc
, size_hints
, wm_hints
, class_hints
);
930 XA_WM_DELETE_WINDOW
= TSXInternAtom( display
, "WM_DELETE_WINDOW", False
);
931 TSXSetWMProtocols( display
, rootWindow
, &XA_WM_DELETE_WINDOW
, 1 );
932 TSXFree( size_hints
);
934 TSXFree( class_hints
);
938 TSXMapWindow( display
, rootWindow
);
942 XKeyboardState keyboard_state
;
944 /***********************************************************************
947 static void MAIN_SaveSetup(void)
949 TSXGetKeyboardControl(display
, &keyboard_state
);
952 /***********************************************************************
955 static void MAIN_RestoreSetup(void)
957 XKeyboardControl keyboard_value
;
959 keyboard_value
.key_click_percent
= keyboard_state
.key_click_percent
;
960 keyboard_value
.bell_percent
= keyboard_state
.bell_percent
;
961 keyboard_value
.bell_pitch
= keyboard_state
.bell_pitch
;
962 keyboard_value
.bell_duration
= keyboard_state
.bell_duration
;
963 keyboard_value
.auto_repeat_mode
= keyboard_state
.global_auto_repeat
;
965 XChangeKeyboardControl(display
, KBKeyClickPercent
| KBBellPercent
|
966 KBBellPitch
| KBBellDuration
| KBAutoRepeatMode
, &keyboard_value
);
970 /***********************************************************************
973 static void called_at_exit(void)
978 /* FIXME: should check for other processes or threads */
979 DeleteCriticalSection( HEAP_SystemLock
);
982 /***********************************************************************
985 * Wine initialisation and command-line parsing
987 BOOL32
MAIN_WineInit( int *argc
, char *argv
[] )
993 #ifdef MALLOC_DEBUGGING
997 if (!(trace
= getenv("MALLOC_TRACE")))
999 MSG( "MALLOC_TRACE not set. No trace generated\n" );
1003 MSG( "malloc trace goes to %s\n", trace
);
1008 setbuf(stdout
,NULL
);
1009 setbuf(stderr
,NULL
);
1011 setlocale(LC_CTYPE
,"");
1012 gettimeofday( &tv
, NULL
);
1013 MSG_WineStartTicks
= (tv
.tv_sec
* 1000) + (tv
.tv_usec
/ 1000);
1015 /* We need this before calling any Xlib function */
1016 InitializeCriticalSection( &X11DRV_CritSection
);
1020 putenv("XKB_DISABLE="); /* Disable XKB extension if present. */
1022 MAIN_ParseOptions( argc
, argv
);
1024 if (Options
.desktopGeometry
&& Options
.managed
)
1027 MSG( "%s: -managed and -desktop options cannot be used together\n",
1028 Options
.programName
);
1031 Options
.managed
= FALSE
;
1035 screen
= DefaultScreenOfDisplay( display
);
1036 screenWidth
= WidthOfScreen( screen
);
1037 screenHeight
= HeightOfScreen( screen
);
1038 if (screenDepth
) /* -depth option specified */
1040 depth_list
= TSXListDepths(display
,DefaultScreen(display
),&depth_count
);
1041 for (i
= 0; i
< depth_count
; i
++)
1042 if (depth_list
[i
] == screenDepth
) break;
1043 TSXFree( depth_list
);
1044 if (i
>= depth_count
)
1046 MSG( "%s: Depth %d not supported on this screen.\n",
1047 Options
.programName
, screenDepth
);
1051 else screenDepth
= DefaultDepthOfScreen( screen
);
1052 if (Options
.synchronous
) TSXSynchronize( display
, True
);
1053 if (Options
.desktopGeometry
) MAIN_CreateDesktop( *argc
, argv
);
1054 else rootWindow
= DefaultRootWindow( display
);
1057 atexit(called_at_exit
);
1062 /***********************************************************************
1063 * MessageBeep16 (USER.104)
1065 void WINAPI
MessageBeep16( UINT16 i
)
1071 /***********************************************************************
1072 * MessageBeep32 (USER32.390)
1074 BOOL32 WINAPI
MessageBeep32( UINT32 i
)
1076 TSXBell( display
, 0 );
1081 /***********************************************************************
1082 * Beep (KERNEL32.11)
1084 BOOL32 WINAPI
Beep( DWORD dwFreq
, DWORD dwDur
)
1086 /* dwFreq and dwDur are ignored by Win95 */
1087 TSXBell(display
, 0);
1092 /***********************************************************************
1093 * GetTimerResolution (USER.14)
1095 LONG WINAPI
GetTimerResolution(void)
1100 /***********************************************************************
1101 * SystemParametersInfo32A (USER32.540)
1103 BOOL32 WINAPI
SystemParametersInfo32A( UINT32 uAction
, UINT32 uParam
,
1104 LPVOID lpvParam
, UINT32 fuWinIni
)
1107 XKeyboardState keyboard_state
;
1111 TSXGetKeyboardControl(display
, &keyboard_state
);
1112 if (keyboard_state
.bell_percent
== 0)
1113 *(BOOL32
*) lpvParam
= FALSE
;
1115 *(BOOL32
*) lpvParam
= TRUE
;
1119 *(INT32
*)lpvParam
= GetSystemMetrics32( SM_CXFRAME
);
1122 case SPI_GETFASTTASKSWITCH
:
1123 if ( GetProfileInt32A( "windows", "CoolSwitch", 1 ) == 1 )
1124 *(BOOL32
*) lpvParam
= TRUE
;
1126 *(BOOL32
*) lpvParam
= FALSE
;
1129 case SPI_GETDRAGFULLWINDOWS
:
1130 *(BOOL32
*) lpvParam
= FALSE
;
1132 case SPI_GETGRIDGRANULARITY
:
1133 *(INT32
*)lpvParam
=GetProfileInt32A("desktop","GridGranularity",1);
1136 case SPI_GETICONTITLEWRAP
:
1137 *(BOOL32
*)lpvParam
=GetProfileInt32A("desktop","IconTitleWrap",TRUE
);
1140 case SPI_GETKEYBOARDDELAY
:
1141 *(INT32
*)lpvParam
=GetProfileInt32A("keyboard","KeyboardDelay",1);
1144 case SPI_GETKEYBOARDSPEED
:
1145 *(DWORD
*)lpvParam
=GetProfileInt32A("keyboard","KeyboardSpeed",30);
1148 case SPI_GETMENUDROPALIGNMENT
:
1149 *(BOOL32
*)lpvParam
=GetSystemMetrics32(SM_MENUDROPALIGNMENT
); /* XXX check this */
1152 case SPI_GETSCREENSAVEACTIVE
:
1153 if ( GetProfileInt32A( "windows", "ScreenSaveActive", 1 ) == 1 )
1154 *(BOOL32
*)lpvParam
= TRUE
;
1156 *(BOOL32
*)lpvParam
= FALSE
;
1159 case SPI_GETSCREENSAVETIMEOUT
:
1160 /* FIXME GetProfileInt( "windows", "ScreenSaveTimeout", 300 ); */
1161 TSXGetScreenSaver(display
, &timeout
, &temp
,&temp
,&temp
);
1162 *(INT32
*) lpvParam
= timeout
* 1000;
1165 case SPI_ICONHORIZONTALSPACING
:
1166 /* FIXME Get/SetProfileInt */
1167 if (lpvParam
== NULL
)
1168 /*SetSystemMetrics( SM_CXICONSPACING, uParam )*/ ;
1170 *(INT32
*)lpvParam
=GetSystemMetrics32(SM_CXICONSPACING
);
1173 case SPI_ICONVERTICALSPACING
:
1174 /* FIXME Get/SetProfileInt */
1175 if (lpvParam
== NULL
)
1176 /*SetSystemMetrics( SM_CYICONSPACING, uParam )*/ ;
1178 *(INT32
*)lpvParam
=GetSystemMetrics32(SM_CYICONSPACING
);
1181 case SPI_GETICONTITLELOGFONT
: {
1182 LPLOGFONT32A lpLogFont
= (LPLOGFONT32A
)lpvParam
;
1184 /* from now on we always have an alias for MS Sans Serif */
1186 GetProfileString32A("Desktop", "IconTitleFaceName", "MS Sans Serif",
1187 lpLogFont
->lfFaceName
, LF_FACESIZE
);
1188 lpLogFont
->lfHeight
= -GetProfileInt32A("Desktop","IconTitleSize", 8);
1189 lpLogFont
->lfWidth
= 0;
1190 lpLogFont
->lfEscapement
= lpLogFont
->lfOrientation
= 0;
1191 lpLogFont
->lfWeight
= FW_NORMAL
;
1192 lpLogFont
->lfItalic
= FALSE
;
1193 lpLogFont
->lfStrikeOut
= FALSE
;
1194 lpLogFont
->lfUnderline
= FALSE
;
1195 lpLogFont
->lfCharSet
= ANSI_CHARSET
;
1196 lpLogFont
->lfOutPrecision
= OUT_DEFAULT_PRECIS
;
1197 lpLogFont
->lfClipPrecision
= CLIP_DEFAULT_PRECIS
;
1198 lpLogFont
->lfPitchAndFamily
= DEFAULT_PITCH
| FF_SWISS
;
1201 case SPI_GETWORKAREA
:
1202 SetRect32( (RECT32
*)lpvParam
, 0, 0,
1203 GetSystemMetrics32( SM_CXSCREEN
),
1204 GetSystemMetrics32( SM_CYSCREEN
)
1207 case SPI_GETNONCLIENTMETRICS
:
1209 #define lpnm ((LPNONCLIENTMETRICS32A)lpvParam)
1211 if( lpnm
->cbSize
== sizeof(NONCLIENTMETRICS32A
) )
1213 /* FIXME: initialize geometry entries */
1215 SystemParametersInfo32A(SPI_GETICONTITLELOGFONT
, 0,
1216 (LPVOID
)&(lpnm
->lfCaptionFont
),0);
1217 lpnm
->lfCaptionFont
.lfWeight
= FW_BOLD
;
1218 SystemParametersInfo32A(SPI_GETICONTITLELOGFONT
, 0,
1219 (LPVOID
)&(lpnm
->lfSmCaptionFont
),0);
1220 SystemParametersInfo32A(SPI_GETICONTITLELOGFONT
, 0,
1221 (LPVOID
)&(lpnm
->lfMenuFont
),0);
1222 SystemParametersInfo32A(SPI_GETICONTITLELOGFONT
, 0,
1223 (LPVOID
)&(lpnm
->lfStatusFont
),0);
1224 SystemParametersInfo32A(SPI_GETICONTITLELOGFONT
, 0,
1225 (LPVOID
)&(lpnm
->lfMessageFont
),0);
1230 case SPI_GETANIMATION
: {
1231 LPANIMATIONINFO lpAnimInfo
= (LPANIMATIONINFO
)lpvParam
;
1233 /* Tell it "disabled" */
1234 lpAnimInfo
->cbSize
= sizeof(ANIMATIONINFO
);
1235 uParam
= sizeof(ANIMATIONINFO
);
1236 lpAnimInfo
->iMinAnimate
= 0; /* Minimise and restore animation is disabled (nonzero == enabled) */
1240 case SPI_SETANIMATION
: {
1241 LPANIMATIONINFO lpAnimInfo
= (LPANIMATIONINFO
)lpvParam
;
1244 WARN(system
, "SPI_SETANIMATION ignored.\n");
1245 lpAnimInfo
->cbSize
= sizeof(ANIMATIONINFO
);
1246 uParam
= sizeof(ANIMATIONINFO
);
1250 case SPI_GETHIGHCONTRAST
:
1252 LPHIGHCONTRASTA lpHighContrastA
= (LPHIGHCONTRASTA
)lpvParam
;
1254 FIXME(system
,"SPI_GETHIGHCONTRAST not fully implemented\n");
1256 if ( lpHighContrastA
->cbSize
== sizeof( HIGHCONTRASTA
) )
1258 /* Indicate that there is no high contrast available */
1259 lpHighContrastA
->dwFlags
= 0;
1260 lpHighContrastA
->lpszDefaultScheme
= NULL
;
1271 return SystemParametersInfo16(uAction
,uParam
,lpvParam
,fuWinIni
);
1277 /***********************************************************************
1278 * SystemParametersInfo16 (USER.483)
1280 BOOL16 WINAPI
SystemParametersInfo16( UINT16 uAction
, UINT16 uParam
,
1281 LPVOID lpvParam
, UINT16 fuWinIni
)
1285 XKeyboardState keyboard_state
;
1286 XKeyboardControl keyboard_value
;
1292 TSXGetKeyboardControl(display
, &keyboard_state
);
1293 if (keyboard_state
.bell_percent
== 0)
1294 *(BOOL16
*) lpvParam
= FALSE
;
1296 *(BOOL16
*) lpvParam
= TRUE
;
1300 *(INT16
*)lpvParam
= GetSystemMetrics16( SM_CXFRAME
);
1303 case SPI_GETFASTTASKSWITCH
:
1304 if ( GetProfileInt32A( "windows", "CoolSwitch", 1 ) == 1 )
1305 *(BOOL16
*) lpvParam
= TRUE
;
1307 *(BOOL16
*) lpvParam
= FALSE
;
1310 case SPI_GETGRIDGRANULARITY
:
1311 *(INT16
*) lpvParam
= GetProfileInt32A( "desktop",
1316 case SPI_GETICONTITLEWRAP
:
1317 *(BOOL16
*) lpvParam
= GetProfileInt32A( "desktop",
1322 case SPI_GETKEYBOARDDELAY
:
1323 *(INT16
*) lpvParam
= GetProfileInt32A( "keyboard",
1324 "KeyboardDelay", 1 );
1327 case SPI_GETKEYBOARDSPEED
:
1328 *(WORD
*) lpvParam
= GetProfileInt32A( "keyboard",
1333 case SPI_GETMENUDROPALIGNMENT
:
1334 *(BOOL16
*) lpvParam
= GetSystemMetrics16( SM_MENUDROPALIGNMENT
); /* XXX check this */
1337 case SPI_GETSCREENSAVEACTIVE
:
1338 if ( GetProfileInt32A( "windows", "ScreenSaveActive", 1 ) == 1 )
1339 *(BOOL16
*) lpvParam
= TRUE
;
1341 *(BOOL16
*) lpvParam
= FALSE
;
1344 case SPI_GETSCREENSAVETIMEOUT
:
1345 /* FIXME GetProfileInt( "windows", "ScreenSaveTimeout", 300 ); */
1346 TSXGetScreenSaver(display
, &timeout
, &temp
,&temp
,&temp
);
1347 *(INT16
*) lpvParam
= timeout
;
1350 case SPI_ICONHORIZONTALSPACING
:
1351 /* FIXME Get/SetProfileInt */
1352 if (lpvParam
== NULL
)
1353 /*SetSystemMetrics( SM_CXICONSPACING, uParam )*/ ;
1355 *(INT16
*)lpvParam
= GetSystemMetrics16( SM_CXICONSPACING
);
1358 case SPI_ICONVERTICALSPACING
:
1359 /* FIXME Get/SetProfileInt */
1360 if (lpvParam
== NULL
)
1361 /*SetSystemMetrics( SM_CYICONSPACING, uParam )*/ ;
1363 *(INT16
*)lpvParam
= GetSystemMetrics16(SM_CYICONSPACING
);
1368 keyboard_value
.bell_percent
= -1;
1370 keyboard_value
.bell_percent
= 0;
1371 TSXChangeKeyboardControl(display
, KBBellPercent
,
1375 case SPI_SETSCREENSAVEACTIVE
:
1377 TSXActivateScreenSaver(display
);
1379 TSXResetScreenSaver(display
);
1382 case SPI_SETSCREENSAVETIMEOUT
:
1383 TSXSetScreenSaver(display
, uParam
, 60, DefaultBlanking
,
1387 case SPI_SETDESKWALLPAPER
:
1388 return (SetDeskWallPaper32((LPSTR
) lpvParam
));
1391 case SPI_SETDESKPATTERN
:
1392 if ((INT16
)uParam
== -1) {
1393 GetProfileString32A("Desktop", "Pattern",
1394 "170 85 170 85 170 85 170 85",
1395 buffer
, sizeof(buffer
) );
1396 return (DESKTOP_SetPattern((LPSTR
) buffer
));
1398 return (DESKTOP_SetPattern((LPSTR
) lpvParam
));
1401 case SPI_GETICONTITLELOGFONT
:
1403 LPLOGFONT16 lpLogFont
= (LPLOGFONT16
)lpvParam
;
1405 GetProfileString32A("Desktop", "IconTitleFaceName", "MS Sans Serif",
1406 lpLogFont
->lfFaceName
, LF_FACESIZE
);
1407 lpLogFont
->lfHeight
= -GetProfileInt32A("Desktop","IconTitleSize", 8);
1408 lpLogFont
->lfWidth
= 0;
1409 lpLogFont
->lfEscapement
= lpLogFont
->lfOrientation
= 0;
1410 lpLogFont
->lfWeight
= FW_NORMAL
;
1411 lpLogFont
->lfItalic
= FALSE
;
1412 lpLogFont
->lfStrikeOut
= FALSE
;
1413 lpLogFont
->lfUnderline
= FALSE
;
1414 lpLogFont
->lfCharSet
= ANSI_CHARSET
;
1415 lpLogFont
->lfOutPrecision
= OUT_DEFAULT_PRECIS
;
1416 lpLogFont
->lfClipPrecision
= CLIP_DEFAULT_PRECIS
;
1417 lpLogFont
->lfPitchAndFamily
= DEFAULT_PITCH
| FF_SWISS
;
1420 case SPI_GETNONCLIENTMETRICS
:
1422 #define lpnm ((LPNONCLIENTMETRICS16)lpvParam)
1423 if( lpnm
->cbSize
== sizeof(NONCLIENTMETRICS16
) )
1425 /* FIXME: initialize geometry entries */
1426 SystemParametersInfo16( SPI_GETICONTITLELOGFONT
, 0,
1427 (LPVOID
)&(lpnm
->lfCaptionFont
),0);
1428 lpnm
->lfCaptionFont
.lfWeight
= FW_BOLD
;
1429 SystemParametersInfo16( SPI_GETICONTITLELOGFONT
, 0,
1430 (LPVOID
)&(lpnm
->lfSmCaptionFont
),0);
1431 SystemParametersInfo16( SPI_GETICONTITLELOGFONT
, 0,
1432 (LPVOID
)&(lpnm
->lfMenuFont
),0);
1433 SystemParametersInfo16( SPI_GETICONTITLELOGFONT
, 0,
1434 (LPVOID
)&(lpnm
->lfStatusFont
),0);
1435 SystemParametersInfo16( SPI_GETICONTITLELOGFONT
, 0,
1436 (LPVOID
)&(lpnm
->lfMessageFont
),0);
1438 else /* winfile 95 sets sbSize to 340 */
1439 SystemParametersInfo32A( uAction
, uParam
, lpvParam
, fuWinIni
);
1443 case SPI_LANGDRIVER
:
1445 case SPI_SETDOUBLECLKHEIGHT
:
1446 case SPI_SETDOUBLECLICKTIME
:
1447 case SPI_SETDOUBLECLKWIDTH
:
1448 case SPI_SETFASTTASKSWITCH
:
1449 case SPI_SETKEYBOARDDELAY
:
1450 case SPI_SETKEYBOARDSPEED
:
1451 WARN(system
, "Option %d ignored.\n", uAction
);
1454 case SPI_GETWORKAREA
:
1455 SetRect16( (RECT16
*)lpvParam
, 0, 0,
1456 GetSystemMetrics16( SM_CXSCREEN
),
1457 GetSystemMetrics16( SM_CYSCREEN
) );
1461 WARN(system
, "Unknown option %d.\n", uAction
);
1467 /***********************************************************************
1468 * SystemParametersInfo32W (USER32.541)
1470 BOOL32 WINAPI
SystemParametersInfo32W( UINT32 uAction
, UINT32 uParam
,
1471 LPVOID lpvParam
, UINT32 fuWinIni
)
1477 case SPI_SETDESKWALLPAPER
:
1480 lstrcpynWtoA(buffer
,(LPWSTR
)lpvParam
,sizeof(buffer
));
1481 return SetDeskWallPaper32(buffer
);
1483 return SetDeskWallPaper32(NULL
);
1485 case SPI_SETDESKPATTERN
:
1486 if ((INT32
) uParam
== -1)
1488 GetProfileString32A("Desktop", "Pattern",
1489 "170 85 170 85 170 85 170 85",
1490 buffer
, sizeof(buffer
) );
1491 return (DESKTOP_SetPattern((LPSTR
) buffer
));
1495 lstrcpynWtoA(buffer
,(LPWSTR
)lpvParam
,sizeof(buffer
));
1496 return DESKTOP_SetPattern(buffer
);
1498 return DESKTOP_SetPattern(NULL
);
1500 case SPI_GETICONTITLELOGFONT
:
1502 /* FIXME GetProfileString32A( "?", "?", "?" ) */
1503 LPLOGFONT32W lpLogFont
= (LPLOGFONT32W
)lpvParam
;
1504 lpLogFont
->lfHeight
= 10;
1505 lpLogFont
->lfWidth
= 0;
1506 lpLogFont
->lfEscapement
= lpLogFont
->lfOrientation
= 0;
1507 lpLogFont
->lfWeight
= FW_NORMAL
;
1508 lpLogFont
->lfItalic
= lpLogFont
->lfStrikeOut
= lpLogFont
->lfUnderline
= FALSE
;
1509 lpLogFont
->lfCharSet
= ANSI_CHARSET
;
1510 lpLogFont
->lfOutPrecision
= OUT_DEFAULT_PRECIS
;
1511 lpLogFont
->lfClipPrecision
= CLIP_DEFAULT_PRECIS
;
1512 lpLogFont
->lfPitchAndFamily
= DEFAULT_PITCH
| FF_SWISS
;
1515 case SPI_GETNONCLIENTMETRICS
: {
1516 /* FIXME: implement correctly */
1517 LPNONCLIENTMETRICS32W lpnm
=(LPNONCLIENTMETRICS32W
)lpvParam
;
1519 SystemParametersInfo32W(SPI_GETICONTITLELOGFONT
,0,(LPVOID
)&(lpnm
->lfCaptionFont
),0);
1520 lpnm
->lfCaptionFont
.lfWeight
= FW_BOLD
;
1521 SystemParametersInfo32W(SPI_GETICONTITLELOGFONT
,0,(LPVOID
)&(lpnm
->lfSmCaptionFont
),0);
1522 SystemParametersInfo32W(SPI_GETICONTITLELOGFONT
,0,(LPVOID
)&(lpnm
->lfMenuFont
),0);
1523 SystemParametersInfo32W(SPI_GETICONTITLELOGFONT
,0,(LPVOID
)&(lpnm
->lfStatusFont
),0);
1524 SystemParametersInfo32W(SPI_GETICONTITLELOGFONT
,0,(LPVOID
)&(lpnm
->lfMessageFont
),0);
1528 case SPI_GETHIGHCONTRAST
:
1530 LPHIGHCONTRASTW lpHighContrastW
= (LPHIGHCONTRASTW
)lpvParam
;
1532 FIXME(system
,"SPI_GETHIGHCONTRAST not fully implemented\n");
1534 if ( lpHighContrastW
->cbSize
== sizeof( HIGHCONTRASTW
) )
1536 /* Indicate that there is no high contrast available */
1537 lpHighContrastW
->dwFlags
= 0;
1538 lpHighContrastW
->lpszDefaultScheme
= NULL
;
1549 return SystemParametersInfo32A(uAction
,uParam
,lpvParam
,fuWinIni
);
1556 /***********************************************************************
1557 * FileCDR (KERNEL.130)
1559 FARPROC16 WINAPI
FileCDR(FARPROC16 x
)
1561 FIXME(file
,"(0x%8x): stub\n", (int) x
);
1562 return (FARPROC16
)TRUE
;