Internals: Add a way to request window to not process any interactions for specified number of frames.
diff --git a/backends/imgui_impl_win32.cpp b/backends/imgui_impl_win32.cpp index 04e462c..356f846 100644 --- a/backends/imgui_impl_win32.cpp +++ b/backends/imgui_impl_win32.cpp
@@ -134,7 +134,7 @@ break; } #endif // IMGUI_IMPL_WIN32_DISABLE_GAMEPAD - + return true; } @@ -148,7 +148,7 @@ g_XInputGetCapabilities = NULL; g_XInputGetState = NULL; #endif // IMGUI_IMPL_WIN32_DISABLE_GAMEPAD - + g_hWnd = NULL; g_Time = 0; g_TicksPerSecond = 0;
diff --git a/imgui.cpp b/imgui.cpp index 031eecf..75675ee 100644 --- a/imgui.cpp +++ b/imgui.cpp
@@ -6294,6 +6294,13 @@ // Update the Hidden flag window->Hidden = (window->HiddenFramesCanSkipItems > 0) || (window->HiddenFramesCannotSkipItems > 0) || (window->HiddenFramesForRenderOnly > 0); + // Disable inputs for requested number of frames + if (window->DisableInputsFrames > 0) + { + window->DisableInputsFrames--; + window->Flags |= ImGuiWindowFlags_NoInputs; + } + // Update the SkipItems flag, used to early out of all items functions (no layout required) bool skip_items = false; if (window->Collapsed || !window->Active || window->Hidden)
diff --git a/imgui_internal.h b/imgui_internal.h index d01f4a6..75e7e5e 100644 --- a/imgui_internal.h +++ b/imgui_internal.h
@@ -1784,6 +1784,7 @@ ImS8 HiddenFramesCanSkipItems; // Hide the window for N frames ImS8 HiddenFramesCannotSkipItems; // Hide the window for N frames while allowing items to be submitted so we can measure their size ImS8 HiddenFramesForRenderOnly; // Hide the window until frame N at Render() time only + ImS8 DisableInputsFrames; // Disable window interactions for N frames ImGuiCond SetWindowPosAllowFlags : 8; // store acceptable condition flags for SetNextWindowPos() use. ImGuiCond SetWindowSizeAllowFlags : 8; // store acceptable condition flags for SetNextWindowSize() use. ImGuiCond SetWindowCollapsedAllowFlags : 8; // store acceptable condition flags for SetNextWindowCollapsed() use.