From 414c07f7adce9c9fd0132ab0fade0267f743f665 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sun, 19 Jul 2020 16:19:17 +1000 Subject: WIXFEAT:6204 Use the new DpiAwareness attribute on BootstrapperApplication element to control the DPI awareness settings in the bundle's application manifest. --- src/WixToolset.Core/Compiler_Bundle.cs | 46 +++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) (limited to 'src/WixToolset.Core') diff --git a/src/WixToolset.Core/Compiler_Bundle.cs b/src/WixToolset.Core/Compiler_Bundle.cs index 7cdb8ca0..d73db84d 100644 --- a/src/WixToolset.Core/Compiler_Bundle.cs +++ b/src/WixToolset.Core/Compiler_Bundle.cs @@ -649,6 +649,7 @@ namespace WixToolset.Core var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); Identifier previousId = null; var previousType = ComplexReferenceChildType.Unknown; + var dpiAwareness = WixBootstrapperApplicationDpiAwarenessType.PerMonitorV2; // The BootstrapperApplication element acts like a Payload element so delegate to the "Payload" attribute parsing code to parse and create a Payload entry. var id = this.ParsePayloadElementContent(node, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId, false); @@ -658,6 +659,40 @@ namespace WixToolset.Core previousType = ComplexReferenceChildType.Payload; } + foreach (var attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "DpiAwareness": + var dpiAwarenessValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + switch (dpiAwarenessValue) + { + case "gdiScaled": + dpiAwareness = WixBootstrapperApplicationDpiAwarenessType.GdiScaled; + break; + case "perMonitor": + dpiAwareness = WixBootstrapperApplicationDpiAwarenessType.PerMonitor; + break; + case "perMonitorV2": + dpiAwareness = WixBootstrapperApplicationDpiAwarenessType.PerMonitorV2; + break; + case "system": + dpiAwareness = WixBootstrapperApplicationDpiAwarenessType.System; + break; + case "unaware": + dpiAwareness = WixBootstrapperApplicationDpiAwarenessType.Unaware; + break; + default: + this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "DpiAwareness", dpiAwarenessValue, "gdiScaled", "perMonitor", "perMonitorV2", "system", "unaware")); + break; + } + break; + } + } + } + foreach (var child in node.Elements()) { if (CompilerCore.WixNamespace == child.Name.Namespace) @@ -702,7 +737,10 @@ namespace WixToolset.Core if (null != id) { - this.Core.AddSymbol(new WixBootstrapperApplicationSymbol(sourceLineNumbers, id)); + this.Core.AddSymbol(new WixBootstrapperApplicationSymbol(sourceLineNumbers, id) + { + DpiAwareness = dpiAwareness, + }); } } } @@ -1325,6 +1363,12 @@ namespace WixToolset.Core case "EnableSignatureVerification": enableSignatureVerification = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; + case "DpiAwareness": + if (node.Name.LocalName != "BootstrapperApplication") + { + this.Core.UnexpectedAttribute(node, attrib); + } + break; default: this.Core.UnexpectedAttribute(node, attrib); break; -- cgit v1.2.3-55-g6feb