4 * Copyright 1994 Alexandre Julliard
12 /* #include <locale.h> */
13 #ifdef MALLOC_DEBUGGING
17 #include "ts_xresource.h"
19 #include <X11/Xlocale.h>
20 #include <X11/cursorfont.h>
33 #include "debugdefs.h"
39 /* when adding new languages look at ole/ole2nls.c
40 * for proper iso name and Windows code (add 0x0400
41 * to the code listed there)
43 const WINE_LANGUAGE_DEF Languages
[] =
45 {"En",0x0409}, /* LANG_En */
46 {"Es",0x040A}, /* LANG_Es */
47 {"De",0x0407}, /* LANG_De */
48 {"No",0x0414}, /* LANG_No */
49 {"Fr",0x040C}, /* LANG_Fr */
50 {"Fi",0x040B}, /* LANG_Fi */
51 {"Da",0x0406}, /* LANG_Da */
52 {"Cs",0x0405}, /* LANG_Cs */
53 {"Eo",0x048f}, /* LANG_Eo */
54 {"It",0x0410}, /* LANG_It */
55 {"Ko",0x0412}, /* LANG_Ko */
56 {"Hu",0x040e}, /* LANG_Hu */
57 {"Pl",0x0415}, /* LANG_Pl */
58 {"Pt",0x0416}, /* LANG_Pt */
59 {"Sv",0x041d}, /* LANG_Sv */
60 {"Ca",0x0403}, /* LANG_Ca */
61 /* for compatibility whith non-iso names previously used */
62 {"Sw",0x041d}, /* LANG_Sv */
63 {"Cz",0x0405}, /* LANG_Cs */
64 {"Po",0x0416}, /* LANG_Pt */
68 WORD WINE_LanguageId
= 0x409; /* english as default */
70 #define WINE_CLASS "Wine" /* Class name for resources */
72 #define WINE_APP_DEFAULTS "/usr/lib/X11/app-defaults/Wine"
77 int screenWidth
= 0, screenHeight
= 0; /* Desktop window dimensions */
78 int screenDepth
= 0; /* Screen depth to use */
80 struct options Options
=
81 { /* default options */
82 NULL
, /* desktopGeometry */
83 NULL
, /* programName */
86 FALSE
, /* usePrivateMap */
87 FALSE
, /* useFixedMap */
88 FALSE
, /* synchronous */
89 FALSE
, /* backing store */
90 SW_SHOWNORMAL
, /* cmdShow */
92 FALSE
, /* failReadOnly */
93 MODE_ENHANCED
, /* Enhanced mode */
95 DEFAULT_LANG
, /* Default language */
99 FALSE
, /* Managed windows */
100 FALSE
, /* Perfect graphics */
102 NULL
/* Alternate config file name */
106 static XrmOptionDescRec optionsTable
[] =
108 { "-backingstore", ".backingstore", XrmoptionNoArg
, (caddr_t
)"on" },
109 { "-desktop", ".desktop", XrmoptionSepArg
, (caddr_t
)NULL
},
110 { "-depth", ".depth", XrmoptionSepArg
, (caddr_t
)NULL
},
111 { "-display", ".display", XrmoptionSepArg
, (caddr_t
)NULL
},
112 { "-iconic", ".iconic", XrmoptionNoArg
, (caddr_t
)"on" },
113 { "-language", ".language", XrmoptionSepArg
, (caddr_t
)"En" },
114 { "-name", ".name", XrmoptionSepArg
, (caddr_t
)NULL
},
115 { "-perfect", ".perfect", XrmoptionNoArg
, (caddr_t
)"on" },
116 { "-privatemap", ".privatemap", XrmoptionNoArg
, (caddr_t
)"on" },
117 { "-fixedmap", ".fixedmap", XrmoptionNoArg
, (caddr_t
)"on" },
118 { "-synchronous", ".synchronous", XrmoptionNoArg
, (caddr_t
)"on" },
119 { "-debug", ".debug", XrmoptionNoArg
, (caddr_t
)"on" },
120 { "-debugmsg", ".debugmsg", XrmoptionSepArg
, (caddr_t
)NULL
},
121 { "-dll", ".dll", XrmoptionSepArg
, (caddr_t
)NULL
},
122 { "-failreadonly", ".failreadonly", XrmoptionNoArg
, (caddr_t
)"on" },
123 { "-mode", ".mode", XrmoptionSepArg
, (caddr_t
)NULL
},
124 { "-managed", ".managed", XrmoptionNoArg
, (caddr_t
)"off"},
125 { "-winver", ".winver", XrmoptionSepArg
, (caddr_t
)NULL
},
126 { "-config", ".config", XrmoptionSepArg
, (caddr_t
)NULL
},
127 { "-nodga", ".nodga", XrmoptionNoArg
, (caddr_t
)"off"}
130 #define NB_OPTIONS (sizeof(optionsTable) / sizeof(optionsTable[0]))
134 "Usage: %s [options] \"program_name [arguments]\"\n" \
137 " -backingstore Turn on backing store\n" \
138 " -config name Specify config file to use\n" \
139 " -debug Enter debugger before starting application\n" \
140 " -debugmsg name Turn debugging-messages on or off\n" \
141 " -depth n Change the depth to use for multiple-depth screens\n" \
142 " -desktop geom Use a desktop window of the given geometry\n" \
143 " -display name Use the specified display\n" \
144 " -dll name Enable or disable built-in DLLs\n" \
145 " -failreadonly Read only files may not be opened in write mode\n" \
146 " -fixedmap Use a \"standard\" color map\n" \
147 " -help Show this help message\n" \
148 " -iconic Start as an icon\n" \
149 " -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" \
150 " -managed Allow the window manager to manage created windows\n" \
151 " -mode mode Start Wine in a particular mode (standard or enhanced)\n" \
152 " -name name Set the application name\n" \
153 " -nodga Disable XFree86 DGA extensions\n" \
154 " -perfect Favor correctness over speed for graphical operations\n" \
155 " -privatemap Use a private color map\n" \
156 " -synchronous Turn on synchronous display mode\n" \
157 " -version Display the Wine version\n" \
158 " -winver Version to imitate (one of win31,win95,nt351,nt40)\n"
162 /***********************************************************************
165 void MAIN_Usage( char *name
)
167 MSG( USAGE
, WINE_RELEASE_INFO
, name
);
172 /***********************************************************************
173 * MAIN_GetProgramName
175 * Get the program name. The name is specified by (in order of precedence):
176 * - the option '-name'.
177 * - the environment variable 'WINE_NAME'.
178 * - the last component of argv[0].
180 static char *MAIN_GetProgramName( int argc
, char *argv
[] )
185 for (i
= 1; i
< argc
-1; i
++)
186 if (!strcmp( argv
[i
], "-name" )) return argv
[i
+1];
187 if ((p
= getenv( "WINE_NAME" )) != NULL
) return p
;
188 if ((p
= strrchr( argv
[0], '/' )) != NULL
) return p
+1;
193 /***********************************************************************
196 * Fetch the value of resource 'name' using the correct instance name.
197 * 'name' must begin with '.' or '*'
199 static int MAIN_GetResource( XrmDatabase db
, char *name
, XrmValue
*value
)
201 char *buff_instance
, *buff_class
;
205 buff_instance
= (char *)xmalloc(strlen(Options
.programName
)+strlen(name
)+1);
206 buff_class
= (char *)xmalloc( strlen(WINE_CLASS
) + strlen(name
) + 1 );
208 strcpy( buff_instance
, Options
.programName
);
209 strcat( buff_instance
, name
);
210 strcpy( buff_class
, WINE_CLASS
);
211 strcat( buff_class
, name
);
212 retval
= TSXrmGetResource( db
, buff_instance
, buff_class
, &dummy
, value
);
213 free( buff_instance
);
219 /***********************************************************************
220 * MAIN_ParseDebugOptions
222 * Turns specific debug messages on or off, according to "options".
225 * TRUE if parsing was successful
227 static BOOL32
MAIN_ParseDebugOptions(char *options
)
229 /* defined in relay32/relay386.c */
230 extern char **debug_relay_includelist
;
231 extern char **debug_relay_excludelist
;
232 /* defined in relay32/snoop.c */
233 extern char **debug_snoop_includelist
;
234 extern char **debug_snoop_excludelist
;
237 if (strlen(options
)<3)
241 if ((*options
!='+')&&(*options
!='-')){
244 for(j
=0; j
<DEBUG_CLASS_COUNT
; j
++)
245 if(!lstrncmpi32A(options
, debug_cl_name
[j
], strlen(debug_cl_name
[j
])))
247 if(j
==DEBUG_CLASS_COUNT
)
249 options
+= strlen(debug_cl_name
[j
]);
250 if ((*options
!='+')&&(*options
!='-'))
255 cls
= -1; /* all classes */
257 if (strchr(options
,','))
258 l
=strchr(options
,',')-options
;
262 if (!lstrncmpi32A(options
+1,"all",l
-1))
265 for (i
=0; i
<DEBUG_CHANNEL_COUNT
; i
++)
266 for(j
=0; j
<DEBUG_CLASS_COUNT
; j
++)
267 if(cls
== -1 || cls
== j
)
268 debug_msg_enabled
[i
][j
]=(*options
=='+');
270 else if (!lstrncmpi32A(options
+1, "relay=", 6) ||
271 !lstrncmpi32A(options
+1, "snoop=", 6))
274 char *s
, *s2
, ***output
, c
;
276 for (i
=0; i
<DEBUG_CHANNEL_COUNT
; i
++)
277 if (debug_ch_name
&& (!lstrncmpi32A(debug_ch_name
[i
],options
+1,5))){
278 for(j
=0; j
<DEBUG_CLASS_COUNT
; j
++)
279 if(cls
== -1 || cls
== j
)
280 debug_msg_enabled
[i
][j
]=TRUE
;
283 /* should never happen, maybe assert(i!=DEBUG_CHANNEL_COUNT)? */
284 if (i
==DEBUG_CHANNEL_COUNT
)
286 output
= (*options
== '+') ?
287 ((*(options
+1) == 'r') ?
288 &debug_relay_includelist
:
289 &debug_snoop_includelist
) :
290 ((*(options
+1) == 'r') ?
291 &debug_relay_excludelist
:
292 &debug_snoop_excludelist
);
295 while((s
= strchr(s
, ':'))) i
++, s
++;
296 *output
= malloc(sizeof(char **) * i
+ 1);
299 while((s2
= strchr(s
, ':'))) {
302 *((*output
)+i
) = strdup(s
);
308 *(options
+ l
) = '\0';
309 *((*output
)+i
) = strdup(s
);
311 *((*output
)+i
+1) = NULL
;
316 for (i
=0; i
<DEBUG_CHANNEL_COUNT
; i
++)
317 if (debug_ch_name
&& (!lstrncmpi32A(options
+1,debug_ch_name
[i
],l
-1))){
318 for(j
=0; j
<DEBUG_CLASS_COUNT
; j
++)
319 if(cls
== -1 || cls
== j
)
320 debug_msg_enabled
[i
][j
]=(*options
=='+');
323 if (i
==DEBUG_CHANNEL_COUNT
)
328 while((*options
==',')&&(*(++options
)));
335 /***********************************************************************
339 * Lang: a string whose two first chars are the iso name of a language.
340 * Country: a string whose two first chars are the iso name of country
341 * Charset: a string defining the chossen charset encoding
342 * Dialect: a string defining a variation of the locale
344 * all those values are from the standardized format of locale
345 * name in unix which is: Lang[_Country][.Charset][@Dialect]
348 * the numeric code of the language used by Windows (or 0x00)
350 int MAIN_GetLanguageID(LPCSTR Lang
,LPCSTR Country
,LPCSTR Charset
,LPCSTR Dialect
)
352 char lang
[3]="??", country
[3]={0,0,0};
353 char *charset
=NULL
, *dialect
=NULL
;
356 if (Lang
==NULL
) return 0x00;
357 if (Lang
[0]) lang
[0]=tolower(Lang
[0]);
358 if (Lang
[1]) lang
[1]=tolower(Lang
[1]);
361 if (Country
[0]) country
[0]=toupper(Country
[0]);
362 if (Country
[1]) country
[1]=toupper(Country
[1]);
367 charset
=(char*)malloc(j
+1);
369 charset
[i
]=toupper(Charset
[i
]);
375 dialect
=(char*)malloc(j
+1);
377 dialect
[i
]=tolower(Dialect
[i
]);
381 #define LANG_ENTRY_BEGIN(x,y) if(!strcmp(lang, x )) { \
384 goto end_MAIN_GetLanguageID; \
386 #define LANG_SUB_ENTRY(x,y,z) if (!strcmp(country, x )) \
387 ret = MAKELANGID( LANG_##y , SUBLANG_##z ); \
388 goto end_MAIN_GetLanguageID;
389 #define LANG_DIALECT_ENTRY(x,y) { ret = MAKELANGID(LANG_##x , SUBLANG_##y ); \
390 goto end_MAIN_GetLanguageID; }
391 #define LANG_ENTRY_END(x) ret = MAKELANGID(LANG_##x , SUBLANG_DEFAULT); \
392 goto end_MAIN_GetLanguageID; \
395 /*x01*/ LANG_ENTRY_BEGIN( "ar", ARABIC
)
396 LANG_SUB_ENTRY( "SA", ARABIC
, ARABIC
)
397 LANG_SUB_ENTRY( "IQ", ARABIC
, ARABIC_IRAQ
)
398 LANG_SUB_ENTRY( "EG", ARABIC
, ARABIC_EGYPT
)
399 LANG_SUB_ENTRY( "LY", ARABIC
, ARABIC_LIBYA
)
400 LANG_SUB_ENTRY( "DZ", ARABIC
, ARABIC_ALGERIA
)
401 LANG_SUB_ENTRY( "MA", ARABIC
, ARABIC_MOROCCO
)
402 LANG_SUB_ENTRY( "TN", ARABIC
, ARABIC_TUNISIA
)
403 LANG_SUB_ENTRY( "OM", ARABIC
, ARABIC_OMAN
)
404 LANG_SUB_ENTRY( "YE", ARABIC
, ARABIC_YEMEN
)
405 LANG_SUB_ENTRY( "SY", ARABIC
, ARABIC_SYRIA
)
406 LANG_SUB_ENTRY( "JO", ARABIC
, ARABIC_JORDAN
)
407 LANG_SUB_ENTRY( "LB", ARABIC
, ARABIC_LEBANON
)
408 LANG_SUB_ENTRY( "KW", ARABIC
, ARABIC_KUWAIT
)
409 LANG_SUB_ENTRY( "AE", ARABIC
, ARABIC_UAE
)
410 LANG_SUB_ENTRY( "BH", ARABIC
, ARABIC_BAHRAIN
)
411 LANG_SUB_ENTRY( "QA", ARABIC
, ARABIC_QATAR
)
412 LANG_ENTRY_END( ARABIC
)
413 /*x02*/ LANG_ENTRY_BEGIN( "bu", BULGARIAN
)
414 LANG_ENTRY_END( BULGARIAN
)
415 /*x03*/ LANG_ENTRY_BEGIN( "ca", CATALAN
)
416 LANG_ENTRY_END( CATALAN
)
417 /*x04*/ LANG_ENTRY_BEGIN( "zh", CHINESE
)
418 LANG_SUB_ENTRY( "TW", CHINESE
, CHINESE_TRADITIONAL
)
419 LANG_SUB_ENTRY( "CN", CHINESE
, CHINESE_SIMPLIFIED
)
420 LANG_SUB_ENTRY( "HK", CHINESE
, CHINESE_HONGKONG
)
421 LANG_SUB_ENTRY( "SG", CHINESE
, CHINESE_SINGAPORE
)
422 LANG_SUB_ENTRY( "MO", CHINESE
, CHINESE_MACAU
)
423 LANG_ENTRY_END( CHINESE
)
424 /*x05*/ LANG_ENTRY_BEGIN( "cs", CZECH
)
425 LANG_ENTRY_END( CZECH
)
426 /*x06*/ LANG_ENTRY_BEGIN( "da", DANISH
)
427 LANG_ENTRY_END( DANISH
)
428 /*x07*/ LANG_ENTRY_BEGIN( "de", GERMAN
)
429 LANG_SUB_ENTRY( "DE", GERMAN
, GERMAN
)
430 LANG_SUB_ENTRY( "CH", GERMAN
, GERMAN_SWISS
)
431 LANG_SUB_ENTRY( "AT", GERMAN
, GERMAN_AUSTRIAN
)
432 LANG_SUB_ENTRY( "LU", GERMAN
, GERMAN_LUXEMBOURG
)
433 LANG_SUB_ENTRY( "LI", GERMAN
, GERMAN_LIECHTENSTEIN
)
434 LANG_ENTRY_END( GERMAN
)
435 /*x08*/ LANG_ENTRY_BEGIN( "el", GREEK
)
436 LANG_ENTRY_END( GREEK
)
437 /*x09*/ LANG_ENTRY_BEGIN( "en", ENGLISH
)
438 LANG_SUB_ENTRY( "US", ENGLISH
, ENGLISH_US
)
439 LANG_SUB_ENTRY( "UK", ENGLISH
, ENGLISH_UK
)
440 LANG_SUB_ENTRY( "AU", ENGLISH
, ENGLISH_AUS
)
441 LANG_SUB_ENTRY( "CA", ENGLISH
, ENGLISH_CAN
)
442 LANG_SUB_ENTRY( "NZ", ENGLISH
, ENGLISH_NZ
)
443 LANG_SUB_ENTRY( "EI", ENGLISH
, ENGLISH_EIRE
)
444 LANG_SUB_ENTRY( "ZA", ENGLISH
, ENGLISH_SAFRICA
)
445 LANG_SUB_ENTRY( "JM", ENGLISH
, ENGLISH_JAMAICA
)
446 /* LANG_SUB_ENTRY( "AG", ENGLISH, ENGLISH_CARIBBEAN ) */
447 LANG_SUB_ENTRY( "BZ", ENGLISH
, ENGLISH_BELIZE
)
448 LANG_SUB_ENTRY( "TT", ENGLISH
, ENGLISH_TRINIDAD
)
449 LANG_SUB_ENTRY( "ZW", ENGLISH
, ENGLISH_ZIMBABWE
)
450 LANG_SUB_ENTRY( "PH", ENGLISH
, ENGLISH_PHILIPPINES
)
451 LANG_ENTRY_END( ENGLISH
)
452 /*x0a*/ LANG_ENTRY_BEGIN( "es", SPANISH
)
453 /* traditional sorting */
454 if (!strcmp(dialect
,"tradicional"))
455 LANG_DIALECT_ENTRY( SPANISH
, SPANISH
)
456 LANG_SUB_ENTRY( "MX", SPANISH
, SPANISH_MEXICAN
)
457 LANG_SUB_ENTRY( "ES", SPANISH
, SPANISH_MODERN
)
458 LANG_SUB_ENTRY( "GT", SPANISH
, SPANISH_GUATEMALA
)
459 LANG_SUB_ENTRY( "CR", SPANISH
, SPANISH_COSTARICA
)
460 LANG_SUB_ENTRY( "PA", SPANISH
, SPANISH_PANAMA
)
461 LANG_SUB_ENTRY( "DO", SPANISH
, SPANISH_DOMINICAN
)
462 LANG_SUB_ENTRY( "VE", SPANISH
, SPANISH_VENEZUELA
)
463 LANG_SUB_ENTRY( "CO", SPANISH
, SPANISH_COLOMBIA
)
464 LANG_SUB_ENTRY( "PE", SPANISH
, SPANISH_PERU
)
465 LANG_SUB_ENTRY( "AR", SPANISH
, SPANISH_ARGENTINA
)
466 LANG_SUB_ENTRY( "EC", SPANISH
, SPANISH_ECUADOR
)
467 LANG_SUB_ENTRY( "CL", SPANISH
, SPANISH_CHILE
)
468 LANG_SUB_ENTRY( "UY", SPANISH
, SPANISH_URUGUAY
)
469 LANG_SUB_ENTRY( "PY", SPANISH
, SPANISH_PARAGUAY
)
470 LANG_SUB_ENTRY( "BO", SPANISH
, SPANISH_BOLIVIA
)
471 LANG_SUB_ENTRY( "HN", SPANISH
, SPANISH_HONDURAS
)
472 LANG_SUB_ENTRY( "NI", SPANISH
, SPANISH_NICARAGUA
)
473 LANG_SUB_ENTRY( "PR", SPANISH
, SPANISH_PUERTO_RICO
)
474 LANG_ENTRY_END( SPANISH
)
475 /*x0b*/ LANG_ENTRY_BEGIN( "fi", FINNISH
)
476 LANG_ENTRY_END( FINNISH
)
477 /*x0c*/ LANG_ENTRY_BEGIN( "fr", FRENCH
)
478 LANG_SUB_ENTRY( "FR", FRENCH
, FRENCH
)
479 LANG_SUB_ENTRY( "BE", FRENCH
, FRENCH_BELGIAN
)
480 LANG_SUB_ENTRY( "CA", FRENCH
, FRENCH_CANADIAN
)
481 LANG_SUB_ENTRY( "CH", FRENCH
, FRENCH_SWISS
)
482 LANG_SUB_ENTRY( "LU", FRENCH
, FRENCH_LUXEMBOURG
)
483 LANG_SUB_ENTRY( "MC", FRENCH
, FRENCH_MONACO
)
484 LANG_ENTRY_END( FRENCH
)
485 /*x0d*/ LANG_ENTRY_BEGIN( "iw", HEBREW
)
486 LANG_ENTRY_END( HEBREW
)
487 /*x0e*/ LANG_ENTRY_BEGIN( "hu", HUNGARIAN
)
488 LANG_ENTRY_END( HUNGARIAN
)
489 /*x0f*/ LANG_ENTRY_BEGIN( "ic", ICELANDIC
)
490 LANG_ENTRY_END( ICELANDIC
)
491 /*x10*/ LANG_ENTRY_BEGIN( "it", ITALIAN
)
492 LANG_SUB_ENTRY( "IT", ITALIAN
, ITALIAN
)
493 LANG_SUB_ENTRY( "CH", ITALIAN
, ITALIAN_SWISS
)
494 LANG_ENTRY_END( ITALIAN
)
495 /*x11*/ LANG_ENTRY_BEGIN( "ja", JAPANESE
)
496 LANG_ENTRY_END( JAPANESE
)
497 /*x12*/ LANG_ENTRY_BEGIN( "ko", KOREAN
)
499 if (!strcmp(charset
,"JOHAB"))
500 LANG_DIALECT_ENTRY( KOREAN
, KOREAN_JOHAB
)
502 LANG_DIALECT_ENTRY( KOREAN
, KOREAN
)
503 LANG_ENTRY_END( KOREAN
)
504 /*x13*/ LANG_ENTRY_BEGIN( "nl", DUTCH
)
505 LANG_SUB_ENTRY( "NL", DUTCH
, DUTCH
)
506 LANG_SUB_ENTRY( "BE", DUTCH
, DUTCH_BELGIAN
)
507 LANG_SUB_ENTRY( "SR", DUTCH
, DUTCH_SURINAM
)
508 LANG_ENTRY_END( DUTCH
)
509 /*x14*/ LANG_ENTRY_BEGIN( "no", NORWEGIAN
)
511 if (!strcmp(dialect
,"nynorsk"))
512 LANG_DIALECT_ENTRY( NORWEGIAN
, NORWEGIAN_NYNORSK
)
514 LANG_DIALECT_ENTRY( NORWEGIAN
, NORWEGIAN_BOKMAL
)
515 LANG_ENTRY_END( NORWEGIAN
)
516 /*x15*/ LANG_ENTRY_BEGIN( "pl", POLISH
)
517 LANG_ENTRY_END( POLISH
)
518 /*x16*/ LANG_ENTRY_BEGIN( "pt", PORTUGUESE
)
519 LANG_SUB_ENTRY( "BR", PORTUGUESE
, PORTUGUESE_BRAZILIAN
)
520 LANG_SUB_ENTRY( "PT", PORTUGUESE
, PORTUGUESE
)
521 LANG_ENTRY_END( PORTUGUESE
)
522 /*x17*/ LANG_ENTRY_BEGIN( "rm", RHAETO_ROMANCE
)
523 LANG_ENTRY_END( RHAETO_ROMANCE
)
524 /*x18*/ LANG_ENTRY_BEGIN( "ro", ROMANIAN
)
525 LANG_SUB_ENTRY( "RO", ROMANIAN
, ROMANIAN
)
526 LANG_SUB_ENTRY( "MD", ROMANIAN
, ROMANIAN_MOLDAVIA
)
527 LANG_ENTRY_END( ROMANIAN
)
528 /*x19*/ LANG_ENTRY_BEGIN( "ru", RUSSIAN
)
529 LANG_SUB_ENTRY( "RU", RUSSIAN
, RUSSIAN
)
530 LANG_SUB_ENTRY( "MD", RUSSIAN
, RUSSIAN_MOLDAVIA
)
531 LANG_ENTRY_END( RUSSIAN
)
532 /*x1a*/ if (!strcmp(lang
,"sh") || !strcmp(lang
,"hr") || !strcmp(lang
,"sr")) {
534 LANG_DIALECT_ENTRY( SERBO_CROATIAN
, NEUTRAL
)
535 if (!strcmp(charset
,"ISO-8859-5"))
536 LANG_DIALECT_ENTRY( SERBO_CROATIAN
, SERBIAN
)
537 LANG_SUB_ENTRY( "HR", SERBO_CROATIAN
, CROATIAN
)
538 if (!strcmp(country
,"YU") && !strcmp(charset
,"ISO-8859-2"))
539 LANG_DIALECT_ENTRY( SERBO_CROATIAN
, SERBIAN_LATIN
)
540 LANG_SUB_ENTRY( "YU", SERBO_CROATIAN
, SERBIAN
)
541 LANG_DIALECT_ENTRY( SERBO_CROATIAN
, SERBIAN_LATIN
)
543 /*x1b*/ LANG_ENTRY_BEGIN( "sk", SLOVAK
)
544 LANG_ENTRY_END( SLOVAK
)
545 /*x1c*/ LANG_ENTRY_BEGIN( "sq", ALBANIAN
)
546 LANG_ENTRY_END( ALBANIAN
)
547 /*x1d*/ LANG_ENTRY_BEGIN( "sv", SWEDISH
)
548 LANG_SUB_ENTRY( "SE", SWEDISH
, SWEDISH
)
549 LANG_SUB_ENTRY( "FI", SWEDISH
, SWEDISH_FINLAND
)
550 LANG_ENTRY_END( SWEDISH
)
551 /*x1e*/ LANG_ENTRY_BEGIN( "th", THAI
)
552 LANG_ENTRY_END( THAI
)
553 /*x1f*/ LANG_ENTRY_BEGIN( "tr", TURKISH
)
554 LANG_ENTRY_END( TURKISH
)
555 /*x20*/ LANG_ENTRY_BEGIN( "ur", URDU
)
556 LANG_ENTRY_END( URDU
)
557 /*x21*/ LANG_ENTRY_BEGIN( "in", INDONESIAN
)
558 LANG_ENTRY_END( INDONESIAN
)
559 /*x22*/ LANG_ENTRY_BEGIN( "uk", UKRAINIAN
)
560 LANG_ENTRY_END( UKRAINIAN
)
561 /*x23*/ LANG_ENTRY_BEGIN( "be", BYELORUSSIAN
)
562 LANG_ENTRY_END( BYELORUSSIAN
)
563 /*x24*/ LANG_ENTRY_BEGIN( "sl", SLOVENIAN
)
564 LANG_ENTRY_END( SLOVENIAN
)
565 /*x25*/ LANG_ENTRY_BEGIN( "et", ESTONIAN
)
566 LANG_ENTRY_END( ESTONIAN
)
567 /*x26*/ LANG_ENTRY_BEGIN( "lv", LATVIAN
)
568 LANG_ENTRY_END( LATVIAN
)
569 /*x27*/ LANG_ENTRY_BEGIN( "lt", LITHUANIAN
)
570 /* traditional sorting ? */
571 if (!strcmp(dialect
,"classic") || !strcmp(dialect
,"traditional"))
572 LANG_DIALECT_ENTRY( LITHUANIAN
, LITHUANIAN_CLASSIC
)
574 LANG_DIALECT_ENTRY( LITHUANIAN
, LITHUANIAN
)
575 LANG_ENTRY_END( LITHUANIAN
)
576 /*x28*/ LANG_ENTRY_BEGIN( "mi", MAORI
)
577 LANG_ENTRY_END( MAORI
)
578 /*x29*/ LANG_ENTRY_BEGIN( "fa", FARSI
)
579 LANG_ENTRY_END( FARSI
)
580 /*x2a*/ LANG_ENTRY_BEGIN( "vi", VIETNAMESE
)
581 LANG_ENTRY_END( VIETNAMESE
)
582 /*x2b*/ LANG_ENTRY_BEGIN( "hy", ARMENIAN
)
583 LANG_ENTRY_END( ARMENIAN
)
584 /*x2c*/ LANG_ENTRY_BEGIN( "az", AZERI
)
586 if (strstr(charset
,"KOI8") || !strcmp(charset
,"ISO-8859-5"))
587 LANG_DIALECT_ENTRY( AZERI
, AZERI_CYRILLIC
)
589 LANG_DIALECT_ENTRY( AZERI
, AZERI
)
590 LANG_ENTRY_END( AZERI
)
591 /*x2d*/ LANG_ENTRY_BEGIN( "eu", BASQUE
)
592 LANG_ENTRY_END( BASQUE
)
593 /*x2e*/ /*LANG_ENTRY_BEGIN( "??", SORBIAN )
594 LANG_ENTRY_END( SORBIAN ) */
595 /*x2f*/ LANG_ENTRY_BEGIN( "mk", MACEDONIAN
)
596 LANG_ENTRY_END( MACEDONIAN
)
597 /*x30*/ /*LANG_ENTRY_BEGIN( "??", SUTU )
598 LANG_ENTRY_END( SUTU ) */
599 /*x31*/ LANG_ENTRY_BEGIN( "ts", TSONGA
)
600 LANG_ENTRY_END( TSONGA
)
601 /*x32*/ /*LANG_ENTRY_BEGIN( "??", TSWANA )
602 LANG_ENTRY_END( TSWANA ) */
603 /*x33*/ /*LANG_ENTRY_BEGIN( "??", VENDA )
604 LANG_ENTRY_END( VENDA ) */
605 /*x34*/ LANG_ENTRY_BEGIN( "xh", XHOSA
)
606 LANG_ENTRY_END( XHOSA
)
607 /*x35*/ LANG_ENTRY_BEGIN( "zu", ZULU
)
608 LANG_ENTRY_END( ZULU
)
609 /*x36*/ LANG_ENTRY_BEGIN( "af", AFRIKAANS
)
610 LANG_ENTRY_END( AFRIKAANS
)
611 /*x37*/ LANG_ENTRY_BEGIN( "ka", GEORGIAN
)
612 LANG_ENTRY_END( GEORGIAN
)
613 /*x38*/ LANG_ENTRY_BEGIN( "fo", FAEROESE
)
614 LANG_ENTRY_END( FAEROESE
)
615 /*x39*/ LANG_ENTRY_BEGIN( "hi", HINDI
)
616 LANG_ENTRY_END( HINDI
)
617 /*x3a*/ LANG_ENTRY_BEGIN( "mt", MALTESE
)
618 LANG_ENTRY_END( MALTESE
)
619 /*x3b*/ /*LANG_ENTRY_BEGIN( "??", SAAMI )
620 LANG_ENTRY_END( SAAMI ) */
621 /*x3c*/ LANG_ENTRY_BEGIN( "ga", GAELIC
)
622 LANG_DIALECT_ENTRY( GAELIC
, GAELIC
)
623 LANG_ENTRY_END( GAELIC
)
624 /*x3c*/ LANG_ENTRY_BEGIN( "gd", GAELIC
)
625 LANG_DIALECT_ENTRY( GAELIC
, GAELIC_SCOTTISH
)
626 LANG_ENTRY_END( GAELIC
)
628 /*x3e*/ LANG_ENTRY_BEGIN( "ms", MALAY
)
629 LANG_SUB_ENTRY( "MY", MALAY
, MALAY
)
630 LANG_SUB_ENTRY( "BN", MALAY
, MALAY_BRUNEI_DARUSSALAM
)
631 LANG_ENTRY_END( MALAY
)
632 /*x3f*/ LANG_ENTRY_BEGIN( "kk", KAZAKH
)
633 LANG_ENTRY_END( KAZAKH
)
635 /*x41*/ LANG_ENTRY_BEGIN( "sw", SWAHILI
)
636 LANG_ENTRY_END( SWAHILI
)
638 /*x43*/ LANG_ENTRY_BEGIN( "uz", UZBEK
)
640 if (strstr(charset
,"KOI8") || !strcmp(charset
,"ISO-8859-5"))
641 LANG_DIALECT_ENTRY( UZBEK
, UZBEK_CYRILLIC
)
643 LANG_DIALECT_ENTRY( UZBEK
, UZBEK
)
644 LANG_ENTRY_END( UZBEK
)
645 /*x44*/ LANG_ENTRY_BEGIN( "tt", TATAR
)
646 LANG_ENTRY_END( TATAR
)
647 /*x45*/ LANG_ENTRY_BEGIN( "bn", BENGALI
)
648 LANG_ENTRY_END( BENGALI
)
649 /*x46*/ LANG_ENTRY_BEGIN( "pa", PUNJABI
)
650 LANG_ENTRY_END( PUNJABI
)
651 /*x47*/ LANG_ENTRY_BEGIN( "gu", GUJARATI
)
652 LANG_ENTRY_END( GUJARATI
)
653 /*x48*/ LANG_ENTRY_BEGIN( "or", ORIYA
)
654 LANG_ENTRY_END( ORIYA
)
655 /*x49*/ LANG_ENTRY_BEGIN( "ta", TAMIL
)
656 LANG_ENTRY_END( TAMIL
)
657 /*x4a*/ LANG_ENTRY_BEGIN( "te", TELUGU
)
658 LANG_ENTRY_END( TELUGU
)
659 /*x4b*/ LANG_ENTRY_BEGIN( "kn", KANNADA
)
660 LANG_ENTRY_END( KANNADA
)
661 /*x4c*/ LANG_ENTRY_BEGIN( "ml", MALAYALAM
)
662 LANG_ENTRY_END( MALAYALAM
)
663 /*x4d*/ LANG_ENTRY_BEGIN( "as", ASSAMESE
)
664 LANG_ENTRY_END( ASSAMESE
)
665 /*x4e*/ LANG_ENTRY_BEGIN( "mr", MARATHI
)
666 LANG_ENTRY_END( MARATHI
)
667 /*x4f*/ LANG_ENTRY_BEGIN( "sa", SANSKRIT
)
668 LANG_ENTRY_END( SANSKRIT
)
670 /*x57*/ /*LANG_ENTRY_BEGIN( "??", KONKANI )
671 LANG_ENTRY_END( KONKANI ) */
673 LANG_ENTRY_BEGIN( "eo", ESPERANTO
) /* not official */
674 LANG_ENTRY_END( ESPERANTO
)
678 end_MAIN_GetLanguageID
:
679 if (Charset
) free(charset
);
680 if (Dialect
) free(dialect
);
685 /***********************************************************************
686 * MAIN_ParseLanguageOption
688 * Parse -language option.
690 static void MAIN_ParseLanguageOption( char *arg
)
692 const WINE_LANGUAGE_DEF
*p
= Languages
;
694 Options
.language
= LANG_En
; /* First language */
697 if (!lstrcmpi32A( p
->name
, arg
))
699 WINE_LanguageId
= p
->langid
;
704 MSG( "Invalid language specified '%s'. Supported languages are: ", arg
);
705 for (p
= Languages
; p
->name
; p
++) MSG( "%s ", p
->name
);
711 /***********************************************************************
712 * MAIN_ParseModeOption
714 * Parse -mode option.
716 static void MAIN_ParseModeOption( char *arg
)
718 if (!lstrcmpi32A("enhanced", arg
)) Options
.mode
= MODE_ENHANCED
;
719 else if (!lstrcmpi32A("standard", arg
)) Options
.mode
= MODE_STANDARD
;
722 MSG( "Invalid mode '%s' specified.\n", arg
);
723 MSG( "Valid modes are: 'standard', 'enhanced' (default).\n");
728 /***********************************************************************
731 * Parse command line options and open display.
733 static void MAIN_ParseOptions( int *argc
, char *argv
[] )
735 char *display_name
= NULL
;
737 XrmDatabase db
= TSXrmGetFileDatabase(WINE_APP_DEFAULTS
);
741 Options
.programName
= MAIN_GetProgramName( *argc
, argv
);
742 Options
.argv0
= argv
[0];
744 /* initialise Options.language to 0 to tell "no language choosen yet" */
745 Options
.language
= 0;
747 /* Get display name from command line */
748 for (i
= 1; i
< *argc
; i
++)
750 if (!strcmp( argv
[i
], "-display" )) display_name
= argv
[i
+1];
751 if (!strcmp( argv
[i
], "-v" ) || !strcmp( argv
[i
], "-version" ))
753 MSG( "%s\n", WINE_RELEASE_INFO
);
756 if (!strcmp( argv
[i
], "-h" ) || !strcmp( argv
[i
], "-help" ))
765 if (display_name
== NULL
&&
766 MAIN_GetResource( db
, ".display", &value
)) display_name
= value
.addr
;
768 if (!(display
= TSXOpenDisplay( display_name
)))
770 MSG( "%s: Can't open display: %s\n",
771 argv
[0], display_name
? display_name
: "(none specified)" );
775 /* tell the libX11 that we will do input method handling ourselves
776 * that keep libX11 from doing anything whith dead keys, allowing Wine
777 * to have total control over dead keys, that is this line allows
778 * them to work in Wine, even whith a libX11 including the dead key
779 * patches from Th.Quinot (http://Web.FdN.FR/~tquinot/dead-keys.en.html)
781 TSXOpenIM(display
,NULL
,NULL
,NULL
);
783 /* Merge file and screen databases */
784 if ((xrm_string
= TSXResourceManagerString( display
)) != NULL
)
786 XrmDatabase display_db
= TSXrmGetStringDatabase( xrm_string
);
787 TSXrmMergeDatabases( display_db
, &db
);
790 /* Parse command line */
791 TSXrmParseCommand( &db
, optionsTable
, NB_OPTIONS
,
792 Options
.programName
, argc
, argv
);
794 /* Get all options */
795 if (MAIN_GetResource( db
, ".iconic", &value
))
796 Options
.cmdShow
= SW_SHOWMINIMIZED
;
797 if (MAIN_GetResource( db
, ".privatemap", &value
))
798 Options
.usePrivateMap
= TRUE
;
799 if (MAIN_GetResource( db
, ".fixedmap", &value
))
800 Options
.useFixedMap
= TRUE
;
801 if (MAIN_GetResource( db
, ".synchronous", &value
))
802 Options
.synchronous
= TRUE
;
803 if (MAIN_GetResource( db
, ".backingstore", &value
))
804 Options
.backingstore
= TRUE
;
805 if (MAIN_GetResource( db
, ".debug", &value
))
806 Options
.debug
= TRUE
;
807 if (MAIN_GetResource( db
, ".failreadonly", &value
))
808 Options
.failReadOnly
= TRUE
;
809 if (MAIN_GetResource( db
, ".perfect", &value
))
810 Options
.perfectGraphics
= TRUE
;
811 if (MAIN_GetResource( db
, ".depth", &value
))
812 screenDepth
= atoi( value
.addr
);
813 if (MAIN_GetResource( db
, ".desktop", &value
))
814 Options
.desktopGeometry
= value
.addr
;
815 if (MAIN_GetResource( db
, ".language", &value
))
816 MAIN_ParseLanguageOption( (char *)value
.addr
);
817 if (MAIN_GetResource( db
, ".managed", &value
))
818 Options
.managed
= TRUE
;
819 if (MAIN_GetResource( db
, ".mode", &value
))
820 MAIN_ParseModeOption( (char *)value
.addr
);
821 if (MAIN_GetResource( db
, ".debugoptions", &value
))
822 MAIN_ParseDebugOptions((char*)value
.addr
);
823 if (MAIN_GetResource( db
, ".debugmsg", &value
))
825 #ifndef DEBUG_RUNTIME
826 MSG("%s: Option \"-debugmsg\" not implemented.\n" \
827 " Recompile with DEBUG_RUNTIME in include/debugtools.h defined.\n",
831 if (MAIN_ParseDebugOptions((char*)value
.addr
)==FALSE
)
834 MSG("%s: Syntax: -debugmsg [class]+xxx,... or "
835 "-debugmsg [class]-xxx,...\n",argv
[0]);
836 MSG("Example: -debugmsg +all,warn-heap\n"
837 " turn on all messages except warning heap messages\n");
838 MSG("Special case: -debugmsg +relay=DLL:DLL.###:FuncName\n"
839 " turn on -debugmsg +relay only as specified\n"
840 "Special case: -debugmsg -relay=DLL:DLL.###:FuncName\n"
841 " turn on -debugmsg +relay except as specified\n"
842 "Also permitted, +snoop=..., -snoop=... as with relay.\n\n");
844 MSG("Available message classes:\n");
845 for(i
=0;i
<DEBUG_CLASS_COUNT
;i
++)
846 MSG( "%-9s", debug_cl_name
[i
]);
849 MSG("Available message types:\n");
851 for(i
=0;i
<DEBUG_CHANNEL_COUNT
;i
++)
853 MSG("%-9s%c",debug_ch_name
[i
],
854 (((i
+2)%8==0)?'\n':' '));
861 if (MAIN_GetResource( db
, ".dll", &value
))
863 /* Hack: store option value in Options to be retrieved */
864 /* later on inside the emulator code. */
865 if (!__winelib
) Options
.dllFlags
= xstrdup((char *)value
.addr
);
868 MSG("-dll not supported in Winelib\n" );
873 if (MAIN_GetResource( db
, ".winver", &value
))
874 VERSION_ParseVersion( (char*)value
.addr
);
875 if (MAIN_GetResource( db
, ".config", &value
))
876 Options
.configFileName
= xstrdup((char *)value
.addr
);
877 if (MAIN_GetResource( db
, ".nodga", &value
))
878 Options
.noDGA
= TRUE
;
882 /***********************************************************************
885 static void MAIN_CreateDesktop( int argc
, char *argv
[] )
888 unsigned int width
= 640, height
= 480; /* Default size = 640x480 */
889 char *name
= "Wine desktop";
890 XSizeHints
*size_hints
;
892 XClassHint
*class_hints
;
893 XSetWindowAttributes win_attr
;
894 XTextProperty window_name
;
895 Atom XA_WM_DELETE_WINDOW
;
897 flags
= TSXParseGeometry( Options
.desktopGeometry
, &x
, &y
, &width
, &height
);
899 screenHeight
= height
;
903 win_attr
.background_pixel
= BlackPixel(display
,0);
904 win_attr
.event_mask
= ExposureMask
| KeyPressMask
| KeyReleaseMask
|
905 PointerMotionMask
| ButtonPressMask
|
906 ButtonReleaseMask
| EnterWindowMask
;
907 win_attr
.cursor
= TSXCreateFontCursor( display
, XC_top_left_arrow
);
909 rootWindow
= TSXCreateWindow( display
, DefaultRootWindow(display
),
910 x
, y
, width
, height
, 0,
911 CopyFromParent
, InputOutput
, CopyFromParent
,
912 CWBackPixel
| CWEventMask
| CWCursor
, &win_attr
);
914 /* Set window manager properties */
916 size_hints
= TSXAllocSizeHints();
917 wm_hints
= TSXAllocWMHints();
918 class_hints
= TSXAllocClassHint();
919 if (!size_hints
|| !wm_hints
|| !class_hints
)
921 MSG("Not enough memory for window manager hints.\n" );
924 size_hints
->min_width
= size_hints
->max_width
= width
;
925 size_hints
->min_height
= size_hints
->max_height
= height
;
926 size_hints
->flags
= PMinSize
| PMaxSize
;
927 if (flags
& (XValue
| YValue
)) size_hints
->flags
|= USPosition
;
928 if (flags
& (WidthValue
| HeightValue
)) size_hints
->flags
|= USSize
;
929 else size_hints
->flags
|= PSize
;
931 wm_hints
->flags
= InputHint
| StateHint
;
932 wm_hints
->input
= True
;
933 wm_hints
->initial_state
= NormalState
;
934 class_hints
->res_name
= argv
[0];
935 class_hints
->res_class
= "Wine";
937 TSXStringListToTextProperty( &name
, 1, &window_name
);
938 TSXSetWMProperties( display
, rootWindow
, &window_name
, &window_name
,
939 argv
, argc
, size_hints
, wm_hints
, class_hints
);
940 XA_WM_DELETE_WINDOW
= TSXInternAtom( display
, "WM_DELETE_WINDOW", False
);
941 TSXSetWMProtocols( display
, rootWindow
, &XA_WM_DELETE_WINDOW
, 1 );
942 TSXFree( size_hints
);
944 TSXFree( class_hints
);
948 TSXMapWindow( display
, rootWindow
);
952 XKeyboardState keyboard_state
;
954 /***********************************************************************
957 static void MAIN_SaveSetup(void)
959 TSXGetKeyboardControl(display
, &keyboard_state
);
962 /***********************************************************************
965 static void MAIN_RestoreSetup(void)
967 XKeyboardControl keyboard_value
;
969 keyboard_value
.key_click_percent
= keyboard_state
.key_click_percent
;
970 keyboard_value
.bell_percent
= keyboard_state
.bell_percent
;
971 keyboard_value
.bell_pitch
= keyboard_state
.bell_pitch
;
972 keyboard_value
.bell_duration
= keyboard_state
.bell_duration
;
973 keyboard_value
.auto_repeat_mode
= keyboard_state
.global_auto_repeat
;
975 XChangeKeyboardControl(display
, KBKeyClickPercent
| KBBellPercent
|
976 KBBellPitch
| KBBellDuration
| KBAutoRepeatMode
, &keyboard_value
);
980 /***********************************************************************
983 static void called_at_exit(void)
988 /* FIXME: should check for other processes or threads */
989 DeleteCriticalSection( HEAP_SystemLock
);
992 static int WINE_X11_ErrorHandler(Display
*display
,XErrorEvent
*error_evt
)
994 kill( getpid(), SIGHUP
); /* force an entry in the debugger */
998 /***********************************************************************
1001 * Wine initialisation and command-line parsing
1003 BOOL32
MAIN_WineInit( int *argc
, char *argv
[] )
1009 #ifdef MALLOC_DEBUGGING
1013 if (!(trace
= getenv("MALLOC_TRACE")))
1015 MSG( "MALLOC_TRACE not set. No trace generated\n" );
1019 MSG( "malloc trace goes to %s\n", trace
);
1024 setbuf(stdout
,NULL
);
1025 setbuf(stderr
,NULL
);
1027 setlocale(LC_CTYPE
,"");
1028 gettimeofday( &tv
, NULL
);
1029 MSG_WineStartTicks
= (tv
.tv_sec
* 1000) + (tv
.tv_usec
/ 1000);
1031 /* We need this before calling any Xlib function */
1032 InitializeCriticalSection( &X11DRV_CritSection
);
1036 putenv("XKB_DISABLE="); /* Disable XKB extension if present. */
1038 MAIN_ParseOptions( argc
, argv
);
1040 if (Options
.synchronous
) XSetErrorHandler( WINE_X11_ErrorHandler
);
1042 if (Options
.desktopGeometry
&& Options
.managed
)
1045 MSG( "%s: -managed and -desktop options cannot be used together\n",
1046 Options
.programName
);
1049 Options
.managed
= FALSE
;
1053 screen
= DefaultScreenOfDisplay( display
);
1054 screenWidth
= WidthOfScreen( screen
);
1055 screenHeight
= HeightOfScreen( screen
);
1056 if (screenDepth
) /* -depth option specified */
1058 depth_list
= TSXListDepths(display
,DefaultScreen(display
),&depth_count
);
1059 for (i
= 0; i
< depth_count
; i
++)
1060 if (depth_list
[i
] == screenDepth
) break;
1061 TSXFree( depth_list
);
1062 if (i
>= depth_count
)
1064 MSG( "%s: Depth %d not supported on this screen.\n",
1065 Options
.programName
, screenDepth
);
1069 else screenDepth
= DefaultDepthOfScreen( screen
);
1070 if (Options
.synchronous
) TSXSynchronize( display
, True
);
1071 if (Options
.desktopGeometry
) MAIN_CreateDesktop( *argc
, argv
);
1072 else rootWindow
= DefaultRootWindow( display
);
1075 atexit(called_at_exit
);
1080 /***********************************************************************
1081 * MessageBeep16 (USER.104)
1083 void WINAPI
MessageBeep16( UINT16 i
)
1089 /***********************************************************************
1090 * MessageBeep32 (USER32.390)
1092 BOOL32 WINAPI
MessageBeep32( UINT32 i
)
1094 TSXBell( display
, 0 );
1099 /***********************************************************************
1100 * Beep (KERNEL32.11)
1102 BOOL32 WINAPI
Beep( DWORD dwFreq
, DWORD dwDur
)
1104 /* dwFreq and dwDur are ignored by Win95 */
1105 TSXBell(display
, 0);
1110 /***********************************************************************
1111 * GetTimerResolution (USER.14)
1113 LONG WINAPI
GetTimerResolution(void)
1118 /***********************************************************************
1119 * SystemParametersInfo32A (USER32.540)
1121 BOOL32 WINAPI
SystemParametersInfo32A( UINT32 uAction
, UINT32 uParam
,
1122 LPVOID lpvParam
, UINT32 fuWinIni
)
1125 XKeyboardState keyboard_state
;
1129 TSXGetKeyboardControl(display
, &keyboard_state
);
1130 if (keyboard_state
.bell_percent
== 0)
1131 *(BOOL32
*) lpvParam
= FALSE
;
1133 *(BOOL32
*) lpvParam
= TRUE
;
1137 *(INT32
*)lpvParam
= GetSystemMetrics32( SM_CXFRAME
);
1140 case SPI_GETFASTTASKSWITCH
:
1141 if ( GetProfileInt32A( "windows", "CoolSwitch", 1 ) == 1 )
1142 *(BOOL32
*) lpvParam
= TRUE
;
1144 *(BOOL32
*) lpvParam
= FALSE
;
1147 case SPI_GETDRAGFULLWINDOWS
:
1148 *(BOOL32
*) lpvParam
= FALSE
;
1150 case SPI_GETGRIDGRANULARITY
:
1151 *(INT32
*)lpvParam
=GetProfileInt32A("desktop","GridGranularity",1);
1154 case SPI_GETICONTITLEWRAP
:
1155 *(BOOL32
*)lpvParam
=GetProfileInt32A("desktop","IconTitleWrap",TRUE
);
1158 case SPI_GETKEYBOARDDELAY
:
1159 *(INT32
*)lpvParam
=GetProfileInt32A("keyboard","KeyboardDelay",1);
1162 case SPI_GETKEYBOARDSPEED
:
1163 *(DWORD
*)lpvParam
=GetProfileInt32A("keyboard","KeyboardSpeed",30);
1166 case SPI_GETMENUDROPALIGNMENT
:
1167 *(BOOL32
*)lpvParam
=GetSystemMetrics32(SM_MENUDROPALIGNMENT
); /* XXX check this */
1170 case SPI_GETSCREENSAVEACTIVE
:
1171 if ( GetProfileInt32A( "windows", "ScreenSaveActive", 1 ) == 1 )
1172 *(BOOL32
*)lpvParam
= TRUE
;
1174 *(BOOL32
*)lpvParam
= FALSE
;
1177 case SPI_GETSCREENSAVETIMEOUT
:
1178 /* FIXME GetProfileInt( "windows", "ScreenSaveTimeout", 300 ); */
1179 TSXGetScreenSaver(display
, &timeout
, &temp
,&temp
,&temp
);
1180 *(INT32
*) lpvParam
= timeout
* 1000;
1183 case SPI_ICONHORIZONTALSPACING
:
1184 /* FIXME Get/SetProfileInt */
1185 if (lpvParam
== NULL
)
1186 /*SetSystemMetrics( SM_CXICONSPACING, uParam )*/ ;
1188 *(INT32
*)lpvParam
=GetSystemMetrics32(SM_CXICONSPACING
);
1191 case SPI_ICONVERTICALSPACING
:
1192 /* FIXME Get/SetProfileInt */
1193 if (lpvParam
== NULL
)
1194 /*SetSystemMetrics( SM_CYICONSPACING, uParam )*/ ;
1196 *(INT32
*)lpvParam
=GetSystemMetrics32(SM_CYICONSPACING
);
1199 case SPI_GETICONTITLELOGFONT
: {
1200 LPLOGFONT32A lpLogFont
= (LPLOGFONT32A
)lpvParam
;
1202 /* from now on we always have an alias for MS Sans Serif */
1204 GetProfileString32A("Desktop", "IconTitleFaceName", "MS Sans Serif",
1205 lpLogFont
->lfFaceName
, LF_FACESIZE
);
1206 lpLogFont
->lfHeight
= -GetProfileInt32A("Desktop","IconTitleSize", 8);
1207 lpLogFont
->lfWidth
= 0;
1208 lpLogFont
->lfEscapement
= lpLogFont
->lfOrientation
= 0;
1209 lpLogFont
->lfWeight
= FW_NORMAL
;
1210 lpLogFont
->lfItalic
= FALSE
;
1211 lpLogFont
->lfStrikeOut
= FALSE
;
1212 lpLogFont
->lfUnderline
= FALSE
;
1213 lpLogFont
->lfCharSet
= ANSI_CHARSET
;
1214 lpLogFont
->lfOutPrecision
= OUT_DEFAULT_PRECIS
;
1215 lpLogFont
->lfClipPrecision
= CLIP_DEFAULT_PRECIS
;
1216 lpLogFont
->lfPitchAndFamily
= DEFAULT_PITCH
| FF_SWISS
;
1219 case SPI_GETWORKAREA
:
1220 SetRect32( (RECT32
*)lpvParam
, 0, 0,
1221 GetSystemMetrics32( SM_CXSCREEN
),
1222 GetSystemMetrics32( SM_CYSCREEN
)
1225 case SPI_GETNONCLIENTMETRICS
:
1227 #define lpnm ((LPNONCLIENTMETRICS32A)lpvParam)
1229 if( lpnm
->cbSize
== sizeof(NONCLIENTMETRICS32A
) )
1231 /* FIXME: initialize geometry entries */
1233 SystemParametersInfo32A(SPI_GETICONTITLELOGFONT
, 0,
1234 (LPVOID
)&(lpnm
->lfCaptionFont
),0);
1235 lpnm
->lfCaptionFont
.lfWeight
= FW_BOLD
;
1236 SystemParametersInfo32A(SPI_GETICONTITLELOGFONT
, 0,
1237 (LPVOID
)&(lpnm
->lfSmCaptionFont
),0);
1238 SystemParametersInfo32A(SPI_GETICONTITLELOGFONT
, 0,
1239 (LPVOID
)&(lpnm
->lfMenuFont
),0);
1240 SystemParametersInfo32A(SPI_GETICONTITLELOGFONT
, 0,
1241 (LPVOID
)&(lpnm
->lfStatusFont
),0);
1242 SystemParametersInfo32A(SPI_GETICONTITLELOGFONT
, 0,
1243 (LPVOID
)&(lpnm
->lfMessageFont
),0);
1248 case SPI_GETANIMATION
: {
1249 LPANIMATIONINFO lpAnimInfo
= (LPANIMATIONINFO
)lpvParam
;
1251 /* Tell it "disabled" */
1252 lpAnimInfo
->cbSize
= sizeof(ANIMATIONINFO
);
1253 uParam
= sizeof(ANIMATIONINFO
);
1254 lpAnimInfo
->iMinAnimate
= 0; /* Minimise and restore animation is disabled (nonzero == enabled) */
1258 case SPI_SETANIMATION
: {
1259 LPANIMATIONINFO lpAnimInfo
= (LPANIMATIONINFO
)lpvParam
;
1262 WARN(system
, "SPI_SETANIMATION ignored.\n");
1263 lpAnimInfo
->cbSize
= sizeof(ANIMATIONINFO
);
1264 uParam
= sizeof(ANIMATIONINFO
);
1268 case SPI_GETHIGHCONTRAST
:
1270 LPHIGHCONTRASTA lpHighContrastA
= (LPHIGHCONTRASTA
)lpvParam
;
1272 FIXME(system
,"SPI_GETHIGHCONTRAST not fully implemented\n");
1274 if ( lpHighContrastA
->cbSize
== sizeof( HIGHCONTRASTA
) )
1276 /* Indicate that there is no high contrast available */
1277 lpHighContrastA
->dwFlags
= 0;
1278 lpHighContrastA
->lpszDefaultScheme
= NULL
;
1289 return SystemParametersInfo16(uAction
,uParam
,lpvParam
,fuWinIni
);
1295 /***********************************************************************
1296 * SystemParametersInfo16 (USER.483)
1298 BOOL16 WINAPI
SystemParametersInfo16( UINT16 uAction
, UINT16 uParam
,
1299 LPVOID lpvParam
, UINT16 fuWinIni
)
1303 XKeyboardState keyboard_state
;
1304 XKeyboardControl keyboard_value
;
1310 TSXGetKeyboardControl(display
, &keyboard_state
);
1311 if (keyboard_state
.bell_percent
== 0)
1312 *(BOOL16
*) lpvParam
= FALSE
;
1314 *(BOOL16
*) lpvParam
= TRUE
;
1318 *(INT16
*)lpvParam
= GetSystemMetrics16( SM_CXFRAME
);
1321 case SPI_GETFASTTASKSWITCH
:
1322 if ( GetProfileInt32A( "windows", "CoolSwitch", 1 ) == 1 )
1323 *(BOOL16
*) lpvParam
= TRUE
;
1325 *(BOOL16
*) lpvParam
= FALSE
;
1328 case SPI_GETGRIDGRANULARITY
:
1329 *(INT16
*) lpvParam
= GetProfileInt32A( "desktop",
1334 case SPI_GETICONTITLEWRAP
:
1335 *(BOOL16
*) lpvParam
= GetProfileInt32A( "desktop",
1340 case SPI_GETKEYBOARDDELAY
:
1341 *(INT16
*) lpvParam
= GetProfileInt32A( "keyboard",
1342 "KeyboardDelay", 1 );
1345 case SPI_GETKEYBOARDSPEED
:
1346 *(WORD
*) lpvParam
= GetProfileInt32A( "keyboard",
1351 case SPI_GETMENUDROPALIGNMENT
:
1352 *(BOOL16
*) lpvParam
= GetSystemMetrics16( SM_MENUDROPALIGNMENT
); /* XXX check this */
1355 case SPI_GETSCREENSAVEACTIVE
:
1356 if ( GetProfileInt32A( "windows", "ScreenSaveActive", 1 ) == 1 )
1357 *(BOOL16
*) lpvParam
= TRUE
;
1359 *(BOOL16
*) lpvParam
= FALSE
;
1362 case SPI_GETSCREENSAVETIMEOUT
:
1363 /* FIXME GetProfileInt( "windows", "ScreenSaveTimeout", 300 ); */
1364 TSXGetScreenSaver(display
, &timeout
, &temp
,&temp
,&temp
);
1365 *(INT16
*) lpvParam
= timeout
;
1368 case SPI_ICONHORIZONTALSPACING
:
1369 /* FIXME Get/SetProfileInt */
1370 if (lpvParam
== NULL
)
1371 /*SetSystemMetrics( SM_CXICONSPACING, uParam )*/ ;
1373 *(INT16
*)lpvParam
= GetSystemMetrics16( SM_CXICONSPACING
);
1376 case SPI_ICONVERTICALSPACING
:
1377 /* FIXME Get/SetProfileInt */
1378 if (lpvParam
== NULL
)
1379 /*SetSystemMetrics( SM_CYICONSPACING, uParam )*/ ;
1381 *(INT16
*)lpvParam
= GetSystemMetrics16(SM_CYICONSPACING
);
1386 keyboard_value
.bell_percent
= -1;
1388 keyboard_value
.bell_percent
= 0;
1389 TSXChangeKeyboardControl(display
, KBBellPercent
,
1393 case SPI_SETSCREENSAVEACTIVE
:
1395 TSXActivateScreenSaver(display
);
1397 TSXResetScreenSaver(display
);
1400 case SPI_SETSCREENSAVETIMEOUT
:
1401 TSXSetScreenSaver(display
, uParam
, 60, DefaultBlanking
,
1405 case SPI_SETDESKWALLPAPER
:
1406 return (SetDeskWallPaper32((LPSTR
) lpvParam
));
1409 case SPI_SETDESKPATTERN
:
1410 if ((INT16
)uParam
== -1) {
1411 GetProfileString32A("Desktop", "Pattern",
1412 "170 85 170 85 170 85 170 85",
1413 buffer
, sizeof(buffer
) );
1414 return (DESKTOP_SetPattern((LPSTR
) buffer
));
1416 return (DESKTOP_SetPattern((LPSTR
) lpvParam
));
1419 case SPI_GETICONTITLELOGFONT
:
1421 LPLOGFONT16 lpLogFont
= (LPLOGFONT16
)lpvParam
;
1423 GetProfileString32A("Desktop", "IconTitleFaceName", "MS Sans Serif",
1424 lpLogFont
->lfFaceName
, LF_FACESIZE
);
1425 lpLogFont
->lfHeight
= -GetProfileInt32A("Desktop","IconTitleSize", 8);
1426 lpLogFont
->lfWidth
= 0;
1427 lpLogFont
->lfEscapement
= lpLogFont
->lfOrientation
= 0;
1428 lpLogFont
->lfWeight
= FW_NORMAL
;
1429 lpLogFont
->lfItalic
= FALSE
;
1430 lpLogFont
->lfStrikeOut
= FALSE
;
1431 lpLogFont
->lfUnderline
= FALSE
;
1432 lpLogFont
->lfCharSet
= ANSI_CHARSET
;
1433 lpLogFont
->lfOutPrecision
= OUT_DEFAULT_PRECIS
;
1434 lpLogFont
->lfClipPrecision
= CLIP_DEFAULT_PRECIS
;
1435 lpLogFont
->lfPitchAndFamily
= DEFAULT_PITCH
| FF_SWISS
;
1438 case SPI_GETNONCLIENTMETRICS
:
1440 #define lpnm ((LPNONCLIENTMETRICS16)lpvParam)
1441 if( lpnm
->cbSize
== sizeof(NONCLIENTMETRICS16
) )
1443 /* FIXME: initialize geometry entries */
1444 SystemParametersInfo16( SPI_GETICONTITLELOGFONT
, 0,
1445 (LPVOID
)&(lpnm
->lfCaptionFont
),0);
1446 lpnm
->lfCaptionFont
.lfWeight
= FW_BOLD
;
1447 SystemParametersInfo16( SPI_GETICONTITLELOGFONT
, 0,
1448 (LPVOID
)&(lpnm
->lfSmCaptionFont
),0);
1449 SystemParametersInfo16( SPI_GETICONTITLELOGFONT
, 0,
1450 (LPVOID
)&(lpnm
->lfMenuFont
),0);
1451 SystemParametersInfo16( SPI_GETICONTITLELOGFONT
, 0,
1452 (LPVOID
)&(lpnm
->lfStatusFont
),0);
1453 SystemParametersInfo16( SPI_GETICONTITLELOGFONT
, 0,
1454 (LPVOID
)&(lpnm
->lfMessageFont
),0);
1456 else /* winfile 95 sets sbSize to 340 */
1457 SystemParametersInfo32A( uAction
, uParam
, lpvParam
, fuWinIni
);
1461 case SPI_LANGDRIVER
:
1463 case SPI_SETDOUBLECLKHEIGHT
:
1464 case SPI_SETDOUBLECLICKTIME
:
1465 case SPI_SETDOUBLECLKWIDTH
:
1466 case SPI_SETFASTTASKSWITCH
:
1467 case SPI_SETKEYBOARDDELAY
:
1468 case SPI_SETKEYBOARDSPEED
:
1469 WARN(system
, "Option %d ignored.\n", uAction
);
1472 case SPI_GETWORKAREA
:
1473 SetRect16( (RECT16
*)lpvParam
, 0, 0,
1474 GetSystemMetrics16( SM_CXSCREEN
),
1475 GetSystemMetrics16( SM_CYSCREEN
) );
1479 WARN(system
, "Unknown option %d.\n", uAction
);
1485 /***********************************************************************
1486 * SystemParametersInfo32W (USER32.541)
1488 BOOL32 WINAPI
SystemParametersInfo32W( UINT32 uAction
, UINT32 uParam
,
1489 LPVOID lpvParam
, UINT32 fuWinIni
)
1495 case SPI_SETDESKWALLPAPER
:
1498 lstrcpynWtoA(buffer
,(LPWSTR
)lpvParam
,sizeof(buffer
));
1499 return SetDeskWallPaper32(buffer
);
1501 return SetDeskWallPaper32(NULL
);
1503 case SPI_SETDESKPATTERN
:
1504 if ((INT32
) uParam
== -1)
1506 GetProfileString32A("Desktop", "Pattern",
1507 "170 85 170 85 170 85 170 85",
1508 buffer
, sizeof(buffer
) );
1509 return (DESKTOP_SetPattern((LPSTR
) buffer
));
1513 lstrcpynWtoA(buffer
,(LPWSTR
)lpvParam
,sizeof(buffer
));
1514 return DESKTOP_SetPattern(buffer
);
1516 return DESKTOP_SetPattern(NULL
);
1518 case SPI_GETICONTITLELOGFONT
:
1520 LPLOGFONT32W lpLogFont
= (LPLOGFONT32W
)lpvParam
;
1521 GetProfileString32A("Desktop", "IconTitleFaceName", "MS Sans Serif",
1522 buffer
, sizeof(buffer
) );
1523 lstrcpynAtoW(lpLogFont
->lfFaceName
, buffer
,LF_FACESIZE
);
1524 lpLogFont
->lfHeight
= 10;
1525 lpLogFont
->lfWidth
= 0;
1526 lpLogFont
->lfEscapement
= lpLogFont
->lfOrientation
= 0;
1527 lpLogFont
->lfWeight
= FW_NORMAL
;
1528 lpLogFont
->lfItalic
= lpLogFont
->lfStrikeOut
= lpLogFont
->lfUnderline
= FALSE
;
1529 lpLogFont
->lfCharSet
= ANSI_CHARSET
;
1530 lpLogFont
->lfOutPrecision
= OUT_DEFAULT_PRECIS
;
1531 lpLogFont
->lfClipPrecision
= CLIP_DEFAULT_PRECIS
;
1532 lpLogFont
->lfPitchAndFamily
= DEFAULT_PITCH
| FF_SWISS
;
1535 case SPI_GETNONCLIENTMETRICS
: {
1536 /* FIXME: implement correctly */
1537 LPNONCLIENTMETRICS32W lpnm
=(LPNONCLIENTMETRICS32W
)lpvParam
;
1539 SystemParametersInfo32W(SPI_GETICONTITLELOGFONT
,0,(LPVOID
)&(lpnm
->lfCaptionFont
),0);
1540 lpnm
->lfCaptionFont
.lfWeight
= FW_BOLD
;
1541 SystemParametersInfo32W(SPI_GETICONTITLELOGFONT
,0,(LPVOID
)&(lpnm
->lfSmCaptionFont
),0);
1542 SystemParametersInfo32W(SPI_GETICONTITLELOGFONT
,0,(LPVOID
)&(lpnm
->lfMenuFont
),0);
1543 SystemParametersInfo32W(SPI_GETICONTITLELOGFONT
,0,(LPVOID
)&(lpnm
->lfStatusFont
),0);
1544 SystemParametersInfo32W(SPI_GETICONTITLELOGFONT
,0,(LPVOID
)&(lpnm
->lfMessageFont
),0);
1548 case SPI_GETHIGHCONTRAST
:
1550 LPHIGHCONTRASTW lpHighContrastW
= (LPHIGHCONTRASTW
)lpvParam
;
1552 FIXME(system
,"SPI_GETHIGHCONTRAST not fully implemented\n");
1554 if ( lpHighContrastW
->cbSize
== sizeof( HIGHCONTRASTW
) )
1556 /* Indicate that there is no high contrast available */
1557 lpHighContrastW
->dwFlags
= 0;
1558 lpHighContrastW
->lpszDefaultScheme
= NULL
;
1569 return SystemParametersInfo32A(uAction
,uParam
,lpvParam
,fuWinIni
);
1576 /***********************************************************************
1577 * FileCDR (KERNEL.130)
1579 FARPROC16 WINAPI
FileCDR(FARPROC16 x
)
1581 FIXME(file
,"(0x%8x): stub\n", (int) x
);
1582 return (FARPROC16
)TRUE
;