From dd832ab6bd5d03cddc3891a5a9cbc6626b1d9e5d Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Sat, 7 Nov 2009 10:42:25 +0000 Subject: [PATCH] Always set the DisplayDevice.Bounds to a correct value. Fixes issue [#1339]: "DisplayDevice.Bounds not set". --- Source/OpenTK/DisplayDevice.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/OpenTK/DisplayDevice.cs b/Source/OpenTK/DisplayDevice.cs index 060770e3..5a20ba35 100644 --- a/Source/OpenTK/DisplayDevice.cs +++ b/Source/OpenTK/DisplayDevice.cs @@ -67,9 +67,11 @@ namespace OpenTK IEnumerable availableResolutions, Rectangle bounds) : this() { +#warning "Consolidate current resolution with bounds? Can they fall out of sync right now?" this.current_resolution = currentResolution; IsPrimary = primary; this.available_resolutions.AddRange(availableResolutions); + this.bounds = bounds == Rectangle.Empty ? currentResolution.Bounds : bounds; Debug.Print("DisplayDevice {0} ({1}) supports {2} resolutions.", available_displays.Count, primary ? "primary" : "secondary", available_resolutions.Count); @@ -143,7 +145,7 @@ namespace OpenTK get { return primary; } internal set { - if (primary_display != null && primary_display != this) + if (value && primary_display != null && primary_display != this) primary_display.IsPrimary = false; lock (display_lock) @@ -326,7 +328,7 @@ namespace OpenTK public override string ToString() { return String.Format("{0}: {1} ({2} modes available)", IsPrimary ? "Primary" : "Secondary", - current_resolution.ToString(), available_resolutions.Count); + Bounds.ToString(), available_resolutions.Count); } #endregion