mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 13:11:05 +01:00 
			
		
		
		
	Settings: Fixed some SetNextWindowPos/SetNextWindowSize API calls not marking settings as dirty.
This commit is contained in:
		| @@ -107,6 +107,7 @@ Other Changes: | |||||||
|   from the menu-bar, avoiding  accidental hovering from one to the other. (#3496, #4797) [@rokups] |   from the menu-bar, avoiding  accidental hovering from one to the other. (#3496, #4797) [@rokups] | ||||||
| - Stack Tool: Added option to copy item path to clipboard. (#4631) | - Stack Tool: Added option to copy item path to clipboard. (#4631) | ||||||
| - Settings: Fixed out-of-bounds read when .ini file on disk is empty. (#5351) [@quantum5] | - Settings: Fixed out-of-bounds read when .ini file on disk is empty. (#5351) [@quantum5] | ||||||
|  | - Settings: Fixed some SetNextWindowPos/SetNextWindowSize API calls not marking settings as dirty. | ||||||
| - DrawList: Fixed PathArcTo() emitting terminating vertices too close to arc vertices. (#4993) [@thedmd] | - DrawList: Fixed PathArcTo() emitting terminating vertices too close to arc vertices. (#4993) [@thedmd] | ||||||
| - DrawList: Fixed texture-based anti-aliasing path with RGBA textures (#5132, #3245) [@cfillion] | - DrawList: Fixed texture-based anti-aliasing path with RGBA textures (#5132, #3245) [@cfillion] | ||||||
| - DrawList: Fixed divide-by-zero or glitches with Radius/Rounding values close to zero. (#5249, #5293, #3491) | - DrawList: Fixed divide-by-zero or glitches with Radius/Rounding values close to zero. (#5249, #5293, #3491) | ||||||
|   | |||||||
							
								
								
									
										35
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										35
									
								
								imgui.cpp
									
									
									
									
									
								
							| @@ -3867,11 +3867,7 @@ void ImGui::UpdateMouseMovingWindowNewFrame() | |||||||
|         if (g.IO.MouseDown[0] && IsMousePosValid(&g.IO.MousePos)) |         if (g.IO.MouseDown[0] && IsMousePosValid(&g.IO.MousePos)) | ||||||
|         { |         { | ||||||
|             ImVec2 pos = g.IO.MousePos - g.ActiveIdClickOffset; |             ImVec2 pos = g.IO.MousePos - g.ActiveIdClickOffset; | ||||||
|             if (moving_window->Pos.x != pos.x || moving_window->Pos.y != pos.y) |  | ||||||
|             { |  | ||||||
|                 MarkIniSettingsDirty(moving_window); |  | ||||||
|             SetWindowPos(moving_window, pos, ImGuiCond_Always); |             SetWindowPos(moving_window, pos, ImGuiCond_Always); | ||||||
|             } |  | ||||||
|             FocusWindow(g.MovingWindow); |             FocusWindow(g.MovingWindow); | ||||||
|         } |         } | ||||||
|         else |         else | ||||||
| @@ -7140,6 +7136,9 @@ void ImGui::SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond) | |||||||
|     const ImVec2 old_pos = window->Pos; |     const ImVec2 old_pos = window->Pos; | ||||||
|     window->Pos = ImFloor(pos); |     window->Pos = ImFloor(pos); | ||||||
|     ImVec2 offset = window->Pos - old_pos; |     ImVec2 offset = window->Pos - old_pos; | ||||||
|  |     if (offset.x == 0.0f && offset.y == 0.0f) | ||||||
|  |         return; | ||||||
|  |     MarkIniSettingsDirty(window); | ||||||
|     window->DC.CursorPos += offset;         // 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.CursorPos += offset;         // 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 += offset;      // And more importantly we need to offset CursorMaxPos/CursorStartPos this so ContentSize calculation doesn't get affected. |     window->DC.CursorMaxPos += offset;      // And more importantly we need to offset CursorMaxPos/CursorStartPos this so ContentSize calculation doesn't get affected. | ||||||
|     window->DC.IdealMaxPos += offset; |     window->DC.IdealMaxPos += offset; | ||||||
| @@ -7174,26 +7173,19 @@ void ImGui::SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond con | |||||||
|     window->SetWindowSizeAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing); |     window->SetWindowSizeAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing); | ||||||
|  |  | ||||||
|     // Set |     // Set | ||||||
|     if (size.x > 0.0f) |     ImVec2 old_size = window->SizeFull; | ||||||
|     { |     window->AutoFitFramesX = (size.x <= 0.0f) ? 2 : 0; | ||||||
|         window->AutoFitFramesX = 0; |     window->AutoFitFramesY = (size.y <= 0.0f) ? 2 : 0; | ||||||
|  |     if (size.x <= 0.0f) | ||||||
|  |         window->AutoFitOnlyGrows = false; | ||||||
|  |     else | ||||||
|         window->SizeFull.x = IM_FLOOR(size.x); |         window->SizeFull.x = IM_FLOOR(size.x); | ||||||
|     } |     if (size.y <= 0.0f) | ||||||
|     else |  | ||||||
|     { |  | ||||||
|         window->AutoFitFramesX = 2; |  | ||||||
|         window->AutoFitOnlyGrows = false; |         window->AutoFitOnlyGrows = false; | ||||||
|     } |     else | ||||||
|     if (size.y > 0.0f) |  | ||||||
|     { |  | ||||||
|         window->AutoFitFramesY = 0; |  | ||||||
|         window->SizeFull.y = IM_FLOOR(size.y); |         window->SizeFull.y = IM_FLOOR(size.y); | ||||||
|     } |     if (old_size.x != window->SizeFull.x || old_size.y != window->SizeFull.y) | ||||||
|     else |         MarkIniSettingsDirty(window); | ||||||
|     { |  | ||||||
|         window->AutoFitFramesY = 2; |  | ||||||
|         window->AutoFitOnlyGrows = false; |  | ||||||
|     } |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void ImGui::SetWindowSize(const ImVec2& size, ImGuiCond cond) | void ImGui::SetWindowSize(const ImVec2& size, ImGuiCond cond) | ||||||
| @@ -10930,7 +10922,6 @@ static void ImGui::NavUpdateWindowing() | |||||||
|             const float move_speed = ImFloor(NAV_MOVE_SPEED * io.DeltaTime * ImMin(io.DisplayFramebufferScale.x, io.DisplayFramebufferScale.y)); // FIXME: Doesn't handle variable framerate very well |             const float move_speed = ImFloor(NAV_MOVE_SPEED * io.DeltaTime * ImMin(io.DisplayFramebufferScale.x, io.DisplayFramebufferScale.y)); // FIXME: Doesn't handle variable framerate very well | ||||||
|             ImGuiWindow* moving_window = g.NavWindowingTarget->RootWindow; |             ImGuiWindow* moving_window = g.NavWindowingTarget->RootWindow; | ||||||
|             SetWindowPos(moving_window, moving_window->Pos + move_delta * move_speed, ImGuiCond_Always); |             SetWindowPos(moving_window, moving_window->Pos + move_delta * move_speed, ImGuiCond_Always); | ||||||
|             MarkIniSettingsDirty(moving_window); |  | ||||||
|             g.NavDisableMouseHover = true; |             g.NavDisableMouseHover = true; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user