Win32: Rename commit function

The data to commit is a result-string rather than preedit.
This commit is contained in:
Daijiro Fukuda 2022-04-19 10:35:49 +09:00
parent 4cdabc29f2
commit 15a64185b0

View File

@ -636,26 +636,26 @@ static GLFWbool getImmPreedit(_GLFWwindow* window)
return GLFW_TRUE;
}
static GLFWbool commitImmPreedit(_GLFWwindow* window)
static GLFWbool commitImmResultStr(_GLFWwindow* window)
{
HIMC hIMC;
LONG preeditBytes;
LONG bytes;
if (!window->callbacks.character)
return GLFW_FALSE;
hIMC = ImmGetContext(window->win32.handle);
// get preedit data sizes
preeditBytes = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, NULL, 0);
bytes = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, NULL, 0);
if (preeditBytes > 0)
if (bytes > 0)
{
int i;
int length = preeditBytes / sizeof(WCHAR);
LPWSTR buffer = _glfw_calloc(preeditBytes, 1);
int length = bytes / sizeof(WCHAR);
LPWSTR buffer = _glfw_calloc(bytes, 1);
// get preedit data
ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, buffer, preeditBytes);
ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, buffer, bytes);
for (i = 0; i < length; i++)
window->callbacks.character((GLFWwindow*) window, buffer[i]);
@ -968,7 +968,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
window->nblocks = 0;
window->ntext = 0;
_glfwInputPreedit(window, 0);
commitImmPreedit(window);
commitImmResultStr(window);
return TRUE;
}
if (lParam & GCS_COMPSTR)