public PointerPoint GetCurrentPoint(UIElement relativeTo)
        {
            var device      = PointerDevice.For(PointerDeviceType.Mouse);
            var rawPosition = _nativeEvent.LocationInWindow;
            var position    = relativeTo != null?
                              relativeTo.ConvertPointFromView(_nativeEvent.LocationInWindow, null) :
                                  rawPosition;

            var properties = new PointerPointProperties()
            {
                IsInRange            = true,
                IsPrimary            = true,
                IsLeftButtonPressed  = ((int)NSEvent.CurrentPressedMouseButtons & LeftMouseButtonMask) == LeftMouseButtonMask,
                IsRightButtonPressed = ((int)NSEvent.CurrentPressedMouseButtons & RightMouseButtonMask) == RightMouseButtonMask,
            };

            if (Pointer.PointerDeviceType == PointerDeviceType.Pen)
            {
                properties.XTilt    = (float)_nativeEvent.Tilt.X;
                properties.YTilt    = (float)_nativeEvent.Tilt.Y;
                properties.Pressure = (float)_nativeEvent.Pressure;
            }

            return(new PointerPoint(
                       FrameId,
                       ToTimeStamp(_nativeEvent.Timestamp),
                       device,
                       Pointer.PointerId,
                       rawPosition,
                       position,
                       Pointer.IsInContact,
                       properties));
        }
示例#2
0
        private void OnMotionEvent(object o, MotionNotifyEventArgs args)
        {
            try
            {
                switch (args.Event.Type)
                {
                case Gdk.EventType.MotionNotify:
                    _ownerEvents.RaisePointerMoved(
                        new PointerEventArgs(
                            new Windows.UI.Input.PointerPoint(
                                frameId: 0,
                                timestamp: args.Event.Time,
                                device: PointerDevice.For(PointerDeviceType.Mouse),
                                pointerId: 0,
                                rawPosition: new Windows.Foundation.Point(args.Event.X, args.Event.Y),
                                position: new Windows.Foundation.Point(args.Event.X, args.Event.Y),
                                isInContact: false,
                                properties: BuildProperties(args.Event)
                                )
                            )
                        );
                    break;

                default:
                    Console.WriteLine($"Unknown event: {args.Event.State}");
                    break;
                }
            }
            catch (Exception e)
            {
                this.Log().Error("Failed to raise PointerMoved", e);
            }
        }
        private void OnWindowLeaveEvent(object o, LeaveNotifyEventArgs args)
        {
            try
            {
                var properties = BuildProperties(args.Event);
                var modifiers  = GetKeyModifiers();

                _ownerEvents.RaisePointerExited(
                    new PointerEventArgs(
                        new Windows.UI.Input.PointerPoint(
                            frameId: GetNextFrameId(),
                            timestamp: args.Event.Time,
                            device: PointerDevice.For(PointerDeviceType.Mouse),
                            pointerId: 0,
                            rawPosition: new Windows.Foundation.Point(args.Event.X, args.Event.Y),
                            position: new Windows.Foundation.Point(args.Event.X, args.Event.Y),
                            isInContact: properties.HasPressedButton,
                            properties: properties
                            ),
                        modifiers
                        )
                    );
            }
            catch (Exception e)
            {
                this.Log().Error("Failed to raise PointerExited", e);
            }
        }
        private void OnTapStart(GestureLayer.TapData data)
        {
            try
            {
                var properties = BuildProperties(true, false);
                var modifiers  = VirtualKeyModifiers.None;
                var point      = GetPoint(data.X, data.Y);

                _ownerEvents.RaisePointerPressed(
                    new PointerEventArgs(
                        new Windows.UI.Input.PointerPoint(
                            frameId: GetNextFrameId(),
                            timestamp: (uint)data.Timestamp,
                            device: PointerDevice.For(PointerDeviceType.Touch),
                            pointerId: 0,
                            rawPosition: point,
                            position: point,
                            isInContact: properties.HasPressedButton,
                            properties: properties
                            ),
                        modifiers
                        )
                    );
            }
            catch (Exception e)
            {
                this.Log().Error("Failed to raise PointerPressed", e);
            }
        }
        public PointerPoint GetCurrentPoint(UIElement relativeTo)
        {
            var timestamp = ToTimeStamp(_nativeEvent.EventTime);
            var device    = PointerDevice.For(Pointer.PointerDeviceType);

            var(rawPosition, position) = GetPositions(relativeTo);

            return(new PointerPoint(FrameId, timestamp, device, Pointer.PointerId, rawPosition, position, Pointer.IsInContact, _properties));
        }
        public PointerPoint GetCurrentPoint(UIElement relativeTo)
        {
            var timestamp  = ToTimeStamp(_nativeTouch.Timestamp);
            var device     = PointerDevice.For(Pointer.PointerDeviceType);
            var position   = (Point)_nativeTouch.LocationInView(relativeTo);
            var properties = GetProperties();

            return(new PointerPoint(FrameId, timestamp, device, Pointer.PointerId, position, position, Pointer.IsInContact, properties));
        }
