mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Workaround Windows changing display source order
Windows changes the display source order which mucks up the equality matching in DM. This change attempts to mitigate that fact. There were also errors in the HDR settings captured, which indicate that the HDR changes weren't finishing before they were being recorded. This change attempts to take care of that too. All tests so far seem to work, so lets see how things go!
This commit is contained in:
parent
1966412162
commit
28a8f131b3
@ -21,6 +21,8 @@ namespace DisplayMagician.UIForms
|
||||
private ProfileAdaptor _profileAdaptor = new ProfileAdaptor();
|
||||
//public static Dictionary<string, bool> profileValidity = new Dictionary<string, bool>();
|
||||
|
||||
private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||
|
||||
public DisplayProfileForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -54,6 +56,8 @@ namespace DisplayMagician.UIForms
|
||||
// Apply the Profile
|
||||
if (ProfileRepository.ApplyProfile(_selectedProfile) == ApplyProfileResult.Successful)
|
||||
{
|
||||
/*logger.Error($"DisplayProfileForm/Apply_Click: Waiting 0.5 sec for the display to apply");
|
||||
System.Threading.Thread.Sleep(500);*/
|
||||
ChangeSelectedProfile(_selectedProfile);
|
||||
}
|
||||
}
|
||||
|
@ -947,6 +947,9 @@ namespace DisplayMagicianShared.AMD
|
||||
|
||||
}
|
||||
|
||||
SharedLogger.logger.Trace($"AMDLibrary/SetActiveConfig: Waiting 0.5 seconds to let the display change take place before adjusting the AMD HDR settings");
|
||||
System.Threading.Thread.Sleep(500);
|
||||
|
||||
// We want to set the AMD HDR settings
|
||||
|
||||
// We want to apply the Windows CCD layout info and HDR
|
||||
|
@ -1244,6 +1244,9 @@ namespace DisplayMagicianShared.NVIDIA
|
||||
SharedLogger.logger.Trace($"NVIDIALibrary/SetActiveConfig: We are on a non-Mosaic profile now, and we are changing to a non-Mosaic profile so there is nothing to do as far as NVIDIA is concerned!");
|
||||
}
|
||||
|
||||
SharedLogger.logger.Trace($"NVIDIALibrary/SetActiveConfig: Waiting 0.5 seconds to let the display change take place before adjusting the NVIDIA HDR settings");
|
||||
System.Threading.Thread.Sleep(500);
|
||||
|
||||
// Now, we have the current HDR settings, and the existing HDR settings, so we go through and we attempt to set each display color settings
|
||||
foreach (var wantedHdrColorData in displayConfig.HdrConfig.HdrColorData)
|
||||
{
|
||||
|
@ -672,6 +672,10 @@ namespace DisplayMagicianShared
|
||||
if (itWorkedforNVIDIA)
|
||||
{
|
||||
SharedLogger.logger.Trace($"ProfileRepository/SetActive: The NVIDIA display settings within profile {Name} were successfully applied.");
|
||||
|
||||
SharedLogger.logger.Trace($"ProfileRepository/SetActive: Waiting 0.5 seconds to let the NVIDIA display change take place before setting the Windows CCD display settings");
|
||||
System.Threading.Thread.Sleep(500);
|
||||
|
||||
// Then let's try to also apply the windows changes
|
||||
// Note: we are unable to check if the Windows CCD display config is possible, as it won't match if either the current display config is a Mosaic config,
|
||||
// or if the display config we want to change to is a Mosaic config. So we just have to assume that it will work!
|
||||
@ -720,6 +724,10 @@ namespace DisplayMagicianShared
|
||||
if (itWorkedforNVIDIA)
|
||||
{
|
||||
SharedLogger.logger.Trace($"ProfileRepository/SetActive: The AMD display settings within profile {Name} were successfully applied.");
|
||||
|
||||
SharedLogger.logger.Trace($"ProfileRepository/SetActive: Waiting 0.5 seconds to let the AMD display change take place before setting the Windows CCD display settings");
|
||||
System.Threading.Thread.Sleep(500);
|
||||
|
||||
// Then let's try to also apply the windows changes
|
||||
// Note: we are unable to check if the Windows CCD display config is possible, as it won't match if either the current display config is a Mosaic config,
|
||||
// or if the display config we want to change to is a Mosaic config. So we just have to assume that it will work!
|
||||
|
@ -519,7 +519,7 @@ namespace DisplayMagicianShared.Windows
|
||||
public override bool Equals(object obj) => obj is DISPLAYCONFIG_PATH_SOURCE_INFO other && this.Equals(other);
|
||||
public bool Equals(DISPLAYCONFIG_PATH_SOURCE_INFO other)
|
||||
=> // AdapterId.Equals(other.AdapterId) && // Removed the AdapterId from the Equals, as it changes after a reboot.
|
||||
Id == other.Id &&
|
||||
//Id == other.Id && // Removed the ID from the list as the Display ID it maps to will change after a switch from surround to non-surround profile
|
||||
ModeInfoIdx == other.ModeInfoIdx &&
|
||||
StatusFlags.Equals(other.StatusFlags);
|
||||
|
||||
@ -643,7 +643,8 @@ namespace DisplayMagicianShared.Windows
|
||||
return true;
|
||||
|
||||
if (InfoType == DISPLAYCONFIG_MODE_INFO_TYPE.DISPLAYCONFIG_MODE_INFO_TYPE_SOURCE &&
|
||||
Id == other.Id &&
|
||||
//Id == other.Id && // Disabling this check as as the Display ID it maps to will change after a switch from surround to non-surround profile, ruining the equality match
|
||||
// Only seems to be a problem with the DISPLAYCONFIG_MODE_INFO_TYPE.DISPLAYCONFIG_MODE_INFO_TYPE_SOURCE options weirdly enough!
|
||||
SourceMode.Equals(other.SourceMode))
|
||||
return true;
|
||||
|
||||
|
@ -788,6 +788,9 @@ namespace DisplayMagicianShared.Windows
|
||||
|
||||
SharedLogger.logger.Trace($"WinLibrary/SetActiveConfig: SUCCESS! The display configuration has been successfully applied");
|
||||
|
||||
SharedLogger.logger.Trace($"WinLibrary/SetActiveConfig: Waiting 0.5 seconds to let the display change take place before adjusting the Windows CCD HDR settings");
|
||||
System.Threading.Thread.Sleep(500);
|
||||
|
||||
foreach (ADVANCED_HDR_INFO_PER_PATH myHDRstate in displayConfig.DisplayHDRStates)
|
||||
{
|
||||
SharedLogger.logger.Trace($"Trying to get information whether HDR color is in use now on Display {myHDRstate.Id}.");
|
||||
|
Loading…
Reference in New Issue
Block a user