< prev index next >
src/java.desktop/windows/native/libawt/windows/awt_InputMethod.cpp
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1997, 2019, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1997, 2020, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 55,65 ****
Java_sun_awt_windows_WInputMethod_createNativeContext(JNIEnv *env, jobject self)
{
TRY;
// use special message to call ImmCreateContext() in main thread.
! return (jint)AwtToolkit::GetInstance().SendMessage(WM_AWT_CREATECONTEXT);
CATCH_BAD_ALLOC_RET(0);
}
--- 55,65 ----
Java_sun_awt_windows_WInputMethod_createNativeContext(JNIEnv *env, jobject self)
{
TRY;
// use special message to call ImmCreateContext() in main thread.
! return (jint)AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_CREATECONTEXT);
CATCH_BAD_ALLOC_RET(0);
}
*** 72,82 ****
Java_sun_awt_windows_WInputMethod_destroyNativeContext(JNIEnv *env, jobject self, jint context)
{
TRY_NO_VERIFY;
// use special message to call ImmDestroyContext() in main thread.
! AwtToolkit::GetInstance().SendMessage(WM_AWT_DESTROYCONTEXT, context, 0);
CATCH_BAD_ALLOC;
}
--- 72,82 ----
Java_sun_awt_windows_WInputMethod_destroyNativeContext(JNIEnv *env, jobject self, jint context)
{
TRY_NO_VERIFY;
// use special message to call ImmDestroyContext() in main thread.
! AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_DESTROYCONTEXT, context, 0);
CATCH_BAD_ALLOC;
}
*** 99,109 ****
enis->self = selfGlobalRef;
enis->peer = peerGlobalRef;
enis->context = context;
enis->useNativeCompWindow = useNativeCompWindow;
! AwtToolkit::GetInstance().SendMessage(WM_AWT_ASSOCIATECONTEXT,
reinterpret_cast<WPARAM>(enis), (LPARAM)0);
// global refs are deleted in message handler
CATCH_BAD_ALLOC;
}
--- 99,109 ----
enis->self = selfGlobalRef;
enis->peer = peerGlobalRef;
enis->context = context;
enis->useNativeCompWindow = useNativeCompWindow;
! AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_ASSOCIATECONTEXT,
reinterpret_cast<WPARAM>(enis), (LPARAM)0);
// global refs are deleted in message handler
CATCH_BAD_ALLOC;
}
*** 126,136 ****
enis->self = NULL;
enis->peer = peerGlobalRef;
enis->context = NULL;
enis->useNativeCompWindow = JNI_TRUE;
! AwtToolkit::GetInstance().SendMessage(WM_AWT_ASSOCIATECONTEXT,
reinterpret_cast<WPARAM>(enis), (LPARAM)0);
// global refs are deleted in message handler
CATCH_BAD_ALLOC;
}
--- 126,136 ----
enis->self = NULL;
enis->peer = peerGlobalRef;
enis->context = NULL;
enis->useNativeCompWindow = JNI_TRUE;
! AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_ASSOCIATECONTEXT,
reinterpret_cast<WPARAM>(enis), (LPARAM)0);
// global refs are deleted in message handler
CATCH_BAD_ALLOC;
}
*** 203,213 ****
// then input text should be committed. Otherwise, should be discarded.
//
// 10/29/98 - Changed to commit it according to the flag.
// use special message to call ImmNotifyIME() in main thread.
! AwtToolkit::GetInstance().SendMessage(WM_AWT_ENDCOMPOSITION, context,
(LPARAM)(flag != sun_awt_windows_WInputMethod_DISCARD_INPUT));
CATCH_BAD_ALLOC;
}
--- 203,213 ----
// then input text should be committed. Otherwise, should be discarded.
//
// 10/29/98 - Changed to commit it according to the flag.
// use special message to call ImmNotifyIME() in main thread.
! AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_ENDCOMPOSITION, context,
(LPARAM)(flag != sun_awt_windows_WInputMethod_DISCARD_INPUT));
CATCH_BAD_ALLOC;
}
*** 220,230 ****
Java_sun_awt_windows_WInputMethod_setConversionStatus(JNIEnv *env, jobject self, jint context, jint request)
{
TRY;
// use special message to call ImmSetConversionStatus() in main thread.
! AwtToolkit::GetInstance().SendMessage(WM_AWT_SETCONVERSIONSTATUS,
context,
MAKELPARAM((WORD)request, (WORD)0));
CATCH_BAD_ALLOC;
}
--- 220,230 ----
Java_sun_awt_windows_WInputMethod_setConversionStatus(JNIEnv *env, jobject self, jint context, jint request)
{
TRY;
// use special message to call ImmSetConversionStatus() in main thread.
! AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_SETCONVERSIONSTATUS,
context,
MAKELPARAM((WORD)request, (WORD)0));
CATCH_BAD_ALLOC;
}
*** 238,248 ****
Java_sun_awt_windows_WInputMethod_getConversionStatus(JNIEnv *env, jobject self, jint context)
{
TRY;
// use special message to call ImmSetConversionStatus() in main thread.
! return (jint) AwtToolkit::GetInstance().SendMessage(
WM_AWT_GETCONVERSIONSTATUS, context, 0);
CATCH_BAD_ALLOC_RET(0);
}
--- 238,248 ----
Java_sun_awt_windows_WInputMethod_getConversionStatus(JNIEnv *env, jobject self, jint context)
{
TRY;
// use special message to call ImmSetConversionStatus() in main thread.
! return (jint) AwtToolkit::GetInstance().InvokeInputMethodFunction(
WM_AWT_GETCONVERSIONSTATUS, context, 0);
CATCH_BAD_ALLOC_RET(0);
}
*** 255,265 ****
Java_sun_awt_windows_WInputMethod_setOpenStatus(JNIEnv *env, jobject self, jint context, jboolean flag)
{
TRY;
// use special message to call ImmSetConversionStatus() in main thread.
! AwtToolkit::GetInstance().SendMessage(WM_AWT_SETOPENSTATUS,
context, flag);
CATCH_BAD_ALLOC;
}
--- 255,265 ----
Java_sun_awt_windows_WInputMethod_setOpenStatus(JNIEnv *env, jobject self, jint context, jboolean flag)
{
TRY;
// use special message to call ImmSetConversionStatus() in main thread.
! AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_SETOPENSTATUS,
context, flag);
CATCH_BAD_ALLOC;
}
*** 272,282 ****
Java_sun_awt_windows_WInputMethod_getOpenStatus(JNIEnv *env, jobject self, jint context)
{
TRY;
// use special message to call ImmSetConversionStatus() in main thread.
! return (jboolean)(AwtToolkit::GetInstance().SendMessage(
WM_AWT_GETOPENSTATUS,
context, 0));
CATCH_BAD_ALLOC_RET(0);
}
--- 272,282 ----
Java_sun_awt_windows_WInputMethod_getOpenStatus(JNIEnv *env, jobject self, jint context)
{
TRY;
// use special message to call ImmSetConversionStatus() in main thread.
! return (jboolean)(AwtToolkit::GetInstance().InvokeInputMethodFunction(
WM_AWT_GETOPENSTATUS,
context, 0));
CATCH_BAD_ALLOC_RET(0);
}
*** 390,400 ****
if (defaultIMEHandler == NULL)
{
jobject peerGlobalRef = env->NewGlobalRef(peer);
// use special message to access pData on the toolkit thread
! LRESULT res = AwtToolkit::GetInstance().SendMessage(WM_AWT_GET_DEFAULT_IME_HANDLER,
reinterpret_cast<WPARAM>(peerGlobalRef), 0);
// global ref is deleted in message handler
if (res == TRUE) {
defaultIMEHandler = AwtToolkit::GetInstance().GetInputMethodWindow();
--- 390,400 ----
if (defaultIMEHandler == NULL)
{
jobject peerGlobalRef = env->NewGlobalRef(peer);
// use special message to access pData on the toolkit thread
! LRESULT res = AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_GET_DEFAULT_IME_HANDLER,
reinterpret_cast<WPARAM>(peerGlobalRef), 0);
// global ref is deleted in message handler
if (res == TRUE) {
defaultIMEHandler = AwtToolkit::GetInstance().GetInputMethodWindow();
*** 429,439 ****
// carefully extract right x and y values using GET_X_LPARAM and
// GET_Y_LPARAM, not LOWORD and HIWORD
// See CR 4805862, AwtToolkit::WndProc
// use special message to open candidate window in main thread.
! AwtToolkit::GetInstance().SendMessage(WM_AWT_OPENCANDIDATEWINDOW,
(WPARAM)peerGlobalRef, MAKELONG(x, y));
// global ref is deleted in message handler
CATCH_BAD_ALLOC;
}
--- 429,439 ----
// carefully extract right x and y values using GET_X_LPARAM and
// GET_Y_LPARAM, not LOWORD and HIWORD
// See CR 4805862, AwtToolkit::WndProc
// use special message to open candidate window in main thread.
! AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_OPENCANDIDATEWINDOW,
(WPARAM)peerGlobalRef, MAKELONG(x, y));
// global ref is deleted in message handler
CATCH_BAD_ALLOC;
}
< prev index next >