@ -5062,14 +5062,13 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFl
{
// Retrieve settings from .ini file
// Use SetWindowPos() or SetNextWindowPos() with the appropriate condition flag to change the initial position of a window.
window - > PosFloat = ImVec2 ( 60 , 60 ) ;
window - > Pos = ImVec2 ( ( float ) ( int ) window - > PosFloat . x , ( float ) ( int ) window - > PosFloat . y ) ;
window - > Pos = window - > PosFloat = ImVec2 ( 60 , 60 ) ;
if ( ImGuiWindowSettings * settings = ImGui : : FindWindowSettings ( window - > ID ) )
{
SetWindowConditionAllowFlags ( window , ImGuiCond_FirstUseEver , false ) ;
window - > PosFloat = settings - > Pos ;
window - > Pos = Im Vec2( ( float ) ( int ) window - > PosFloat . x , ( float ) ( int ) window - > PosFloat . y ) ;
window - > Pos = Im Floor( window - > PosFloat ) ;
window - > Collapsed = settings - > Collapsed ;
if ( ImLengthSqr ( settings - > Size ) > 0.00001f )
size = settings - > Size ;
@ -5381,6 +5380,13 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window - > LastFrameActive = current_frame ;
window - > IDStack . resize ( 1 ) ;
// Lock window rounding, border size and rounding so that altering the border sizes for children doesn't have side-effects.
window - > WindowRounding = ( flags & ImGuiWindowFlags_ChildWindow ) ? style . ChildRounding : ( ( flags & ImGuiWindowFlags_Popup ) & & ! ( flags & ImGuiWindowFlags_Modal ) ) ? style . PopupRounding : style . WindowRounding ;
window - > WindowBorderSize = ( flags & ImGuiWindowFlags_ChildWindow ) ? style . ChildBorderSize : ( ( flags & ImGuiWindowFlags_Popup ) & & ! ( flags & ImGuiWindowFlags_Modal ) ) ? style . PopupBorderSize : style . WindowBorderSize ;
window - > WindowPadding = style . WindowPadding ;
if ( ( flags & ImGuiWindowFlags_ChildWindow ) & & ! ( flags & ( ImGuiWindowFlags_AlwaysUseWindowPadding | ImGuiWindowFlags_Popup ) ) & & window - > WindowBorderSize = = 0.0f )
window - > WindowPadding = ImVec2 ( 0.0f , ( flags & ImGuiWindowFlags_MenuBar ) ? style . WindowPadding . y : 0.0f ) ;
// Setup draw list and outer clipping rectangle
window - > DrawList - > Clear ( ) ;
window - > DrawList - > Flags = ( g . Style . AntiAliasedLines ? ImDrawListFlags_AntiAliasedLines : 0 ) | ( g . Style . AntiAliasedFill ? ImDrawListFlags_AntiAliasedFill : 0 ) ;
@ -5396,7 +5402,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
// Popup first latch mouse position, will position itself when it appears next frame
window - > AutoPosLastDirection = ImGuiDir_None ;
if ( ( flags & ImGuiWindowFlags_Popup ) ! = 0 & & ! window_pos_set_by_api )
window - > Pos Float = g . CurrentPopupStack . back ( ) . OpenPopupPos ;
window - > Pos = window - > Pos Float = g . CurrentPopupStack . back ( ) . OpenPopupPos ;
}
// Collapse window by double-clicking on title bar
@ -5438,15 +5444,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
}
}
// Lock window rounding, border size and rounding so that altering the border sizes for children doesn't have side-effects.
window - > WindowRounding = ( flags & ImGuiWindowFlags_ChildWindow ) ? style . ChildRounding : ( ( flags & ImGuiWindowFlags_Popup ) & & ! ( flags & ImGuiWindowFlags_Modal ) ) ? style . PopupRounding : style . WindowRounding ;
window - > WindowBorderSize = ( flags & ImGuiWindowFlags_ChildWindow ) ? style . ChildBorderSize : ( ( flags & ImGuiWindowFlags_Popup ) & & ! ( flags & ImGuiWindowFlags_Modal ) ) ? style . PopupBorderSize : style . WindowBorderSize ;
window - > WindowPadding = style . WindowPadding ;
if ( ( flags & ImGuiWindowFlags_ChildWindow ) & & ! ( flags & ( ImGuiWindowFlags_AlwaysUseWindowPadding | ImGuiWindowFlags_Popup ) ) & & window - > WindowBorderSize = = 0.0f )
window - > WindowPadding = ImVec2 ( 0.0f , ( flags & ImGuiWindowFlags_MenuBar ) ? style . WindowPadding . y : 0.0f ) ;
const float window_rounding = window - > WindowRounding ;
const float window_border_size = window - > WindowBorderSize ;
// Calculate auto-fit size, handle automatic resize
const ImVec2 size_auto_fit = CalcSizeAutoFit ( window , window - > SizeContents ) ;
ImVec2 size_full_modified ( FLT_MAX , FLT_MAX ) ;
@ -5551,7 +5548,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window - > PosFloat = ImMin ( window - > PosFloat , g . IO . DisplaySize - padding ) ;
}
}
window - > Pos = Im Vec2( ( float ) ( int ) window - > PosFloat . x , ( float ) ( int ) window - > PosFloat . y ) ;
window - > Pos = Im Floor( window - > PosFloat ) ;
// Default item width. Make it proportional to window size if window manually resizes
if ( window - > Size . x > 0.0f & & ! ( flags & ImGuiWindowFlags_Tooltip ) & & ! ( flags & ImGuiWindowFlags_AlwaysAutoResize ) )
@ -5589,6 +5586,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window - > DrawList - > AddRectFilled ( fullscreen_rect . Min , fullscreen_rect . Max , GetColorU32 ( ImGuiCol_ModalWindowDarkening , g . ModalWindowDarkeningRatio ) ) ;
// Draw window + handle manual resize
const float window_rounding = window - > WindowRounding ;
const float window_border_size = window - > WindowBorderSize ;
ImRect title_bar_rect = window - > TitleBarRect ( ) ;
const bool window_is_focused = want_focus | | ( g . NavWindow & & window - > RootNonPopupWindow = = g . NavWindow - > RootNonPopupWindow ) ;
if ( window - > Collapsed )
@ -5697,7 +5696,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
}
if ( pos_target . x ! = FLT_MAX )
{
window - > Pos = window - > PosFloat = Im Vec2( ( float ) ( int ) pos_target . x , ( float ) ( int ) pos_target . y ) ;
window - > Pos = window - > PosFloat = Im Floor( pos_target ) ;
MarkIniSettingsDirty ( window ) ;
}
@ -6565,7 +6564,7 @@ static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond)
// Set
const ImVec2 old_pos = window - > Pos ;
window - > PosFloat = pos ;
window - > Pos = Im Vec2( ( float ) ( int ) window - > PosFloat . x , ( float ) ( int ) window - > PosFloat . y ) ;
window - > Pos = Im Floor( pos ) ;
window - > DC . CursorPos + = ( window - > Pos - old_pos ) ; // As we happen to move the window while it is being appended to (which is a bad idea - will smear) let's at least offset the cursor
window - > DC . CursorMaxPos + = ( window - > Pos - old_pos ) ; // And more importantly we need to adjust this so size calculation doesn't get affected.
}