Skip to content

Commit

Permalink
Core - High-DPI support is now enabled by default in Chromium.
Browse files Browse the repository at this point in the history
- Chromium now enables DPI awareness programmatically by default
- Remove Cef.EnableHighDPISupport calls and mark as obsolete
- Remove dpiawareness entries from app.manifest

Issues #4417 #4410
  • Loading branch information
amaitland committed Mar 7, 2023
1 parent 5b61574 commit b17cd2a
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 41 deletions.
4 changes: 0 additions & 4 deletions CefSharp.BrowserSubprocess.Core/BrowserSubprocessExecutable.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ namespace CefSharp
/// This overload is specifically used for .Net Core. For hosting your own BrowserSubProcess
/// it's preferable to use the Main method provided by this class.
/// - Obtains the command line args via a call to Environment::GetCommandLineArgs
/// - Calls CefEnableHighDPISupport before any other processing
/// </summary>
/// <returns>
/// If called for the browser process (identified by no "type" command-line value) it will return immediately
Expand All @@ -53,7 +52,6 @@ namespace CefSharp
/// This overload is specifically used for .Net Core. For hosting your own BrowserSubProcess
/// it's preferable to use the Main method provided by this class.
/// - Obtains the command line args via a call to Environment::GetCommandLineArgs
/// - Calls CefEnableHighDPISupport before any other processing
/// </summary>
/// <returns>
/// If called for the browser process (identified by no "type" command-line value) it will return immediately
Expand All @@ -62,8 +60,6 @@ namespace CefSharp
/// </returns
static int MainNetCore(IntPtr arg, int argLength)
{
SubProcess::EnableHighDPISupport();

auto args = Environment::GetCommandLineArgs();

auto subProcess = gcnew BrowserSubprocessExecutable();
Expand Down
2 changes: 0 additions & 2 deletions CefSharp.BrowserSubprocess/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ public static int Main(string[] args)
{
Debug.WriteLine("BrowserSubprocess starting up with command line: " + string.Join("\n", args));

SubProcess.EnableHighDPISupport();

//Add your own custom implementation of IRenderProcessHandler here
IRenderProcessHandler handler = null;

Expand Down
6 changes: 0 additions & 6 deletions CefSharp.BrowserSubprocess/app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@
</security>
</trustInfo>

<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true/PM</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of all Windows versions that this application is designed to work with.
Expand Down
7 changes: 2 additions & 5 deletions CefSharp.Core/BrowserSubprocess/SelfHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace CefSharp.BrowserSubprocess
/// <summary>
/// SelfHost allows your application executable to be used as the BrowserSubProcess
/// with minimal effort.
/// https://github.com/cefsharp/CefSharp/wiki/SelfHost-BrowserSubProcess
/// </summary>
/// <example>
/// //WinForms Example
Expand All @@ -21,8 +22,6 @@ namespace CefSharp.BrowserSubprocess
/// [STAThread]
/// public static int Main(string[] args)
/// {
/// Cef.EnableHighDPISupport();
///
/// var exitCode = CefSharp.BrowserSubprocess.SelfHost.Main(args);
///
/// if (exitCode >= 0)
Expand All @@ -43,16 +42,14 @@ namespace CefSharp.BrowserSubprocess
/// }
/// }
/// </example>
public class SelfHost
public class SelfHost
{
/// <summary>
/// This function should be called from the application entry point function (typically Program.Main)
/// to execute a secondary process e.g. gpu, renderer, utility
/// This overload is specifically used for .Net Core. For hosting your own BrowserSubProcess
/// it's preferable to use the Main method provided by this class.
/// - Pass in command line args
/// - To support High DPI Displays you should call Cef.EnableHighDPISupport before any other processing
/// or add the relevant entries to your app.manifest
/// </summary>
/// <param name="args">command line args</param>
/// <returns>
Expand Down
1 change: 1 addition & 0 deletions CefSharp.Core/Cef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ public static bool ClearSchemeHandlerFactories()
/// Older versions of Windows should be left DPI-unaware because they do not
/// support DirectWrite and GDI fonts are kerned very badly.
/// </summary>
[Obsolete("This method will be removed in M113. See https://github.com/cefsharp/CefSharp/issues/4417")]
public static void EnableHighDPISupport()
{
Core.Cef.EnableHighDPISupport();
Expand Down
6 changes: 0 additions & 6 deletions CefSharp.OffScreen.Example/app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@
</security>
</trustInfo>

<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true/PM</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of all Windows versions that this application is designed to work with.
Expand Down
11 changes: 0 additions & 11 deletions CefSharp.WinForms.Example/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,6 @@ public static int Main(string[] args)

if (selfHostSubProcess)
{
var processType = CefSharp.Internals.CommandLineArgsParser.GetArgumentValue(args, CefSharp.Internals.CefSharpArguments.SubProcessTypeArgument);

if (processType == "gpu-process")
{
// Enable DPI Awareness for GPU process.
// Our main application is already DPI aware using WinForms specific features
// **IMPORTANT** There's a mistake in the following doc https://github.com/dotnet/docs-desktop/issues/1485
// https://docs.microsoft.com/en-us/dotnet/desktop/winforms/high-dpi-support-in-windows-forms
Cef.EnableHighDPISupport();
}

var exitCode = CefSharp.BrowserSubprocess.SelfHost.Main(args);

if (exitCode >= 0)
Expand Down
7 changes: 0 additions & 7 deletions CefSharp.Wpf.Example/app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@
</security>
</trustInfo>

<asmv3:application>
<asmv3:windowsSettings>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of all Windows versions that this application is designed to work with.
Expand Down

0 comments on commit b17cd2a

Please sign in to comment.