示例#7
0
        public PointerPoint GetCurrentPoint(UIElement relativeTo)
        {
            var timestamp   = ToTimeStamp(_nativeEvent.EventTime);
            var device      = PointerDevice.For(Pointer.PointerDeviceType);
            var rawPosition = new Point(_nativeEvent.RawX, _nativeEvent.RawY);             // Relative to the screen
            var position    = GetPosition(relativeTo);
            var properties  = GetProperties();

            return(new PointerPoint(FrameId, timestamp, device, Pointer.PointerId, rawPosition, position, Pointer.IsInContact, properties));
        }
        public PointerPoint GetCurrentPoint(UIElement relativeTo)
        {
            var device   = PointerDevice.For(PointerDeviceType.Mouse);
            var position = relativeTo == null
                                ? _absolutePosition
                                : relativeTo.TransformToVisual(null).Inverse.TransformPoint(_absolutePosition);

            var properties = _pointerEventArgs.CurrentPoint.Properties;

            return(new PointerPoint(FrameId, _pseudoTimestamp, device, 0, _absolutePosition, position, true, properties));
        }
示例#9
0
        public PointerPoint GetCurrentPoint(UIElement relativeTo)
        {
            var timestamp = ToTimeStamp(_timestamp);
            var device    = PointerDevice.For(Pointer.PointerDeviceType);
            var position  = relativeTo == null
                                ? _absolutePosition
                                : relativeTo.TransformToVisual(null).Inverse.TransformPoint(_absolutePosition);
            var properties = GetProperties();

            return(new PointerPoint(FrameId, timestamp, device, Pointer.PointerId, position, position, Pointer.IsInContact, properties));
        }
        public PointerPoint GetCurrentPoint(UIElement relativeTo)
        {
            var device     = PointerDevice.For(PointerDeviceType.Mouse);
            var point      = relativeTo.ConvertPointFromView(_nativeEvent.LocationInWindow, null);
            var properties = new PointerPointProperties()
            {
                IsInRange = true, IsPrimary = true
            };

            return(new PointerPoint(FrameId, _pseudoTimestamp, device, 0, point, point, true, properties));
        }
        public PointerPoint GetCurrentPoint(UIElement relativeTo)
        {
            var timestamp   = ToTimeStamp(_nativeTouch.Timestamp);
            var device      = PointerDevice.For(Pointer.PointerDeviceType);
            var rawPosition = (Point)_nativeTouch.GetPreciseLocation(null);
            var position    = relativeTo == null
                                ? rawPosition
                                : (Point)_nativeTouch.GetPreciseLocation(relativeTo);

            return(new PointerPoint(FrameId, timestamp, device, Pointer.PointerId, rawPosition, position, Pointer.IsInContact, _properties));
        }
示例#12
0
        public PointerPoint GetCurrentPoint(UIElement relativeTo)
        {
            var device      = PointerDevice.For(PointerDeviceType.Mouse);
            var translation = relativeTo.TransformToVisual(null) as TranslateTransform;
            var offset      = new Point(_point.X - translation.X, _point.Y - translation.Y);
            var properties  = new PointerPointProperties()
            {
                IsInRange = true, IsPrimary = true
            };

            return(new PointerPoint(FrameId, _pseudoTimestamp, device, 0, offset, offset, true, properties));
        }
示例#13
0
        private static PointerPoint GetPointerPoint(NSEvent nativeEvent, Point posInWindow)
        {
            var frameId           = ToFrameId(nativeEvent.Timestamp);
            var timestamp         = ToTimestamp(nativeEvent.Timestamp);
            var pointerDeviceType = GetPointerDeviceType(nativeEvent);
            var pointerDevice     = PointerDevice.For(pointerDeviceType);
            var pointerId         = pointerDeviceType == PointerDeviceType.Pen
                                ? (uint)nativeEvent.PointingDeviceID()
                                : (uint)0;
            var isInContact = GetIsInContact(nativeEvent);
            var properties  = GetPointerProperties(nativeEvent, pointerDeviceType);

            return(new PointerPoint(frameId, timestamp, pointerDevice, pointerId, posInWindow, posInWindow, isInContact, properties));
        }
示例#14
0
        private static PointerEventArgs BuildPointerArgs(NSEvent nativeEvent, Point posInWindow)
        {
            var frameId           = ToFrameId(nativeEvent.Timestamp);
            var timestamp         = ToTimestamp(nativeEvent.Timestamp);
            var pointerDeviceType = GetPointerDeviceType(nativeEvent);
            var pointerDevice     = PointerDevice.For(pointerDeviceType);
            var pointerId         = pointerDeviceType == PointerDeviceType.Pen
                                ? (uint)nativeEvent.PointingDeviceID()
                                : (uint)1;
            var isInContact = GetIsInContact(nativeEvent);
            var properties  = GetPointerProperties(nativeEvent, pointerDeviceType).SetUpdateKindFromPrevious(_previous?.CurrentPoint.Properties);
            var modifiers   = GetVirtualKeyModifiers(nativeEvent);

            var point = new PointerPoint(frameId, timestamp, pointerDevice, pointerId, posInWindow, posInWindow, isInContact, properties);
            var args  = new PointerEventArgs(point, modifiers);

            _previous = args;

            return(args);
        }
示例#15
0
        private void OnWindowMotionEvent(object o, MotionNotifyEventArgs args)         // a.k.a. move
        {
            try
            {
                switch (args.Event.Type)
                {
                case Gdk.EventType.MotionNotify:
                    var properties = BuildProperties(args.Event);
                    var modifiers  = GetKeyModifiers();

                    _ownerEvents.RaisePointerMoved(
                        new PointerEventArgs(
                            new Windows.UI.Input.PointerPoint(
                                frameId: GetNextFrameId(),
                                timestamp: args.Event.Time,
                                device: PointerDevice.For(PointerDeviceType.Mouse),
                                pointerId: 0,
                                rawPosition: new Windows.Foundation.Point(args.Event.X, args.Event.Y),
                                position: new Windows.Foundation.Point(args.Event.X, args.Event.Y),
                                isInContact: properties.HasPressedButton,
                                properties: properties
                                ),
                            modifiers
                            )
                        );
                    break;

                default:
                    Console.WriteLine($"Unknown event: {args.Event.State}");
                    break;
                }
            }
            catch (Exception e)
            {
                this.Log().Error("Failed to raise PointerMoved", e);
            }
        }
示例#16
0
 private void Window_LeaveEvent(object o, LeaveNotifyEventArgs args)
 {
     try
     {
         _ownerEvents.RaisePointerExited(
             new PointerEventArgs(
                 new Windows.UI.Input.PointerPoint(
                     frameId: 0,
                     timestamp: args.Event.Time,
                     device: PointerDevice.For(PointerDeviceType.Mouse),
                     pointerId: 0,
                     rawPosition: new Windows.Foundation.Point(args.Event.X, args.Event.Y),
                     position: new Windows.Foundation.Point(args.Event.X, args.Event.Y),
                     isInContact: false,
                     properties: BuildProperties(args.Event)
                     )
                 )
             );
     }
     catch (Exception e)
     {
         this.Log().Error("Failed to raise PointerExited", e);
     }
 }
