mirror of
https://github.com/ocornut/imgui.git
synced 2025-02-26 14:51:46 +01:00
Before the assert was introduced in d66f4e589 the viewport would be eventually clamped with ClampWindowPos using g.FallbackMonitor, but code would run temporarly with DpiScale=0.
This commit is contained in:
parent
71d39a4634
commit
95c4111783
@ -83,6 +83,11 @@ Other changes:
|
||||
- Backends: WebGPU: Fix for DAWN API rename WGPUProgrammableStageDescriptor -> WGPUComputeState.
|
||||
[@PhantomCloak] (#8369)
|
||||
|
||||
Docking+Viewports Branch:
|
||||
|
||||
- Viewports: fixed an assert when a window load settings with a position outside
|
||||
monitor bounds, when there are multiple monitors. (#8393, #8385) [@gaborodriguez]
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
VERSION 1.91.8 (Released 2025-01-31)
|
||||
|
@ -16536,13 +16536,14 @@ static int ImGui::FindPlatformMonitorForRect(const ImRect& rect)
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
||||
const int monitor_count = g.PlatformIO.Monitors.Size;
|
||||
IM_ASSERT(monitor_count > 0);
|
||||
if (monitor_count <= 1)
|
||||
return monitor_count - 1;
|
||||
return 0;
|
||||
|
||||
// Use a minimum threshold of 1.0f so a zero-sized rect won't false positive, and will still find the correct monitor given its position.
|
||||
// This is necessary for tooltips which always resize down to zero at first.
|
||||
const float surface_threshold = ImMax(rect.GetWidth() * rect.GetHeight() * 0.5f, 1.0f);
|
||||
int best_monitor_n = -1;
|
||||
int best_monitor_n = 0; // Default to the first monitor as fallback
|
||||
float best_monitor_surface = 0.001f;
|
||||
|
||||
for (int monitor_n = 0; monitor_n < g.PlatformIO.Monitors.Size && best_monitor_surface < surface_threshold; monitor_n++)
|
||||
|
Loading…
x
Reference in New Issue
Block a user