public X11Keyboard()
{
Debug.WriteLine("Using X11Keyboard.");
state.IsConnected = true;
var display = API.DefaultDisplay;
using (new XLock(display))
{
// Find the number of keysyms per keycode.
int first = 0, last = 0;
API.DisplayKeycodes(display, ref first, ref last);
var keysym_ptr =
API.GetKeyboardMapping(display,
(byte)first,
last - first + 1,
ref KeysymsPerKeycode);
Functions.XFree(keysym_ptr);
if (Xkb.IsSupported(display))
{
// Request that auto-repeat is only set on devices that support it physically.
// This typically means that it's turned off for keyboards what we want).
// We prefer this method over XAutoRepeatOff/On, because the latter needs to
// be reset before the program exits.
bool supported;
Xkb.SetDetectableAutoRepeat(display, true, out supported);
KeyMap = new X11KeyMap(display);
}
}
}