Exemple #1
0
        public EvDevSingleTouchScreen(EvDevDevice device, EvDevTouchScreenDeviceDescription description,
                                      IScreenInfoProvider screenInfo) : base(device)
        {
            if (device.AbsX == null || device.AbsY == null)
            {
                throw new ArgumentException("Device is not a touchscreen");
            }
            _screenInfo = screenInfo;

            _calibration = description.CalibrationMatrix;
            _axisX       = device.AbsX.Value;
            _axisY       = device.AbsY.Value;
        }
Exemple #2
0
        public void Initialize(IScreenInfoProvider info, Action <RawInputEventArgs> onInput)
        {
            _onInput = onInput;
            _epoll   = epoll_create1(0);
            for (var c = 0; c < _deviceDescriptions.Length; c++)
            {
                var description = _deviceDescriptions[c];
                var dev         = EvDevDevice.Open(description.Path);
                EvDevDeviceHandler handler;
                if (description is EvDevTouchScreenDeviceDescription touch)
                {
                    handler = new EvDevSingleTouchScreen(dev, touch, info)
                    {
                        InputRoot = _inputRoot
                    }
                }
                ;
                else
                {
                    throw new Exception("Unknown device description type " + description.GetType().FullName);
                }

                handler.OnEvent += OnRawEvent;
                _handlers.Add(handler);

                var ev = new epoll_event {
                    events = EPOLLIN, data = { u32 = (uint)c }
                };
                epoll_ctl(_epoll, EPOLL_CTL_ADD, dev.Fd, ref ev);
            }

            new Thread(InputThread)
            {
                IsBackground = true
            }.Start();
        }
Exemple #3
0
 public EvDevDeviceHandler(EvDevDevice device)
 {
     Device = device;
 }