Kaynağa Gözat

Backends: Made all backends sources files support global IMGUI_DISABLE. (#6601)

ocornut 2 yıl önce
ebeveyn
işleme
33e13c85e1
41 değiştirilmiş dosya ile 171 ekleme ve 9 silme
  1. 7 2
      backends/imgui_impl_allegro5.cpp
  2. 3 0
      backends/imgui_impl_allegro5.h
  3. 5 0
      backends/imgui_impl_android.cpp
  4. 4 0
      backends/imgui_impl_android.h
  5. 5 0
      backends/imgui_impl_dx10.cpp
  6. 4 1
      backends/imgui_impl_dx10.h
  7. 5 0
      backends/imgui_impl_dx11.cpp
  8. 4 1
      backends/imgui_impl_dx11.h
  9. 5 0
      backends/imgui_impl_dx12.cpp
  10. 3 0
      backends/imgui_impl_dx12.h
  11. 5 0
      backends/imgui_impl_dx9.cpp
  12. 4 1
      backends/imgui_impl_dx9.h
  13. 5 0
      backends/imgui_impl_glfw.cpp
  14. 3 0
      backends/imgui_impl_glfw.h
  15. 5 0
      backends/imgui_impl_glut.cpp
  16. 4 1
      backends/imgui_impl_glut.h
  17. 6 1
      backends/imgui_impl_metal.h
  18. 5 0
      backends/imgui_impl_metal.mm
  19. 5 0
      backends/imgui_impl_opengl2.cpp
  20. 4 1
      backends/imgui_impl_opengl2.h
  21. 5 0
      backends/imgui_impl_opengl3.cpp
  22. 3 0
      backends/imgui_impl_opengl3.h
  23. 3 0
      backends/imgui_impl_osx.h
  24. 5 0
      backends/imgui_impl_osx.mm
  25. 5 0
      backends/imgui_impl_sdl2.cpp
  26. 3 0
      backends/imgui_impl_sdl2.h
  27. 4 0
      backends/imgui_impl_sdl3.cpp
  28. 3 0
      backends/imgui_impl_sdl3.h
  29. 5 0
      backends/imgui_impl_sdlrenderer2.cpp
  30. 3 0
      backends/imgui_impl_sdlrenderer2.h
  31. 5 0
      backends/imgui_impl_sdlrenderer3.cpp
  32. 3 0
      backends/imgui_impl_sdlrenderer3.h
  33. 6 0
      backends/imgui_impl_vulkan.cpp
  34. 2 0
      backends/imgui_impl_vulkan.h
  35. 5 0
      backends/imgui_impl_wgpu.cpp
  36. 4 0
      backends/imgui_impl_wgpu.h
  37. 3 0
      backends/imgui_impl_win32.cpp
  38. 3 0
      backends/imgui_impl_win32.h
  39. 1 0
      docs/CHANGELOG.txt
  40. 6 0
      misc/freetype/imgui_freetype.cpp
  41. 3 1
      misc/freetype/imgui_freetype.h

+ 7 - 2
backends/imgui_impl_allegro5.cpp

@@ -47,10 +47,11 @@
 //  2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
 //  2018-02-06: Inputs: Added mapping for ImGuiKey_Space.
 
-#include <stdint.h>     // uint64_t
-#include <cstring>      // memcpy
 #include "imgui.h"
+#ifndef IMGUI_DISABLE
 #include "imgui_impl_allegro5.h"
+#include <stdint.h>     // uint64_t
+#include <cstring>      // memcpy
 
 // Allegro
 #include <allegro5/allegro.h>
@@ -603,3 +604,7 @@ void ImGui_ImplAllegro5_NewFrame()
     // Setup mouse cursor shape
     ImGui_ImplAllegro5_UpdateMouseCursor();
 }
+
+//-----------------------------------------------------------------------------
+
+#endif // #ifndef IMGUI_DISABLE

+ 3 - 0
backends/imgui_impl_allegro5.h

@@ -17,6 +17,7 @@
 
 #pragma once
 #include "imgui.h"      // IMGUI_IMPL_API
+#ifndef IMGUI_DISABLE
 
 struct ALLEGRO_DISPLAY;
 union ALLEGRO_EVENT;
