mirror of
https://github.com/shadps4-emu/ext-imgui.git
synced 2025-02-17 05:19:32 +00:00
Nav: fixed c licking window decorations (e.g. resize borders) from losing focused item when within a child window using ImGuiChildFlags_NavFlattened.
In essence, using ImGuiFocusRequestFlags_RestoreFocusedChild here is a way to reduce changes caused by FocusWindow(), but it could be done more neatly. See amended "nav_flattened" test.
This commit is contained in:
parent
c3dca77a19
commit
97ff9bd370
@ -134,6 +134,8 @@ Other changes:
|
|||||||
- Multi-Select (checkboxes)
|
- Multi-Select (checkboxes)
|
||||||
- Multi-Select (multiple scopes)
|
- Multi-Select (multiple scopes)
|
||||||
- Multi-Select (advanced)
|
- Multi-Select (advanced)
|
||||||
|
- Nav: fixed clicking window decorations (e.g. resize borders) from losing focused item when
|
||||||
|
within a child window using ImGuiChildFlags_NavFlattened.
|
||||||
- Clipper: added SeekCursorForItem() function. When using ImGuiListClipper::Begin(INT_MAX) you can
|
- Clipper: added SeekCursorForItem() function. When using ImGuiListClipper::Begin(INT_MAX) you can
|
||||||
can use the clipper without knowing the amount of items beforehand. (#1311)
|
can use the clipper without knowing the amount of items beforehand. (#1311)
|
||||||
In this situation, call ImGuiListClipper::SeekCursorForItem(items_count) as the end of your iteration
|
In this situation, call ImGuiListClipper::SeekCursorForItem(items_count) as the end of your iteration
|
||||||
|
2
imgui.h
2
imgui.h
@ -28,7 +28,7 @@
|
|||||||
// Library Version
|
// Library Version
|
||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
||||||
#define IMGUI_VERSION "1.91.0 WIP"
|
#define IMGUI_VERSION "1.91.0 WIP"
|
||||||
#define IMGUI_VERSION_NUM 19097
|
#define IMGUI_VERSION_NUM 19098
|
||||||
#define IMGUI_HAS_TABLE
|
#define IMGUI_HAS_TABLE
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -567,8 +567,14 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
SetActiveID(id, window);
|
SetActiveID(id, window);
|
||||||
g.ActiveIdMouseButton = mouse_button_clicked;
|
g.ActiveIdMouseButton = mouse_button_clicked;
|
||||||
if (!(flags & ImGuiButtonFlags_NoNavFocus))
|
if (!(flags & ImGuiButtonFlags_NoNavFocus))
|
||||||
|
{
|
||||||
SetFocusID(id, window);
|
SetFocusID(id, window);
|
||||||
FocusWindow(window);
|
FocusWindow(window);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FocusWindow(window, ImGuiFocusRequestFlags_RestoreFocusedChild); // Still need to focus and bring to front, but try to avoid losing NavId when navigating a child
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((flags & ImGuiButtonFlags_PressedOnClick) || ((flags & ImGuiButtonFlags_PressedOnDoubleClick) && g.IO.MouseClickedCount[mouse_button_clicked] == 2))
|
if ((flags & ImGuiButtonFlags_PressedOnClick) || ((flags & ImGuiButtonFlags_PressedOnDoubleClick) && g.IO.MouseClickedCount[mouse_button_clicked] == 2))
|
||||||
{
|
{
|
||||||
@ -577,10 +583,16 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
ClearActiveID();
|
ClearActiveID();
|
||||||
else
|
else
|
||||||
SetActiveID(id, window); // Hold on ID
|
SetActiveID(id, window); // Hold on ID
|
||||||
if (!(flags & ImGuiButtonFlags_NoNavFocus))
|
|
||||||
SetFocusID(id, window);
|
|
||||||
g.ActiveIdMouseButton = mouse_button_clicked;
|
g.ActiveIdMouseButton = mouse_button_clicked;
|
||||||
FocusWindow(window);
|
if (!(flags & ImGuiButtonFlags_NoNavFocus))
|
||||||
|
{
|
||||||
|
SetFocusID(id, window);
|
||||||
|
FocusWindow(window);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FocusWindow(window, ImGuiFocusRequestFlags_RestoreFocusedChild); // Still need to focus and bring to front, but try to avoid losing NavId when navigating a child
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flags & ImGuiButtonFlags_PressedOnRelease)
|
if (flags & ImGuiButtonFlags_PressedOnRelease)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user