瀏覽代碼

Backends: SDL2: Gamepad handlng: amend bf1c96d. (#3884, #6559, #6890)

ocornut 1 年之前
父節點
當前提交
f966da1f8f
共有 2 個文件被更改,包括 4 次插入2 次删除
  1. 3 1
      backends/imgui_impl_sdl2.cpp
  2. 1 1
      docs/CHANGELOG.txt

+ 3 - 1
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;

+ 1 - 1
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