18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-14 09:06:58 +01:00

fix(ui): a popup begun outside any window stays in the main window too

A popup begun outside any window, as the context menus of the editor, the dialogs for a new scenery and for opening one and the
pause dialog of the driver are, takes no viewport from a parent. It was put into the main window only where it merged there:
with the main window minimized, or behind a panel taken out into a window of its own, it got a window of the system of its own,
with an OpenGL context of its own, the way the editor froze. With io.ConfigViewportsNoAutoDetach the tooltips and popups stay in
the main window there too.

The comment of io.ConfigViewportsNoAutoDetach tells how they're placed: as with the viewports off, not shrunk.
io.ConfigTooltipsWrapWidth moves to the miscellaneous options, it works with the viewports off as well, and its comment tells
that SetItemTooltip() wraps too and BeginTooltip() doesn't.
This commit is contained in:
maj00r
2026-11-08 19:58:48 +01:00
parent be40008808
commit d0ca44cd67
2 changed files with 6 additions and 4 deletions

View File

@@ -1491,7 +1491,6 @@ ImGuiIO::ImGuiIO()
ConfigViewportsNoDecoration = true;
ConfigViewportsNoDefaultParent = false;
ConfigViewportsNoAutoDetach = false;
ConfigTooltipsWrapWidth = 0.0f;
// Miscellaneous options
MouseDrawCursor = false;
@@ -1509,6 +1508,7 @@ ImGuiIO::ImGuiIO()
ConfigWindowsCopyContentsWithCtrlC = false;
ConfigScrollbarScrollByPage = true;
ConfigMemoryCompactTimer = 60.0f;
ConfigTooltipsWrapWidth = 0.0f;
ConfigDebugIsDebuggerPresent = false;
ConfigDebugHighlightIdConflicts = true;
ConfigDebugHighlightIdConflictsShowItemPicker = true;
@@ -16383,9 +16383,11 @@ static void ImGui::WindowSelectViewport(ImGuiWindow* window)
}
// Fallback: merge in default viewport if z-order matches, otherwise create a new viewport
// MaSzyna addition: with io.ConfigViewportsNoAutoDetach the tooltips and popups stay in the main viewport here too
if (window->Viewport == NULL)
if (!UpdateTryMergeWindowIntoHostViewport(window, main_viewport))
window->Viewport = WindowStaysInHostViewport(window, main_viewport) ? main_viewport : AddUpdateViewport(window, window->ID, window->Pos, window->Size, ImGuiViewportFlags_None);
window->Viewport = (WindowStaysInHostViewport(window, main_viewport) || (g.IO.ConfigViewportsNoAutoDetach && (flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip))))
? main_viewport : AddUpdateViewport(window, window->ID, window->Pos, window->Size, ImGuiViewportFlags_None);
// Mark window as allowed to protrude outside of its viewport and into the current monitor
if (!lock_viewport)