Ejemplo n.º 1
0
        private void HandleKeyboard(KeyboardDevice device, KeyboardEvent e)
        {
            if (device != null)
            {
                device.State.SetIsConnected(true);
                Debug.Print("[Input] Added keyboard {0}", device.Id);

                Key  key = Key.Unknown;
                uint raw = e.Key;
                if (raw >= 0 && raw < KeyMap.Length)
                {
                    key = KeyMap[raw];
                }

                if (key == Key.Unknown)
                {
                    Debug.Print("[Linux] Unknown key with code '{0}'", raw);
                }

                device.State.SetKeyState(key, e.KeyState == KeyState.Pressed);
            }
        }
Ejemplo n.º 2
0
        void HandleKeyboard(KeyboardDevice device, KeyboardEvent e)
        {
            if (device != null)
            {
                device.State.SetIsConnected(true);
                Debug.Print("[Input] Added keyboard {0}", device.Id);

                Key key = Key.Unknown;
                uint raw = e.Key;
                if (raw >= 0 && raw < KeyMap.Length)
                {
                    key = KeyMap[raw];
                }

                if (key == Key.Unknown)
                {
                    Debug.Print("[Linux] Unknown key with code '{0}'", raw);
                }

                device.State.SetKeyState(key, e.KeyState == KeyState.Pressed);
            }
        }