diff --git a/Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs b/Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs index 0a55e127..204d482f 100644 --- a/Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs +++ b/Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs @@ -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) diff --git a/Source/OpenTK/Platform/Windows/WinFactory.cs b/Source/OpenTK/Platform/Windows/WinFactory.cs index 74f27038..b0fc8224 100644 --- a/Source/OpenTK/Platform/Windows/WinFactory.cs +++ b/Source/OpenTK/Platform/Windows/WinFactory.cs @@ -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); + } } } diff --git a/Source/OpenTK/Toolkit.cs b/Source/OpenTK/Toolkit.cs index 5c1c476c..88665b09 100644 --- a/Source/OpenTK/Toolkit.cs +++ b/Source/OpenTK/Toolkit.cs @@ -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 /// diff --git a/Source/OpenTK/ToolkitOptions.cs b/Source/OpenTK/ToolkitOptions.cs index 957f4758..0cb7b6e7 100644 --- a/Source/OpenTK/ToolkitOptions.cs +++ b/Source/OpenTK/ToolkitOptions.cs @@ -68,6 +68,7 @@ namespace OpenTK static ToolkitOptions() { Default = new ToolkitOptions(); + Default.EnableHighResolution = false; } /// @@ -76,6 +77,16 @@ namespace OpenTK /// public PlatformBackend Backend { get; set; } + /// + /// 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.) + /// + /// + public bool EnableHighResolution { get; set; } + /// /// Gets a ToolkitOptions instance with /// default values.