@@ -30,3 +31,5 @@ IMGUI_IMPL_API bool     ImGui_ImplAllegro5_ProcessEvent(ALLEGRO_EVENT* event);
 // Use if you want to reset your rendering device without losing Dear ImGui state.
 IMGUI_IMPL_API bool     ImGui_ImplAllegro5_CreateDeviceObjects();
 IMGUI_IMPL_API void     ImGui_ImplAllegro5_InvalidateDeviceObjects();
+
+#endif // #ifndef IMGUI_DISABLE

+ 5 - 0
backends/imgui_impl_android.cpp

@@ -27,6 +27,7 @@
 //  2021-03-04: Initial version.
 
 #include "imgui.h"
+#ifndef IMGUI_DISABLE
 #include "imgui_impl_android.h"
 #include <time.h>
 #include <android/native_window.h>
@@ -294,3 +295,7 @@ void ImGui_ImplAndroid_NewFrame()
     io.DeltaTime = g_Time > 0.0 ? (float)(current_time - g_Time) : (float)(1.0f / 60.0f);
     g_Time = current_time;
 }
+
+//-----------------------------------------------------------------------------
+
+#endif // #ifndef IMGUI_DISABLE

+ 4 - 0
backends/imgui_impl_android.h

@@ -19,6 +19,8 @@
 // Read online: https://github.com/ocornut/imgui/tree/master/docs
 
 #pragma once
+#include "imgui.h"      // IMGUI_IMPL_API
+#ifndef IMGUI_DISABLE
 
 struct ANativeWindow;
 struct AInputEvent;
@@ -27,3 +29,5 @@ IMGUI_IMPL_API bool     ImGui_ImplAndroid_Init(ANativeWindow* window);
 IMGUI_IMPL_API int32_t  ImGui_ImplAndroid_HandleInputEvent(AInputEvent* input_event);
 IMGUI_IMPL_API void     ImGui_ImplAndroid_Shutdown();
 IMGUI_IMPL_API void     ImGui_ImplAndroid_NewFrame();
+
+#endif // #ifndef IMGUI_DISABLE

+ 5 - 0
backends/imgui_impl_dx10.cpp

@@ -30,6 +30,7 @@
 //  2016-05-07: DirectX10: Disabling depth-write.
 
 #include "imgui.h"
+#ifndef IMGUI_DISABLE
 #include "imgui_impl_dx10.h"
 
 // DirectX
@@ -579,3 +580,7 @@ void ImGui_ImplDX10_NewFrame()
     if (!bd->pFontSampler)
         ImGui_ImplDX10_CreateDeviceObjects();
 }
+
+//-----------------------------------------------------------------------------
+
+#endif // #ifndef IMGUI_DISABLE

+ 4 - 1
backends/imgui_impl_dx10.h

@@ -5,13 +5,14 @@
 //  [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID!
 //  [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices.
 
-// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 
+// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
 // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
 // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
 // Read online: https://github.com/ocornut/imgui/tree/master/docs
 
 #pragma once
 #include "imgui.h"      // IMGUI_IMPL_API
+#ifndef IMGUI_DISABLE
 
 struct ID3D10Device;
 
@@ -23,3 +24,5 @@ IMGUI_IMPL_API void     ImGui_ImplDX10_RenderDrawData(ImDrawData* draw_data);
 // Use if you want to reset your rendering device without losing Dear ImGui state.
 IMGUI_IMPL_API void     ImGui_ImplDX10_InvalidateDeviceObjects();
 IMGUI_IMPL_API bool     ImGui_ImplDX10_CreateDeviceObjects();
+
+#endif // #ifndef IMGUI_DISABLE

+ 5 - 0
backends/imgui_impl_dx11.cpp

@@ -31,6 +31,7 @@
 //  2016-05-07: DirectX11: Disabling depth-write.
 
 #include "imgui.h"
+#ifndef IMGUI_DISABLE
 #include "imgui_impl_dx11.h"
 
 // DirectX
@@ -595,3 +596,7 @@ void ImGui_ImplDX11_NewFrame()
     if (!bd->pFontSampler)
         ImGui_ImplDX11_CreateDeviceObjects();
 }
+
+//-----------------------------------------------------------------------------
+
+#endif // #ifndef IMGUI_DISABLE

+ 4 - 1
backends/imgui_impl_dx11.h

@@ -5,13 +5,14 @@
 //  [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID!
 //  [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices.
 
-// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 
+// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
 // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
 // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
 // Read online: https://github.com/ocornut/imgui/tree/master/docs
 
 #pragma once
 #include "imgui.h"      // IMGUI_IMPL_API
