Example #1
0
        internal static IInputAction CreateMouseMoveInput(
            double absoluteX,
            double absoluteY)
        {
            Log.Out(msg: "Raw mouse move pixels ({0}, {1})", (object)absoluteX, (object)absoluteY);
            var mouseInputAction = new MouseInputAction();
            var clientArea       = nativeMethods.GetClientArea();

            absoluteX = (absoluteX - clientArea.X) * ushort.MaxValue / clientArea.Width;
            absoluteY = (absoluteY - clientArea.Y) * ushort.MaxValue / clientArea.Height;
            mouseInputAction.mouseInput.dx    = (int)Math.Round(a: absoluteX);
            mouseInputAction.mouseInput.dy    = (int)Math.Round(a: absoluteY);
            mouseInputAction.mouseInput.flags = RIMNativeMethods.MOUSE_EVENT_FLAGS.VIRTUALDESK | RIMNativeMethods.MOUSE_EVENT_FLAGS.ABSOLUTE;
            return(mouseInputAction);
        }
Example #2
0
        internal static IInputAction CreateMouseUpInput(PointerButtons button, bool swapped)
        {
            var physicalButton   = DeterminePhysicalButton(button: button, swapped: swapped);
            var mouseInputAction = new MouseInputAction();

            mouseInputAction.mouseInput.flags = MouseButtonsToMouseInputs(physicalButton: physicalButton, isMouseFlagsDown: false);
            if ((button & PointerButtons.XButton1) != PointerButtons.None)
            {
                mouseInputAction.mouseInput.mouseData |= 1U;
            }
            if ((button & PointerButtons.XButton2) != PointerButtons.None)
            {
                mouseInputAction.mouseInput.mouseData |= 2U;
            }
            return(mouseInputAction);
        }