From 79153cf19f53726d556637c270fc0b11122835a0 Mon Sep 17 00:00:00 2001 From: omar Date: Sat, 23 Jun 2018 20:08:19 +0200 Subject: [PATCH] Internals: Various renaming. e.g. NewFrameUpdateHoveredWindowAndCaptureFlags() to UpdateHoveredWindowAndCaptureFlags() + exposed UpdateMovingWindow() in imgui_internal.h. --- imgui.cpp | 13 ++++++------- imgui_internal.h | 5 +++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index c33b53aef..77a66f64e 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -441,7 +441,7 @@ Note: The 'io.WantCaptureMouse' is more accurate that any attempt to "check if the mouse is hovering a window" (don't do that!). It handle mouse dragging correctly (both dragging that started over your application or over an imgui window) and handle e.g. modal windows blocking inputs. Those flags are updated by ImGui::NewFrame(). Preferably read the flags after calling NewFrame() if you can afford it, but reading them before is also - perfectly fine, as the bool toggle fairly rarely. If you have on a touch device, you might find use for an early call to NewFrameUpdateHoveredWindowAndCaptureFlags(). + perfectly fine, as the bool toggle fairly rarely. If you have on a touch device, you might find use for an early call to UpdateHoveredWindowAndCaptureFlags(). Note: Text input widget releases focus on "Return KeyDown", so the subsequent "Return KeyUp" event that your application receive will typically have 'io.WantCaptureKeyboard=false'. Depending on your application logic it may or not be inconvenient. You might want to track which key-downs were targeted for Dear ImGui, e.g. with an array of bool, and filter out the corresponding key-ups.) @@ -855,7 +855,6 @@ static void NavUpdate(); static void NavUpdateWindowing(); static void NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, const ImGuiID id); -static void UpdateMovingWindow(); static void UpdateMouseInputs(); static void UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4]); static void FocusFrontMostActiveWindow(ImGuiWindow* ignore_window); @@ -2070,7 +2069,7 @@ ImGuiWindow::ImGuiWindow(ImGuiContext* context, const char* name) CollapseToggleWanted = false; SkipItems = false; Appearing = false; - CloseButton = false; + HasCloseButton = false; BeginOrderWithinParent = -1; BeginOrderWithinContext = -1; BeginCount = 0; @@ -3503,7 +3502,7 @@ static void ImGui::NavUpdate() #endif } -static void ImGui::UpdateMovingWindow() +void ImGui::UpdateMovingWindow() { ImGuiContext& g = *GImGui; if (g.MovingWindow != NULL) @@ -3592,7 +3591,7 @@ static void ImGui::UpdateMouseInputs() } // The reason this is exposed in imgui_internal.h is: on touch-based system that don't have hovering, we want to dispatch inputs to the right target (imgui vs imgui+app) -void ImGui::NewFrameUpdateHoveredWindowAndCaptureFlags() +void ImGui::UpdateHoveredWindowAndCaptureFlags() { ImGuiContext& g = *GImGui; @@ -3763,7 +3762,7 @@ void ImGui::NewFrame() // Handle user moving window with mouse (at the beginning of the frame to avoid input lag or sheering) UpdateMovingWindow(); - NewFrameUpdateHoveredWindowAndCaptureFlags(); + UpdateHoveredWindowAndCaptureFlags(); if (GetFrontMostPopupModal() != NULL) g.ModalWindowDarkeningRatio = ImMin(g.ModalWindowDarkeningRatio + g.IO.DeltaTime * 6.0f, 1.0f); @@ -6030,7 +6029,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window_just_activated_by_user |= (window != popup_ref.Window); } window->Appearing = (window_just_activated_by_user || window_just_appearing_after_hidden_for_resize); - window->CloseButton = (p_open != NULL); + window->HasCloseButton = (p_open != NULL); if (window->Appearing) SetWindowConditionAllowFlags(window, ImGuiCond_Appearing, true); diff --git a/imgui_internal.h b/imgui_internal.h index db4429e95..16674ee2f 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -966,7 +966,7 @@ struct IMGUI_API ImGuiWindow bool CollapseToggleWanted; bool SkipItems; // Set when items can safely be all clipped (e.g. window not visible or collapsed) bool Appearing; // Set during the frame where the window is appearing (or re-appearing) - bool CloseButton; // Set when the window has a close button (p_open != NULL) + bool HasCloseButton; // Set when the window has a close button (p_open != NULL) int BeginOrderWithinParent; // Order within immediate parent window, if we are a child window. Otherwise 0. int BeginOrderWithinContext; // Order within entire imgui context. This is mostly used for debugging submission order related issues. int BeginCount; // Number of Begin() during the current frame (generally 0 or 1, 1+ if appending via multiple Begin/End pairs) @@ -1070,7 +1070,8 @@ namespace ImGui IMGUI_API void Initialize(ImGuiContext* context); IMGUI_API void Shutdown(ImGuiContext* context); // Since 1.60 this is a _private_ function. You can call DestroyContext() to destroy the context created by CreateContext(). - IMGUI_API void NewFrameUpdateHoveredWindowAndCaptureFlags(); + IMGUI_API void UpdateHoveredWindowAndCaptureFlags(); + IMGUI_API void UpdateMovingWindow(); IMGUI_API void MarkIniSettingsDirty(); IMGUI_API void MarkIniSettingsDirty(ImGuiWindow* window);