+#ifndef IMGUI_DISABLE
 
 struct ID3D11Device;
 struct ID3D11DeviceContext;
@@ -24,3 +25,5 @@ IMGUI_IMPL_API void     ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data);
 // Use if you want to reset your rendering device without losing Dear ImGui state.
 IMGUI_IMPL_API void     ImGui_ImplDX11_InvalidateDeviceObjects();
 IMGUI_IMPL_API bool     ImGui_ImplDX11_CreateDeviceObjects();
+
+#endif // #ifndef IMGUI_DISABLE

+ 5 - 0
backends/imgui_impl_dx12.cpp

@@ -39,6 +39,7 @@
 //  2018-02-22: Merged into master with all Win32 code synchronized to other examples.
 
 #include "imgui.h"
+#ifndef IMGUI_DISABLE
 #include "imgui_impl_dx12.h"
 
 // DirectX
@@ -751,3 +752,7 @@ void ImGui_ImplDX12_NewFrame()
     if (!bd->pPipelineState)
         ImGui_ImplDX12_CreateDeviceObjects();
 }
+
+//-----------------------------------------------------------------------------
+
+#endif // #ifndef IMGUI_DISABLE

+ 3 - 0
backends/imgui_impl_dx12.h

@@ -15,6 +15,7 @@
 
 #pragma once
 #include "imgui.h"      // IMGUI_IMPL_API
+#ifndef IMGUI_DISABLE
 #include <dxgiformat.h> // DXGI_FORMAT
 
 struct ID3D12Device;
@@ -36,3 +37,5 @@ IMGUI_IMPL_API void     ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3
 // Use if you want to reset your rendering device without losing Dear ImGui state.
 IMGUI_IMPL_API void     ImGui_ImplDX12_InvalidateDeviceObjects();
 IMGUI_IMPL_API bool     ImGui_ImplDX12_CreateDeviceObjects();
+
+#endif // #ifndef IMGUI_DISABLE

+ 5 - 0
backends/imgui_impl_dx9.cpp

@@ -32,6 +32,7 @@
 //  2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
 
 #include "imgui.h"
+#ifndef IMGUI_DISABLE
 #include "imgui_impl_dx9.h"
 
 // DirectX
@@ -378,3 +379,7 @@ void ImGui_ImplDX9_NewFrame()
     if (!bd->FontTexture)
         ImGui_ImplDX9_CreateDeviceObjects();
 }
+
+//-----------------------------------------------------------------------------
+
+#endif // #ifndef IMGUI_DISABLE

+ 4 - 1
backends/imgui_impl_dx9.h

@@ -5,13 +5,14 @@
 //  [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID!
 //  [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices.
 
-// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 
+// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
 // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
 // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
 // Read online: https://github.com/ocornut/imgui/tree/master/docs
 
 #pragma once
 #include "imgui.h"      // IMGUI_IMPL_API
+#ifndef IMGUI_DISABLE
 
 struct IDirect3DDevice9;
 
@@ -23,3 +24,5 @@ IMGUI_IMPL_API void     ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data);
 // Use if you want to reset your rendering device without losing Dear ImGui state.
 IMGUI_IMPL_API bool     ImGui_ImplDX9_CreateDeviceObjects();
 IMGUI_IMPL_API void     ImGui_ImplDX9_InvalidateDeviceObjects();
+
+#endif // #ifndef IMGUI_DISABLE

+ 5 - 0
backends/imgui_impl_glfw.cpp

@@ -64,6 +64,7 @@
 //  2016-10-15: Misc: Added a void* user_data parameter to Clipboard function handlers.
 
 #include "imgui.h"
+#ifndef IMGUI_DISABLE
 #include "imgui_impl_glfw.h"
 
 // Clang warnings with -Weverything
@@ -795,6 +796,10 @@ void ImGui_ImplGlfw_NewFrame()
     ImGui_ImplGlfw_UpdateGamepads();
 }
 
+//-----------------------------------------------------------------------------
+
 #if defined(__clang__)
 #pragma clang diagnostic pop
 #endif
+
+#endif // #ifndef IMGUI_DISABLE

+ 3 - 0
backends/imgui_impl_glfw.h

@@ -16,6 +16,7 @@
 
 #pragma once
 #include "imgui.h"      // IMGUI_IMPL_API
+#ifndef IMGUI_DISABLE
 
 struct GLFWwindow;
 struct GLFWmonitor;
