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.");
            }
        }
Example #2
0
        public override void GetPointer(IntPtr client, IntPtr resource, UInt32 id)
        {
            WlPointer pointer = new WlPointer(client, 1, id);

            pointer.client.pointer = pointer;
        }