Skip to content

Commit

Permalink
Backends: Win32: Use ResisterClassW()/CreateWindowExW() for secondary…
Browse files Browse the repository at this point in the history
… viewports. (#7979, #5725)
  • Loading branch information
ocornut committed Oct 3, 2024
1 parent 02b9797 commit 3293ef8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 6 additions & 6 deletions backends/imgui_impl_win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1062,8 +1062,8 @@ static void ImGui_ImplWin32_CreateWindow(ImGuiViewport* viewport)
// Create window
RECT rect = { (LONG)viewport->Pos.x, (LONG)viewport->Pos.y, (LONG)(viewport->Pos.x + viewport->Size.x), (LONG)(viewport->Pos.y + viewport->Size.y) };
::AdjustWindowRectEx(&rect, vd->DwStyle, FALSE, vd->DwExStyle);
vd->Hwnd = ::CreateWindowEx(
vd->DwExStyle, _T("ImGui Platform"), _T("Untitled"), vd->DwStyle, // Style, class name, window name
vd->Hwnd = ::CreateWindowExW(
vd->DwExStyle, L"ImGui Platform", L"Untitled", vd->DwStyle, // Style, class name, window name
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, // Window area
vd->HwndParent, nullptr, ::GetModuleHandle(nullptr), nullptr); // Owner window, Menu, Instance, Param
vd->HwndOwned = true;
Expand Down Expand Up @@ -1330,8 +1330,8 @@ static LRESULT CALLBACK ImGui_ImplWin32_WndProcHandler_PlatformWindow(HWND hWnd,

static void ImGui_ImplWin32_InitPlatformInterface(bool platform_has_own_dc)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
WNDCLASSEXW wcex;
wcex.cbSize = sizeof(WNDCLASSEXW);
wcex.style = CS_HREDRAW | CS_VREDRAW | (platform_has_own_dc ? CS_OWNDC : 0);
wcex.lpfnWndProc = ImGui_ImplWin32_WndProcHandler_PlatformWindow;
wcex.cbClsExtra = 0;
Expand All @@ -1341,9 +1341,9 @@ static void ImGui_ImplWin32_InitPlatformInterface(bool platform_has_own_dc)
wcex.hCursor = nullptr;
wcex.hbrBackground = (HBRUSH)(COLOR_BACKGROUND + 1);
wcex.lpszMenuName = nullptr;
wcex.lpszClassName = _T("ImGui Platform");
wcex.lpszClassName = L"ImGui Platform";
wcex.hIconSm = nullptr;
::RegisterClassEx(&wcex);
::RegisterClassExW(&wcex);

ImGui_ImplWin32_UpdateMonitors();

Expand Down
3 changes: 3 additions & 0 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ Other changes:
Docking+Viewports Branch:

- Backends: SDL2, SDL3: Fixed building for UWP platforms. (#8008)
- Backends: Win32: Use ResisterClassW()/CreateWindowExW() for secondary viewports, to
ensure correct IME input even if the backend was compiled in MBCS mode. (#7979, #5725)


-----------------------------------------------------------------------
VERSION 1.91.2 (Released 2024-09-19)
Expand Down

0 comments on commit 3293ef8

Please sign in to comment.