@@ -45,3 +46,5 @@ IMGUI_IMPL_API void     ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double
 IMGUI_IMPL_API void     ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
 IMGUI_IMPL_API void     ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c);
 IMGUI_IMPL_API void     ImGui_ImplGlfw_MonitorCallback(GLFWmonitor* monitor, int event);
+
+#endif // #ifndef IMGUI_DISABLE

+ 5 - 0
backends/imgui_impl_glut.cpp

@@ -32,6 +32,7 @@
 //  2018-03-22: Added GLUT Platform binding.
 
 #include "imgui.h"
+#ifndef IMGUI_DISABLE
 #include "imgui_impl_glut.h"
 #define GL_SILENCE_DEPRECATION
 #ifdef __APPLE__
@@ -298,3 +299,7 @@ void ImGui_ImplGLUT_MotionFunc(int x, int y)
     ImGuiIO& io = ImGui::GetIO();
     io.AddMousePosEvent((float)x, (float)y);
 }
+
+//-----------------------------------------------------------------------------
+
+#endif // #ifndef IMGUI_DISABLE

+ 4 - 1
backends/imgui_impl_glut.h

@@ -20,6 +20,7 @@
 // Read online: https://github.com/ocornut/imgui/tree/master/docs
 
 #pragma once
+#ifndef IMGUI_DISABLE
 #include "imgui.h"      // IMGUI_IMPL_API
 
 IMGUI_IMPL_API bool     ImGui_ImplGLUT_Init();
@@ -29,7 +30,7 @@ IMGUI_IMPL_API void     ImGui_ImplGLUT_NewFrame();
 
 // You can call ImGui_ImplGLUT_InstallFuncs() to get all those functions installed automatically,
 // or call them yourself from your own GLUT handlers. We are using the same weird names as GLUT for consistency..
-//---------------------------------------- GLUT name --------------------------------------------- Decent Name ---------
+//------------------------------------ GLUT name ---------------------------------------------- Decent Name ---------
 IMGUI_IMPL_API void     ImGui_ImplGLUT_ReshapeFunc(int w, int h);                           // ~ ResizeFunc
 IMGUI_IMPL_API void     ImGui_ImplGLUT_MotionFunc(int x, int y);                            // ~ MouseMoveFunc
 IMGUI_IMPL_API void     ImGui_ImplGLUT_MouseFunc(int button, int state, int x, int y);      // ~ MouseButtonFunc
@@ -38,3 +39,5 @@ IMGUI_IMPL_API void     ImGui_ImplGLUT_KeyboardFunc(unsigned char c, int x, int
 IMGUI_IMPL_API void     ImGui_ImplGLUT_KeyboardUpFunc(unsigned char c, int x, int y);       // ~ CharReleasedFunc
 IMGUI_IMPL_API void     ImGui_ImplGLUT_SpecialFunc(int key, int x, int y);                  // ~ KeyPressedFunc
 IMGUI_IMPL_API void     ImGui_ImplGLUT_SpecialUpFunc(int key, int x, int y);                // ~ KeyReleasedFunc
+
+#endif // #ifndef IMGUI_DISABLE

+ 6 - 1
backends/imgui_impl_metal.h

@@ -5,12 +5,13 @@
 //  [X] Renderer: User texture binding. Use 'MTLTexture' as ImTextureID. Read the FAQ about ImTextureID!
 //  [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices.
 
-// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 
+// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
 // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
 // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
 // Read online: https://github.com/ocornut/imgui/tree/master/docs
 
 #include "imgui.h"      // IMGUI_IMPL_API
+#ifndef IMGUI_DISABLE
 
 //-----------------------------------------------------------------------------
 // ObjC API
@@ -62,3 +63,7 @@ IMGUI_IMPL_API void ImGui_ImplMetal_DestroyDeviceObjects();
 
 #endif
 #endif
+
+//-----------------------------------------------------------------------------
+
+#endif // #ifndef IMGUI_DISABLE

+ 5 - 0
backends/imgui_impl_metal.mm

@@ -30,6 +30,7 @@
 //  2018-07-05: Metal: Added new Metal backend implementation.
 
 #include "imgui.h"
+#ifndef IMGUI_DISABLE
 #include "imgui_impl_metal.h"
 #import <time.h>
 #import <Metal/Metal.h>
@@ -580,3 +581,7 @@ void ImGui_ImplMetal_DestroyDeviceObjects()
 }
 
 @end
