diff --git a/Source/Examples/Main.cs b/Source/Examples/Main.cs index eb86bd06..c23e99b5 100644 --- a/Source/Examples/Main.cs +++ b/Source/Examples/Main.cs @@ -101,6 +101,23 @@ namespace Examples public static void Main(string[] args) { Trace.Listeners.Add(new ConsoleTraceListener()); + using (Toolkit.Init()) + { + while (true) + { + var state = OpenTK.Input.Keyboard.GetState(); + if (!state.IsConnected) + { + break; + } + else if (state.IsKeyDown(OpenTK.Input.Key.Escape)) + { + break; + } + } + } + return; + Tests.GameWindowStates.Main(); return; diff --git a/Source/OpenTK/Platform/Linux/LinuxFactory.cs b/Source/OpenTK/Platform/Linux/LinuxFactory.cs index 8d0d8e27..943e9dcd 100644 --- a/Source/OpenTK/Platform/Linux/LinuxFactory.cs +++ b/Source/OpenTK/Platform/Linux/LinuxFactory.cs @@ -48,6 +48,7 @@ namespace OpenTK.Platform.Linux IJoystickDriver2 JoystickDriver; IKeyboardDriver2 KeyboardDriver; + IMouseDriver2 MouseDriver; const string gpu_path = "/dev/dri"; // card0, card1, ... @@ -216,9 +217,7 @@ namespace OpenTK.Platform.Linux { lock (this) { - KeyboardDriver = KeyboardDriver ?? - // Todo: use LinuxInput driver if available? - (IKeyboardDriver2)new LinuxKeyboardTTY(); + KeyboardDriver = KeyboardDriver ?? new LinuxInput(); return KeyboardDriver; } } diff --git a/Source/OpenTK/Platform/Linux/LinuxKeyboardTTY.cs b/Source/OpenTK/Platform/Linux/LinuxKeyboardTTY.cs index d9c0c6bd..63b80952 100644 --- a/Source/OpenTK/Platform/Linux/LinuxKeyboardTTY.cs +++ b/Source/OpenTK/Platform/Linux/LinuxKeyboardTTY.cs @@ -35,6 +35,11 @@ using OpenTK.Input; namespace OpenTK.Platform.Linux { + // Todo: this has terrible side-effects on process exit + // (the keyboard remains tied up.) We need to find a + // proper way to clean up after ourselves, even in case + // of a crash. + #if EXPERIMENTAL class LinuxKeyboardTTY : IKeyboardDriver2, IDisposable { const int stdin = 0; // STDIN_FILENO @@ -552,5 +557,6 @@ namespace OpenTK.Platform.Linux #endregion } + #endif }