Skip to content

Commit 1ab63d9

Browse files
committed
Undid some of the changes done by c95fbb4 because they are not compatible with docking code.
(Will cherry-pick this from docking to master) # Conflicts: # imgui.cpp
1 parent c0bc43c commit 1ab63d9

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

imgui.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,8 +1107,8 @@ static void UpdateKeyRoutingTable(ImGuiKeyRoutingTable* rt);
11071107
// Misc
11081108
static void UpdateSettings();
11091109
static int UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_hovered, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4], const ImRect& visibility_rect);
1110-
static void RenderWindowOuterBorders(ImGuiWindow* window, int border_hovered, int border_held);
1111-
static void RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, bool handle_borders_and_resize_grips, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size, int border_hovered, int border_held);
1110+
static void RenderWindowOuterBorders(ImGuiWindow* window);
1111+
static void RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, bool handle_borders_and_resize_grips, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size);
11121112
static void RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& title_bar_rect, const char* name, bool* p_open);
11131113
static void RenderDimmedBackgroundBehindWindow(ImGuiWindow* window, ImU32 col);
11141114
static void RenderDimmedBackgrounds();
@@ -6089,20 +6089,20 @@ static inline void ClampWindowPos(ImGuiWindow* window, const ImRect& visibility_
60896089
window->Pos = ImClamp(window->Pos, visibility_rect.Min - size_for_clamping, visibility_rect.Max);
60906090
}
60916091

6092-
static void ImGui::RenderWindowOuterBorders(ImGuiWindow* window, int border_hovered, int border_held)
6092+
static void ImGui::RenderWindowOuterBorders(ImGuiWindow* window)
60936093
{
60946094
ImGuiContext& g = *GImGui;
60956095
float rounding = window->WindowRounding;
60966096
float border_size = window->WindowBorderSize;
60976097
if (border_size > 0.0f && !(window->Flags & ImGuiWindowFlags_NoBackground))
60986098
window->DrawList->AddRect(window->Pos, window->Pos + window->Size, GetColorU32(ImGuiCol_Border), rounding, 0, border_size);
60996099

6100-
if (border_hovered != -1 || border_held != -1)
6100+
if (window->ResizeBorderHovered != -1 || window->ResizeBorderHeld != -1)
61016101
{
6102-
const int border_n = (border_held != -1) ? border_held : border_hovered;
6102+
const int border_n = (window->ResizeBorderHeld != -1) ? window->ResizeBorderHeld : window->ResizeBorderHovered;
61036103
const ImGuiResizeBorderDef& def = resize_border_def[border_n];
61046104
const ImRect border_r = GetResizeBorderRect(window, border_n, rounding, 0.0f);
6105-
const ImU32 border_col = GetColorU32((border_held != -1) ? ImGuiCol_SeparatorActive : ImGuiCol_SeparatorHovered);
6105+
const ImU32 border_col = GetColorU32((window->ResizeBorderHeld != -1) ? ImGuiCol_SeparatorActive : ImGuiCol_SeparatorHovered);
61066106
window->DrawList->PathArcTo(ImLerp(border_r.Min, border_r.Max, def.SegmentN1) + ImVec2(0.5f, 0.5f) + def.InnerDir * rounding, rounding, def.OuterAngle - IM_PI * 0.25f, def.OuterAngle);
61076107
window->DrawList->PathArcTo(ImLerp(border_r.Min, border_r.Max, def.SegmentN2) + ImVec2(0.5f, 0.5f) + def.InnerDir * rounding, rounding, def.OuterAngle, def.OuterAngle + IM_PI * 0.25f);
61086108
window->DrawList->PathStroke(border_col, 0, ImMax(2.0f, border_size)); // Thicker than usual
@@ -6116,7 +6116,7 @@ static void ImGui::RenderWindowOuterBorders(ImGuiWindow* window, int border_hove
61166116

61176117
// Draw background and borders
61186118
// Draw and handle scrollbars
6119-
void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, bool handle_borders_and_resize_grips, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size, int border_hovered, int border_held)
6119+
void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, bool handle_borders_and_resize_grips, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size)
61206120
{
61216121
ImGuiContext& g = *GImGui;
61226122
ImGuiStyle& style = g.Style;
@@ -6199,7 +6199,7 @@ void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar
61996199

62006200
// Borders
62016201
if (handle_borders_and_resize_grips)
6202-
RenderWindowOuterBorders(window, border_hovered, border_held);
6202+
RenderWindowOuterBorders(window);
62036203
}
62046204
}
62056205

@@ -6742,6 +6742,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
67426742
if (auto_fit_mask & (1 << ImGuiAxis_Y))
67436743
use_current_size_for_scrollbar_y = true;
67446744
}
6745+
window->ResizeBorderHovered = (signed char)border_hovered;
6746+
window->ResizeBorderHeld = (signed char)border_held;
67456747

67466748
// SCROLLBAR VISIBILITY
67476749

@@ -6856,7 +6858,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
68566858
const ImGuiWindow* window_to_highlight = g.NavWindowingTarget ? g.NavWindowingTarget : g.NavWindow;
68576859
const bool title_bar_is_highlight = want_focus || (window_to_highlight && window->RootWindowForTitleBarHighlight == window_to_highlight->RootWindowForTitleBarHighlight);
68586860
const bool handle_borders_and_resize_grips = true; // This exists to facilitate merge with 'docking' branch.
6859-
RenderWindowDecorations(window, title_bar_rect, title_bar_is_highlight, handle_borders_and_resize_grips, resize_grip_count, resize_grip_col, resize_grip_draw_size, border_hovered, border_held);
6861+
RenderWindowDecorations(window, title_bar_rect, title_bar_is_highlight, handle_borders_and_resize_grips, resize_grip_count, resize_grip_col, resize_grip_draw_size);
68606862

68616863
if (render_decorations_in_parent)
68626864
window->DrawList = &window->DrawListInst;

imgui_internal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2436,6 +2436,8 @@ struct IMGUI_API ImGuiWindow
24362436
bool IsFallbackWindow; // Set on the "Debug##Default" window.
24372437
bool IsExplicitChild; // Set when passed _ChildWindow, left to false by BeginDocked()
24382438
bool HasCloseButton; // Set when the window has a close button (p_open != NULL)
2439+
signed char ResizeBorderHovered; // Current border being hovered for resize (-1: none, otherwise 0-3)
2440+
signed char ResizeBorderHeld; // Current border being held for resize (-1: none, otherwise 0-3)
24392441
short BeginCount; // Number of Begin() during the current frame (generally 0 or 1, 1+ if appending via multiple Begin/End pairs)
24402442
short BeginCountPreviousFrame; // Number of Begin() during the previous frame
24412443
short BeginOrderWithinParent; // Begin() order within immediate parent window, if we are a child window. Otherwise 0.

0 commit comments

Comments
 (0)