imgui icon indicating copy to clipboard operation
imgui copied to clipboard

Update viewport flags from window flags every frame

Open cfillion opened this issue 5 months ago • 0 comments

This fixes WindowFlags_NoInputs (for mouse passthrough) only being taken in consideration when the viewport is intially created.

I'm not 100% sure this is free of side-effects (why wasn't AddUpdateViewport done every frame before?). Another possibility could be to update ViewportFlags_NoInputs in WindowSyncOwnedViewport.

Use-case demo

static int flags, reset;

if(reset && reset < ImGui::GetTime())
  flags = reset = 0;

ImGui::Begin("Hello, world!", nullptr, flags);
if(ImGui::CheckboxFlags("WindowFlags_NoInputs", &flags, ImGuiWindowFlags_NoInputs))
  reset = ImGui::GetTime() + 4;
if(reset)
  ImGui::Text("reset in %d\n", static_cast<int>(reset - ImGui::GetTime()) + 1);
ImGui::End();

cfillion avatar Mar 12 '24 01:03 cfillion