mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-02-24 21:36:49 +00:00
Remember DisplayDevice original resolutions
When refreshing the AvailableDevices list, it is important to set the original resolution on any DisplayDevices that were previously available to allow the RestoreResolution() method to work correctly.
This commit is contained in:
parent
c2e3328f59
commit
5f6c8e654c
|
@ -47,7 +47,8 @@ namespace OpenTK
|
||||||
|
|
||||||
bool primary;
|
bool primary;
|
||||||
Rectangle bounds;
|
Rectangle bounds;
|
||||||
DisplayResolution current_resolution = new DisplayResolution(), original_resolution;
|
DisplayResolution current_resolution = new DisplayResolution();
|
||||||
|
internal DisplayResolution original_resolution;
|
||||||
List<DisplayResolution> available_resolutions = new List<DisplayResolution>();
|
List<DisplayResolution> available_resolutions = new List<DisplayResolution>();
|
||||||
IList<DisplayResolution> available_resolutions_readonly;
|
IList<DisplayResolution> available_resolutions_readonly;
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,10 @@ namespace OpenTK.Platform.Windows
|
||||||
{
|
{
|
||||||
lock (display_lock)
|
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();
|
AvailableDevices.Clear();
|
||||||
|
|
||||||
// We save all necessary parameters in temporary variables
|
// We save all necessary parameters in temporary variables
|
||||||
|
@ -159,6 +163,11 @@ namespace OpenTK.Platform.Windows
|
||||||
opentk_dev_current_res.Bounds,
|
opentk_dev_current_res.Bounds,
|
||||||
dev1.DeviceName);
|
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.original_resolution = existingDevice.original_resolution;
|
||||||
|
|
||||||
AvailableDevices.Add(opentk_dev);
|
AvailableDevices.Add(opentk_dev);
|
||||||
|
|
||||||
if (opentk_dev_primary)
|
if (opentk_dev_primary)
|
||||||
|
|
Loading…
Reference in a new issue