示例#17
0
    internal PointerPoint ToPointerPoint(InjectedInputState state)
    {
        var isNew      = PointerOptions.HasFlag(InjectedInputPointerOptions.New);
        var properties = isNew
                        ? new PointerPointProperties()
                        : new PointerPointProperties(state.Properties);

        properties.IsPrimary = PointerOptions.HasFlag(InjectedInputPointerOptions.Primary);
        properties.IsInRange = PointerOptions.HasFlag(InjectedInputPointerOptions.InRange);
        // IsLeftButtonPressed = // stateful, cf. below,
        // IsMiddleButtonPressed = // Mouse only
        // IsRightButtonPressed = // stateful, cf. below,
        // IsHorizontalMouseWheel = // Mouse only
        // IsXButton1Pressed =
        // IsXButton2Pressed =
        // IsBarrelButtonPressed = // Pen only
        // IsEraser = // Pen only
        // Pressure = // Touch only
        // Orientation = // Touch only
        // ContactRect = new Rect(Contact.Left, Contact.Top, Contact.Right - Contact.Left, Contact.Bottom - Contact.Top),
        properties.TouchConfidence = PointerOptions.HasFlag(InjectedInputPointerOptions.Confidence);
        properties.IsCanceled      = PointerOptions.HasFlag(InjectedInputPointerOptions.Canceled);

        var update = default(PointerUpdateKind);

        if (PointerOptions.HasFlag(InjectedInputPointerOptions.FirstButton))
        {
            if (PointerOptions.HasFlag(InjectedInputPointerOptions.PointerDown))
            {
                properties.IsLeftButtonPressed = true;
                update |= PointerUpdateKind.LeftButtonPressed;
            }
            else if (PointerOptions.HasFlag(InjectedInputPointerOptions.PointerUp))
            {
                properties.IsLeftButtonPressed = false;
                update |= PointerUpdateKind.LeftButtonReleased;
            }
        }
        if (PointerOptions.HasFlag(InjectedInputPointerOptions.SecondButton))
        {
            if (PointerOptions.HasFlag(InjectedInputPointerOptions.PointerDown))
            {
                properties.IsRightButtonPressed = true;
                update |= PointerUpdateKind.RightButtonPressed;
            }
            else if (PointerOptions.HasFlag(InjectedInputPointerOptions.PointerUp))
            {
                properties.IsRightButtonPressed = false;
                update |= PointerUpdateKind.RightButtonReleased;
            }
        }

        properties.PointerUpdateKind = update;
        if (state.Type is PointerDeviceType.Pen)
        {
            properties.IsBarrelButtonPressed = properties.IsRightButtonPressed;
        }

        var location = new Point(PixelLocation.PositionX, PixelLocation.PositionY);
        var point    = new PointerPoint(
            state.FrameId + TimeOffsetInMilliseconds,
            state.Timestamp + PerformanceCount,
            PointerDevice.For(state.Type),
            isNew ? PointerId : state.PointerId,
            location,
            location,
            PointerOptions.HasFlag(InjectedInputPointerOptions.InContact),
            properties);

        return(point);
    }
示例#18
0
    internal PointerEventArgs ToEventArgs(InjectedInputState state)
    {
        var update     = default(PointerUpdateKind);
        var position   = state.Position;
        var properties = new PointerPointProperties(state.Properties)
        {
            IsPrimary = false,
            IsInRange = true             // always true for mouse
        };

        if (MouseOptions.HasFlag(InjectedInputMouseOptions.LeftDown))
        {
            properties.IsLeftButtonPressed = true;
            update |= PointerUpdateKind.LeftButtonPressed;
        }
        else if (MouseOptions.HasFlag(InjectedInputMouseOptions.LeftUp))
        {
            properties.IsLeftButtonPressed = false;
            update |= PointerUpdateKind.LeftButtonReleased;
        }

        if (MouseOptions.HasFlag(InjectedInputMouseOptions.MiddleDown))
        {
            properties.IsMiddleButtonPressed = true;
            update |= PointerUpdateKind.MiddleButtonPressed;
        }
        else if (MouseOptions.HasFlag(InjectedInputMouseOptions.MiddleUp))
        {
            properties.IsMiddleButtonPressed = false;
            update |= PointerUpdateKind.MiddleButtonReleased;
        }

        if (MouseOptions.HasFlag(InjectedInputMouseOptions.RightDown))
        {
            properties.IsRightButtonPressed = true;
            update |= PointerUpdateKind.RightButtonPressed;
        }
        else if (MouseOptions.HasFlag(InjectedInputMouseOptions.RightUp))
        {
            properties.IsRightButtonPressed = false;
            update |= PointerUpdateKind.RightButtonReleased;
        }

        if (MouseOptions.HasFlag(InjectedInputMouseOptions.XDown))
        {
            properties.IsXButton1Pressed = true;
            update |= PointerUpdateKind.XButton1Pressed;
        }
        else if (MouseOptions.HasFlag(InjectedInputMouseOptions.XUp))
        {
            properties.IsXButton1Pressed = false;
            update |= PointerUpdateKind.XButton1Released;
        }

        if (MouseOptions.HasFlag(InjectedInputMouseOptions.Wheel))
        {
            properties.MouseWheelDelta        = DeltaY;
            properties.IsHorizontalMouseWheel = false;
        }
        else if (MouseOptions.HasFlag(InjectedInputMouseOptions.HWheel))
        {
            properties.MouseWheelDelta        = DeltaX;
            properties.IsHorizontalMouseWheel = true;
        }
        else
        {
            properties.MouseWheelDelta        = default;
            properties.IsHorizontalMouseWheel = false;
            position.X += DeltaX;
            position.Y += DeltaY;
        }

        properties.PointerUpdateKind = update;

        var point = new PointerPoint(
            state.FrameId + TimeOffsetInMilliseconds,
            state.Timestamp + TimeOffsetInMilliseconds,
            PointerDevice.For(PointerDeviceType.Mouse),
            1,
            position,
            position,
            isInContact: true,             // Always true for mouse
            properties);

        return(new PointerEventArgs(point, default));
    }
