Skip to content

Commit

Permalink
Fix for empty rectangle being passed to ConvertToDCS in MonitorSetupG…
Browse files Browse the repository at this point in the history
…enerator when simulate monitor in profile tool is selected. #584

Tighten up the profile monitor checking against the physical displays in HeliosProfile because it was returning a match when the profile only contained a subset of the real monitors.  Now the number of Monitors in the profile must match the number of displays.
  • Loading branch information
BlueFinBima committed Oct 16, 2024
1 parent 071c334 commit ead0a0d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Helios/HeliosProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public bool IsValidMonitorLayout
}

CheckedDisplays = ConfigManager.DisplayManager.Displays;
_validLayout = true;
_validLayout = CheckedDisplays.Count == Monitors.Count;
foreach (Monitor display in Monitors)
{
if (CheckedDisplays.Any(systemDisplay =>
Expand Down
10 changes: 8 additions & 2 deletions Patching/DCS/MonitorSetupGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,14 @@ private IEnumerable<StatusReportItem> UpdateMonitorSetup(MonitorSetupTemplate te

internal void ConvertToDCS(ref Rect windowsRect)
{
windowsRect.Offset(-_parent.Rendered.TopLeft.X, -_parent.Rendered.TopLeft.Y);
windowsRect.Scale(ConfigManager.DisplayManager.PixelsPerDip, ConfigManager.DisplayManager.PixelsPerDip);
if (!windowsRect.IsEmpty)
{
windowsRect.Offset(-_parent.Rendered.TopLeft.X, -_parent.Rendered.TopLeft.Y);
windowsRect.Scale(ConfigManager.DisplayManager.PixelsPerDip, ConfigManager.DisplayManager.PixelsPerDip);
} else
{
windowsRect = _parent.Rendered;
}
}

private bool TryCreateViewport(ICollection<FormattableString> lines, KeyValuePair<string, Rect> viewport, string indent, out FormattableString code)
Expand Down

0 comments on commit ead0a0d

Please sign in to comment.