@ -5295,7 +5295,7 @@ ImGuiWindow* ImGui::FindWindowByName(const char* name)
static void ApplyWindowSettings ( ImGuiWindow * window , ImGuiWindowSettings * settings )
{
ImGuiViewport * main_viewport = ImGui : : GetMainViewport ( ) ;
const ImGuiViewport * main_viewport = ImGui : : GetMainViewport ( ) ;
window - > ViewportPos = main_viewport - > Pos ;
if ( settings - > ViewportId )
{
@ -5321,7 +5321,7 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags)
g . WindowsById . SetVoidPtr ( window - > ID , window ) ;
// Default/arbitrary window position. Use SetNextWindowPos() with the appropriate condition flag to change the initial position of a window.
ImGuiViewport * main_viewport = ImGui : : GetMainViewport ( ) ;
const ImGuiViewport * main_viewport = ImGui : : GetMainViewport ( ) ;
window - > Pos = main_viewport - > Pos + ImVec2 ( 60 , 60 ) ;
window - > ViewportPos = main_viewport - > Pos ;
@ -6412,7 +6412,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
if ( window - > Viewport - > PlatformMonitor = = - 1 )
{
// Fallback for "lost" window (e.g. a monitor disconnected): we move the window back over the main viewport
ImGuiViewport * main_viewport = GetMainViewport ( ) ;
const ImGuiViewport * main_viewport = GetMainViewport ( ) ;
SetWindowPos ( window , main_viewport - > Pos + style . DisplayWindowPadding , ImGuiCond_Always ) ;
}
else
@ -8878,8 +8878,8 @@ bool ImGui::BeginPopupModal(const char* name, bool* p_open, ImGuiWindowFlags fla
// FIXME: Should test for (PosCond & window->SetWindowPosAllowFlags) with the upcoming window.
if ( ( g . NextWindowData . Flags & ImGuiNextWindowDataFlags_HasPos ) = = 0 )
{
ImGuiViewport P * viewport = window - > WasActive ? window - > Viewport : ( ImGuiViewportP * ) GetMainViewport ( ) ; // FIXME-VIEWPORT: What may be our reference viewport?
SetNextWindowPos ( viewport - > Get MainRect( ) . Get Center( ) , ImGuiCond_FirstUseEver , ImVec2 ( 0.5f , 0.5f ) ) ;
const ImGuiViewport * viewport = window - > WasActive ? window - > Viewport : GetMainViewport ( ) ; // FIXME-VIEWPORT: What may be our reference viewport?
SetNextWindowPos ( viewport - > Get Center( ) , ImGuiCond_FirstUseEver , ImVec2 ( 0.5f , 0.5f ) ) ;
}
flags | = ImGuiWindowFlags_Popup | ImGuiWindowFlags_Modal | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoDocking ;
@ -10259,7 +10259,7 @@ void ImGui::NavUpdateWindowingOverlay()
if ( g . NavWindowingListWindow = = NULL )
g . NavWindowingListWindow = FindWindowByName ( " ###NavWindowingList " ) ;
ImGuiViewport P * viewport = /*g.NavWindow ? g.NavWindow->Viewport :*/ ( ImGuiViewportP * ) GetMainViewport ( ) ;
const ImGuiViewport * viewport = /*g.NavWindow ? g.NavWindow->Viewport :*/ GetMainViewport ( ) ;
SetNextWindowSizeConstraints ( ImVec2 ( viewport - > Size . x * 0.20f , viewport - > Size . y * 0.20f ) , ImVec2 ( FLT_MAX , FLT_MAX ) ) ;
SetNextWindowPos ( viewport - > Pos + viewport - > Size * 0.5f , ImGuiCond_Always , ImVec2 ( 0.5f , 0.5f ) ) ;
PushStyleVar ( ImGuiStyleVar_WindowPadding , g . Style . WindowPadding * 2.0f ) ;
@ -11589,7 +11589,7 @@ static void ImGui::UpdateSelectWindowViewport(ImGuiWindow* window)
window - > ViewportAllowPlatformMonitorExtend = - 1 ;
// Restore main viewport if multi-viewport is not supported by the backend
ImGuiViewportP * main_viewport = ( ImGuiViewportP * ) GetMainViewport ( ) ;
ImGuiViewportP * main_viewport = ( ImGuiViewportP * ) ( void * ) GetMainViewport ( ) ;
if ( ! ( g . ConfigFlagsCurrFrame & ImGuiConfigFlags_ViewportsEnable ) )
{
SetWindowViewport ( window , main_viewport ) ;
@ -14409,7 +14409,7 @@ void ImGui::DockNodeTreeUpdateSplitter(ImGuiDockNode* node)
/*
// [DEBUG] Render limits
ImDrawList * draw_list = node - > HostWindow ? GetForegroundDrawList ( node - > HostWindow ) : GetForegroundDrawList ( ( ImGuiViewportP * ) GetMainViewport ( ) ) ;
ImDrawList * draw_list = node - > HostWindow ? GetForegroundDrawList ( node - > HostWindow ) : GetForegroundDrawList ( GetMainViewport ( ) ) ;
for ( int n = 0 ; n < 2 ; n + + )
if ( axis = = ImGuiAxis_X )
draw_list - > AddLine ( ImVec2 ( resize_limits [ n ] , node - > ChildNodes [ n ] - > Pos . y ) , ImVec2 ( resize_limits [ n ] , node - > ChildNodes [ n ] - > Pos . y + node - > ChildNodes [ n ] - > Size . y ) , IM_COL32 ( 255 , 0 , 255 , 255 ) , 3.0f ) ;
@ -14437,7 +14437,7 @@ void ImGui::DockNodeTreeUpdateSplitter(ImGuiDockNode* node)
for ( int touching_node_n = 0 ; touching_node_n < touching_nodes [ side_n ] . Size ; touching_node_n + + )
{
ImGuiDockNode * touching_node = touching_nodes [ side_n ] [ touching_node_n ] ;
//ImDrawList* draw_list = node->HostWindow ? GetForegroundDrawList(node->HostWindow) : GetForegroundDrawList( (ImGuiViewportP*) GetMainViewport());
//ImDrawList* draw_list = node->HostWindow ? GetForegroundDrawList(node->HostWindow) : GetForegroundDrawList( GetMainViewport());
//draw_list->AddRect(touching_node->Pos, touching_node->Pos + touching_node->Size, IM_COL32(255, 128, 0, 255));
while ( touching_node - > ParentNode ! = node )
{
@ -14653,7 +14653,7 @@ void ImGui::DockSpace(ImGuiID id, const ImVec2& size_arg, ImGuiDockNodeFlags fla
// The limitation with this call is that your window won't have a menu bar.
// Even though we could pass window flags, it would also require the user to be able to call BeginMenuBar() somehow meaning we can't Begin/End in a single function.
// But you can also use BeginMainMenuBar(). If you really want a menu bar inside the same window as the one hosting the dockspace, you will need to copy this code somewhere and tweak it.
ImGuiID ImGui : : DockSpaceOverViewport ( ImGuiViewport * viewport , ImGuiDockNodeFlags dockspace_flags , const ImGuiWindowClass * window_class )
ImGuiID ImGui : : DockSpaceOverViewport ( const ImGuiViewport * viewport , ImGuiDockNodeFlags dockspace_flags , const ImGuiWindowClass * window_class )
{
if ( viewport = = NULL )
viewport = GetMainViewport ( ) ;
@ -15980,9 +15980,33 @@ void ImGui::ShowMetricsWindow(bool* p_open)
TreePop ( ) ;
}
// Content s
// Window s
DebugNodeWindowsList ( & g . Windows , " Windows " ) ;
//DebugNodeWindowsList(&g.WindowsFocusOrder, "WindowsFocusOrder");
// Drawlists
int drawlist_count = 0 ;
for ( int viewport_i = 0 ; viewport_i < g . Viewports . Size ; viewport_i + + )
drawlist_count + = g . Viewports [ viewport_i ] - > DrawDataBuilder . GetDrawListCount ( ) ;
if ( TreeNode ( " DrawLists " , " DrawLists (%d) " , drawlist_count ) )
{
for ( int viewport_i = 0 ; viewport_i < g . Viewports . Size ; viewport_i + + )
{
ImGuiViewportP * viewport = g . Viewports [ viewport_i ] ;
bool viewport_has_drawlist = false ;
for ( int layer_i = 0 ; layer_i < IM_ARRAYSIZE ( viewport - > DrawDataBuilder . Layers ) ; layer_i + + )
for ( int draw_list_i = 0 ; draw_list_i < viewport - > DrawDataBuilder . Layers [ layer_i ] . Size ; draw_list_i + + )
{
if ( ! viewport_has_drawlist )
ImGui : : Text ( " Active DrawLists in Viewport #%d, ID: 0x%08X " , viewport - > Idx , viewport - > ID ) ;
viewport_has_drawlist = true ;
DebugNodeDrawList ( NULL , viewport , viewport - > DrawDataBuilder . Layers [ layer_i ] [ draw_list_i ] , " DrawList " ) ;
}
}
TreePop ( ) ;
}
// Viewports
if ( TreeNode ( " Viewports " , " Viewports (%d) " , g . Viewports . Size ) )
{
Indent ( GetTreeNodeToLabelSpacing ( ) ) ;
@ -16228,7 +16252,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
char buf [ 64 ] = " " ;
char * p = buf ;
ImGuiDockNode * node = g . HoveredDockNode ;
ImDrawList * overlay_draw_list = node - > HostWindow ? GetForegroundDrawList ( node - > HostWindow ) : GetForegroundDrawList ( ( ImGuiViewportP * ) GetMainViewport ( ) ) ;
ImDrawList * overlay_draw_list = node - > HostWindow ? GetForegroundDrawList ( node - > HostWindow ) : GetForegroundDrawList ( GetMainViewport ( ) ) ;
p + = ImFormatString ( p , buf + IM_ARRAYSIZE ( buf ) - p , " DockId: %X%s \n " , node - > ID , node - > IsCentralNode ( ) ? " *CentralNode* " : " " ) ;
p + = ImFormatString ( p , buf + IM_ARRAYSIZE ( buf ) - p , " WindowClass: %08X \n " , node - > WindowClass . ClassId ) ;
p + = ImFormatString ( p , buf + IM_ARRAYSIZE ( buf ) - p , " Size: (%.0f, %.0f) \n " , node - > Size . x , node - > Size . y ) ;