示例#19
0
    internal PointerEventArgs ToEventArgs(InjectedInputState state)
    {
        var update     = default(PointerUpdateKind);
        var position   = state.Position;
        var properties = new PointerPointProperties(state.Properties)
        {
            IsPrimary = false,
            IsInRange = true             // always true for mouse
        };

        if (MouseOptions.HasFlag(InjectedInputMouseOptions.LeftDown))
        {
            properties.IsLeftButtonPressed = true;
            update |= PointerUpdateKind.LeftButtonPressed;
        }
        else if (MouseOptions.HasFlag(InjectedInputMouseOptions.LeftUp))
        {
            properties.IsLeftButtonPressed = false;
            update |= PointerUpdateKind.LeftButtonReleased;
        }

        if (MouseOptions.HasFlag(InjectedInputMouseOptions.MiddleDown))
        {
            properties.IsMiddleButtonPressed = true;
            update |= PointerUpdateKind.MiddleButtonPressed;
        }
        else if (MouseOptions.HasFlag(InjectedInputMouseOptions.MiddleUp))
        {
            properties.IsMiddleButtonPressed = false;
            update |= PointerUpdateKind.MiddleButtonReleased;
        }

        if (MouseOptions.HasFlag(InjectedInputMouseOptions.RightDown))
        {
            properties.IsRightButtonPressed = true;
            update |= PointerUpdateKind.RightButtonPressed;
        }
        else if (MouseOptions.HasFlag(InjectedInputMouseOptions.RightUp))
        {
            properties.IsRightButtonPressed = false;
            update |= PointerUpdateKind.RightButtonReleased;
        }

        if (MouseOptions.HasFlag(InjectedInputMouseOptions.XDown))
        {
            properties.IsXButton1Pressed = true;
            update |= PointerUpdateKind.XButton1Pressed;
        }
        else if (MouseOptions.HasFlag(InjectedInputMouseOptions.XUp))
        {
            properties.IsXButton1Pressed = false;
            update |= PointerUpdateKind.XButton1Released;
        }

        if (MouseOptions.HasFlag(InjectedInputMouseOptions.Wheel))
        {
            properties.MouseWheelDelta        = DeltaY;
            properties.IsHorizontalMouseWheel = false;
        }
        else if (MouseOptions.HasFlag(InjectedInputMouseOptions.HWheel))
        {
            properties.MouseWheelDelta        = DeltaX;
            properties.IsHorizontalMouseWheel = true;
        }
        else if (MouseOptions.HasFlag(InjectedInputMouseOptions.Move) || MouseOptions.HasFlag(InjectedInputMouseOptions.MoveNoCoalesce))
        {
            properties.MouseWheelDelta        = default;
            properties.IsHorizontalMouseWheel = false;

            // Should we use MouseData ??? But How to discriminate between X and Y moves?
            position.X += DeltaX;
            position.Y += DeltaY;
        }
        else
        {
            properties.MouseWheelDelta        = default;
            properties.IsHorizontalMouseWheel = false;
        }

        properties.PointerUpdateKind = update;

        var point = new PointerPoint(
            state.FrameId + TimeOffsetInMilliseconds,
            state.Timestamp + TimeOffsetInMilliseconds,
            PointerDevice.For(PointerDeviceType.Mouse),
            uint.MaxValue - 42,             // Try to avoid conflict with the real mouse pointer
            position,
            position,
            isInContact: properties.HasPressedButton,
            properties);

        return(new PointerEventArgs(point, default));
    }
        private void ProcessTouchEvent(IntPtr rawEvent, libinput_event_type rawEventType)
        {
            var rawTouchEvent = libinput_event_get_touch_event(rawEvent);

            if (rawTouchEvent != IntPtr.Zero &&
                rawEventType < LIBINPUT_EVENT_TOUCH_FRAME)
            {
                var properties = new PointerPointProperties();
                var timestamp  = libinput_event_touch_get_time_usec(rawTouchEvent);
                var pointerId  = (uint)libinput_event_touch_get_slot(rawTouchEvent);
                Action <PointerEventArgs>?raisePointerEvent = null;
                Point currentPosition;

                if (rawEventType == LIBINPUT_EVENT_TOUCH_DOWN ||
                    rawEventType == LIBINPUT_EVENT_TOUCH_MOTION)
                {
                    currentPosition = new Point(
                        x: libinput_event_touch_get_x_transformed(rawTouchEvent, (int)_displayInformation.ScreenWidthInRawPixels),
                        y: libinput_event_touch_get_y_transformed(rawTouchEvent, (int)_displayInformation.ScreenHeightInRawPixels));

                    _activePointers[pointerId] = currentPosition;
                }
                else
                {
                    _activePointers.TryGetValue(pointerId, out currentPosition);
                    _activePointers.Remove(pointerId);
                }

                if (this.Log().IsEnabled(LogLevel.Trace))
                {
                    this.Log().Trace($"ProcessTouchEvent: {rawEventType}, pointerId:{pointerId}, currentPosition:{currentPosition}, timestamp:{timestamp}");
                }

                switch (rawEventType)
                {
                case LIBINPUT_EVENT_TOUCH_MOTION:
                    raisePointerEvent = _ownerEvents.RaisePointerMoved;
                    break;

                case LIBINPUT_EVENT_TOUCH_DOWN:
                    properties.PointerUpdateKind = LeftButtonPressed;
                    raisePointerEvent            = _ownerEvents.RaisePointerPressed;
                    break;

                case LIBINPUT_EVENT_TOUCH_UP:
                    properties.PointerUpdateKind = LeftButtonReleased;
                    raisePointerEvent            = _ownerEvents.RaisePointerReleased;
                    break;

                case LIBINPUT_EVENT_TOUCH_CANCEL:
                    properties.PointerUpdateKind = LeftButtonReleased;
                    raisePointerEvent            = _ownerEvents.RaisePointerCancelled;
                    break;
                }

                properties.IsLeftButtonPressed = rawEventType != LIBINPUT_EVENT_TOUCH_UP && rawEventType != LIBINPUT_EVENT_TOUCH_CANCEL;

                var pointerPoint = new Windows.UI.Input.PointerPoint(
                    frameId: (uint)timestamp,                     // UNO TODO: How should set the frame, timestamp may overflow.
                    timestamp: timestamp,
                    device: PointerDevice.For(PointerDeviceType.Touch),
                    pointerId: pointerId,
                    rawPosition: currentPosition,
                    position: currentPosition,
                    isInContact: properties.HasPressedButton,
                    properties: properties
                    );

                if (raisePointerEvent != null)
                {
                    var args = new PointerEventArgs(pointerPoint, GetCurrentModifiersState());

                    RaisePointerEvent(raisePointerEvent, args);
                }
                else
                {
                    this.Log().LogWarning($"Touch event type {rawEventType} was not handled");
                }
            }
        }
        private void ProcessMouseEvent(IntPtr rawEvent, libinput_event_type type)
        {
            var rawPointerEvent = libinput_event_get_pointer_event(rawEvent);

            var timestamp  = libinput_event_pointer_get_time_usec(rawPointerEvent);
            var properties = new PointerPointProperties();
            Action <PointerEventArgs>?raisePointerEvent = null;

            if (type == LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE)
            {
                _mousePosition = new Point(
                    x: libinput_event_pointer_get_absolute_x_transformed(rawPointerEvent, (int)_displayInformation.ScreenWidthInRawPixels),
                    y: libinput_event_pointer_get_absolute_y_transformed(rawPointerEvent, (int)_displayInformation.ScreenHeightInRawPixels));

                raisePointerEvent = _ownerEvents.RaisePointerMoved;
            }
            else if (type == LIBINPUT_EVENT_POINTER_AXIS)
            {
                double GetAxisValue(libinput_pointer_axis axis)
                {
                    var source = libinput_event_pointer_get_axis_source(rawPointerEvent);

                    return(source == libinput_pointer_axis_source.Wheel
                                                ? libinput_event_pointer_get_axis_value_discrete(rawPointerEvent, axis)
                                                : libinput_event_pointer_get_axis_value(rawPointerEvent, axis));
                }

                if (libinput_event_pointer_has_axis(rawPointerEvent, libinput_pointer_axis.ScrollHorizontal) != 0)
                {
                    properties.IsHorizontalMouseWheel = true;
                    properties.MouseWheelDelta        = (int)GetAxisValue(libinput_pointer_axis.ScrollHorizontal);
                    raisePointerEvent = _ownerEvents.RaisePointerWheelChanged;
                }
                else if (libinput_event_pointer_has_axis(rawPointerEvent, libinput_pointer_axis.ScrollVertical) != 0)
                {
                    properties.IsHorizontalMouseWheel = false;
                    properties.MouseWheelDelta        = (int)GetAxisValue(libinput_pointer_axis.ScrollVertical);
                    raisePointerEvent = _ownerEvents.RaisePointerWheelChanged;
                }
            }
            else if (type == LIBINPUT_EVENT_POINTER_BUTTON)
            {
                var button      = libinput_event_pointer_get_button(rawPointerEvent);
                var buttonState = libinput_event_pointer_get_button_state(rawPointerEvent);

                if (buttonState == libinput_button_state.Pressed)
                {
                    _pointerPressed.Add(button);

                    properties.PointerUpdateKind = button switch
                    {
                        libinput_event_code.BTN_LEFT => LeftButtonPressed,
                        libinput_event_code.BTN_MIDDLE => MiddleButtonPressed,
                        libinput_event_code.BTN_RIGHT => RightButtonPressed,
                        _ => Other
                    };

                    raisePointerEvent = _ownerEvents.RaisePointerPressed;
                }
                else
                {
                    _pointerPressed.Remove(button);

                    properties.PointerUpdateKind = button switch
                    {
                        libinput_event_code.BTN_LEFT => LeftButtonReleased,
                        libinput_event_code.BTN_MIDDLE => MiddleButtonReleased,
                        libinput_event_code.BTN_RIGHT => RightButtonReleased,
                        _ => Other
                    };

                    raisePointerEvent = _ownerEvents.RaisePointerReleased;
                }
            }

            properties.IsLeftButtonPressed   = _pointerPressed.Contains(libinput_event_code.BTN_LEFT);
            properties.IsMiddleButtonPressed = _pointerPressed.Contains(libinput_event_code.BTN_MIDDLE);
            properties.IsRightButtonPressed  = _pointerPressed.Contains(libinput_event_code.BTN_RIGHT);

            var pointerPoint = new Windows.UI.Input.PointerPoint(
                frameId: (uint)timestamp,                 // UNO TODO: How should set the frame, timestamp may overflow.
                timestamp: timestamp,
                device: PointerDevice.For(PointerDeviceType.Mouse),
                pointerId: 0,
                rawPosition: _mousePosition,
                position: _mousePosition,
                isInContact: properties.HasPressedButton,
                properties: properties
                );

            if (raisePointerEvent != null)
            {
                var args = new PointerEventArgs(pointerPoint, GetCurrentModifiersState());

                RaisePointerEvent(raisePointerEvent, args);
            }
            else
            {
                this.Log().LogWarning($"Pointer event type {type} was not handled");
            }
        }
    }