1 /*
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
509 break;
510 }
511 env->SetObjectArrayElement(locales,
512 current,
513 obj);
514 }
515
516 }
517 env->DeleteLocalRef(localeClass);
518 }
519
520 for (current = 0; current < javaLocaleNameCount; current++) {
521 free((void *)javaLocaleNames[current]);
522 }
523
524 free(hKLList);
525 free(javaLocaleNames);
526 return locales;
527
528 CATCH_BAD_ALLOC_RET(NULL);
529 }
530
531 /**
532 * Class: sun_awt_windows_WInputMethod
533 * Method: getNativeIMMDescription
534 * Signature: ()Ljava/lang/String;
535 *
536 * This method tries to get the information about the input method associated with
537 * the current active thread.
538 *
539 */
540 JNIEXPORT jstring JNICALL Java_sun_awt_windows_WInputMethod_getNativeIMMDescription
541 (JNIEnv *env, jobject self) {
542
543 TRY;
544
545 // Get the keyboard layout of the active thread.
546 HKL hkl = AwtComponent::GetKeyboardLayout();
547 LPTSTR szImmDescription = NULL;
548 UINT buffSize = 0;
|
1 /*
2 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
509 break;
510 }
511 env->SetObjectArrayElement(locales,
512 current,
513 obj);
514 }
515
516 }
517 env->DeleteLocalRef(localeClass);
518 }
519
520 for (current = 0; current < javaLocaleNameCount; current++) {
521 free((void *)javaLocaleNames[current]);
522 }
523
524 free(hKLList);
525 free(javaLocaleNames);
526 return locales;
527
528 CATCH_BAD_ALLOC_RET(NULL);
529 }
530
531 /*
532 * Class: sun_awt_windows_WInputMethod
533 * Method: isCompositionStringAvailable
534 * Signature: (I)Z
535 */
536 JNIEXPORT jboolean JNICALL Java_sun_awt_windows_WInputMethod_isCompositionStringAvailable
537 (JNIEnv *env, jobject self, jint context)
538 {
539 LONG length;
540 length = ImmGetCompositionString((HIMC)IntToPtr(context), GCS_COMPSTR, NULL, 0);
541 if (length > 0) {
542 return JNI_TRUE;
543 } else {
544 return JNI_FALSE;
545 }
546 }
547
548 /**
549 * Class: sun_awt_windows_WInputMethod
550 * Method: getNativeIMMDescription
551 * Signature: ()Ljava/lang/String;
552 *
553 * This method tries to get the information about the input method associated with
554 * the current active thread.
555 *
556 */
557 JNIEXPORT jstring JNICALL Java_sun_awt_windows_WInputMethod_getNativeIMMDescription
558 (JNIEnv *env, jobject self) {
559
560 TRY;
561
562 // Get the keyboard layout of the active thread.
563 HKL hkl = AwtComponent::GetKeyboardLayout();
564 LPTSTR szImmDescription = NULL;
565 UINT buffSize = 0;
|