From fa422dca2aca1efc459f47db5ef3b8990c615821 Mon Sep 17 00:00:00 2001 From: Andy Korth Date: Mon, 14 Jan 2013 13:09:55 -0600 Subject: [PATCH] Fix Windows 8 Keyboard, OpenTK issue 3198 --- Source/OpenTK/Platform/Windows/WinRawKeyboard.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Source/OpenTK/Platform/Windows/WinRawKeyboard.cs b/Source/OpenTK/Platform/Windows/WinRawKeyboard.cs index 9b2a1989..a81b29b9 100644 --- a/Source/OpenTK/Platform/Windows/WinRawKeyboard.cs +++ b/Source/OpenTK/Platform/Windows/WinRawKeyboard.cs @@ -102,7 +102,16 @@ namespace OpenTK.Platform.Windows // keyboard device by qeurying the registry. RegistryKey regkey = GetRegistryKey(name); string deviceDesc = (string)regkey.GetValue("DeviceDesc"); + string deviceClass = (string)regkey.GetValue("Class"); + + 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... + if(deviceClass != null || deviceClass.Equals(string.Empty)){ + RegistryKey classGUIDKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Class\" + deviceClassGUID); + deviceClass = classGUIDKey != null ? (string) classGUIDKey.GetValue("Class") : string.Empty; + } if (String.IsNullOrEmpty(deviceDesc)) {