Made changes to stop Cloned displays causing CTD

Currently still can't get the cloned displays to get applied properly though. Looks like the cloned displays are not being recorded in the settings.
This commit is contained in:
Terry MacDonald 2021-10-16 21:41:34 +13:00
parent 6032be043a
commit 7661f1dc73
3 changed files with 17 additions and 6 deletions

View File

@ -26,8 +26,8 @@ using System.Resources;
[assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")]
// Version information
[assembly: AssemblyVersion("2.0.1.159")]
[assembly: AssemblyFileVersion("2.0.1.159")]
[assembly: AssemblyVersion("2.0.1.161")]
[assembly: AssemblyFileVersion("2.0.1.161")]
[assembly: NeutralResourcesLanguageAttribute( "en" )]
[assembly: CLSCompliant(true)]

View File

@ -892,7 +892,7 @@ namespace DisplayMagicianShared.NVIDIA
// Now we need to loop through each of the windows paths so we can record the Windows DisplayName to DisplayID mapping
// This is needed for us to piece together the Screen layout for when we draw the NVIDIA screens!
myDisplayConfig.DisplayNames = new Dictionary<uint, string>();
foreach (KeyValuePair<string, uint> displaySource in WinLibrary.GetDisplaySourceNames())
foreach (KeyValuePair<string, List<uint>> displaySource in WinLibrary.GetDisplaySourceNames())
{
// Now we try to get the information about the displayIDs and map them to windows \\DISPLAY names e.g. \\DISPLAY1
string displayName = displaySource.Key;

View File

@ -478,7 +478,7 @@ namespace DisplayMagicianShared.Windows
return windowsDisplayConfig;
}
public static Dictionary<string, uint> GetDisplaySourceNames()
public static Dictionary<string, List<uint>> GetDisplaySourceNames()
{
// Get the size of the largest Active Paths and Modes arrays
SharedLogger.logger.Trace($"WinLibrary/GetWindowsDisplayConfig: Getting the size of the largest Active Paths and Modes arrays");
@ -529,7 +529,7 @@ namespace DisplayMagicianShared.Windows
}
// Prepare the empty DisplaySources dictionary
Dictionary<string, uint> DisplaySources = new Dictionary<string, uint>();
Dictionary<string, List<uint>> DisplaySources = new Dictionary<string, List<uint>>();
// Now cycle through the paths and grab the HDR state information
// and map the adapter name to adapter id
@ -547,7 +547,18 @@ namespace DisplayMagicianShared.Windows
if (err == WIN32STATUS.ERROR_SUCCESS)
{
// Store it for later
DisplaySources.Add(sourceInfo.ViewGdiDeviceName, path.SourceInfo.Id);
//DisplaySources.Add(sourceInfo.ViewGdiDeviceName, path.SourceInfo.Id);
if (DisplaySources.ContainsKey(sourceInfo.ViewGdiDeviceName))
{
// We want to add another cloned display
DisplaySources[sourceInfo.ViewGdiDeviceName].Add(path.SourceInfo.Id);
}
else
{
// We want to create a new list entry if there isn't one already there.
DisplaySources.Add(sourceInfo.ViewGdiDeviceName, new List<uint> { path.SourceInfo.Id });
}
SharedLogger.logger.Trace($"WinLibrary/GetWindowsDisplayConfig: Found Display Source {sourceInfo.ViewGdiDeviceName} for source {path.SourceInfo.Id}.");
}
else