Beispiel #1
0
        private void ProcessModifierKey(IntPtr inEvent)
        {
            MacOSKeyModifiers modifiers = API.GetEventKeyModifiers(inEvent);
            bool caps    = (modifiers & MacOSKeyModifiers.CapsLock) != 0 ? true : false;
            bool control = (modifiers & MacOSKeyModifiers.Control) != 0 ? true : false;
            bool command = (modifiers & MacOSKeyModifiers.Command) != 0 ? true : false;
            bool option  = (modifiers & MacOSKeyModifiers.Option) != 0 ? true : false;
            bool shift   = (modifiers & MacOSKeyModifiers.Shift) != 0 ? true : false;

            Debug.Print("Modifiers Changed: {0}", modifiers);
            Input.KeyboardDevice keyboard = InputDriver.Keyboard[0];
            if (keyboard[OpenTK.Input.Key.AltLeft] ^ option)
            {
                keyboard[OpenTK.Input.Key.AltLeft] = option;
            }
            if (keyboard[OpenTK.Input.Key.ShiftLeft] ^ shift)
            {
                keyboard[OpenTK.Input.Key.ShiftLeft] = shift;
            }
            if (keyboard[OpenTK.Input.Key.WinLeft] ^ command)
            {
                keyboard[OpenTK.Input.Key.WinLeft] = command;
            }
            if (keyboard[OpenTK.Input.Key.ControlLeft] ^ control)
            {
                keyboard[OpenTK.Input.Key.ControlLeft] = control;
            }
            if (keyboard[OpenTK.Input.Key.CapsLock] ^ caps)
            {
                keyboard[OpenTK.Input.Key.CapsLock] = caps;
            }
        }
Beispiel #2
0
        private void ProcessModifierKey(IntPtr inEvent)
        {
            MacOSKeyModifiers eventKeyModifiers = API.GetEventKeyModifiers(inEvent);
            bool           flag1          = (eventKeyModifiers & MacOSKeyModifiers.CapsLock) != MacOSKeyModifiers.None;
            bool           flag2          = (eventKeyModifiers & MacOSKeyModifiers.Control) != MacOSKeyModifiers.None;
            bool           flag3          = (eventKeyModifiers & MacOSKeyModifiers.Command) != MacOSKeyModifiers.None;
            bool           flag4          = (eventKeyModifiers & MacOSKeyModifiers.Option) != MacOSKeyModifiers.None;
            bool           flag5          = (eventKeyModifiers & MacOSKeyModifiers.Shift) != MacOSKeyModifiers.None;
            KeyboardDevice keyboardDevice = this.InputDriver.Keyboard[0];

            if (keyboardDevice[Key.AltLeft] ^ flag4)
            {
                keyboardDevice[Key.AltLeft] = flag4;
            }
            if (keyboardDevice[Key.ShiftLeft] ^ flag5)
            {
                keyboardDevice[Key.ShiftLeft] = flag5;
            }
            if (keyboardDevice[Key.WinLeft] ^ flag3)
            {
                keyboardDevice[Key.WinLeft] = flag3;
            }
            if (keyboardDevice[Key.ControlLeft] ^ flag2)
            {
                keyboardDevice[Key.ControlLeft] = flag2;
            }
            if (!(keyboardDevice[Key.CapsLock] ^ flag1))
            {
                return;
            }
            keyboardDevice[Key.CapsLock] = flag1;
        }
Beispiel #3
0
        void ProcessModifierKey(IntPtr inEvent)
        {
            MacOSKeyModifiers modifiers = API.GetEventKeyModifiers(inEvent);

            bool caps    = (modifiers & MacOSKeyModifiers.CapsLock) != 0;
            bool control = (modifiers & MacOSKeyModifiers.Control) != 0;
            bool command = (modifiers & MacOSKeyModifiers.Command) != 0;
            bool option  = (modifiers & MacOSKeyModifiers.Option) != 0;
            bool shift   = (modifiers & MacOSKeyModifiers.Shift) != 0;

            Debug.Print("Modifiers Changed: {0}", modifiers);
            // TODO: Is this even needed
            bool repeat = Keyboard.KeyRepeat; Keyboard.KeyRepeat = false;

            Keyboard.Set(Key.AltLeft, option);
            Keyboard.Set(Key.ShiftLeft, shift);
            Keyboard.Set(Key.WinLeft, command);
            Keyboard.Set(Key.ControlLeft, control);
            Keyboard.Set(Key.CapsLock, caps);

            Keyboard.KeyRepeat = repeat;
        }
Beispiel #4
0
        private void ProcessModifierKey(IntPtr inEvent)
        {
            MacOSKeyModifiers modifiers = API.GetEventKeyModifiers(inEvent);

            bool caps    = (modifiers & MacOSKeyModifiers.CapsLock) != 0 ? true : false;
            bool control = (modifiers & MacOSKeyModifiers.Control) != 0 ? true : false;
            bool command = (modifiers & MacOSKeyModifiers.Command) != 0 ? true : false;
            bool option  = (modifiers & MacOSKeyModifiers.Option) != 0 ? true : false;
            bool shift   = (modifiers & MacOSKeyModifiers.Shift) != 0 ? true : false;

            Input.KeyboardDevice keyboard = InputDriver.Keyboard[0];

            if (keyboard[OpenTK.Input.Key.AltLeft] ^ option)
            {
                ProcessKey(MacOSKeyCode.OptionAlt, option);
            }

            if (keyboard[OpenTK.Input.Key.ShiftLeft] ^ shift)
            {
                ProcessKey(MacOSKeyCode.Shift, shift);
            }

            if (keyboard[OpenTK.Input.Key.WinLeft] ^ command)
            {
                ProcessKey(MacOSKeyCode.Command, command);
            }

            if (keyboard[OpenTK.Input.Key.ControlLeft] ^ control)
            {
                ProcessKey(MacOSKeyCode.Control, control);
            }

            if (keyboard[OpenTK.Input.Key.CapsLock] ^ caps)
            {
                ProcessKey(MacOSKeyCode.CapsLock, caps);
            }
        }