< prev index next >
src/java.desktop/macosx/native/libawt_lwawt/awt/CInputMethod.m
Print this page
@@ -297,14 +297,24 @@
{
if (!inputMethodController) return NULL;
jobject returnValue = 0;
__block NSArray *selectableArray = nil;
+ __block NSString *currentLocale = nil;
JNF_COCOA_ENTER(env);
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
selectableArray = (NSArray *)[inputMethodController performSelector:@selector(availableInputMethodLocales)];
+ // If it is impossible to retirieve the list of available input method locales from
+ // the platform for some reason, we will return the array contained only current locale.
+ if ([selectableArray count] == 0) {
+ currentLocale = (NSString *) [inputMethodController performSelector:@selector(currentInputMethodLocale)];
+ if ([currentLocale length] != 0) {
+ selectableArray = [NSArray arrayWithObjects:currentLocale, nil];
+ [currentLocale retain];
+ }
+ }
[selectableArray retain];
}];
if (selectableArray == nil) return NULL;
@@ -321,10 +331,11 @@
JNFCallBooleanMethod(env, returnValue, jm_listAdd, localeObj);
}
(*env)->DeleteLocalRef(env, localeObj);
}
+ [currentLocale release];
[selectableArray release];
JNF_COCOA_EXIT(env);
return returnValue;
}
< prev index next >