changeset 12664:fd839d3eb879

8163979: [macosx] Chinese text shows as Latin w/ openVanilla input method Reviewed-by: prr, serb
author dmarkov
date Fri, 17 Feb 2017 15:14:31 +0300
parents dd7cf67203d6
children 1f5c744d3d57
files src/macosx/classes/sun/lwawt/macosx/CInputMethodDescriptor.java
diffstat 1 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/classes/sun/lwawt/macosx/CInputMethodDescriptor.java	Tue Jan 31 10:35:06 2017 +0300
+++ b/src/macosx/classes/sun/lwawt/macosx/CInputMethodDescriptor.java	Fri Feb 17 15:14:31 2017 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,15 +57,19 @@
     }
 
     static Object[] getAvailableLocalesInternal() {
-        List workList = nativeGetAvailableLocales();
+        List<Object> workList = nativeGetAvailableLocales();
+        Locale currentLocale = CInputMethod.getNativeLocale();
 
-        if (workList != null) {
+        if (workList == null || workList.isEmpty()) {
+            return new Object[] {
+                    currentLocale != null ? currentLocale : Locale.getDefault()
+            };
+        } else {
+            if (currentLocale != null && !workList.contains(currentLocale)) {
+                workList.add(currentLocale);
+            }
             return workList.toArray();
         }
-
-        return new Object[] {
-            Locale.getDefault()
-        };
     }
 
     /**
@@ -119,5 +123,5 @@
     }
 
     private static native void nativeInit();
-    private static native List nativeGetAvailableLocales();
+    private static native List<Object> nativeGetAvailableLocales();
 }