mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 07:55:39 +00:00
Made DPI-awareness configurable (issue #6)
It is now possible to indicate that an application is not DPI-aware. In that case, OpenTK will let the operating system handle DPI scaling. This results in worse visuals (pixel doubling) but allows non DPI-aware applications to continue working.
This commit is contained in:
parent
32a5e0fc50
commit
1475b3d427
|
@ -79,7 +79,10 @@ namespace OpenTK.Platform.SDL2
|
|||
flags |= WindowFlags.OPENGL;
|
||||
flags |= WindowFlags.RESIZABLE;
|
||||
flags |= WindowFlags.HIDDEN;
|
||||
flags |= WindowFlags.ALLOW_HIGHDPI;
|
||||
if (Toolkit.Options.EnableHighResolution)
|
||||
{
|
||||
flags |= WindowFlags.ALLOW_HIGHDPI;
|
||||
}
|
||||
|
||||
if ((flags & WindowFlags.FULLSCREEN_DESKTOP) != 0 ||
|
||||
(flags & WindowFlags.FULLSCREEN) != 0)
|
||||
|
|
|
@ -50,10 +50,13 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
if (System.Environment.OSVersion.Version.Major >= 6)
|
||||
{
|
||||
// Enable high-dpi support
|
||||
// Only available on Windows Vista and higher
|
||||
bool result = Functions.SetProcessDPIAware();
|
||||
Debug.Print("SetProcessDPIAware() returned {0}", result);
|
||||
if (Toolkit.Options.EnableHighResolution)
|
||||
{
|
||||
// Enable high-dpi support
|
||||
// Only available on Windows Vista and higher
|
||||
bool result = Functions.SetProcessDPIAware();
|
||||
Debug.Print("SetProcessDPIAware() returned {0}", result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -134,6 +134,7 @@ namespace OpenTK
|
|||
{
|
||||
initialized = true;
|
||||
Configuration.Init(options);
|
||||
Options = options;
|
||||
|
||||
// The actual initialization takes place in the
|
||||
// platform-specific factory constructors.
|
||||
|
@ -145,6 +146,12 @@ namespace OpenTK
|
|||
|
||||
#endregion
|
||||
|
||||
#region Internal Members
|
||||
|
||||
internal static ToolkitOptions Options { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -68,6 +68,7 @@ namespace OpenTK
|
|||
static ToolkitOptions()
|
||||
{
|
||||
Default = new ToolkitOptions();
|
||||
Default.EnableHighResolution = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -76,6 +77,16 @@ namespace OpenTK
|
|||
/// </summary>
|
||||
public PlatformBackend Backend { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether high
|
||||
/// resolution modes are supported on high-DPI
|
||||
/// ("Retina") displays. Enabled by default.
|
||||
/// Set to false for applications that are not
|
||||
/// DPI-aware (e.g. WinForms.)
|
||||
/// </summary>
|
||||
/// <seealso cref="http://msdn.microsoft.com/en-us/library/windows/desktop/ee308410(v=vs.85).aspx"/>
|
||||
public bool EnableHighResolution { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <c>ToolkitOptions</c> instance with
|
||||
/// default values.
|
||||
|
|
Loading…
Reference in a new issue