@ -3268,7 +3268,6 @@ ImGuiID ImGuiWindow::GetID(const char* str, const char* str_end)
{
ImGuiID seed = IDStack . back ( ) ;
ImGuiID id = ImHashStr ( str , str_end ? ( str_end - str ) : 0 , seed ) ;
ImGui : : KeepAliveID ( id ) ;
ImGuiContext & g = * GImGui ;
if ( g . DebugHookIdInfo = = id )
ImGui : : DebugHookIdInfo ( id , ImGuiDataType_String , str , str_end ) ;
@ -3279,7 +3278,6 @@ ImGuiID ImGuiWindow::GetID(const void* ptr)
{
ImGuiID seed = IDStack . back ( ) ;
ImGuiID id = ImHashData ( & ptr , sizeof ( void * ) , seed ) ;
ImGui : : KeepAliveID ( id ) ;
ImGuiContext & g = * GImGui ;
if ( g . DebugHookIdInfo = = id )
ImGui : : DebugHookIdInfo ( id , ImGuiDataType_Pointer , ptr , NULL ) ;
@ -3290,7 +3288,6 @@ ImGuiID ImGuiWindow::GetID(int n)
{
ImGuiID seed = IDStack . back ( ) ;
ImGuiID id = ImHashData ( & n , sizeof ( n ) , seed ) ;
ImGui : : KeepAliveID ( id ) ;
ImGuiContext & g = * GImGui ;
if ( g . DebugHookIdInfo = = id )
ImGui : : DebugHookIdInfo ( id , ImGuiDataType_S32 , ( void * ) ( intptr_t ) n , NULL ) ;
@ -3333,7 +3330,6 @@ ImGuiID ImGuiWindow::GetIDFromRectangle(const ImRect& r_abs)
ImGuiID seed = IDStack . back ( ) ;
ImRect r_rel = ImGui : : WindowRectAbsToRel ( this , r_abs ) ;
ImGuiID id = ImHashData ( & r_rel , sizeof ( r_rel ) , seed ) ;
ImGui : : KeepAliveID ( id ) ;
return id ;
}
@ -3436,6 +3432,8 @@ ImGuiID ImGui::GetHoveredID()
return g . HoveredId ? g . HoveredId : g . HoveredIdPreviousFrame ;
}
// This is called by ItemAdd().
// Code not using ItemAdd() may need to call this manually otherwise ActiveId will be cleared. In IMGUI_VERSION_NUM < 18717 this was called by GetID().
void ImGui : : KeepAliveID ( ImGuiID id )
{
ImGuiContext & g = * GImGui ;
@ -5625,6 +5623,7 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s
if ( resize_rect . Min . x > resize_rect . Max . x ) ImSwap ( resize_rect . Min . x , resize_rect . Max . x ) ;
if ( resize_rect . Min . y > resize_rect . Max . y ) ImSwap ( resize_rect . Min . y , resize_rect . Max . y ) ;
ImGuiID resize_grip_id = window - > GetID ( resize_grip_n ) ; // == GetWindowResizeCornerID()
KeepAliveID ( resize_grip_id ) ;
ButtonBehavior ( resize_rect , resize_grip_id , & hovered , & held , ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_NoNavFocus ) ;
//GetForegroundDrawList(window)->AddRect(resize_rect.Min, resize_rect.Max, IM_COL32(255, 255, 0, 255));
if ( hovered | | held )
@ -5660,6 +5659,7 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s
bool hovered , held ;
ImRect border_rect = GetResizeBorderRect ( window , border_n , grip_hover_inner_size , WINDOWS_HOVER_PADDING ) ;
ImGuiID border_id = window - > GetID ( border_n + 4 ) ; // == GetWindowResizeBorderID()
KeepAliveID ( border_id ) ;
ButtonBehavior ( border_rect , border_id , & hovered , & held , ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_NoNavFocus ) ;
//GetForegroundDrawLists(window)->AddRect(border_rect.Min, border_rect.Max, IM_COL32(255, 255, 0, 255));
if ( ( hovered & & g . HoveredIdTimer > WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER ) | | held )
@ -8282,6 +8282,8 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg, ImGu
// Directional navigation processing
if ( id ! = 0 )
{
KeepAliveID ( id ) ;
// Runs prior to clipping early-out
// (a) So that NavInitRequest can be honored, for newly opened windows to select a default widget
// (b) So that we can scroll up/down past clipped items. This adds a small O(N) cost to regular navigation requests
@ -11046,6 +11048,7 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
// We don't need to maintain/call ClearActiveID() as releasing the button will early out this function and trigger !ActiveIdIsAlive.
// Rely on keeping other window->LastItemXXX fields intact.
source_id = g . LastItemData . ID = window - > GetIDFromRectangle ( g . LastItemData . Rect ) ;
KeepAliveID ( source_id ) ;
bool is_hovered = ItemHoverable ( g . LastItemData . Rect , source_id ) ;
if ( is_hovered & & g . IO . MouseClicked [ mouse_button ] )
{
@ -11212,7 +11215,10 @@ bool ImGui::BeginDragDropTarget()
const ImRect & display_rect = ( g . LastItemData . StatusFlags & ImGuiItemStatusFlags_HasDisplayRect ) ? g . LastItemData . DisplayRect : g . LastItemData . Rect ;
ImGuiID id = g . LastItemData . ID ;
if ( id = = 0 )
{
id = window - > GetIDFromRectangle ( display_rect ) ;
KeepAliveID ( id ) ;
}
if ( g . DragDropPayload . SourceId = = id )
return false ;