From 15a64185b0d861bbac4bb15cba7155232e7b1bc1 Mon Sep 17 00:00:00 2001 From: Daijiro Fukuda Date: Tue, 19 Apr 2022 10:35:49 +0900 Subject: [PATCH] Win32: Rename commit function The data to commit is a result-string rather than preedit. --- src/win32_window.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/win32_window.c b/src/win32_window.c index d2c7218b..d3816363 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -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)