Skip to content
Browse files

Merge remote-tracking branch 'cwassall/develop' into develop

  • Loading branch information...
2 parents b942600 + 7b59196 commit c73e4785cdf4593204a615d6f1ddf196e4765c82 @thefiddler thefiddler committed Jan 26, 2014
Showing with 28 additions and 1 deletion.
  1. +19 −1 Source/OpenTK/DisplayDevice.cs
  2. +9 −0 Source/OpenTK/Platform/Windows/WinDisplayDevice.cs
View
20 Source/OpenTK/DisplayDevice.cs
@@ -47,7 +47,8 @@ public class DisplayDevice
bool primary;
Rectangle bounds;
- DisplayResolution current_resolution = new DisplayResolution(), original_resolution;
+ DisplayResolution current_resolution = new DisplayResolution();
+ DisplayResolution original_resolution;
List<DisplayResolution> available_resolutions = new List<DisplayResolution>();
IList<DisplayResolution> available_resolutions_readonly;
@@ -335,6 +336,23 @@ public static DisplayDevice GetDisplay(DisplayIndex index)
#endregion
+ #region --- Internal Methods ---
+
+ #region internal DisplayResolution OriginalResolution
+
+ /// <summary>
+ /// Gets the original resolution of this instance.
+ /// </summary>
+ 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)
View
9 Source/OpenTK/Platform/Windows/WinDisplayDevice.cs
@@ -96,6 +96,10 @@ public void RefreshDisplayDevices()
{
lock (display_lock)
{
+ // Store an array of the current available DisplayDevice objects.
+ // This is needed to preserve the original resolution.
+ DisplayDevice[] previousDevices = AvailableDevices.ToArray();
+
AvailableDevices.Clear();
// We save all necessary parameters in temporary variables
@@ -159,6 +163,11 @@ public void RefreshDisplayDevices()
opentk_dev_current_res.Bounds,
dev1.DeviceName);
+ // 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.OriginalResolution = existingDevice.OriginalResolution;
+
AvailableDevices.Add(opentk_dev);
if (opentk_dev_primary)

0 comments on commit c73e478

Please sign in to comment.
Something went wrong with that request. Please try again.