Skip to content

Commit 3293ef8

Browse files
committed
Backends: Win32: Use ResisterClassW()/CreateWindowExW() for secondary viewports. (ocornut#7979, ocornut#5725)
1 parent 02b9797 commit 3293ef8

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

backends/imgui_impl_win32.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,8 +1062,8 @@ static void ImGui_ImplWin32_CreateWindow(ImGuiViewport* viewport)
10621062
// Create window
10631063
RECT rect = { (LONG)viewport->Pos.x, (LONG)viewport->Pos.y, (LONG)(viewport->Pos.x + viewport->Size.x), (LONG)(viewport->Pos.y + viewport->Size.y) };
10641064
::AdjustWindowRectEx(&rect, vd->DwStyle, FALSE, vd->DwExStyle);
1065-
vd->Hwnd = ::CreateWindowEx(
1066-
vd->DwExStyle, _T("ImGui Platform"), _T("Untitled"), vd->DwStyle, // Style, class name, window name
1065+
vd->Hwnd = ::CreateWindowExW(
1066+
vd->DwExStyle, L"ImGui Platform", L"Untitled", vd->DwStyle, // Style, class name, window name
10671067
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, // Window area
10681068
vd->HwndParent, nullptr, ::GetModuleHandle(nullptr), nullptr); // Owner window, Menu, Instance, Param
10691069
vd->HwndOwned = true;
@@ -1330,8 +1330,8 @@ static LRESULT CALLBACK ImGui_ImplWin32_WndProcHandler_PlatformWindow(HWND hWnd,
13301330

13311331
static void ImGui_ImplWin32_InitPlatformInterface(bool platform_has_own_dc)
13321332
{
1333-
WNDCLASSEX wcex;
1334-
wcex.cbSize = sizeof(WNDCLASSEX);
1333+
WNDCLASSEXW wcex;
1334+
wcex.cbSize = sizeof(WNDCLASSEXW);
13351335
wcex.style = CS_HREDRAW | CS_VREDRAW | (platform_has_own_dc ? CS_OWNDC : 0);
13361336
wcex.lpfnWndProc = ImGui_ImplWin32_WndProcHandler_PlatformWindow;
13371337
wcex.cbClsExtra = 0;
@@ -1341,9 +1341,9 @@ static void ImGui_ImplWin32_InitPlatformInterface(bool platform_has_own_dc)
13411341
wcex.hCursor = nullptr;
13421342
wcex.hbrBackground = (HBRUSH)(COLOR_BACKGROUND + 1);
13431343
wcex.lpszMenuName = nullptr;
1344-
wcex.lpszClassName = _T("ImGui Platform");
1344+
wcex.lpszClassName = L"ImGui Platform";
13451345
wcex.hIconSm = nullptr;
1346-
::RegisterClassEx(&wcex);
1346+
::RegisterClassExW(&wcex);
13471347

13481348
ImGui_ImplWin32_UpdateMonitors();
13491349

docs/CHANGELOG.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ Other changes:
8484
Docking+Viewports Branch:
8585

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

8891
-----------------------------------------------------------------------
8992
VERSION 1.91.2 (Released 2024-09-19)

0 commit comments

Comments
 (0)