mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-17 11:07:30 +00:00
Added code to obtain refresh rates.
This commit is contained in:
parent
9f3252f821
commit
b134ae509f
|
@ -23,26 +23,33 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
static X11XrandrDisplayDevice()
|
static X11XrandrDisplayDevice()
|
||||||
{
|
{
|
||||||
//lock (display_lock)
|
// Get available resolutions. Then, for each resolution get all
|
||||||
|
// available rates.
|
||||||
|
// TODO: Find a way to get all available depths, too.
|
||||||
|
|
||||||
|
//lock (display_lock) // TODO: Global X11 lock.
|
||||||
{
|
{
|
||||||
for (int i = 0; i < API.ScreenCount; i++)
|
for (int screen = 0; screen < API.ScreenCount; screen++)
|
||||||
{
|
{
|
||||||
List<DisplayResolution> resolutions = new List<DisplayResolution>();
|
List<DisplayResolution> resolutions = new List<DisplayResolution>();
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
XRRScreenSize[] array = Functions.XRRSizes(API.DefaultDisplay, i);
|
XRRScreenSize[] array = Functions.XRRSizes(API.DefaultDisplay, screen);
|
||||||
Debug.Print("{0} resolutions.", array.Length);
|
if (array == null)
|
||||||
Debug.Indent();
|
throw new NotSupportedException("XRandR extensions not available.");
|
||||||
for (int count = 0; count < array.Length; count++)
|
|
||||||
|
int resolution = 0;
|
||||||
|
foreach (XRRScreenSize size in array)
|
||||||
{
|
{
|
||||||
resolutions.Add(new DisplayResolution(array[count].Width, array[count].Height, 24, 0));
|
short[] rates = Functions.XRRRates(API.DefaultDisplay, screen, resolution);
|
||||||
Debug.Print(resolutions[count].ToString());
|
foreach (short rate in rates)
|
||||||
|
resolutions.Add(new DisplayResolution(size.Width, size.Height, 24, (float)rate));
|
||||||
|
++resolution;
|
||||||
}
|
}
|
||||||
Debug.Unindent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct a default device for testing purposes.
|
// Construct a default device for testing purposes.
|
||||||
new DisplayDevice(resolutions[0], i == API.DefaultScreen, resolutions);
|
new DisplayDevice(resolutions[0], screen == API.DefaultScreen, resolutions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue