mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-06-24 23:01:26 +00:00
Merge branch 'rdp' into develop
This commit is contained in:
commit
bcc2405002
|
@ -216,15 +216,31 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
static bool Compare(int got, int requested, ref int distance)
|
static bool Compare(int got, int requested, ref int distance)
|
||||||
{
|
{
|
||||||
if (got < requested)
|
bool valid = true;
|
||||||
|
if (got == 0 && requested != 0)
|
||||||
{
|
{
|
||||||
return false;
|
// mode does not support the requested feature.
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
else if (got >= requested)
|
||||||
|
{
|
||||||
|
// mode supports the requested feature,
|
||||||
|
// calculate the distance from an "ideal" mode
|
||||||
|
// that matches this feature exactly.
|
||||||
|
distance += got - requested;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
distance += got - requested;
|
// mode supports the requested feature,
|
||||||
return true;
|
// but at a suboptimal level. For example:
|
||||||
|
// - requsted AA = 8x, got 4x
|
||||||
|
// - requested color = 32bpp, got 16bpp
|
||||||
|
// We can still use this mode but only if
|
||||||
|
// no better mode exists.
|
||||||
|
const int penalty = 8;
|
||||||
|
distance += penalty * Math.Abs(got - requested);
|
||||||
}
|
}
|
||||||
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
static AccelerationType GetAccelerationType(ref PixelFormatDescriptor pfd)
|
static AccelerationType GetAccelerationType(ref PixelFormatDescriptor pfd)
|
||||||
|
@ -262,8 +278,18 @@ namespace OpenTK.Platform.Windows
|
||||||
// Does not appear to be supported by DescribePixelFormat
|
// Does not appear to be supported by DescribePixelFormat
|
||||||
//flags |= PixelFormatDescriptorFlags.DOUBLEBUFFER;
|
//flags |= PixelFormatDescriptorFlags.DOUBLEBUFFER;
|
||||||
}
|
}
|
||||||
if (System.Environment.OSVersion.Version.Major >= 6)
|
|
||||||
|
if (System.Environment.OSVersion.Version.Major >= 6 &&
|
||||||
|
requested_acceleration_type != AccelerationType.None)
|
||||||
{
|
{
|
||||||
|
// Request a compositor-capable mode when running on
|
||||||
|
// Vista+ and using hardware acceleration. Without this,
|
||||||
|
// some modes will cause the compositor to turn off,
|
||||||
|
// which is very annoying to the user.
|
||||||
|
// Note: compositor-capable modes require hardware
|
||||||
|
// acceleration. Don't set this flag when running
|
||||||
|
// with software acceleration (e.g. over Remote Desktop
|
||||||
|
// as described in bug https://github.com/opentk/opentk/issues/35)
|
||||||
flags |= PixelFormatDescriptorFlags.SUPPORT_COMPOSITION;
|
flags |= PixelFormatDescriptorFlags.SUPPORT_COMPOSITION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,10 +103,11 @@ namespace OpenTK.Platform.Windows
|
||||||
// This is a keyboard or USB keyboard device. In the latter case, discover if it really is a
|
// This is a keyboard or USB keyboard device. In the latter case, discover if it really is a
|
||||||
// keyboard device by qeurying the registry.
|
// keyboard device by qeurying the registry.
|
||||||
RegistryKey regkey = GetRegistryKey(name);
|
RegistryKey regkey = GetRegistryKey(name);
|
||||||
string deviceDesc = (string)regkey.GetValue("DeviceDesc");
|
if (regkey == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
string deviceDesc = (string)regkey.GetValue("DeviceDesc");
|
||||||
string deviceClass = (string)regkey.GetValue("Class");
|
string deviceClass = (string)regkey.GetValue("Class");
|
||||||
|
|
||||||
string deviceClassGUID = (string)regkey.GetValue("ClassGUID"); // for windows 8 support via OpenTK issue 3198
|
string deviceClassGUID = (string)regkey.GetValue("ClassGUID"); // for windows 8 support via OpenTK issue 3198
|
||||||
|
|
||||||
// making a guess at backwards compatability. Not sure what older windows returns in these cases...
|
// making a guess at backwards compatability. Not sure what older windows returns in these cases...
|
||||||
|
@ -205,10 +206,15 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
static RegistryKey GetRegistryKey(string name)
|
static RegistryKey GetRegistryKey(string name)
|
||||||
{
|
{
|
||||||
|
if (name.Length < 4)
|
||||||
|
return null;
|
||||||
|
|
||||||
// remove the \??\
|
// remove the \??\
|
||||||
name = name.Substring(4);
|
name = name.Substring(4);
|
||||||
|
|
||||||
string[] split = name.Split('#');
|
string[] split = name.Split('#');
|
||||||
|
if (split.Length < 3)
|
||||||
|
return null;
|
||||||
|
|
||||||
string id_01 = split[0]; // ACPI (Class code)
|
string id_01 = split[0]; // ACPI (Class code)
|
||||||
string id_02 = split[1]; // PNP0303 (SubClass code)
|
string id_02 = split[1]; // PNP0303 (SubClass code)
|
||||||
|
|
|
@ -110,11 +110,13 @@ namespace OpenTK.Platform.Windows
|
||||||
// This is a mouse or a USB mouse device. In the latter case, discover if it really is a
|
// This is a mouse or a USB mouse device. In the latter case, discover if it really is a
|
||||||
// mouse device by qeurying the registry.
|
// mouse device by qeurying the registry.
|
||||||
RegistryKey regkey = FindRegistryKey(name);
|
RegistryKey regkey = FindRegistryKey(name);
|
||||||
string deviceDesc = (string)regkey.GetValue("DeviceDesc");
|
if (regkey == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
string deviceDesc = (string)regkey.GetValue("DeviceDesc");
|
||||||
string deviceClass = (string)regkey.GetValue("Class") as string;
|
string deviceClass = (string)regkey.GetValue("Class") as string;
|
||||||
if(deviceClass == null){
|
if(deviceClass == null)
|
||||||
|
{
|
||||||
// Added to address OpenTK issue 3198 with mouse on Windows 8
|
// Added to address OpenTK issue 3198 with mouse on Windows 8
|
||||||
string deviceClassGUID = (string)regkey.GetValue("ClassGUID");
|
string deviceClassGUID = (string)regkey.GetValue("ClassGUID");
|
||||||
RegistryKey classGUIDKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Class\" + deviceClassGUID);
|
RegistryKey classGUIDKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Class\" + deviceClassGUID);
|
||||||
|
@ -266,10 +268,15 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
static RegistryKey FindRegistryKey(string name)
|
static RegistryKey FindRegistryKey(string name)
|
||||||
{
|
{
|
||||||
|
if (name.Length < 4)
|
||||||
|
return null;
|
||||||
|
|
||||||
// remove the \??\
|
// remove the \??\
|
||||||
name = name.Substring(4);
|
name = name.Substring(4);
|
||||||
|
|
||||||
string[] split = name.Split('#');
|
string[] split = name.Split('#');
|
||||||
|
if (split.Length < 3)
|
||||||
|
return null;
|
||||||
|
|
||||||
string id_01 = split[0]; // ACPI (Class code)
|
string id_01 = split[0]; // ACPI (Class code)
|
||||||
string id_02 = split[1]; // PNP0303 (SubClass code)
|
string id_02 = split[1]; // PNP0303 (SubClass code)
|
||||||
|
|
Loading…
Reference in a new issue