+
+//-----------------------------------------------------------------------------
+
+#endif // #ifndef IMGUI_DISABLE

+ 5 - 0
backends/imgui_impl_opengl2.cpp

@@ -37,6 +37,7 @@
 //  2016-09-05: OpenGL: Fixed save and restore of current scissor rectangle.
 
 #include "imgui.h"
+#ifndef IMGUI_DISABLE
 #include "imgui_impl_opengl2.h"
 #if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
 #include <stddef.h>     // intptr_t
@@ -293,6 +294,10 @@ void    ImGui_ImplOpenGL2_DestroyDeviceObjects()
     ImGui_ImplOpenGL2_DestroyFontsTexture();
 }
 
+//-----------------------------------------------------------------------------
+
 #if defined(__clang__)
 #pragma clang diagnostic pop
 #endif
+
+#endif // #ifndef IMGUI_DISABLE

+ 4 - 1
backends/imgui_impl_opengl2.h

@@ -4,7 +4,7 @@
 // Implemented features:
 //  [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID!
 
-// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 
+// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
 // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
 // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
 // Read online: https://github.com/ocornut/imgui/tree/master/docs
@@ -19,6 +19,7 @@
 
 #pragma once
 #include "imgui.h"      // IMGUI_IMPL_API
+#ifndef IMGUI_DISABLE
 
 IMGUI_IMPL_API bool     ImGui_ImplOpenGL2_Init();
 IMGUI_IMPL_API void     ImGui_ImplOpenGL2_Shutdown();
@@ -30,3 +31,5 @@ IMGUI_IMPL_API bool     ImGui_ImplOpenGL2_CreateFontsTexture();
 IMGUI_IMPL_API void     ImGui_ImplOpenGL2_DestroyFontsTexture();
 IMGUI_IMPL_API bool     ImGui_ImplOpenGL2_CreateDeviceObjects();
 IMGUI_IMPL_API void     ImGui_ImplOpenGL2_DestroyDeviceObjects();
+
+#endif // #ifndef IMGUI_DISABLE

+ 5 - 0
backends/imgui_impl_opengl3.cpp

@@ -104,6 +104,7 @@
 #endif
 
 #include "imgui.h"
+#ifndef IMGUI_DISABLE
 #include "imgui_impl_opengl3.h"
 #include <stdio.h>
 #if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
@@ -933,9 +934,13 @@ void    ImGui_ImplOpenGL3_DestroyDeviceObjects()
     ImGui_ImplOpenGL3_DestroyFontsTexture();
 }
 
+//-----------------------------------------------------------------------------
+
 #if defined(__GNUC__)
 #pragma GCC diagnostic pop
 #endif
 #if defined(__clang__)
 #pragma clang diagnostic pop
 #endif
+
+#endif // #ifndef IMGUI_DISABLE

+ 3 - 0
backends/imgui_impl_opengl3.h

@@ -24,6 +24,7 @@
 
 #pragma once
 #include "imgui.h"      // IMGUI_IMPL_API
+#ifndef IMGUI_DISABLE
 
 // Backend API
 IMGUI_IMPL_API bool     ImGui_ImplOpenGL3_Init(const char* glsl_version = nullptr);
@@ -58,3 +59,5 @@ IMGUI_IMPL_API void     ImGui_ImplOpenGL3_DestroyDeviceObjects();
 #endif
 
 #endif
+
+#endif // #ifndef IMGUI_DISABLE

+ 3 - 0
backends/imgui_impl_osx.h

@@ -17,6 +17,7 @@
 // Read online: https://github.com/ocornut/imgui/tree/master/docs
 
 #include "imgui.h"      // IMGUI_IMPL_API
+#ifndef IMGUI_DISABLE
 
 #ifdef __OBJC__
 
@@ -43,3 +44,5 @@ IMGUI_IMPL_API void     ImGui_ImplOSX_NewFrame(void* _Nullable view);
 
 #endif
 #endif
+
+#endif // #ifndef IMGUI_DISABLE

+ 5 - 0
backends/imgui_impl_osx.mm

@@ -17,6 +17,7 @@
 // Read online: https://github.com/ocornut/imgui/tree/master/docs
 
 #import "imgui.h"
+#ifndef IMGUI_DISABLE
 #import "imgui_impl_osx.h"
 #import <Cocoa/Cocoa.h>
 #import <Carbon/Carbon.h>
