[Linux] Disabled TTY keyboard driver in favor of libinput

The TTY keyboard driver requires a robust cleanup method to avoid
hogging the keyboard/console after the process exists. Without
this, it does not make sense to use enable this driver.
This commit is contained in:
thefiddler 2014-07-14 21:35:30 +00:00
parent e7bd311fbd
commit 4a53a5511a
3 changed files with 25 additions and 3 deletions

View file

@ -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;

View file

@ -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;
}
}

View file

@ -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
}