Skip to content

Viewports and Dockspace. Window stops responding to any action. #5503

@mihaillatyshov

Description

@mihaillatyshov

Version/Branch of Dear ImGui:

Version: v1.86
Branch: docking

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_opengl3.cpp + imgui_impl_glfw.cpp
Compiler: Visual Studio 2022
Operating System: Windows 10

My Issue/Question:

Used dockspace and multiviewports.
When the window is detached from the dockspace in a collapsed state, the main window stops responding to any actions.
This problem only occurs while using multiviewports.
Maybe I'm doing something wrong, but it looks like a problem of multiviewports.

Screenshots/Video

2022-07-23.16-33-31.mp4
2022-07-23.16-34-08.mp4

I paste this code before ImGui::Render(); in OpenGL3 and GLFW example.

static bool firstLoop = true;
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDocking;
if (ImGui::Begin("Shader Editor", nullptr, window_flags))
{
	ImGuiID idWind = ImGui::GetID("Shader Editor");
	if (firstLoop)
	{
		ImVec2 workCenter = ImGui::GetMainViewport()->GetWorkCenter();

		ImGuiID id = ImGui::GetID("Shader Editor DockSpace"); 
		ImGui::DockBuilderRemoveNode(id);            
		ImGui::DockBuilderAddNode(id);                

		ImVec2 size{ 600, 300 }; 

		ImVec2 nodePos{ workCenter.x - size.x * 0.5f, workCenter.y - size.y * 0.5f };

		// Set the size and position:
		ImGui::DockBuilderSetNodeSize(id, size);
		ImGui::DockBuilderSetNodePos(id, nodePos);

		ImGuiID dock1 = ImGui::DockBuilderSplitNode(id, ImGuiDir_Left, 0.5f, nullptr, &id);
		ImGuiID dock2 = ImGui::DockBuilderSplitNode(id, ImGuiDir_Right, 0.5f, nullptr, &id);
		ImGuiID dock3 = ImGui::DockBuilderSplitNode(dock2, ImGuiDir_Down, 0.5f, nullptr, &dock2);
		ImGui::DockBuilderDockWindow("One", dock1);
		ImGui::DockBuilderDockWindow("Two", dock2);
		ImGui::DockBuilderDockWindow("Three", dock3);
		ImGui::DockBuilderFinish(id);
		firstLoop = false;
	}
	ImGui::DockSpace(ImGui::GetID("Shader Editor DockSpace"), ImVec2(0, 0));
	ImGui::Begin("One"); ImGui::Text("One"); ImGui::Separator(); ImGui::End();
	ImGui::Begin("Two"); ImGui::Text("Two"); ImGui::Separator(); ImGui::End();
	ImGui::Begin("Three"); ImGui::Text("Three"); ImGui::Separator(); ImGui::End();
}
ImGui::End();

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions