mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Menus: Fixed an assertion happening in some situations when closing nested menus (broken in 1.83). (#4640)
Broken since936f5322
Weirdly chain-reaction caused by the fact following #4640 repro, the SourceWindow assignment in OpenPopupEx() picks Menu_04 before its closure. Value of SourceWindow sincebda2cde6
#2517
This commit is contained in:
parent
44f801186f
commit
ba5c105c01
@ -86,9 +86,11 @@ Other Changes:
|
|||||||
RGB<>HSV round trips every frames. [@rokups]
|
RGB<>HSV round trips every frames. [@rokups]
|
||||||
- ColorPicker4: Fixed picker being unable to select exact 1.0f color when dragging toward the edges
|
- ColorPicker4: Fixed picker being unable to select exact 1.0f color when dragging toward the edges
|
||||||
of the SV square (previously picked 0.999989986f). (#3517) [@rokups]
|
of the SV square (previously picked 0.999989986f). (#3517) [@rokups]
|
||||||
- Menus: Fixed vertical alignments of MenuItem() calls within a menu bar. (broken in 1.84). (#4538)
|
- Menus: Fixed vertical alignments of MenuItem() calls within a menu bar (broken in 1.84). (#4538)
|
||||||
- Menus: Adjust closing logic to accomodate for varying font size and dpi.
|
- Menus: Improve closing logic when moving diagonally in empty between between parent and child menus to
|
||||||
|
accomodate for varying font size and dpi.
|
||||||
- Menus: Fixed crash when navigating left inside a child window inside a sub-menu. (#4510).
|
- Menus: Fixed crash when navigating left inside a child window inside a sub-menu. (#4510).
|
||||||
|
- Menus: Fixed an assertion happening in some situations when closing nested menus (broken in 1.83). (#4640)
|
||||||
- Drag and Drop: Fixed using BeginDragDropSource() inside a BeginChild() that returned false. (#4515)
|
- Drag and Drop: Fixed using BeginDragDropSource() inside a BeginChild() that returned false. (#4515)
|
||||||
- PlotHistogram: Fixed zero-line position when manually specifying min<0 and max>0. (#4349) [@filippocrocchini]
|
- PlotHistogram: Fixed zero-line position when manually specifying min<0 and max>0. (#4349) [@filippocrocchini]
|
||||||
- Misc: Added asserts for missing PopItemFlag() calls.
|
- Misc: Added asserts for missing PopItemFlag() calls.
|
||||||
|
15
imgui.cpp
15
imgui.cpp
@ -6551,8 +6551,18 @@ void ImGui::FocusWindow(ImGuiWindow* window)
|
|||||||
void ImGui::FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWindow* ignore_window)
|
void ImGui::FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWindow* ignore_window)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
int start_idx = g.WindowsFocusOrder.Size - 1;
|
||||||
const int start_idx = ((under_this_window != NULL) ? FindWindowFocusIndex(under_this_window) : g.WindowsFocusOrder.Size) - 1;
|
if (under_this_window != NULL)
|
||||||
|
{
|
||||||
|
// Aim at root window behind us, if we are in a child window that's our own root (see #4640)
|
||||||
|
int offset = -1;
|
||||||
|
while (under_this_window->Flags & ImGuiWindowFlags_ChildWindow)
|
||||||
|
{
|
||||||
|
under_this_window = under_this_window->ParentWindow;
|
||||||
|
offset = 0;
|
||||||
|
}
|
||||||
|
start_idx = FindWindowFocusIndex(under_this_window) + offset;
|
||||||
|
}
|
||||||
for (int i = start_idx; i >= 0; i--)
|
for (int i = start_idx; i >= 0; i--)
|
||||||
{
|
{
|
||||||
// We may later decide to test for different NoXXXInputs based on the active navigation input (mouse vs nav) but that may feel more confusing to the user.
|
// We may later decide to test for different NoXXXInputs based on the active navigation input (mouse vs nav) but that may feel more confusing to the user.
|
||||||
@ -9838,6 +9848,7 @@ static int ImGui::FindWindowFocusIndex(ImGuiWindow* window)
|
|||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
IM_UNUSED(g);
|
IM_UNUSED(g);
|
||||||
int order = window->FocusOrder;
|
int order = window->FocusOrder;
|
||||||
|
IM_ASSERT((window->Flags & ImGuiWindowFlags_ChildWindow) == 0);
|
||||||
IM_ASSERT(g.WindowsFocusOrder[order] == window);
|
IM_ASSERT(g.WindowsFocusOrder[order] == window);
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user