Fixed second CTD when changing from Surround to non-surround.

The NVIDIA Driver seems to not like any other SetTopoFlags except NONE. There is a CTD if anything is selected :(. So as a workaround I will leave send a NONE SetTopoFlag so DisplayMagician can work.

Also have updated the Display Profiles Window logic so that it repositions DisplayMagician in the center of the screen on the primary display. This has to be done when changing Display Profiles using the Apply Button, as the display coordinates change, and sometimes this results in the current position being off screen. This was causing confusion amongst users. But now just always moving to the middle of the primary screen I can always be sure that the UI is visible.
This commit is contained in:
Terry MacDonald 2022-06-09 22:56:07 +12:00
parent 97d9caf2af
commit 7d17b5ae10
4 changed files with 13 additions and 3 deletions

View File

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

View File

@ -81,9 +81,16 @@ namespace DisplayMagician.UIForms
logger.Error($"DisplayProfileForm/Apply_Click: Error applying the Profile {_selectedProfile.Name}. Unable to change the display layout.");
}
// Center the MainAppForm
Program.AppMainForm.Top = (Screen.PrimaryScreen.Bounds.Height - Program.AppMainForm.Height) / 2;
Program.AppMainForm.Left = (Screen.PrimaryScreen.Bounds.Width - Program.AppMainForm.Width) / 2;
Program.AppMainForm.Activate();
// Bring the window back to the front
Visible = true;
CenterToParent();
Activate();
BringToFront();
// Also refresh the right-click menu (if we have a main form loaded)
if (Program.AppMainForm is Form)

View File

@ -5758,6 +5758,8 @@ namespace DisplayMagicianShared.NVIDIA
// Go through the array and copy things from managed code to unmanaged code
for (Int32 x = 0; x < (Int32)GridCount; x++)
{
GridTopologies[x].Version = NVImport.NV_MOSAIC_GRID_TOPO_V2_VER;
// Marshal a single gridtopology into unmanaged code ready for sending to the unmanaged NVAPI function
Marshal.StructureToPtr(GridTopologies[x], currentGridTopologiesBuffer, false);
// advance the buffer forwards to the next object

View File

@ -2553,7 +2553,8 @@ namespace DisplayMagicianShared.NVIDIA
// We are on a Mosaic profile now, and we need to change to a non-Mosaic profile
// We need to disable the Mosaic Topology
NV_MOSAIC_SETDISPLAYTOPO_FLAGS setTopoFlags = NV_MOSAIC_SETDISPLAYTOPO_FLAGS.ALLOW_INVALID;
//NV_MOSAIC_SETDISPLAYTOPO_FLAGS setTopoFlags = NV_MOSAIC_SETDISPLAYTOPO_FLAGS.ALLOW_INVALID;
NV_MOSAIC_SETDISPLAYTOPO_FLAGS setTopoFlags = NV_MOSAIC_SETDISPLAYTOPO_FLAGS.NONE;
SharedLogger.logger.Trace($"NVIDIALibrary/SetActiveConfig: Mosaic config that is currently set is no longer needed. Removing Mosaic config.");
NV_MOSAIC_GRID_TOPO_V2[] individualScreensTopology = CreateSingleScreenMosaicTopology();