@@ -801,3 +802,7 @@ static void ImGui_ImplOSX_AddTrackingArea(NSView* _Nonnull view)
         return event;
     }];
 }
+
+//-----------------------------------------------------------------------------
+
+#endif // #ifndef IMGUI_DISABLE

+ 5 - 0
backends/imgui_impl_sdl2.cpp

@@ -73,6 +73,7 @@
 //  2016-10-15: Misc: Added a void* user_data parameter to Clipboard function handlers.
 
 #include "imgui.h"
+#ifndef IMGUI_DISABLE
 #include "imgui_impl_sdl2.h"
 
 // Clang warnings with -Weverything
@@ -641,6 +642,10 @@ void ImGui_ImplSDL2_NewFrame()
     ImGui_ImplSDL2_UpdateGamepads();
 }
 
+//-----------------------------------------------------------------------------
+
 #if defined(__clang__)
 #pragma clang diagnostic pop
 #endif
+
+#endif // #ifndef IMGUI_DISABLE

+ 3 - 0
backends/imgui_impl_sdl2.h

@@ -17,6 +17,7 @@
 
 #pragma once
 #include "imgui.h"      // IMGUI_IMPL_API
+#ifndef IMGUI_DISABLE
 
 struct SDL_Window;
 struct SDL_Renderer;
@@ -34,3 +35,5 @@ IMGUI_IMPL_API bool     ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event);
 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
 static inline void ImGui_ImplSDL2_NewFrame(SDL_Window*) { ImGui_ImplSDL2_NewFrame(); } // 1.84: removed unnecessary parameter
 #endif
+
+#endif // #ifndef IMGUI_DISABLE

+ 4 - 0
backends/imgui_impl_sdl3.cpp

@@ -26,6 +26,7 @@
 //  2023-02-07: Forked "imgui_impl_sdl2" into "imgui_impl_sdl3". Removed version checks for old feature. Refer to imgui_impl_sdl2.cpp for older changelog.
 
 #include "imgui.h"
+#ifndef IMGUI_DISABLE
 #include "imgui_impl_sdl3.h"
 
 // Clang warnings with -Weverything
@@ -576,7 +577,10 @@ void ImGui_ImplSDL3_NewFrame()
     ImGui_ImplSDL3_UpdateGamepads();
 }
 
+//-----------------------------------------------------------------------------
+
 #if defined(__clang__)
 #pragma clang diagnostic pop
 #endif
 
+#endif // #ifndef IMGUI_DISABLE

+ 3 - 0
backends/imgui_impl_sdl3.h

@@ -19,6 +19,7 @@
 
 #pragma once
 #include "imgui.h"      // IMGUI_IMPL_API
+#ifndef IMGUI_DISABLE
 
 struct SDL_Window;
 struct SDL_Renderer;
@@ -32,3 +33,5 @@ IMGUI_IMPL_API bool     ImGui_ImplSDL3_InitForSDLRenderer(SDL_Window* window, SD
 IMGUI_IMPL_API void     ImGui_ImplSDL3_Shutdown();
 IMGUI_IMPL_API void     ImGui_ImplSDL3_NewFrame();
 IMGUI_IMPL_API bool     ImGui_ImplSDL3_ProcessEvent(const SDL_Event* event);
+
+#endif // #ifndef IMGUI_DISABLE

+ 5 - 0
backends/imgui_impl_sdlrenderer2.cpp

@@ -24,6 +24,7 @@
 //  2021-09-21: Initial version.
 
 #include "imgui.h"
+#ifndef IMGUI_DISABLE
 #include "imgui_impl_sdlrenderer2.h"
 #if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
 #include <stddef.h>     // intptr_t
@@ -256,6 +257,10 @@ void ImGui_ImplSDLRenderer2_DestroyDeviceObjects()
     ImGui_ImplSDLRenderer2_DestroyFontsTexture();
 }
 
+//-----------------------------------------------------------------------------
+
 #if defined(__clang__)
 #pragma clang diagnostic pop
 #endif
+
+#endif // #ifndef IMGUI_DISABLE

+ 3 - 0
backends/imgui_impl_sdlrenderer2.h

@@ -12,6 +12,7 @@
 //  [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices.
 
 #pragma once
+#ifndef IMGUI_DISABLE
 #include "imgui.h"      // IMGUI_IMPL_API
 
 struct SDL_Renderer;
