From cdbf71ac12178c25d15e27f19975a4814805582f Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 17 Jul 2015 16:36:04 -0600 Subject: [PATCH] Added ImGuiWindowFlags_NoInputs for input-passthru window Would be more useful with finer control over display layer --- imgui.cpp | 5 +++++ imgui.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 96e16ddd..0009e64d 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2902,6 +2902,8 @@ static ImGuiWindow* FindHoveredWindow(ImVec2 pos, bool excluding_childs) ImGuiWindow* window = g.Windows[i]; if (!window->Active) continue; + if (window->Flags & ImGuiWindowFlags_NoInputs) + continue; if (excluding_childs && (window->Flags & ImGuiWindowFlags_ChildWindow) != 0) continue; @@ -3631,6 +3633,9 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_ IM_ASSERT(g.Initialized); // Forgot to call ImGui::NewFrame() IM_ASSERT(name != NULL); // Must pass a name + if (flags & ImGuiWindowFlags_NoInputs) + flags |= ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize; + // Find or create bool window_is_new = false; ImGuiWindow* window = FindWindowByName(name); diff --git a/imgui.h b/imgui.h index 9aad7979..0098e5fa 100644 --- a/imgui.h +++ b/imgui.h @@ -434,7 +434,8 @@ enum ImGuiWindowFlags_ ImGuiWindowFlags_AlwaysAutoResize = 1 << 6, // Resize every window to its content every frame ImGuiWindowFlags_ShowBorders = 1 << 7, // Show borders around windows and items ImGuiWindowFlags_NoSavedSettings = 1 << 8, // Never load/save settings in .ini file - ImGuiWindowFlags_MenuBar = 1 << 9, // Has a menu-bar + ImGuiWindowFlags_NoInputs = 1 << 9, // Disable catching mouse or keyboard inputs + ImGuiWindowFlags_MenuBar = 1 << 10, // Has a menu-bar // [Internal] ImGuiWindowFlags_ChildWindow = 1 << 20, // Don't use! For internal use by BeginChild() ImGuiWindowFlags_ChildWindowAutoFitX = 1 << 21, // Don't use! For internal use by BeginChild()