From f966da1f8fb569b99dd4220162f2d9bde6f3b153 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 13 Feb 2024 16:31:33 +0100 Subject: [PATCH] Backends: SDL2: Gamepad handlng: amend bf1c96d. (#3884, #6559, #6890) --- backends/imgui_impl_sdl2.cpp | 4 +++- docs/CHANGELOG.txt | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/backends/imgui_impl_sdl2.cpp b/backends/imgui_impl_sdl2.cpp index 6fe074677239..001dced3e42c 100644 --- a/backends/imgui_impl_sdl2.cpp +++ b/backends/imgui_impl_sdl2.cpp @@ -530,7 +530,9 @@ void ImGui_ImplSDL2_Shutdown() SDL_free(bd->ClipboardTextData); for (ImGuiMouseCursor cursor_n = 0; cursor_n < ImGuiMouseCursor_COUNT; cursor_n++) SDL_FreeCursor(bd->MouseCursors[cursor_n]); - bd->MouseLastCursor = nullptr; + + if (bd->Gamepad && bd->GamepadSelectAuto) + SDL_GameControllerClose(bd->Gamepad); io.BackendPlatformName = nullptr; io.BackendPlatformUserData = nullptr; diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 5b37b9f20933..94457fc867a4 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -53,7 +53,7 @@ Other changes: - Backends: SDL2: Handle gamepad disconnection + fixed increasing gamepad reference counter continuously. Added ImGui_ImplSDL2_SelectGamepadAuto()/ImGui_ImplSDL2_SelectGamepadExplicit() functions to respectively select automatic selection or provide a gamepad to use. - (#3884, #6559, #6890) [@ocornut, @lethal-guitar, @wn2000, @bog-dan-ro] + (#3884, #6559, #6890) [@lethal-guitar, @wn2000, @ocornut, @bog-dan-ro] - Backends: SDLRenderer3: query newly added SDL_RenderViewportSet() to not restore a wrong viewport if none was initially set. - Backends: DirectX9: Using RGBA format when allowed by the driver to avoid CPU side