@@ -26,3 +27,5 @@ IMGUI_IMPL_API bool     ImGui_ImplSDLRenderer2_CreateFontsTexture();
 IMGUI_IMPL_API void     ImGui_ImplSDLRenderer2_DestroyFontsTexture();
 IMGUI_IMPL_API bool     ImGui_ImplSDLRenderer2_CreateDeviceObjects();
 IMGUI_IMPL_API void     ImGui_ImplSDLRenderer2_DestroyDeviceObjects();
+
+#endif // #ifndef IMGUI_DISABLE

+ 5 - 0
backends/imgui_impl_sdlrenderer3.cpp

@@ -19,6 +19,7 @@
 //  2023-05-30: Initial version.
 
 #include "imgui.h"
+#ifndef IMGUI_DISABLE
 #include "imgui_impl_sdlrenderer3.h"
 #if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
 #include <stddef.h>     // intptr_t
@@ -251,6 +252,10 @@ void ImGui_ImplSDLRenderer3_DestroyDeviceObjects()
     ImGui_ImplSDLRenderer3_DestroyFontsTexture();
 }
 
+//-----------------------------------------------------------------------------
+
 #if defined(__clang__)
 #pragma clang diagnostic pop
 #endif
+
+#endif // #ifndef IMGUI_DISABLE

+ 3 - 0
backends/imgui_impl_sdlrenderer3.h

@@ -13,6 +13,7 @@
 
 #pragma once
 #include "imgui.h"      // IMGUI_IMPL_API
+#ifndef IMGUI_DISABLE
 
 struct SDL_Renderer;
 
@@ -26,3 +27,5 @@ IMGUI_IMPL_API bool     ImGui_ImplSDLRenderer3_CreateFontsTexture();
 IMGUI_IMPL_API void     ImGui_ImplSDLRenderer3_DestroyFontsTexture();
 IMGUI_IMPL_API bool     ImGui_ImplSDLRenderer3_CreateDeviceObjects();
 IMGUI_IMPL_API void     ImGui_ImplSDLRenderer3_DestroyDeviceObjects();
+
+#endif // #ifndef IMGUI_DISABLE

+ 6 - 0
backends/imgui_impl_vulkan.cpp

@@ -66,6 +66,8 @@
 //  2016-10-18: Vulkan: Add location decorators & change to use structs as in/out in glsl, update embedded spv (produced with glslangValidator -x). Null the released resources.
 //  2016-08-27: Vulkan: Fix Vulkan example for use when a depth buffer is active.
 
+#include "imgui.h"
+#ifndef IMGUI_DISABLE
 #include "imgui_impl_vulkan.h"
 #include <stdio.h>
 
@@ -1493,3 +1495,7 @@ void ImGui_ImplVulkanH_DestroyWindowRenderBuffers(VkDevice device, ImGui_ImplVul
     buffers->Index = 0;
     buffers->Count = 0;
 }
+
+//-----------------------------------------------------------------------------
+
+#endif // #ifndef IMGUI_DISABLE

+ 2 - 0
backends/imgui_impl_vulkan.h

@@ -24,6 +24,7 @@
 // Read comments in imgui_impl_vulkan.h.
 
 #pragma once
+#ifndef IMGUI_DISABLE
 #include "imgui.h"      // IMGUI_IMPL_API
 
 // [Configuration] in order to use a custom Vulkan function loader:
@@ -162,3 +163,4 @@ struct ImGui_ImplVulkanH_Window
     }
 };
 
+#endif // #ifndef IMGUI_DISABLE

+ 5 - 0
backends/imgui_impl_wgpu.cpp

@@ -28,6 +28,7 @@
 //  2021-01-28: Initial version.
 
 #include "imgui.h"
+#ifndef IMGUI_DISABLE
 #include "imgui_impl_wgpu.h"
 #include <limits.h>
 #include <webgpu/webgpu.h>
@@ -761,3 +762,7 @@ void ImGui_ImplWGPU_NewFrame()
     if (!bd->pipelineState)
         ImGui_ImplWGPU_CreateDeviceObjects();
 }
+
+//-----------------------------------------------------------------------------
+
+#endif // #ifndef IMGUI_DISABLE

+ 4 - 0
backends/imgui_impl_wgpu.h

@@ -13,6 +13,8 @@
 
 #pragma once
 #include "imgui.h"          // IMGUI_IMPL_API
