From 7b591962e888f18cc4f098d0c369867cbd56aff7 Mon Sep 17 00:00:00 2001 From: cwassall Date: Mon, 20 Jan 2014 12:51:55 +0000 Subject: [PATCH] Change original_resolution field to a property As the original_resolution field needs to be accessed from outside the module, it should be an internal property as opposed to an internal field --- Source/OpenTK/DisplayDevice.cs | 19 ++++++++++++++++++- .../Platform/Windows/WinDisplayDevice.cs | 6 +++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Source/OpenTK/DisplayDevice.cs b/Source/OpenTK/DisplayDevice.cs index d6bf0837..4e8c7a3d 100644 --- a/Source/OpenTK/DisplayDevice.cs +++ b/Source/OpenTK/DisplayDevice.cs @@ -48,7 +48,7 @@ namespace OpenTK bool primary; Rectangle bounds; DisplayResolution current_resolution = new DisplayResolution(); - internal DisplayResolution original_resolution; + DisplayResolution original_resolution; List available_resolutions = new List(); IList available_resolutions_readonly; @@ -336,6 +336,23 @@ namespace OpenTK #endregion + #region --- Internal Methods --- + + #region internal DisplayResolution OriginalResolution + + /// + /// Gets the original resolution of this instance. + /// + internal DisplayResolution OriginalResolution + { + get { return original_resolution; } + set { original_resolution = value; } + } + + #endregion + + #endregion + #region --- Private Methods --- #region DisplayResolution FindResolution(int width, int height, int bitsPerPixel, float refreshRate) diff --git a/Source/OpenTK/Platform/Windows/WinDisplayDevice.cs b/Source/OpenTK/Platform/Windows/WinDisplayDevice.cs index 56da3668..fc594b63 100644 --- a/Source/OpenTK/Platform/Windows/WinDisplayDevice.cs +++ b/Source/OpenTK/Platform/Windows/WinDisplayDevice.cs @@ -97,7 +97,7 @@ namespace OpenTK.Platform.Windows lock (display_lock) { // Store an array of the current available DisplayDevice objects. - // This is needed to preserve the original_resolution. + // This is needed to preserve the original resolution. DisplayDevice[] previousDevices = AvailableDevices.ToArray(); AvailableDevices.Clear(); @@ -163,10 +163,10 @@ namespace OpenTK.Platform.Windows opentk_dev_current_res.Bounds, dev1.DeviceName); - // Set the original_resolution if the DisplayDevice was previously available. + // Set the original resolution if the DisplayDevice was previously available. foreach (DisplayDevice existingDevice in previousDevices) if ((string)existingDevice.Id == (string)opentk_dev.Id) - opentk_dev.original_resolution = existingDevice.original_resolution; + opentk_dev.OriginalResolution = existingDevice.OriginalResolution; AvailableDevices.Add(opentk_dev);