예제 #1
0
        public override void GetKeyboard(IntPtr client, IntPtr resource, UInt32 id)
        {
            WlKeyboard keyboard = new WlKeyboard(client, Resource.GetVersion(resource), id);

            keyboard.client.keyboard = keyboard;
            if (keyboard.GetVersion() >= 4)
            {
                keyboard.SendRepeatInfo(30, 200);
            }
            Tuple <int, int> fdAndSize = WindowManager.keymap.GetKeymap();

            keyboard.SendKeymap(1, fdAndSize.Item1, (uint)fdAndSize.Item2);
        }
예제 #2
0
        private void SeatCapabilitiesCallback(void *data, wl_seat *proxy, wl_seat_capability capabilities)
        {
            var hasKeyboard = capabilities.HasFlag(wl_seat_capability.Keyboard);
            var hasPointer  = capabilities.HasFlag(wl_seat_capability.Pointer);
            var hasTouch    = capabilities.HasFlag(wl_seat_capability.Touch);

            if (hasKeyboard && _wlKeyboard.IsNull)
            {
                _wlKeyboard = _wlSeat.GetKeyboard();
                LogDebug("Got keyboard.");
                _wlKeyboard.SetListener(KeymapCallback, KeyboardEnterCallback, KeyboardLeaveCallback,
                                        KeyboardKeyCallback, KeyboardModifiersCallback, KeyboardRepeatInfoCallback);
            }
            if (hasPointer && _wlPointer.IsNull)
            {
                _wlPointer = _wlSeat.GetPointer();
                LogDebug("Got pointer.");
                _wlPointer.SetListener(PointerEnterCallback, PointerLeaveCallback, PointerMotionCallback,
                                       PointerButtonCallback, PointerAxisCallback,
                                       PointerFrameCallback, PointerAxisSourceCallback, PointerAxisStopCallback, PointerAxisDiscreteCallback);
            }
            if (hasTouch && _wlTouch.IsNull)
            {
                _wlTouch = _wlSeat.GetTouch();
                LogDebug("Got touch.");
            }

            if (!hasKeyboard && !_wlKeyboard.IsNull)
            {
                _wlKeyboard.FreeListener();
                _wlKeyboard = WlKeyboard.Null;
                LogDebug("Lost keyboard.");
            }
            if (!hasPointer && !_wlPointer.IsNull)
            {
                _wlPointer.FreeListener();
                _wlPointer = WlPointer.Null;
                LogDebug("Lost mouse.");
            }
            if (!hasTouch && !_wlTouch.IsNull)
            {
                _wlTouch.FreeListener();
                _wlTouch = WlTouch.Null;
                LogDebug("Lost touch.");
            }
        }