mirror of
https://github.com/ocornut/imgui.git
synced 2025-01-19 01:34:08 +01:00
Windows: Fixed subsequent Begin() append calls from setting last item information for title-bar. (#7506, #823)
Amend 067605052, 27fd1b913b
This commit is contained in:
parent
361432a0bb
commit
fa0120ea5e
@ -56,6 +56,9 @@ Breaking changes:
|
|||||||
|
|
||||||
Other changes:
|
Other changes:
|
||||||
|
|
||||||
|
- Windows: Fixed subsequent Begin() append calls from setting last item information
|
||||||
|
for title bar, making it impossible to use IsItemHovered() on a Begin()-to-append,
|
||||||
|
and causing issue bypassing hover detection on collapsed windows. (#7506, #823)
|
||||||
- Fonts: Fixed font ascent and descent calculation when a font hits exact integer values.
|
- Fonts: Fixed font ascent and descent calculation when a font hits exact integer values.
|
||||||
It is possible that some prior manual use of ImFontConfig::GlyphOffset may become
|
It is possible that some prior manual use of ImFontConfig::GlyphOffset may become
|
||||||
duplicate with this fix. (#7399, #7404) [@GamingMinds-DanielC]
|
duplicate with this fix. (#7399, #7404) [@GamingMinds-DanielC]
|
||||||
|
10
imgui.cpp
10
imgui.cpp
@ -1139,6 +1139,7 @@ static void RenderWindowDecorations(ImGuiWindow* window, const ImRec
|
|||||||
static void RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& title_bar_rect, const char* name, bool* p_open);
|
static void RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& title_bar_rect, const char* name, bool* p_open);
|
||||||
static void RenderDimmedBackgroundBehindWindow(ImGuiWindow* window, ImU32 col);
|
static void RenderDimmedBackgroundBehindWindow(ImGuiWindow* window, ImU32 col);
|
||||||
static void RenderDimmedBackgrounds();
|
static void RenderDimmedBackgrounds();
|
||||||
|
static void SetLastItemDataForWindow(ImGuiWindow* window, const ImRect& rect);
|
||||||
|
|
||||||
// Viewports
|
// Viewports
|
||||||
const ImGuiID IMGUI_VIEWPORT_DEFAULT_ID = 0x11111111; // Using an arbitrary constant instead of e.g. ImHashStr("ViewportDefault", 0); so it's easier to spot in the debugger. The exact value doesn't matter.
|
const ImGuiID IMGUI_VIEWPORT_DEFAULT_ID = 0x11111111; // Using an arbitrary constant instead of e.g. ImHashStr("ViewportDefault", 0); so it's easier to spot in the debugger. The exact value doesn't matter.
|
||||||
@ -6992,7 +6993,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
|
|
||||||
// We fill last item data based on Title Bar/Tab, in order for IsItemHovered() and IsItemActive() to be usable after Begin().
|
// We fill last item data based on Title Bar/Tab, in order for IsItemHovered() and IsItemActive() to be usable after Begin().
|
||||||
// This is useful to allow creating context menus on title bar only, etc.
|
// This is useful to allow creating context menus on title bar only, etc.
|
||||||
SetLastItemData(window->MoveId, g.CurrentItemFlags, IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max, false) ? ImGuiItemStatusFlags_HoveredRect : 0, title_bar_rect);
|
SetLastItemDataForWindow(window, title_bar_rect);
|
||||||
|
|
||||||
// [DEBUG]
|
// [DEBUG]
|
||||||
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||||
@ -7010,6 +7011,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
{
|
{
|
||||||
// Append
|
// Append
|
||||||
SetCurrentWindow(window);
|
SetCurrentWindow(window);
|
||||||
|
SetLastItemDataForWindow(window, window->TitleBarRect());
|
||||||
}
|
}
|
||||||
|
|
||||||
PushClipRect(window->InnerClipRect.Min, window->InnerClipRect.Max, true);
|
PushClipRect(window->InnerClipRect.Min, window->InnerClipRect.Max, true);
|
||||||
@ -7082,6 +7084,12 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
return !window->SkipItems;
|
return !window->SkipItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ImGui::SetLastItemDataForWindow(ImGuiWindow* window, const ImRect& rect)
|
||||||
|
{
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
SetLastItemData(window->MoveId, g.CurrentItemFlags, IsMouseHoveringRect(rect.Min, rect.Max, false) ? ImGuiItemStatusFlags_HoveredRect : 0, rect);
|
||||||
|
}
|
||||||
|
|
||||||
void ImGui::End()
|
void ImGui::End()
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user