Skip to content
This repository was archived by the owner on Jul 24, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 20 additions & 22 deletions LenovoLegionToolkit.Lib/Extensions/DisplayExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,32 @@ public static void SetSettingsUsingPathInfo(this Display display, DisplaySetting
// which lets the display consume less power for more battery life.
var displaySource = display.ToPathDisplaySource();
var pathInfos = PathInfo.GetActivePaths();
var newPathInfos = new List<PathInfo>();

foreach (var pathInfo in pathInfos)
for (var i = 0; i < pathInfos.Length; i++)
{
if (pathInfo.DisplaySource != displaySource)
{
newPathInfos.Add(pathInfo);
continue;
}
var pathInfo = pathInfos[i];

var targetsInfo = pathInfo.TargetsInfo;
var pathTargetInfos = targetsInfo
.Select(targetInfo => new PathTargetInfo(targetInfo.DisplayTarget,
new PathTargetSignalInfo(displaySetting, displaySetting.Resolution),
targetInfo.Rotation,
targetInfo.Scaling))
.ToArray();
if (pathInfo.DisplaySource == displaySource)
{
var targetsInfo = pathInfo.TargetsInfo;
var pathTargetInfos = targetsInfo
.Select(targetInfo => new PathTargetInfo(targetInfo.DisplayTarget,
new PathTargetSignalInfo(displaySetting, displaySetting.Resolution),
targetInfo.Rotation,
targetInfo.Scaling))
.ToArray();

newPathInfos.Add(new PathInfo(
pathInfo.DisplaySource,
pathInfo.Position,
displaySetting.Resolution,
pathInfo.PixelFormat,
pathTargetInfos
));
pathInfos[i] = new PathInfo(
pathInfo.DisplaySource,
pathInfo.Position,
displaySetting.Resolution,
pathInfo.PixelFormat,
pathTargetInfos
);
}
}

PathInfo.ApplyPathInfos(newPathInfos.ToArray());
PathInfo.ApplyPathInfos(pathInfos);
}

public static DisplayAdvancedColorInfo GetAdvancedColorInfo(this Display display)
Expand Down