Lines 254-267
Link Here
|
254 |
p_inlocale = aLocaleString.GetBuffer(); |
254 |
p_inlocale = aLocaleString.GetBuffer(); |
255 |
} |
255 |
} |
256 |
} |
256 |
} |
257 |
#endif |
257 |
p_outlocale = p_inlocale; |
258 |
|
258 |
|
|
|
259 |
// FIXME |
260 |
// setlocale() doesn't do much on Darwin 5 or 6. Here, since setlocale() is |
261 |
// #defined to _Xsetlocale() by our <X11/Xlocale.h>, it still doesn't work. |
262 |
// Bypass it for MacOS X and Darwin. |
263 |
// NOTE: On MacOS X, we can't set the locale anyway because its set in |
264 |
// the System Preferences application, under the International control panel. |
265 |
// Thus, the locale that we get from osl_getProcessLocale() is always valid as |
266 |
// its the locale that's already set. |
267 |
// NOTE 2: This setlocale() is still valid for Darwin though. |
268 |
#else |
259 |
if ( (p_outlocale = setlocale(LC_ALL, p_inlocale)) == NULL ) |
269 |
if ( (p_outlocale = setlocale(LC_ALL, p_inlocale)) == NULL ) |
260 |
{ |
270 |
{ |
261 |
fprintf( stderr, |
271 |
fprintf( stderr, |
262 |
"I18N: Operating system doesn't support locale \"%s\"\n", |
272 |
"I18N: Operating system doesn't support locale \"%s\"\n", |
263 |
p_inlocale ); |
273 |
p_inlocale ); |
264 |
} |
274 |
} |
|
|
275 |
#endif |
265 |
|
276 |
|
266 |
return p_outlocale; |
277 |
return p_outlocale; |
267 |
} |
278 |
} |
Lines 458-521
Link Here
|
458 |
{ |
469 |
{ |
459 |
if ( getenv("USE_XOPENIM") == NULL ) |
470 |
if ( getenv("USE_XOPENIM") == NULL ) |
460 |
{ |
471 |
{ |
461 |
mbMultiLingual = True; // set ml-input flag to create input-method |
472 |
mbMultiLingual = True; // set ml-input flag to create input-method |
462 |
maMethod = XvaOpenIM(pDisplay, NULL, NULL, NULL, |
473 |
maMethod = XvaOpenIM(pDisplay, NULL, NULL, NULL, |
463 |
XNMultiLingualInput, mbMultiLingual, /* dummy */ |
474 |
XNMultiLingualInput, mbMultiLingual, /* dummy */ |
464 |
0); |
475 |
0); |
465 |
// get ml-input flag from input-method |
476 |
// get ml-input flag from input-method |
466 |
if ( maMethod == (XIM)NULL ) |
477 |
if ( maMethod == (XIM)NULL ) |
467 |
mbMultiLingual = False; |
478 |
mbMultiLingual = False; |
468 |
#if !defined(LINUX) |
479 |
#if !defined(LINUX) |
469 |
else |
480 |
else |
470 |
if ( XGetIMValues(maMethod, |
481 |
if ( XGetIMValues(maMethod, |
471 |
XNMultiLingualInput, &mbMultiLingual, NULL ) != NULL ) |
482 |
XNMultiLingualInput, &mbMultiLingual, NULL ) != NULL ) |
472 |
mbMultiLingual = False; |
483 |
mbMultiLingual = False; |
473 |
if( mbMultiLingual ) |
484 |
|
474 |
{ |
485 |
#ifdef MACOSX |
475 |
XIMUnicodeCharacterSubsets* subsets; |
486 |
// FIXME |
476 |
if( XGetIMValues( maMethod, |
487 |
// For whatever reason, the XvaOpenIM call always returns NULL |
477 |
XNQueryUnicodeCharacterSubset, &subsets, NULL ) == NULL ) |
488 |
// on MacOS X/Darwin. We know we've got multi-lingual support |
478 |
{ |
489 |
// anyway so hack it to true so we can type international characters. |
|
|
490 |
mbMultiLingual = True; |
491 |
#endif |
492 |
|
493 |
if( mbMultiLingual ) |
494 |
{ |
495 |
XIMUnicodeCharacterSubsets* subsets; |
496 |
if( XGetIMValues( maMethod, |
497 |
XNQueryUnicodeCharacterSubset, &subsets, NULL ) == NULL ) |
498 |
{ |
479 |
#ifdef DEBUG |
499 |
#ifdef DEBUG |
480 |
fprintf( stderr, "IM reports %d subsets: ", subsets->count_subsets ); |
500 |
fprintf( stderr, "IM reports %d subsets: ", subsets->count_subsets ); |
481 |
#endif |
501 |
#endif |
482 |
I18NStatus& rStatus( I18NStatus::get() ); |
502 |
I18NStatus& rStatus( I18NStatus::get() ); |
483 |
rStatus.clearChoices(); |
503 |
rStatus.clearChoices(); |
484 |
for( int i = 0; i < subsets->count_subsets; i++ ) |
504 |
for( int i = 0; i < subsets->count_subsets; i++ ) |
485 |
{ |
505 |
{ |
486 |
#ifdef DEBUG |
506 |
#ifdef DEBUG |
487 |
fprintf( stderr,"\"%s\" ", subsets->supported_subsets[i].name ); |
507 |
fprintf( stderr,"\"%s\" ", subsets->supported_subsets[i].name ); |
488 |
#endif |
508 |
#endif |
489 |
rStatus.addChoice( String( subsets->supported_subsets[i].name, RTL_TEXTENCODING_UTF8 ), &subsets->supported_subsets[i] ); |
509 |
rStatus.addChoice( String( subsets->supported_subsets[i].name, RTL_TEXTENCODING_UTF8 ), &subsets->supported_subsets[i] ); |
490 |
} |
510 |
} |
491 |
#ifdef DEBUG |
511 |
#ifdef DEBUG |
492 |
fprintf( stderr, "\n" ); |
512 |
fprintf( stderr, "\n" ); |
493 |
#endif |
513 |
#endif |
494 |
} |
514 |
} |
495 |
#ifdef DEBUG |
515 |
#ifdef DEBUG |
496 |
else |
516 |
else |
497 |
fprintf( stderr, "query subsets failed\n" ); |
517 |
fprintf( stderr, "query subsets failed\n" ); |
498 |
#endif |
518 |
#endif |
499 |
} |
519 |
} |
500 |
#else |
520 |
#else |
501 |
mbMultiLingual = False; |
521 |
mbMultiLingual = False; |
502 |
#endif |
522 |
#endif |
503 |
} |
523 |
} |
504 |
else |
524 |
else |
505 |
{ |
525 |
{ |
506 |
maMethod = XOpenIM(pDisplay, NULL, NULL, NULL); |
526 |
maMethod = XOpenIM(pDisplay, NULL, NULL, NULL); |
507 |
mbMultiLingual = False; |
527 |
mbMultiLingual = False; |
508 |
} |
528 |
} |
509 |
|
529 |
|
510 |
if ((maMethod == (XIM)NULL) && (getenv("XMODIFIERS") != NULL)) |
530 |
if ((maMethod == (XIM)NULL) && (getenv("XMODIFIERS") != NULL)) |
511 |
{ |
531 |
{ |
512 |
putenv ("XMODIFIERS"); |
532 |
putenv ("XMODIFIERS"); |
513 |
XSetLocaleModifiers(""); |
533 |
XSetLocaleModifiers(""); |
514 |
maMethod = XOpenIM(pDisplay, NULL, NULL, NULL); |
534 |
maMethod = XOpenIM(pDisplay, NULL, NULL, NULL); |
515 |
mbMultiLingual = False; |
535 |
mbMultiLingual = False; |
516 |
} |
536 |
} |
517 |
|
537 |
|
518 |
if ( maMethod != (XIM)NULL ) |
538 |
if ( maMethod != (XIM)NULL ) |
519 |
{ |
539 |
{ |
520 |
if ( XGetIMValues(maMethod, XNQueryInputStyle, &mpStyles, NULL) |
540 |
if ( XGetIMValues(maMethod, XNQueryInputStyle, &mpStyles, NULL) |
521 |
!= NULL) |
541 |
!= NULL) |
Lines 537-546
Link Here
|
537 |
fprintf(stderr, "input method creation failed\n"); |
557 |
fprintf(stderr, "input method creation failed\n"); |
538 |
#endif |
558 |
#endif |
539 |
|
559 |
|
540 |
maDestroyCallback.callback = (XIMProc)IM_IMDestroyCallback; |
560 |
maDestroyCallback.callback = (XIMProc)IM_IMDestroyCallback; |
541 |
maDestroyCallback.client_data = (XPointer)this; |
561 |
maDestroyCallback.client_data = (XPointer)this; |
542 |
if (mbUseable && maMethod != NULL) |
562 |
if (mbUseable && maMethod != NULL) |
543 |
XSetIMValues(maMethod, XNDestroyCallback, &maDestroyCallback, NULL); |
563 |
XSetIMValues(maMethod, XNDestroyCallback, &maDestroyCallback, NULL); |
544 |
|
564 |
|
545 |
return mbUseable; |
565 |
return mbUseable; |
546 |
} |
566 |
} |