Backends: Win32: minor tidying up. (#5819)

This commit is contained in:
Teselka 2022-10-25 13:39:27 +03:00 committed by ocornut
parent baea25e657
commit 9db6b1a0d9

View File

@ -88,10 +88,10 @@ struct ImGui_ImplWin32_Data
INT64 Time; INT64 Time;
INT64 TicksPerSecond; INT64 TicksPerSecond;
ImGuiMouseCursor LastMouseCursor; ImGuiMouseCursor LastMouseCursor;
bool HasGamepad;
bool WantUpdateHasGamepad;
#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD #ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
bool HasGamepad;
bool WantUpdateHasGamepad;
HMODULE XInputDLL; HMODULE XInputDLL;
PFN_XInputGetCapabilities XInputGetCapabilities; PFN_XInputGetCapabilities XInputGetCapabilities;
PFN_XInputGetState XInputGetState; PFN_XInputGetState XInputGetState;
@ -129,7 +129,6 @@ bool ImGui_ImplWin32_Init(void* hwnd)
io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used) io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
bd->hWnd = (HWND)hwnd; bd->hWnd = (HWND)hwnd;
bd->WantUpdateHasGamepad = true;
bd->TicksPerSecond = perf_frequency; bd->TicksPerSecond = perf_frequency;
bd->Time = perf_counter; bd->Time = perf_counter;
bd->LastMouseCursor = ImGuiMouseCursor_COUNT; bd->LastMouseCursor = ImGuiMouseCursor_COUNT;
@ -139,6 +138,7 @@ bool ImGui_ImplWin32_Init(void* hwnd)
// Dynamically load XInput library // Dynamically load XInput library
#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD #ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
bd->WantUpdateHasGamepad = true;
const char* xinput_dll_names[] = const char* xinput_dll_names[] =
{ {
"xinput1_4.dll", // Windows 8+ "xinput1_4.dll", // Windows 8+
@ -634,8 +634,10 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARA
return 1; return 1;
return 0; return 0;
case WM_DEVICECHANGE: case WM_DEVICECHANGE:
#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
if ((UINT)wParam == DBT_DEVNODES_CHANGED) if ((UINT)wParam == DBT_DEVNODES_CHANGED)
bd->WantUpdateHasGamepad = true; bd->WantUpdateHasGamepad = true;
#endif
return 0; return 0;
} }
return 0; return 0;