mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 05:01:05 +01:00 
			
		
		
		
	Merged a bunch of small inconsequential things from my work branch, to reduce the diff noise.
This commit is contained in:
		
							
								
								
									
										25
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								imgui.cpp
									
									
									
									
									
								
							| @@ -705,13 +705,13 @@ static void             SetWindowScrollY(ImGuiWindow* window, float new_scroll_y | ||||
| static void             SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond); | ||||
| static void             SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond); | ||||
| static void             SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiCond cond); | ||||
| static ImGuiWindow*     FindHoveredWindow(ImVec2 pos); | ||||
| static ImGuiWindow*     FindHoveredWindow(); | ||||
| static ImGuiWindow*     CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags); | ||||
| static void             CheckStacksSize(ImGuiWindow* window, bool write); | ||||
| static ImVec2           CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window); | ||||
|  | ||||
| static void             AddDrawListToDrawData(ImVector<ImDrawList*>* out_render_list, ImDrawList* draw_list); | ||||
| static void             AddWindowToDrawData(ImVector<ImDrawList*>* out_render_list, ImGuiWindow* window); | ||||
| static void             AddDrawListToDrawData(ImVector<ImDrawList*>* out_list, ImDrawList* draw_list); | ||||
| static void             AddWindowToDrawData(ImVector<ImDrawList*>* out_list, ImGuiWindow* window); | ||||
| static void             AddWindowToSortedBuffer(ImVector<ImGuiWindow*>* out_sorted_windows, ImGuiWindow* window); | ||||
|  | ||||
| static ImGuiWindowSettings* AddWindowSettings(const char* name); | ||||
| @@ -857,10 +857,10 @@ ImGuiIO::ImGuiIO() | ||||
|     // Settings | ||||
|     DisplaySize = ImVec2(-1.0f, -1.0f); | ||||
|     DeltaTime = 1.0f/60.0f; | ||||
|     NavFlags = 0x00; | ||||
|     IniSavingRate = 5.0f; | ||||
|     IniFilename = "imgui.ini"; | ||||
|     LogFilename = "imgui_log.txt"; | ||||
|     NavFlags = 0x00; | ||||
|     MouseDoubleClickTime = 0.30f; | ||||
|     MouseDoubleClickMaxDist = 6.0f; | ||||
|     for (int i = 0; i < ImGuiKey_COUNT; i++) | ||||
| @@ -2664,7 +2664,8 @@ ImGuiStyle& ImGui::GetStyle() | ||||
| // Same value as passed to the old io.RenderDrawListsFn function. Valid after Render() and until the next call to NewFrame() | ||||
| ImDrawData* ImGui::GetDrawData() | ||||
| { | ||||
|     return GImGui->DrawData.Valid ? &GImGui->DrawData : NULL; | ||||
|     ImGuiContext& g = *GImGui; | ||||
|     return g.DrawData.Valid ? &g.DrawData : NULL; | ||||
| } | ||||
|  | ||||
| float ImGui::GetTime() | ||||
| @@ -3415,7 +3416,7 @@ void ImGui::NewFrame() | ||||
|     // - Child windows can extend beyond the limit of their parent so we need to derive HoveredRootWindow from HoveredWindow. | ||||
|     // - When moving a window we can skip the search, which also conveniently bypasses the fact that window->WindowRectClipped is lagging as this point. | ||||
|     // - We also support the moved window toggling the NoInputs flag after moving has started in order to be able to detect windows below it, which is useful for e.g. docking mechanisms. | ||||
|     g.HoveredWindow = (g.MovingWindow && !(g.MovingWindow->Flags & ImGuiWindowFlags_NoInputs)) ? g.MovingWindow : FindHoveredWindow(g.IO.MousePos); | ||||
|     g.HoveredWindow = (g.MovingWindow && !(g.MovingWindow->Flags & ImGuiWindowFlags_NoInputs)) ? g.MovingWindow : FindHoveredWindow(); | ||||
|     g.HoveredRootWindow = g.HoveredWindow ? g.HoveredWindow->RootWindow : NULL; | ||||
|  | ||||
|     ImGuiWindow* modal_window = GetFrontMostModalRootWindow(); | ||||
| @@ -3633,6 +3634,7 @@ void ImGui::Shutdown(ImGuiContext* context) | ||||
|  | ||||
|     SaveIniSettingsToDisk(g.IO.IniFilename); | ||||
|  | ||||
|     // Clear everything else | ||||
|     for (int i = 0; i < g.Windows.Size; i++) | ||||
|         IM_DELETE(g.Windows[i]); | ||||
|     g.Windows.clear(); | ||||
| @@ -4445,7 +4447,7 @@ void ImGui::CalcListClipping(int items_count, float items_height, int* out_items | ||||
|  | ||||
| // Find window given position, search front-to-back | ||||
| // FIXME: Note that we have a lag here because WindowRectClipped is updated in Begin() so windows moved by user via SetWindowPos() and not SetNextWindowPos() will have that rectangle lagging by a frame at the time FindHoveredWindow() is called, aka before the next Begin(). Moving window thankfully isn't affected. | ||||
| static ImGuiWindow* FindHoveredWindow(ImVec2 pos) | ||||
| static ImGuiWindow* FindHoveredWindow() | ||||
| { | ||||
|     ImGuiContext& g = *GImGui; | ||||
|     for (int i = g.Windows.Size - 1; i >= 0; i--) | ||||
| @@ -4458,7 +4460,7 @@ static ImGuiWindow* FindHoveredWindow(ImVec2 pos) | ||||
|  | ||||
|         // Using the clipped AABB, a child window will typically be clipped by its parent (not always) | ||||
|         ImRect bb(window->WindowRectClipped.Min - g.Style.TouchExtraPadding, window->WindowRectClipped.Max + g.Style.TouchExtraPadding); | ||||
|         if (bb.Contains(pos)) | ||||
|         if (bb.Contains(g.IO.MousePos)) | ||||
|             return window; | ||||
|     } | ||||
|     return NULL; | ||||
| @@ -6209,14 +6211,13 @@ void ImGui::End() | ||||
|  | ||||
|     if (window->DC.ColumnsSet != NULL) | ||||
|         EndColumns(); | ||||
|     PopClipRect();   // inner window clip rectangle | ||||
|     PopClipRect();   // Inner window clip rectangle | ||||
|  | ||||
|     // Stop logging | ||||
|     if (!(window->Flags & ImGuiWindowFlags_ChildWindow))    // FIXME: add more options for scope of logging | ||||
|         LogFinish(); | ||||
|  | ||||
|     // Pop | ||||
|     // NB: we don't clear 'window->RootWindow'. The pointer is allowed to live until the next call to Begin(). | ||||
|     // Pop from window stack | ||||
|     g.CurrentWindowStack.pop_back(); | ||||
|     if (window->Flags & ImGuiWindowFlags_Popup) | ||||
|         g.CurrentPopupStack.pop_back(); | ||||
| @@ -13125,7 +13126,7 @@ void ImGui::ShowMetricsWindow(bool* p_open) | ||||
|                     return; | ||||
|                 } | ||||
|  | ||||
|                 ImDrawList* overlay_draw_list = &GImGui->OverlayDrawList;   // Render additional visuals into the top-most draw list | ||||
|                 ImDrawList* overlay_draw_list = ImGui::GetOverlayDrawList(); // Render additional visuals into the top-most draw list | ||||
|                 if (window && ImGui::IsItemHovered()) | ||||
|                     overlay_draw_list->AddRect(window->Pos, window->Pos + window->Size, IM_COL32(255, 255, 0, 255)); | ||||
|                 if (!node_open) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user