Backends: changed all backends to allow enabling ImGuiConfigFlags_ViewportsEnable after initialization. (#5371)
This commit is contained in:
parent
fa9277d12d
commit
22503bfe75
@ -83,8 +83,8 @@ static ImGui_ImplDX10_Data* ImGui_ImplDX10_GetBackendData()
|
||||
}
|
||||
|
||||
// Forward Declarations
|
||||
static void ImGui_ImplDX10_InitPlatformInterface();
|
||||
static void ImGui_ImplDX10_ShutdownPlatformInterface();
|
||||
static void ImGui_ImplDX10_InitMultiViewportSupport();
|
||||
static void ImGui_ImplDX10_ShutdownMultiViewportSupport();
|
||||
|
||||
// Functions
|
||||
static void ImGui_ImplDX10_SetupRenderState(ImDrawData* draw_data, ID3D10Device* device)
|
||||
@ -566,8 +566,8 @@ bool ImGui_ImplDX10_Init(ID3D10Device* device)
|
||||
if (pDXGIAdapter) pDXGIAdapter->Release();
|
||||
bd->pd3dDevice->AddRef();
|
||||
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
ImGui_ImplDX10_InitPlatformInterface();
|
||||
ImGui_ImplDX10_InitMultiViewportSupport();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -577,7 +577,7 @@ void ImGui_ImplDX10_Shutdown()
|
||||
IM_ASSERT(bd != nullptr && "No renderer backend to shutdown, or already shutdown?");
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
ImGui_ImplDX10_ShutdownPlatformInterface();
|
||||
ImGui_ImplDX10_ShutdownMultiViewportSupport();
|
||||
ImGui_ImplDX10_InvalidateDeviceObjects();
|
||||
if (bd->pFactory) { bd->pFactory->Release(); }
|
||||
if (bd->pd3dDevice) { bd->pd3dDevice->Release(); }
|
||||
@ -704,7 +704,7 @@ static void ImGui_ImplDX10_SwapBuffers(ImGuiViewport* viewport, void*)
|
||||
vd->SwapChain->Present(0, 0); // Present without vsync
|
||||
}
|
||||
|
||||
void ImGui_ImplDX10_InitPlatformInterface()
|
||||
void ImGui_ImplDX10_InitMultiViewportSupport()
|
||||
{
|
||||
ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
|
||||
platform_io.Renderer_CreateWindow = ImGui_ImplDX10_CreateWindow;
|
||||
@ -714,7 +714,7 @@ void ImGui_ImplDX10_InitPlatformInterface()
|
||||
platform_io.Renderer_SwapBuffers = ImGui_ImplDX10_SwapBuffers;
|
||||
}
|
||||
|
||||
void ImGui_ImplDX10_ShutdownPlatformInterface()
|
||||
void ImGui_ImplDX10_ShutdownMultiViewportSupport()
|
||||
{
|
||||
ImGui::DestroyPlatformWindows();
|
||||
}
|
||||
|
@ -86,8 +86,8 @@ static ImGui_ImplDX11_Data* ImGui_ImplDX11_GetBackendData()
|
||||
}
|
||||
|
||||
// Forward Declarations
|
||||
static void ImGui_ImplDX11_InitPlatformInterface();
|
||||
static void ImGui_ImplDX11_ShutdownPlatformInterface();
|
||||
static void ImGui_ImplDX11_InitMultiViewportSupport();
|
||||
static void ImGui_ImplDX11_ShutdownMultiViewportSupport();
|
||||
|
||||
// Functions
|
||||
static void ImGui_ImplDX11_SetupRenderState(ImDrawData* draw_data, ID3D11DeviceContext* device_ctx)
|
||||
@ -592,8 +592,7 @@ bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_co
|
||||
bd->pd3dDevice->AddRef();
|
||||
bd->pd3dDeviceContext->AddRef();
|
||||
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
ImGui_ImplDX11_InitPlatformInterface();
|
||||
ImGui_ImplDX11_InitMultiViewportSupport();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -604,7 +603,7 @@ void ImGui_ImplDX11_Shutdown()
|
||||
IM_ASSERT(bd != nullptr && "No renderer backend to shutdown, or already shutdown?");
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
ImGui_ImplDX11_ShutdownPlatformInterface();
|
||||
ImGui_ImplDX11_ShutdownMultiViewportSupport();
|
||||
ImGui_ImplDX11_InvalidateDeviceObjects();
|
||||
if (bd->pFactory) { bd->pFactory->Release(); }
|
||||
if (bd->pd3dDevice) { bd->pd3dDevice->Release(); }
|
||||
@ -732,7 +731,7 @@ static void ImGui_ImplDX11_SwapBuffers(ImGuiViewport* viewport, void*)
|
||||
vd->SwapChain->Present(0, 0); // Present without vsync
|
||||
}
|
||||
|
||||
static void ImGui_ImplDX11_InitPlatformInterface()
|
||||
static void ImGui_ImplDX11_InitMultiViewportSupport()
|
||||
{
|
||||
ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
|
||||
platform_io.Renderer_CreateWindow = ImGui_ImplDX11_CreateWindow;
|
||||
@ -742,7 +741,7 @@ static void ImGui_ImplDX11_InitPlatformInterface()
|
||||
platform_io.Renderer_SwapBuffers = ImGui_ImplDX11_SwapBuffers;
|
||||
}
|
||||
|
||||
static void ImGui_ImplDX11_ShutdownPlatformInterface()
|
||||
static void ImGui_ImplDX11_ShutdownMultiViewportSupport()
|
||||
{
|
||||
ImGui::DestroyPlatformWindows();
|
||||
}
|
||||
|
@ -80,8 +80,8 @@ static ImGui_ImplDX9_Data* ImGui_ImplDX9_GetBackendData()
|
||||
}
|
||||
|
||||
// Forward Declarations
|
||||
static void ImGui_ImplDX9_InitPlatformInterface();
|
||||
static void ImGui_ImplDX9_ShutdownPlatformInterface();
|
||||
static void ImGui_ImplDX9_InitMultiViewportSupport();
|
||||
static void ImGui_ImplDX9_ShutdownMultiViewportSupport();
|
||||
static void ImGui_ImplDX9_CreateDeviceObjectsForPlatformWindows();
|
||||
static void ImGui_ImplDX9_InvalidateDeviceObjectsForPlatformWindows();
|
||||
|
||||
@ -320,8 +320,7 @@ bool ImGui_ImplDX9_Init(IDirect3DDevice9* device)
|
||||
bd->pd3dDevice = device;
|
||||
bd->pd3dDevice->AddRef();
|
||||
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
ImGui_ImplDX9_InitPlatformInterface();
|
||||
ImGui_ImplDX9_InitMultiViewportSupport();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -332,7 +331,7 @@ void ImGui_ImplDX9_Shutdown()
|
||||
IM_ASSERT(bd != nullptr && "No renderer backend to shutdown, or already shutdown?");
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
ImGui_ImplDX9_ShutdownPlatformInterface();
|
||||
ImGui_ImplDX9_ShutdownMultiViewportSupport();
|
||||
ImGui_ImplDX9_InvalidateDeviceObjects();
|
||||
if (bd->pd3dDevice) { bd->pd3dDevice->Release(); }
|
||||
io.BackendRendererName = nullptr;
|
||||
@ -546,7 +545,7 @@ static void ImGui_ImplDX9_SwapBuffers(ImGuiViewport* viewport, void*)
|
||||
IM_ASSERT(SUCCEEDED(hr) || hr == D3DERR_DEVICELOST);
|
||||
}
|
||||
|
||||
static void ImGui_ImplDX9_InitPlatformInterface()
|
||||
static void ImGui_ImplDX9_InitMultiViewportSupport()
|
||||
{
|
||||
ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
|
||||
platform_io.Renderer_CreateWindow = ImGui_ImplDX9_CreateWindow;
|
||||
@ -556,7 +555,7 @@ static void ImGui_ImplDX9_InitPlatformInterface()
|
||||
platform_io.Renderer_SwapBuffers = ImGui_ImplDX9_SwapBuffers;
|
||||
}
|
||||
|
||||
static void ImGui_ImplDX9_ShutdownPlatformInterface()
|
||||
static void ImGui_ImplDX9_ShutdownMultiViewportSupport()
|
||||
{
|
||||
ImGui::DestroyPlatformWindows();
|
||||
}
|
||||
|
@ -211,8 +211,8 @@ static ImGui_ImplGlfw_Data* ImGui_ImplGlfw_GetBackendData()
|
||||
|
||||
// Forward Declarations
|
||||
static void ImGui_ImplGlfw_UpdateMonitors();
|
||||
static void ImGui_ImplGlfw_InitPlatformInterface();
|
||||
static void ImGui_ImplGlfw_ShutdownPlatformInterface();
|
||||
static void ImGui_ImplGlfw_InitMultiViewportSupport();
|
||||
static void ImGui_ImplGlfw_ShutdownMultiViewportSupport();
|
||||
|
||||
// Functions
|
||||
|
||||
@ -668,8 +668,7 @@ static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, Glfw
|
||||
#else
|
||||
IM_UNUSED(main_viewport);
|
||||
#endif
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
ImGui_ImplGlfw_InitPlatformInterface();
|
||||
ImGui_ImplGlfw_InitMultiViewportSupport();
|
||||
|
||||
// Windows: register a WndProc hook so we can intercept some messages.
|
||||
#ifdef _WIN32
|
||||
@ -720,7 +719,7 @@ void ImGui_ImplGlfw_Shutdown()
|
||||
IM_ASSERT(bd != nullptr && "No platform backend to shutdown, or already shutdown?");
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
ImGui_ImplGlfw_ShutdownPlatformInterface();
|
||||
ImGui_ImplGlfw_ShutdownMultiViewportSupport();
|
||||
|
||||
if (bd->InstalledCallbacks)
|
||||
ImGui_ImplGlfw_RestoreCallbacks(bd->Window);
|
||||
@ -1334,7 +1333,7 @@ static int ImGui_ImplGlfw_CreateVkSurface(ImGuiViewport* viewport, ImU64 vk_inst
|
||||
}
|
||||
#endif // GLFW_HAS_VULKAN
|
||||
|
||||
static void ImGui_ImplGlfw_InitPlatformInterface()
|
||||
static void ImGui_ImplGlfw_InitMultiViewportSupport()
|
||||
{
|
||||
// Register platform interface (will be coupled with a renderer interface)
|
||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||
@ -1369,7 +1368,7 @@ static void ImGui_ImplGlfw_InitPlatformInterface()
|
||||
main_viewport->PlatformHandle = (void*)bd->Window;
|
||||
}
|
||||
|
||||
static void ImGui_ImplGlfw_ShutdownPlatformInterface()
|
||||
static void ImGui_ImplGlfw_ShutdownMultiViewportSupport()
|
||||
{
|
||||
ImGui::DestroyPlatformWindows();
|
||||
}
|
||||
|
@ -41,8 +41,8 @@
|
||||
#import <Metal/Metal.h>
|
||||
|
||||
// Forward Declarations
|
||||
static void ImGui_ImplMetal_InitPlatformInterface();
|
||||
static void ImGui_ImplMetal_ShutdownPlatformInterface();
|
||||
static void ImGui_ImplMetal_InitMultiViewportSupport();
|
||||
static void ImGui_ImplMetal_ShutdownMultiViewportSupport();
|
||||
static void ImGui_ImplMetal_CreateDeviceObjectsForPlatformWindows();
|
||||
static void ImGui_ImplMetal_InvalidateDeviceObjectsForPlatformWindows();
|
||||
|
||||
@ -145,8 +145,7 @@ bool ImGui_ImplMetal_Init(id<MTLDevice> device)
|
||||
bd->SharedMetalContext = [[MetalContext alloc] init];
|
||||
bd->SharedMetalContext.device = device;
|
||||
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
ImGui_ImplMetal_InitPlatformInterface();
|
||||
ImGui_ImplMetal_InitMultiViewportSupport();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -155,7 +154,7 @@ void ImGui_ImplMetal_Shutdown()
|
||||
{
|
||||
ImGui_ImplMetal_Data* bd = ImGui_ImplMetal_GetBackendData();
|
||||
IM_ASSERT(bd != nullptr && "No renderer backend to shutdown, or already shutdown?");
|
||||
ImGui_ImplMetal_ShutdownPlatformInterface();
|
||||
ImGui_ImplMetal_ShutdownMultiViewportSupport();
|
||||
ImGui_ImplMetal_DestroyDeviceObjects();
|
||||
ImGui_ImplMetal_DestroyBackendData();
|
||||
|
||||
@ -509,7 +508,7 @@ static void ImGui_ImplMetal_RenderWindow(ImGuiViewport* viewport, void*)
|
||||
[commandBuffer commit];
|
||||
}
|
||||
|
||||
static void ImGui_ImplMetal_InitPlatformInterface()
|
||||
static void ImGui_ImplMetal_InitMultiViewportSupport()
|
||||
{
|
||||
ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
|
||||
platform_io.Renderer_CreateWindow = ImGui_ImplMetal_CreateWindow;
|
||||
@ -518,7 +517,7 @@ static void ImGui_ImplMetal_InitPlatformInterface()
|
||||
platform_io.Renderer_RenderWindow = ImGui_ImplMetal_RenderWindow;
|
||||
}
|
||||
|
||||
static void ImGui_ImplMetal_ShutdownPlatformInterface()
|
||||
static void ImGui_ImplMetal_ShutdownMultiViewportSupport()
|
||||
{
|
||||
ImGui::DestroyPlatformWindows();
|
||||
}
|
||||
|
@ -84,8 +84,8 @@ static ImGui_ImplOpenGL2_Data* ImGui_ImplOpenGL2_GetBackendData()
|
||||
}
|
||||
|
||||
// Forward Declarations
|
||||
static void ImGui_ImplOpenGL2_InitPlatformInterface();
|
||||
static void ImGui_ImplOpenGL2_ShutdownPlatformInterface();
|
||||
static void ImGui_ImplOpenGL2_InitMultiViewportSupport();
|
||||
static void ImGui_ImplOpenGL2_ShutdownMultiViewportSupport();
|
||||
|
||||
// Functions
|
||||
bool ImGui_ImplOpenGL2_Init()
|
||||
@ -100,8 +100,7 @@ bool ImGui_ImplOpenGL2_Init()
|
||||
io.BackendRendererName = "imgui_impl_opengl2";
|
||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional)
|
||||
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
ImGui_ImplOpenGL2_InitPlatformInterface();
|
||||
ImGui_ImplOpenGL2_InitMultiViewportSupport();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -112,7 +111,7 @@ void ImGui_ImplOpenGL2_Shutdown()
|
||||
IM_ASSERT(bd != nullptr && "No renderer backend to shutdown, or already shutdown?");
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
ImGui_ImplOpenGL2_ShutdownPlatformInterface();
|
||||
ImGui_ImplOpenGL2_ShutdownMultiViewportSupport();
|
||||
ImGui_ImplOpenGL2_DestroyDeviceObjects();
|
||||
io.BackendRendererName = nullptr;
|
||||
io.BackendRendererUserData = nullptr;
|
||||
@ -330,13 +329,13 @@ static void ImGui_ImplOpenGL2_RenderWindow(ImGuiViewport* viewport, void*)
|
||||
ImGui_ImplOpenGL2_RenderDrawData(viewport->DrawData);
|
||||
}
|
||||
|
||||
static void ImGui_ImplOpenGL2_InitPlatformInterface()
|
||||
static void ImGui_ImplOpenGL2_InitMultiViewportSupport()
|
||||
{
|
||||
ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
|
||||
platform_io.Renderer_RenderWindow = ImGui_ImplOpenGL2_RenderWindow;
|
||||
}
|
||||
|
||||
static void ImGui_ImplOpenGL2_ShutdownPlatformInterface()
|
||||
static void ImGui_ImplOpenGL2_ShutdownMultiViewportSupport()
|
||||
{
|
||||
ImGui::DestroyPlatformWindows();
|
||||
}
|
||||
|
@ -253,8 +253,8 @@ static ImGui_ImplOpenGL3_Data* ImGui_ImplOpenGL3_GetBackendData()
|
||||
}
|
||||
|
||||
// Forward Declarations
|
||||
static void ImGui_ImplOpenGL3_InitPlatformInterface();
|
||||
static void ImGui_ImplOpenGL3_ShutdownPlatformInterface();
|
||||
static void ImGui_ImplOpenGL3_InitMultiViewportSupport();
|
||||
static void ImGui_ImplOpenGL3_ShutdownMultiViewportSupport();
|
||||
|
||||
// OpenGL vertex attribute state (for ES 1.0 and ES 2.0 only)
|
||||
#ifndef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||
@ -389,8 +389,7 @@ bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
ImGui_ImplOpenGL3_InitPlatformInterface();
|
||||
ImGui_ImplOpenGL3_InitMultiViewportSupport();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -401,7 +400,7 @@ void ImGui_ImplOpenGL3_Shutdown()
|
||||
IM_ASSERT(bd != nullptr && "No renderer backend to shutdown, or already shutdown?");
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
ImGui_ImplOpenGL3_ShutdownPlatformInterface();
|
||||
ImGui_ImplOpenGL3_ShutdownMultiViewportSupport();
|
||||
ImGui_ImplOpenGL3_DestroyDeviceObjects();
|
||||
io.BackendRendererName = nullptr;
|
||||
io.BackendRendererUserData = nullptr;
|
||||
@ -980,13 +979,13 @@ static void ImGui_ImplOpenGL3_RenderWindow(ImGuiViewport* viewport, void*)
|
||||
ImGui_ImplOpenGL3_RenderDrawData(viewport->DrawData);
|
||||
}
|
||||
|
||||
static void ImGui_ImplOpenGL3_InitPlatformInterface()
|
||||
static void ImGui_ImplOpenGL3_InitMultiViewportSupport()
|
||||
{
|
||||
ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
|
||||
platform_io.Renderer_RenderWindow = ImGui_ImplOpenGL3_RenderWindow;
|
||||
}
|
||||
|
||||
static void ImGui_ImplOpenGL3_ShutdownPlatformInterface()
|
||||
static void ImGui_ImplOpenGL3_ShutdownMultiViewportSupport()
|
||||
{
|
||||
ImGui::DestroyPlatformWindows();
|
||||
}
|
||||
|
@ -101,8 +101,8 @@ static void ImGui_ImplOSX_DestroyBackendData() { IM_DELETE(
|
||||
static inline CFTimeInterval GetMachAbsoluteTimeInSeconds() { return (CFTimeInterval)(double)(clock_gettime_nsec_np(CLOCK_UPTIME_RAW) / 1e9); }
|
||||
|
||||
// Forward Declarations
|
||||
static void ImGui_ImplOSX_InitPlatformInterface();
|
||||
static void ImGui_ImplOSX_ShutdownPlatformInterface();
|
||||
static void ImGui_ImplOSX_InitMultiViewportSupport();
|
||||
static void ImGui_ImplOSX_ShutdownMultiViewportSupport();
|
||||
static void ImGui_ImplOSX_UpdateMonitors();
|
||||
static void ImGui_ImplOSX_AddTrackingArea(NSView* _Nonnull view);
|
||||
static bool ImGui_ImplOSX_HandleEvent(NSEvent* event, NSView* view);
|
||||
@ -447,8 +447,7 @@ bool ImGui_ImplOSX_Init(NSView* view)
|
||||
ImGuiViewport* main_viewport = ImGui::GetMainViewport();
|
||||
main_viewport->PlatformHandle = main_viewport->PlatformHandleRaw = (__bridge_retained void*)bd->Window;
|
||||
ImGui_ImplOSX_UpdateMonitors();
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
ImGui_ImplOSX_InitPlatformInterface();
|
||||
ImGui_ImplOSX_InitMultiViewportSupport();
|
||||
|
||||
// Load cursors. Some of them are undocumented.
|
||||
bd->MouseCursorHidden = false;
|
||||
@ -538,7 +537,7 @@ void ImGui_ImplOSX_Shutdown()
|
||||
bd->Monitor = nullptr;
|
||||
}
|
||||
|
||||
ImGui_ImplOSX_ShutdownPlatformInterface();
|
||||
ImGui_ImplOSX_ShutdownMultiViewportSupport();
|
||||
ImGui_ImplOSX_DestroyBackendData();
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.BackendPlatformName = nullptr;
|
||||
@ -1097,7 +1096,7 @@ static void ImGui_ImplOSX_UpdateMonitors()
|
||||
}
|
||||
}
|
||||
|
||||
static void ImGui_ImplOSX_InitPlatformInterface()
|
||||
static void ImGui_ImplOSX_InitMultiViewportSupport()
|
||||
{
|
||||
ImGui_ImplOSX_Data* bd = ImGui_ImplOSX_GetBackendData();
|
||||
|
||||
@ -1131,7 +1130,7 @@ static void ImGui_ImplOSX_InitPlatformInterface()
|
||||
object:nil];
|
||||
}
|
||||
|
||||
static void ImGui_ImplOSX_ShutdownPlatformInterface()
|
||||
static void ImGui_ImplOSX_ShutdownMultiViewportSupport()
|
||||
{
|
||||
ImGui_ImplOSX_Data* bd = ImGui_ImplOSX_GetBackendData();
|
||||
[NSNotificationCenter.defaultCenter removeObserver:bd->Observer
|
||||
|
@ -170,8 +170,8 @@ static ImGui_ImplSDL2_Data* ImGui_ImplSDL2_GetBackendData()
|
||||
|
||||
// Forward Declarations
|
||||
static void ImGui_ImplSDL2_UpdateMonitors();
|
||||
static void ImGui_ImplSDL2_InitPlatformInterface(SDL_Window* window, void* sdl_gl_context);
|
||||
static void ImGui_ImplSDL2_ShutdownPlatformInterface();
|
||||
static void ImGui_ImplSDL2_InitMultiViewportSupport(SDL_Window* window, void* sdl_gl_context);
|
||||
static void ImGui_ImplSDL2_ShutdownMultiViewportSupport();
|
||||
|
||||
// Functions
|
||||
static const char* ImGui_ImplSDL2_GetClipboardText(ImGuiContext*)
|
||||
@ -587,9 +587,9 @@ static bool ImGui_ImplSDL2_Init(SDL_Window* window, SDL_Renderer* renderer, void
|
||||
#endif
|
||||
|
||||
// We need SDL_CaptureMouse(), SDL_GetGlobalMouseState() from SDL 2.0.4+ to support multiple viewports.
|
||||
// We left the call to ImGui_ImplSDL2_InitPlatformInterface() outside of #ifdef to avoid unused-function warnings.
|
||||
if ((io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) && (io.BackendFlags & ImGuiBackendFlags_PlatformHasViewports))
|
||||
ImGui_ImplSDL2_InitPlatformInterface(window, sdl_gl_context);
|
||||
// We left the call to ImGui_ImplSDL2_InitMultiViewportSupport() outside of #ifdef to avoid unused-function warnings.
|
||||
if (io.BackendFlags & ImGuiBackendFlags_PlatformHasViewports)
|
||||
ImGui_ImplSDL2_InitMultiViewportSupport(window, sdl_gl_context);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -642,7 +642,7 @@ void ImGui_ImplSDL2_Shutdown()
|
||||
IM_ASSERT(bd != nullptr && "No platform backend to shutdown, or already shutdown?");
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
ImGui_ImplSDL2_ShutdownPlatformInterface();
|
||||
ImGui_ImplSDL2_ShutdownMultiViewportSupport();
|
||||
|
||||
if (bd->ClipboardTextData)
|
||||
SDL_free(bd->ClipboardTextData);
|
||||
@ -1154,7 +1154,7 @@ static int ImGui_ImplSDL2_CreateVkSurface(ImGuiViewport* viewport, ImU64 vk_inst
|
||||
}
|
||||
#endif // SDL_HAS_VULKAN
|
||||
|
||||
static void ImGui_ImplSDL2_InitPlatformInterface(SDL_Window* window, void* sdl_gl_context)
|
||||
static void ImGui_ImplSDL2_InitMultiViewportSupport(SDL_Window* window, void* sdl_gl_context)
|
||||
{
|
||||
// Register platform interface (will be coupled with a renderer interface)
|
||||
ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
|
||||
@ -1190,7 +1190,7 @@ static void ImGui_ImplSDL2_InitPlatformInterface(SDL_Window* window, void* sdl_g
|
||||
main_viewport->PlatformHandle = (void*)(intptr_t)vd->WindowID;
|
||||
}
|
||||
|
||||
static void ImGui_ImplSDL2_ShutdownPlatformInterface()
|
||||
static void ImGui_ImplSDL2_ShutdownMultiViewportSupport()
|
||||
{
|
||||
ImGui::DestroyPlatformWindows();
|
||||
}
|
||||
|
@ -130,8 +130,8 @@ static ImGui_ImplSDL3_Data* ImGui_ImplSDL3_GetBackendData()
|
||||
|
||||
// Forward Declarations
|
||||
static void ImGui_ImplSDL3_UpdateMonitors();
|
||||
static void ImGui_ImplSDL3_InitPlatformInterface(SDL_Window* window, void* sdl_gl_context);
|
||||
static void ImGui_ImplSDL3_ShutdownPlatformInterface();
|
||||
static void ImGui_ImplSDL3_InitMultiViewportSupport(SDL_Window* window, void* sdl_gl_context);
|
||||
static void ImGui_ImplSDL3_ShutdownMultiViewportSupport();
|
||||
|
||||
// Functions
|
||||
static const char* ImGui_ImplSDL3_GetClipboardText(ImGuiContext*)
|
||||
@ -554,8 +554,8 @@ static bool ImGui_ImplSDL3_Init(SDL_Window* window, SDL_Renderer* renderer, void
|
||||
|
||||
// We need SDL_CaptureMouse(), SDL_GetGlobalMouseState() from SDL 2.0.4+ to support multiple viewports.
|
||||
// We left the call to ImGui_ImplSDL3_InitPlatformInterface() outside of #ifdef to avoid unused-function warnings.
|
||||
if ((io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) && (io.BackendFlags & ImGuiBackendFlags_PlatformHasViewports))
|
||||
ImGui_ImplSDL3_InitPlatformInterface(window, sdl_gl_context);
|
||||
if (io.BackendFlags & ImGuiBackendFlags_PlatformHasViewports)
|
||||
ImGui_ImplSDL3_InitMultiViewportSupport(window, sdl_gl_context);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -606,7 +606,7 @@ void ImGui_ImplSDL3_Shutdown()
|
||||
IM_ASSERT(bd != nullptr && "No platform backend to shutdown, or already shutdown?");
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
ImGui_ImplSDL3_ShutdownPlatformInterface();
|
||||
ImGui_ImplSDL3_ShutdownMultiViewportSupport();
|
||||
|
||||
if (bd->ClipboardTextData)
|
||||
SDL_free(bd->ClipboardTextData);
|
||||
@ -1108,7 +1108,7 @@ static int ImGui_ImplSDL3_CreateVkSurface(ImGuiViewport* viewport, ImU64 vk_inst
|
||||
return ret ? 0 : 1; // ret ? VK_SUCCESS : VK_NOT_READY
|
||||
}
|
||||
|
||||
static void ImGui_ImplSDL3_InitPlatformInterface(SDL_Window* window, void* sdl_gl_context)
|
||||
static void ImGui_ImplSDL3_InitMultiViewportSupport(SDL_Window* window, void* sdl_gl_context)
|
||||
{
|
||||
// Register platform interface (will be coupled with a renderer interface)
|
||||
ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
|
||||
@ -1141,7 +1141,7 @@ static void ImGui_ImplSDL3_InitPlatformInterface(SDL_Window* window, void* sdl_g
|
||||
main_viewport->PlatformHandle = (void*)(intptr_t)vd->WindowID;
|
||||
}
|
||||
|
||||
static void ImGui_ImplSDL3_ShutdownPlatformInterface()
|
||||
static void ImGui_ImplSDL3_ShutdownMultiViewportSupport()
|
||||
{
|
||||
ImGui::DestroyPlatformWindows();
|
||||
}
|
||||
|
@ -277,8 +277,8 @@ struct ImGui_ImplVulkan_Data
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Forward Declarations
|
||||
static void ImGui_ImplVulkan_InitPlatformInterface();
|
||||
static void ImGui_ImplVulkan_ShutdownPlatformInterface();
|
||||
static void ImGui_ImplVulkan_InitMultiViewportSupport();
|
||||
static void ImGui_ImplVulkan_ShutdownMultiViewportSupport();
|
||||
|
||||
// backends/vulkan/glsl_shader.vert, compiled with:
|
||||
// # glslangValidator -V -x -o glsl_shader.vert.u32 glsl_shader.vert
|
||||
@ -1163,8 +1163,7 @@ bool ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info)
|
||||
ImGuiViewport* main_viewport = ImGui::GetMainViewport();
|
||||
main_viewport->RendererUserData = IM_NEW(ImGui_ImplVulkan_ViewportData)();
|
||||
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
ImGui_ImplVulkan_InitPlatformInterface();
|
||||
ImGui_ImplVulkan_InitMultiViewportSupport();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1185,7 +1184,7 @@ void ImGui_ImplVulkan_Shutdown()
|
||||
main_viewport->RendererUserData = nullptr;
|
||||
|
||||
// Clean up windows
|
||||
ImGui_ImplVulkan_ShutdownPlatformInterface();
|
||||
ImGui_ImplVulkan_ShutdownMultiViewportSupport();
|
||||
|
||||
io.BackendRendererName = nullptr;
|
||||
io.BackendRendererUserData = nullptr;
|
||||
@ -1919,7 +1918,7 @@ static void ImGui_ImplVulkan_SwapBuffers(ImGuiViewport* viewport, void*)
|
||||
wd->SemaphoreIndex = (wd->SemaphoreIndex + 1) % wd->SemaphoreCount; // Now we can use the next set of semaphores
|
||||
}
|
||||
|
||||
void ImGui_ImplVulkan_InitPlatformInterface()
|
||||
void ImGui_ImplVulkan_InitMultiViewportSupport()
|
||||
{
|
||||
ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
|
||||
if (ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
@ -1931,7 +1930,7 @@ void ImGui_ImplVulkan_InitPlatformInterface()
|
||||
platform_io.Renderer_SwapBuffers = ImGui_ImplVulkan_SwapBuffers;
|
||||
}
|
||||
|
||||
void ImGui_ImplVulkan_ShutdownPlatformInterface()
|
||||
void ImGui_ImplVulkan_ShutdownMultiViewportSupport()
|
||||
{
|
||||
ImGui::DestroyPlatformWindows();
|
||||
}
|
||||
|
@ -107,8 +107,8 @@ typedef DWORD(WINAPI* PFN_XInputGetState)(DWORD, XINPUT_STATE*);
|
||||
#endif
|
||||
|
||||
// Forward Declarations
|
||||
static void ImGui_ImplWin32_InitPlatformInterface(bool platform_has_own_dc);
|
||||
static void ImGui_ImplWin32_ShutdownPlatformInterface();
|
||||
static void ImGui_ImplWin32_InitMultiViewportSupport(bool platform_has_own_dc);
|
||||
static void ImGui_ImplWin32_ShutdownMultiViewportSupport();
|
||||
static void ImGui_ImplWin32_UpdateMonitors();
|
||||
|
||||
struct ImGui_ImplWin32_Data
|
||||
@ -187,8 +187,7 @@ static bool ImGui_ImplWin32_InitEx(void* hwnd, bool platform_has_own_dc)
|
||||
// Our mouse update function expect PlatformHandle to be filled for the main viewport
|
||||
ImGuiViewport* main_viewport = ImGui::GetMainViewport();
|
||||
main_viewport->PlatformHandle = main_viewport->PlatformHandleRaw = (void*)bd->hWnd;
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
ImGui_ImplWin32_InitPlatformInterface(platform_has_own_dc);
|
||||
ImGui_ImplWin32_InitMultiViewportSupport(platform_has_own_dc);
|
||||
|
||||
// Dynamically load XInput library
|
||||
#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
|
||||
@ -231,7 +230,7 @@ void ImGui_ImplWin32_Shutdown()
|
||||
IM_ASSERT(bd != nullptr && "No platform backend to shutdown, or already shutdown?");
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
ImGui_ImplWin32_ShutdownPlatformInterface();
|
||||
ImGui_ImplWin32_ShutdownMultiViewportSupport();
|
||||
|
||||
// Unload XInput library
|
||||
#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
|
||||
@ -1328,7 +1327,7 @@ static LRESULT CALLBACK ImGui_ImplWin32_WndProcHandler_PlatformWindow(HWND hWnd,
|
||||
return result;
|
||||
}
|
||||
|
||||
static void ImGui_ImplWin32_InitPlatformInterface(bool platform_has_own_dc)
|
||||
static void ImGui_ImplWin32_InitMultiViewportSupport(bool platform_has_own_dc)
|
||||
{
|
||||
WNDCLASSEXW wcex;
|
||||
wcex.cbSize = sizeof(WNDCLASSEXW);
|
||||
@ -1373,10 +1372,9 @@ static void ImGui_ImplWin32_InitPlatformInterface(bool platform_has_own_dc)
|
||||
vd->Hwnd = bd->hWnd;
|
||||
vd->HwndOwned = false;
|
||||
main_viewport->PlatformUserData = vd;
|
||||
main_viewport->PlatformHandle = (void*)bd->hWnd;
|
||||
}
|
||||
|
||||
static void ImGui_ImplWin32_ShutdownPlatformInterface()
|
||||
static void ImGui_ImplWin32_ShutdownMultiViewportSupport()
|
||||
{
|
||||
::UnregisterClass(_T("ImGui Platform"), ::GetModuleHandle(nullptr));
|
||||
ImGui::DestroyPlatformWindows();
|
||||
|
@ -51,6 +51,11 @@ Other changes:
|
||||
- Backends: DX9, DX10, DX11, DX12, OpenGL, Vulkan, WGPU: Changed default texture sampler
|
||||
to Clamp instead of Repeat/Wrap. (#7468, #7511, #5999, #5502)
|
||||
|
||||
Docking+Viewports Branch:
|
||||
|
||||
- Backends: changed all backends to allow enabling ImGuiConfigFlags_ViewportsEnable
|
||||
after initialization. (#5371)
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
VERSION 1.91.3 (Released 2024-10-04)
|
||||
|
Loading…
Reference in New Issue
Block a user