+#ifndef IMGUI_DISABLE
+
 #include <webgpu/webgpu.h>
 
 IMGUI_IMPL_API bool ImGui_ImplWGPU_Init(WGPUDevice device, int num_frames_in_flight, WGPUTextureFormat rt_format, WGPUTextureFormat depth_format = WGPUTextureFormat_Undefined);
@@ -23,3 +25,5 @@ IMGUI_IMPL_API void ImGui_ImplWGPU_RenderDrawData(ImDrawData* draw_data, WGPURen
 // Use if you want to reset your rendering device without losing Dear ImGui state.
 IMGUI_IMPL_API void ImGui_ImplWGPU_InvalidateDeviceObjects();
 IMGUI_IMPL_API bool ImGui_ImplWGPU_CreateDeviceObjects();
+
+#endif // #ifndef IMGUI_DISABLE

+ 3 - 0
backends/imgui_impl_win32.cpp

@@ -14,6 +14,7 @@
 // Read online: https://github.com/ocornut/imgui/tree/master/docs
 
 #include "imgui.h"
+#ifndef IMGUI_DISABLE
 #include "imgui_impl_win32.h"
 #ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN
@@ -859,3 +860,5 @@ void ImGui_ImplWin32_EnableAlphaCompositing(void* hwnd)
 }
 
 //---------------------------------------------------------------------------------------------------------
+
+#endif // #ifndef IMGUI_DISABLE

+ 3 - 0
backends/imgui_impl_win32.h

@@ -15,6 +15,7 @@
 
 #pragma once
 #include "imgui.h"      // IMGUI_IMPL_API
+#ifndef IMGUI_DISABLE
 
 IMGUI_IMPL_API bool     ImGui_ImplWin32_Init(void* hwnd);
 IMGUI_IMPL_API bool     ImGui_ImplWin32_InitForOpenGL(void* hwnd);
@@ -44,3 +45,5 @@ IMGUI_IMPL_API float    ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor); //
 // - Use to enable alpha compositing transparency with the desktop.
 // - Use together with e.g. clearing your framebuffer with zero-alpha.
 IMGUI_IMPL_API void     ImGui_ImplWin32_EnableAlphaCompositing(void* hwnd);   // HWND hwnd
+
+#endif // #ifndef IMGUI_DISABLE

+ 1 - 0
docs/CHANGELOG.txt

@@ -70,6 +70,7 @@ Other changes:
   desirable behavior.
 - Demo: Better showcase use of SetNextItemAllowOverlap(). (#6574, #6512, #3909, #517)
 - Demo: Showcase a few more InputText() flags.
+- Backends: Made all backends sources files support global IMGUI_DISABLE. (#6601)
 
 
 -----------------------------------------------------------------------

+ 6 - 0
misc/freetype/imgui_freetype.cpp

@@ -33,6 +33,8 @@
 
 // FIXME: cfg.OversampleH, OversampleV are not supported (but perhaps not so necessary with this rasterizer).
 
+#include "imgui.h"
+#ifndef IMGUI_DISABLE
 #include "imgui_freetype.h"
 #include "imgui_internal.h"     // ImMin,ImMax,ImFontAtlasBuild*,
 #include <stdint.h>
@@ -788,6 +790,8 @@ void ImGuiFreeType::SetAllocatorFunctions(void* (*alloc_func)(size_t sz, void* u
     GImGuiFreeTypeAllocatorUserData = user_data;
 }
 
+//-----------------------------------------------------------------------------
+
 #ifdef __GNUC__
 #pragma GCC diagnostic pop
 #endif
@@ -795,3 +799,5 @@ void ImGuiFreeType::SetAllocatorFunctions(void* (*alloc_func)(size_t sz, void* u
 #ifdef _MSC_VER
 #pragma warning (pop)
 #endif
+
+#endif // #ifndef IMGUI_DISABLE

+ 3 - 1
misc/freetype/imgui_freetype.h

@@ -2,8 +2,8 @@
 // (headers)
 
 #pragma once
-
 #include "imgui.h"      // IMGUI_API
+#ifndef IMGUI_DISABLE
 
 // Forward declarations
 struct ImFontAtlas;
@@ -48,3 +48,5 @@ namespace ImGuiFreeType
     static inline bool BuildFontAtlas(ImFontAtlas* atlas, unsigned int flags = 0) { atlas->FontBuilderIO = GetBuilderForFreeType(); atlas->FontBuilderFlags = flags; return atlas->Build(); }
 #endif
 }
+
+#endif // #ifndef IMGUI_DISABLE