Problem: Undocking a large (~full screen) window would leave it so large that the bottom right sizing corner would more than likely be off the screen and the window would be hard to resize to fit on screen. This can be particularly problematic with 'ConfigWindowsMoveFromTitleBarOnly=true' and/or with 'ConfigWindowsResizeFromEdges=false' as well (the later can be due to missing ImGuiBackendFlags_Ha
| 18424 | // When undocking a window we currently force its maximum size to 90% of the host viewport or monitor. |
| 18425 | // Reevaluate this when we implement preserving docked/undocked size ("docking_wip/undocked_size" branch). |
| 18426 | static ImVec2 FixLargeWindowsWhenUndocking(const ImVec2& size, ImGuiViewport* ref_viewport) |
| 18427 | { |
| 18428 | if (ref_viewport == NULL) |
| 18429 | return size; |
| 18430 | |
| 18431 | ImGuiContext& g = *GImGui; |
| 18432 | ImVec2 max_size = ImTrunc(ref_viewport->WorkSize * 0.90f); |
| 18433 | if (g.ConfigFlagsCurrFrame & ImGuiConfigFlags_ViewportsEnable) |
| 18434 | { |
| 18435 | const ImGuiPlatformMonitor* monitor = ImGui::GetViewportPlatformMonitor(ref_viewport); |
| 18436 | max_size = ImTrunc(monitor->WorkSize * 0.90f); |
| 18437 | } |
| 18438 | return ImMin(size, max_size); |
| 18439 | } |
| 18440 | |
| 18441 | void ImGui::DockContextProcessUndockWindow(ImGuiContext* ctx, ImGuiWindow* window, bool clear_persistent_docking_ref) |
| 18442 | { |
no test coverage detected