From 00927105ba6b14f6d05a651b316428a8342fb4d3 Mon Sep 17 00:00:00 2001 From: OmarEmaraDev Date: Mon, 6 Apr 2020 20:23:57 +0200 Subject: [PATCH] Backends: Include imgui.h in implementation headers. (#3105) Currently, the implementation headers don't include the imgui.h header. Which means that the compilation will fail if the implementation header was included before the imgui.h header in the compilation unit. For instance, a compilation unit with the following will work: #include "imgui.h" #include "imgui_impl_glfw.h" #include "imgui_impl_opengl3.h" But a compilation unit with the following will fail because IMGUI_IMPL_API and possibly other symbols will not be defined: #include "imgui_impl_glfw.h" #include "imgui_impl_opengl3.h" #include "imgui.h" This patch includes imgui.h in the implementation headers to make inclusions order-invariant, which is a recommended practice. --- examples/imgui_impl_allegro5.h | 2 ++ examples/imgui_impl_dx10.h | 2 ++ examples/imgui_impl_dx11.h | 2 ++ examples/imgui_impl_dx12.h | 2 ++ examples/imgui_impl_dx9.h | 2 ++ examples/imgui_impl_glfw.h | 2 ++ examples/imgui_impl_glut.h | 2 ++ examples/imgui_impl_marmalade.h | 2 ++ examples/imgui_impl_metal.h | 2 ++ examples/imgui_impl_opengl2.h | 2 ++ examples/imgui_impl_opengl3.h | 2 ++ examples/imgui_impl_osx.h | 2 ++ examples/imgui_impl_sdl.h | 2 ++ examples/imgui_impl_vulkan.h | 1 + examples/imgui_impl_win32.h | 2 ++ 15 files changed, 29 insertions(+) diff --git a/examples/imgui_impl_allegro5.h b/examples/imgui_impl_allegro5.h index 8b9a47d1..c105fea6 100644 --- a/examples/imgui_impl_allegro5.h +++ b/examples/imgui_impl_allegro5.h @@ -15,6 +15,8 @@ #pragma once +#include "imgui.h" + struct ALLEGRO_DISPLAY; union ALLEGRO_EVENT; diff --git a/examples/imgui_impl_dx10.h b/examples/imgui_impl_dx10.h index 85281d79..341bd7df 100644 --- a/examples/imgui_impl_dx10.h +++ b/examples/imgui_impl_dx10.h @@ -11,6 +11,8 @@ #pragma once +#include "imgui.h" + struct ID3D10Device; IMGUI_IMPL_API bool ImGui_ImplDX10_Init(ID3D10Device* device); diff --git a/examples/imgui_impl_dx11.h b/examples/imgui_impl_dx11.h index c54d4379..d7351644 100644 --- a/examples/imgui_impl_dx11.h +++ b/examples/imgui_impl_dx11.h @@ -11,6 +11,8 @@ #pragma once +#include "imgui.h" + struct ID3D11Device; struct ID3D11DeviceContext; diff --git a/examples/imgui_impl_dx12.h b/examples/imgui_impl_dx12.h index 8f307dc5..df95b205 100644 --- a/examples/imgui_impl_dx12.h +++ b/examples/imgui_impl_dx12.h @@ -13,6 +13,8 @@ #pragma once +#include "imgui.h" + enum DXGI_FORMAT; struct ID3D12Device; struct ID3D12DescriptorHeap; diff --git a/examples/imgui_impl_dx9.h b/examples/imgui_impl_dx9.h index b36e95b2..f630eeaa 100644 --- a/examples/imgui_impl_dx9.h +++ b/examples/imgui_impl_dx9.h @@ -11,6 +11,8 @@ #pragma once +#include "imgui.h" + struct IDirect3DDevice9; IMGUI_IMPL_API bool ImGui_ImplDX9_Init(IDirect3DDevice9* device); diff --git a/examples/imgui_impl_glfw.h b/examples/imgui_impl_glfw.h index a86790b7..f7f6f8c2 100644 --- a/examples/imgui_impl_glfw.h +++ b/examples/imgui_impl_glfw.h @@ -18,6 +18,8 @@ #pragma once +#include "imgui.h" + struct GLFWwindow; IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks); diff --git a/examples/imgui_impl_glut.h b/examples/imgui_impl_glut.h index 0c561207..68326dce 100644 --- a/examples/imgui_impl_glut.h +++ b/examples/imgui_impl_glut.h @@ -17,6 +17,8 @@ #pragma once +#include "imgui.h" + IMGUI_IMPL_API bool ImGui_ImplGLUT_Init(); IMGUI_IMPL_API void ImGui_ImplGLUT_InstallFuncs(); IMGUI_IMPL_API void ImGui_ImplGLUT_Shutdown(); diff --git a/examples/imgui_impl_marmalade.h b/examples/imgui_impl_marmalade.h index 01fbd0d2..6ff1cc23 100644 --- a/examples/imgui_impl_marmalade.h +++ b/examples/imgui_impl_marmalade.h @@ -10,6 +10,8 @@ #pragma once +#include "imgui.h" + IMGUI_IMPL_API bool ImGui_Marmalade_Init(bool install_callbacks); IMGUI_IMPL_API void ImGui_Marmalade_Shutdown(); IMGUI_IMPL_API void ImGui_Marmalade_NewFrame(); diff --git a/examples/imgui_impl_metal.h b/examples/imgui_impl_metal.h index f09a115d..bf43ef66 100644 --- a/examples/imgui_impl_metal.h +++ b/examples/imgui_impl_metal.h @@ -9,6 +9,8 @@ // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. // https://github.com/ocornut/imgui +#include "imgui.h" + @class MTLRenderPassDescriptor; @protocol MTLDevice, MTLCommandBuffer, MTLRenderCommandEncoder; diff --git a/examples/imgui_impl_opengl2.h b/examples/imgui_impl_opengl2.h index 009052d7..4e0185fc 100644 --- a/examples/imgui_impl_opengl2.h +++ b/examples/imgui_impl_opengl2.h @@ -18,6 +18,8 @@ #pragma once +#include "imgui.h" + IMGUI_IMPL_API bool ImGui_ImplOpenGL2_Init(); IMGUI_IMPL_API void ImGui_ImplOpenGL2_Shutdown(); IMGUI_IMPL_API void ImGui_ImplOpenGL2_NewFrame(); diff --git a/examples/imgui_impl_opengl3.h b/examples/imgui_impl_opengl3.h index a9a1e199..9a651dc4 100644 --- a/examples/imgui_impl_opengl3.h +++ b/examples/imgui_impl_opengl3.h @@ -23,6 +23,8 @@ #pragma once +#include "imgui.h" + // Backend API IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL); IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown(); diff --git a/examples/imgui_impl_osx.h b/examples/imgui_impl_osx.h index fe066eec..52b44a6d 100644 --- a/examples/imgui_impl_osx.h +++ b/examples/imgui_impl_osx.h @@ -8,6 +8,8 @@ // Issues: // [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters].. +#include "imgui.h" + @class NSEvent; @class NSView; diff --git a/examples/imgui_impl_sdl.h b/examples/imgui_impl_sdl.h index a672ca83..ae2261d5 100644 --- a/examples/imgui_impl_sdl.h +++ b/examples/imgui_impl_sdl.h @@ -16,6 +16,8 @@ #pragma once +#include "imgui.h" + struct SDL_Window; typedef union SDL_Event SDL_Event; diff --git a/examples/imgui_impl_vulkan.h b/examples/imgui_impl_vulkan.h index a74cdb5a..ce02b4c2 100644 --- a/examples/imgui_impl_vulkan.h +++ b/examples/imgui_impl_vulkan.h @@ -22,6 +22,7 @@ #pragma once +#include "imgui.h" #include // Initialization data, for ImGui_ImplVulkan_Init() diff --git a/examples/imgui_impl_win32.h b/examples/imgui_impl_win32.h index 41bae701..328a3724 100644 --- a/examples/imgui_impl_win32.h +++ b/examples/imgui_impl_win32.h @@ -9,6 +9,8 @@ #pragma once +#include "imgui.h" + IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd); IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown(); IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame();