Backends: GLFW, Input: Use Unicode version of WndProc for get correct input for text in utf-8 code page. (#7174)

Similar to #6785, #6782, #5725, #5961 for for GLFW backend.
This commit is contained in:
kida22 2023-12-28 04:17:28 +00:00 committed by ocornut
parent 4a2426449a
commit 240ab5890b
2 changed files with 6 additions and 4 deletions

View File

@ -493,7 +493,7 @@ static LRESULT CALLBACK ImGui_ImplGlfw_WndProc(HWND hWnd, UINT msg, WPARAM wPara
ImGui::GetIO().AddMouseSourceEvent(GetMouseSourceFromMessageExtraInfo()); ImGui::GetIO().AddMouseSourceEvent(GetMouseSourceFromMessageExtraInfo());
break; break;
} }
return ::CallWindowProc(bd->GlfwWndProc, hWnd, msg, wParam, lParam); return ::CallWindowProcW(bd->GlfwWndProc, hWnd, msg, wParam, lParam);
} }
#endif #endif
@ -617,9 +617,9 @@ static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, Glfw
// Windows: register a WndProc hook so we can intercept some messages. // Windows: register a WndProc hook so we can intercept some messages.
#ifdef _WIN32 #ifdef _WIN32
bd->GlfwWndProc = (WNDPROC)::GetWindowLongPtr((HWND)main_viewport->PlatformHandleRaw, GWLP_WNDPROC); bd->GlfwWndProc = (WNDPROC)::GetWindowLongPtrW((HWND)main_viewport->PlatformHandleRaw, GWLP_WNDPROC);
IM_ASSERT(bd->GlfwWndProc != nullptr); IM_ASSERT(bd->GlfwWndProc != nullptr);
::SetWindowLongPtr((HWND)main_viewport->PlatformHandleRaw, GWLP_WNDPROC, (LONG_PTR)ImGui_ImplGlfw_WndProc); ::SetWindowLongPtrW((HWND)main_viewport->PlatformHandleRaw, GWLP_WNDPROC, (LONG_PTR)ImGui_ImplGlfw_WndProc);
#endif #endif
bd->ClientApi = client_api; bd->ClientApi = client_api;
@ -659,7 +659,7 @@ void ImGui_ImplGlfw_Shutdown()
// Windows: register a WndProc hook so we can intercept some messages. // Windows: register a WndProc hook so we can intercept some messages.
#ifdef _WIN32 #ifdef _WIN32
ImGuiViewport* main_viewport = ImGui::GetMainViewport(); ImGuiViewport* main_viewport = ImGui::GetMainViewport();
::SetWindowLongPtr((HWND)main_viewport->PlatformHandleRaw, GWLP_WNDPROC, (LONG_PTR)bd->GlfwWndProc); ::SetWindowLongPtrW((HWND)main_viewport->PlatformHandleRaw, GWLP_WNDPROC, (LONG_PTR)bd->GlfwWndProc);
bd->GlfwWndProc = nullptr; bd->GlfwWndProc = nullptr;
#endif #endif

View File

@ -92,6 +92,8 @@ Other changes:
on a codebase where another copy of the library is used. on a codebase where another copy of the library is used.
- Backends: GLFW, Emscripten: Added ImGui_ImplGlfw_InstallEmscriptenCanvasResizeCallback() to - Backends: GLFW, Emscripten: Added ImGui_ImplGlfw_InstallEmscriptenCanvasResizeCallback() to
register canvas selector and auto-resize GLFW window. (#6751) [@Traveller23, @ypujante] register canvas selector and auto-resize GLFW window. (#6751) [@Traveller23, @ypujante]
- Backends: GLFW: Fixed Windows specific hooks to use Unicode version of WndProc even when
compiling in MBCS mode. (#7174) [@kimidaisuki22]
- Backends: Vulkan: Fixed mismatching allocator passed to vkCreateCommandPool() vs - Backends: Vulkan: Fixed mismatching allocator passed to vkCreateCommandPool() vs
vkDestroyCommandPool(). (#7075) [@FoonTheRaccoon] vkDestroyCommandPool(). (#7075) [@FoonTheRaccoon]
- Examples: GLFW+Emscripten: Fixed examples not consistently resizing according to host canvas. - Examples: GLFW+Emscripten: Fixed examples not consistently resizing according to host canvas.