fix windows keyboard(for real this time)
This commit is contained in:
parent
364d689452
commit
bac73cd815
8 changed files with 87 additions and 20 deletions
16
InputTest/InputTest.csproj
Normal file
16
InputTest/InputTest.csproj
Normal file
|
@ -0,0 +1,16 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\src\OpenTK\OpenTK.Standard.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
34
InputTest/Program.cs
Normal file
34
InputTest/Program.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using OpenTK;
|
||||
using OpenTK.Input;
|
||||
using OpenTK.Platform;
|
||||
|
||||
|
||||
namespace InputTest
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Toolkit.Init(new ToolkitOptions()
|
||||
{
|
||||
Backend = PlatformBackend.PreferNative,
|
||||
EnableHighResolution = true
|
||||
});
|
||||
Console.WriteLine("Testing Keyboard");
|
||||
|
||||
while (true)
|
||||
{
|
||||
var keyboard = Keyboard.GetState();
|
||||
if (keyboard.IsAnyKeyDown)
|
||||
{
|
||||
Console.WriteLine("Key detected. Working");
|
||||
break;
|
||||
}
|
||||
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
10
OpenTK.sln
10
OpenTK.sln
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27703.2000
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29411.108
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Generator.Bind", "src\Generator.Bind\Generator.Bind.csproj", "{31D19132-0000-0000-0000-000000000000}"
|
||||
EndProject
|
||||
|
@ -45,6 +45,8 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "OpenTK.Tests.Generators", "
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTK.Standard", "src\OpenTK\OpenTK.Standard.csproj", "{67F02FD3-8F7F-4D89-8551-359993271CA3}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InputTest", "InputTest\InputTest.csproj", "{BC138ACD-99EC-44ED-BBCF-731EADF06C42}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -103,6 +105,10 @@ Global
|
|||
{67F02FD3-8F7F-4D89-8551-359993271CA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{67F02FD3-8F7F-4D89-8551-359993271CA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{67F02FD3-8F7F-4D89-8551-359993271CA3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BC138ACD-99EC-44ED-BBCF-731EADF06C42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BC138ACD-99EC-44ED-BBCF-731EADF06C42}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BC138ACD-99EC-44ED-BBCF-731EADF06C42}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BC138ACD-99EC-44ED-BBCF-731EADF06C42}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<AssemblyName>OpenTK</AssemblyName>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<RootNamespace>OpenTK</RootNamespace>
|
||||
<DefineConstants>$(DefineConstants);WIN32;CARBON;X11;SDL2;OPENGL;OPENGLES;MINIMAL</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
@ -68,7 +68,7 @@
|
|||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<Version>1.0.4</Version>
|
||||
<Version>1.0.5.0</Version>
|
||||
<Description>The Open Toolkit library (OpenTK) is an advanced, low-level C# wrapper for OpenGL, OpenGL ES and OpenAL.
|
||||
It is suitable for games, scientific visualizations and projects that require 3d graphics, audio or compute functionality.
|
||||
|
||||
|
@ -84,8 +84,8 @@ This version can be found at https://github.com/emmauss/opentk</Description>
|
|||
<Company>emmaus</Company>
|
||||
<Product>OpenTK</Product>
|
||||
<PackageProjectUrl>https://github.com/emmauss/opentk</PackageProjectUrl>
|
||||
<AssemblyVersion>1.0.4.0</AssemblyVersion>
|
||||
<FileVersion>1.0.4.0</FileVersion>
|
||||
<AssemblyVersion>1.0.5.0</AssemblyVersion>
|
||||
<FileVersion>1.0.5.0</FileVersion>
|
||||
</PropertyGroup>
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="$(OutputPath)..\..\..\..\Generator.Rewrite\bin\Debug\Rewrite.exe --assembly $(OutputPath)OpenTK.dll --signing-key ..\..\OpenTK.snk -debug -netstandard" Condition="$(OS) == 'Windows_NT' and $(Configuration) == 'Debug'" />
|
||||
|
@ -108,7 +108,8 @@ This version can be found at https://github.com/emmauss/opentk</Description>
|
|||
</MonoDevelop>
|
||||
</ProjectExtensions>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Drawing.Common" Version="4.5.0" />
|
||||
<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
|
|
|
@ -1243,15 +1243,10 @@ namespace OpenTK.Platform.Windows
|
|||
}
|
||||
}
|
||||
}
|
||||
#if !NETSTANDARD
|
||||
Debug.Assert(oldCursorHandle != IntPtr.Zero);
|
||||
Debug.Assert(oldCursorHandle != cursor_handle);
|
||||
Debug.Assert(oldCursor != cursor);
|
||||
#else
|
||||
System.Diagnostics.Debug.Assert(oldCursorHandle != IntPtr.Zero);
|
||||
System.Diagnostics.Debug.Assert(oldCursorHandle != cursor_handle);
|
||||
System.Diagnostics.Debug.Assert(oldCursor != cursor);
|
||||
#endif
|
||||
|
||||
// If we've replaced a custom (non-default) cursor we need to free the handle.
|
||||
if (oldCursor != MouseCursor.Default)
|
||||
{
|
||||
|
|
|
@ -27,9 +27,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
#if !(ANDROID || IPHONE || MINIMAL)
|
||||
using Microsoft.Win32;
|
||||
#endif
|
||||
using OpenTK.Input;
|
||||
using OpenTK.Platform.Common;
|
||||
|
||||
|
@ -96,7 +94,7 @@ namespace OpenTK.Platform.Windows
|
|||
{
|
||||
// This is a keyboard or USB keyboard device. In the latter case, discover if it really is a
|
||||
// keyboard device by qeurying the registry.
|
||||
RegistryKey regkey = GetRegistryKey(name);
|
||||
var regkey = GetRegistryKey(name);
|
||||
if (regkey == null)
|
||||
{
|
||||
continue;
|
||||
|
@ -108,7 +106,7 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
// 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);
|
||||
var classGUIDKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Class\" + deviceClassGUID);
|
||||
deviceClass = classGUIDKey != null ? (string)classGUIDKey.GetValue("Class") : string.Empty;
|
||||
}
|
||||
|
||||
|
@ -204,7 +202,7 @@ namespace OpenTK.Platform.Windows
|
|||
return processed;
|
||||
}
|
||||
|
||||
private static RegistryKey GetRegistryKey(string name)
|
||||
private static Microsoft.Win32.RegistryKey GetRegistryKey(string name)
|
||||
{
|
||||
if (name.Length < 4)
|
||||
{
|
||||
|
@ -226,10 +224,12 @@ namespace OpenTK.Platform.Windows
|
|||
// The final part is the class GUID and is not needed here
|
||||
|
||||
string findme = string.Format(
|
||||
@"System\CurrentControlSet\Enum\{0}\{1}\{2}",
|
||||
@"SYSTEM\CurrentControlSet\Enum\{0}\{1}\{2}",
|
||||
id_01, id_02, id_03);
|
||||
|
||||
RegistryKey regkey = Registry.LocalMachine.OpenSubKey(findme);
|
||||
|
||||
var shellKey = Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64);
|
||||
Microsoft.Win32.RegistryKey regkey = shellKey.OpenSubKey(findme);
|
||||
return regkey;
|
||||
}
|
||||
|
||||
|
|
8
te/Class1.cs
Normal file
8
te/Class1.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
using System;
|
||||
|
||||
namespace te
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
}
|
||||
}
|
7
te/te.csproj
Normal file
7
te/te.csproj
Normal file
|
@ -0,0 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
Loading…
Reference in a new issue