Esempio n. 1
0
        public void OnEvent(XIEvent *xev)
        {
            if (xev->evtype == XiEventType.XI_DeviceChanged)
            {
                var changed = (XIDeviceChangedEvent *)xev;
                _pointerDevice.Update(changed->Classes, changed->NumClasses);
            }


            if ((xev->evtype >= XiEventType.XI_ButtonPress && xev->evtype <= XiEventType.XI_Motion) ||
                (xev->evtype >= XiEventType.XI_TouchBegin && xev->evtype <= XiEventType.XI_TouchEnd))
            {
                var dev = (XIDeviceEvent *)xev;
                if (_clients.TryGetValue(dev->EventWindow, out var client))
                {
                    OnDeviceEvent(client, new ParsedDeviceEvent(dev));
                }
            }

            if (xev->evtype == XiEventType.XI_Leave || xev->evtype == XiEventType.XI_Enter)
            {
                var rev = (XIEnterLeaveEvent *)xev;
                if (_clients.TryGetValue(rev->EventWindow, out var client))
                {
                    OnEnterLeaveEvent(client, ref *rev);
                }
            }
        }
Esempio n. 2
0
        public void OnEvent(XIEvent *xev)
        {
            if (xev->evtype == XiEventType.XI_DeviceChanged)
            {
                var changed = (XIDeviceChangedEvent *)xev;
                _pointerDevice.Update(changed->Classes, changed->NumClasses);
            }

            //TODO: this should only be used for non-touch devices
            if (xev->evtype >= XiEventType.XI_ButtonPress && xev->evtype <= XiEventType.XI_Motion)
            {
                var dev = (XIDeviceEvent *)xev;
                if (_clients.TryGetValue(dev->EventWindow, out var client))
                {
                    OnDeviceEvent(client, new ParsedDeviceEvent(dev));
                }
            }
        }