From 0f7eb00f6728aa677b31b158d0886ee4dc5011e2 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 29 Jun 2021 14:35:30 +0200 Subject: [PATCH] Backends: amends to 1db1066 + merge minor bits from docking incl SetActiveIdUsingNavAndKeys(). No need to clear fields before deletion. DX12: renamed to match docking branch. --- backends/imgui_impl_dx12.cpp | 1 + backends/imgui_impl_glfw.cpp | 4 ---- backends/imgui_impl_opengl3.cpp | 7 +++---- imgui.cpp | 1 + imgui_widgets.cpp | 2 +- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/backends/imgui_impl_dx12.cpp b/backends/imgui_impl_dx12.cpp index 8b00e19d..5a984a2b 100644 --- a/backends/imgui_impl_dx12.cpp +++ b/backends/imgui_impl_dx12.cpp @@ -179,6 +179,7 @@ struct VERTEX_CONSTANT_BUFFER static void ImGui_ImplDX12_InitPlatformInterface(); static void ImGui_ImplDX12_ShutdownPlatformInterface(); +// Functions static void ImGui_ImplDX12_SetupRenderState(ImDrawData* draw_data, ID3D12GraphicsCommandList* ctx, ImGui_ImplDX12_RenderBuffers* fr) { ImGui_ImplDX12_Data* bd = ImGui_ImplDX12_GetBackendData(); diff --git a/backends/imgui_impl_glfw.cpp b/backends/imgui_impl_glfw.cpp index 14410a91..c20a3d6b 100644 --- a/backends/imgui_impl_glfw.cpp +++ b/backends/imgui_impl_glfw.cpp @@ -326,14 +326,10 @@ void ImGui_ImplGlfw_Shutdown() glfwSetScrollCallback(bd->Window, bd->PrevUserCallbackScroll); glfwSetKeyCallback(bd->Window, bd->PrevUserCallbackKey); glfwSetCharCallback(bd->Window, bd->PrevUserCallbackChar); - bd->InstalledCallbacks = false; } for (ImGuiMouseCursor cursor_n = 0; cursor_n < ImGuiMouseCursor_COUNT; cursor_n++) - { glfwDestroyCursor(bd->MouseCursors[cursor_n]); - bd->MouseCursors[cursor_n] = NULL; - } io.BackendPlatformName = NULL; io.BackendPlatformUserData = NULL; diff --git a/backends/imgui_impl_opengl3.cpp b/backends/imgui_impl_opengl3.cpp index 17445b73..438b752f 100644 --- a/backends/imgui_impl_opengl3.cpp +++ b/backends/imgui_impl_opengl3.cpp @@ -237,19 +237,18 @@ bool ImGui_ImplOpenGL3_Init(const char* glsl_version) // Store GLSL version string so we can refer to it later in case we recreate shaders. // Note: GLSL version is NOT the same as GL version. Leave this to NULL if unsure. -#if defined(IMGUI_IMPL_OPENGL_ES2) if (glsl_version == NULL) + { +#if defined(IMGUI_IMPL_OPENGL_ES2) glsl_version = "#version 100"; #elif defined(IMGUI_IMPL_OPENGL_ES3) - if (glsl_version == NULL) glsl_version = "#version 300 es"; #elif defined(__APPLE__) - if (glsl_version == NULL) glsl_version = "#version 150"; #else - if (glsl_version == NULL) glsl_version = "#version 130"; #endif + } IM_ASSERT((int)strlen(glsl_version) + 2 < IM_ARRAYSIZE(bd->GlslVersionString)); strcpy(bd->GlslVersionString, glsl_version); strcat(bd->GlslVersionString, "\n"); diff --git a/imgui.cpp b/imgui.cpp index 5ca1e9e7..c05c486c 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -7170,6 +7170,7 @@ void ImGui::PopTextWrapPos() window->DC.TextWrapPosStack.pop_back(); } +// FIXME: We are exposing the docking hierarchy to end-user here (via IsWindowHovered, IsWindowFocused) which is unusual. bool ImGui::IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent) { if (window->RootWindowDockTree == potential_parent) diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 272160d8..f48b0b11 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -7991,7 +7991,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, // Click to Select a tab ImGuiButtonFlags button_flags = ((is_tab_button ? ImGuiButtonFlags_PressedOnClickRelease : ImGuiButtonFlags_PressedOnClick) | ImGuiButtonFlags_AllowItemOverlap); - if (g.DragDropActive && !g.DragDropPayload.IsDataType(IMGUI_PAYLOAD_TYPE_WINDOW)) + if (g.DragDropActive && !g.DragDropPayload.IsDataType(IMGUI_PAYLOAD_TYPE_WINDOW)) // FIXME: May be an opt-in property of the payload to disable this button_flags |= ImGuiButtonFlags_PressedOnDragDropHold; bool hovered, held; bool pressed = ButtonBehavior(bb, id, &hovered, &held, button_flags);