mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-23 21:08:19 +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.OPENGL;
|
||||||
flags |= WindowFlags.RESIZABLE;
|
flags |= WindowFlags.RESIZABLE;
|
||||||
flags |= WindowFlags.HIDDEN;
|
flags |= WindowFlags.HIDDEN;
|
||||||
|
if (Toolkit.Options.EnableHighResolution)
|
||||||
|
{
|
||||||
flags |= WindowFlags.ALLOW_HIGHDPI;
|
flags |= WindowFlags.ALLOW_HIGHDPI;
|
||||||
|
}
|
||||||
|
|
||||||
if ((flags & WindowFlags.FULLSCREEN_DESKTOP) != 0 ||
|
if ((flags & WindowFlags.FULLSCREEN_DESKTOP) != 0 ||
|
||||||
(flags & WindowFlags.FULLSCREEN) != 0)
|
(flags & WindowFlags.FULLSCREEN) != 0)
|
||||||
|
|
|
@ -49,6 +49,8 @@ namespace OpenTK.Platform.Windows
|
||||||
}
|
}
|
||||||
|
|
||||||
if (System.Environment.OSVersion.Version.Major >= 6)
|
if (System.Environment.OSVersion.Version.Major >= 6)
|
||||||
|
{
|
||||||
|
if (Toolkit.Options.EnableHighResolution)
|
||||||
{
|
{
|
||||||
// Enable high-dpi support
|
// Enable high-dpi support
|
||||||
// Only available on Windows Vista and higher
|
// Only available on Windows Vista and higher
|
||||||
|
@ -56,6 +58,7 @@ namespace OpenTK.Platform.Windows
|
||||||
Debug.Print("SetProcessDPIAware() returned {0}", result);
|
Debug.Print("SetProcessDPIAware() returned {0}", result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#region IPlatformFactory Members
|
#region IPlatformFactory Members
|
||||||
|
|
||||||
|
|
|
@ -134,6 +134,7 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
initialized = true;
|
initialized = true;
|
||||||
Configuration.Init(options);
|
Configuration.Init(options);
|
||||||
|
Options = options;
|
||||||
|
|
||||||
// The actual initialization takes place in the
|
// The actual initialization takes place in the
|
||||||
// platform-specific factory constructors.
|
// platform-specific factory constructors.
|
||||||
|
@ -145,6 +146,12 @@ namespace OpenTK
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Internal Members
|
||||||
|
|
||||||
|
internal static ToolkitOptions Options { get; private set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region IDisposable Members
|
#region IDisposable Members
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -68,6 +68,7 @@ namespace OpenTK
|
||||||
static ToolkitOptions()
|
static ToolkitOptions()
|
||||||
{
|
{
|
||||||
Default = new ToolkitOptions();
|
Default = new ToolkitOptions();
|
||||||
|
Default.EnableHighResolution = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -76,6 +77,16 @@ namespace OpenTK
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PlatformBackend Backend { get; set; }
|
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>
|
/// <summary>
|
||||||
/// Gets a <c>ToolkitOptions</c> instance with
|
/// Gets a <c>ToolkitOptions</c> instance with
|
||||||
/// default values.
|
/// default values.
|
||||||
|
|
Loading…
Reference in a new issue