Added AMD display rotation awareness

Fixes #153. AMD display profiles with rotated displays will now show that rotation properly in the display layout. Last commit included NVIDIA and Windows, and this now means all supported video cards now have this feature so the issue can be closed.
This commit is contained in:
Terry MacDonald 2022-12-28 20:16:05 +13:00
parent 97664100e8
commit 181b3b8a9a
2 changed files with 38 additions and 7 deletions

View File

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

View File

@ -1358,9 +1358,8 @@ namespace DisplayMagicianShared
//screen.DisplayConnector = displayMode.DisplayConnector;
screen.ScreenX = _amdDisplayConfig.DisplayMaps[i].DisplayMode.XPos;
screen.ScreenY = _amdDisplayConfig.DisplayMaps[i].DisplayMode.YPos;
screen.ScreenWidth = _amdDisplayConfig.DisplayMaps[i].DisplayMode.XRes;
screen.ScreenHeight = _amdDisplayConfig.DisplayMaps[i].DisplayMode.YRes;
screen.Rotation = ScreenRotation.ROTATE_0;
// If we're at the 0,0 coordinate then we're the primary monitor
if (screen.ScreenX == 0 && screen.ScreenY == 0)
{
@ -1439,8 +1438,40 @@ namespace DisplayMagicianShared
//screen.DisplayConnector = displayMode.DisplayConnector;
screen.ScreenX = displayMode.SourceMode.Position.X;
screen.ScreenY = displayMode.SourceMode.Position.Y;
screen.ScreenWidth = (int)displayMode.SourceMode.Width;
screen.ScreenHeight = (int)displayMode.SourceMode.Height;
//screen.ScreenWidth = (int)displayMode.SourceMode.Width;
//screen.ScreenHeight = (int)displayMode.SourceMode.Height;
if (path.TargetInfo.Rotation == DISPLAYCONFIG_ROTATION.DISPLAYCONFIG_ROTATION_IDENTITY)
{
screen.ScreenWidth = (int)displayMode.SourceMode.Width;
screen.ScreenHeight = (int)displayMode.SourceMode.Height;
screen.Rotation = ScreenRotation.ROTATE_0;
}
else if (path.TargetInfo.Rotation == DISPLAYCONFIG_ROTATION.DISPLAYCONFIG_ROTATION_ROTATE90)
{
// Portrait screen so need to change width and height
screen.ScreenWidth = (int)displayMode.SourceMode.Height;
screen.ScreenHeight = (int)displayMode.SourceMode.Width;
screen.Rotation = ScreenRotation.ROTATE_90;
}
else if (path.TargetInfo.Rotation == DISPLAYCONFIG_ROTATION.DISPLAYCONFIG_ROTATION_ROTATE180)
{
screen.ScreenWidth = (int)displayMode.SourceMode.Width;
screen.ScreenHeight = (int)displayMode.SourceMode.Height;
screen.Rotation = ScreenRotation.ROTATE_180;
}
else if (path.TargetInfo.Rotation == DISPLAYCONFIG_ROTATION.DISPLAYCONFIG_ROTATION_ROTATE270)
{
screen.ScreenWidth = (int)displayMode.SourceMode.Width;
screen.ScreenHeight = (int)displayMode.SourceMode.Height;
screen.Rotation = ScreenRotation.ROTATE_270;
}
else
{
screen.ScreenWidth = (int)displayMode.SourceMode.Width;
screen.ScreenHeight = (int)displayMode.SourceMode.Height;
screen.Rotation = ScreenRotation.ROTATE_0;
}
// If we're at the 0,0 coordinate then we're the primary monitor
if (screen.ScreenX == 0 && screen.ScreenY == 0)