Exemplo n.º 1
0
        public virtual bool InjectMouseButtonTripleClick(MouseButton button)
        {
            if (d_inputReceiver == null)
            {
                return(false);
            }

            var semanticEvent = new SemanticInputEvent((int)SemanticValue.SV_SelectAll);

            semanticEvent.d_payload.source = PointerSourceHelper.ConvertToPointerSource(button);

            return(d_inputReceiver.InjectInputEvent(semanticEvent));
        }
Exemplo n.º 2
0
        public virtual bool InjectMouseButtonUp(MouseButton button)
        {
            if (d_inputReceiver == null)
            {
                return(false);
            }

            SemanticInputEvent semanticEvent = new SemanticInputEvent((int)SemanticValue.SV_CursorActivate)
            {
                d_payload = { source = PointerSourceHelper.ConvertToPointerSource(button) }
            };

            return(d_inputReceiver.InjectInputEvent(semanticEvent));
        }
Exemplo n.º 3
0
        public virtual bool InjectMouseButtonClick(MouseButton button)
        {
            if (d_inputReceiver == null)
            {
                return(false);
            }

            var semanticEvent = new SemanticInputEvent((int)SemanticValue.SV_CursorActivate);

            if (IsControlPressed())
            {
                semanticEvent.d_value = (int)SemanticValue.SV_SelectCumulative;
            }

            semanticEvent.d_payload.source = PointerSourceHelper.ConvertToPointerSource(button);

            return(d_inputReceiver.InjectInputEvent(semanticEvent));
        }
Exemplo n.º 4
0
        public virtual bool InjectMouseButtonDown(MouseButton button)
        {
            if (d_inputReceiver == null)
            {
                return(false);
            }

            //
            // Handling for multi-click generation
            //
            var tkr = d_mouseClickTrackers[(int)button];

            tkr.d_click_count++;

            // TODO: re-add the check for different windows?
            // if multi-click requirements are not met
            if (((d_mouseButtonMultiClickTimeout > 0) && (tkr.d_timer.Elapsed() > d_mouseButtonMultiClickTimeout)) ||
                (!tkr.d_click_area.IsPointInRect(d_pointerPosition)) ||
                (tkr.d_click_count > 3))
            {
                // reset to single down event.
                tkr.d_click_count = 1;

                // build new allowable area for multi-clicks
                tkr.d_click_area.Position = d_pointerPosition;
                tkr.d_click_area.Size     = d_mouseButtonMultiClickAbsoluteTolerance;
                tkr.d_click_area.Offset(new Lunatics.Mathematics.Vector2(
                                            -(d_mouseButtonMultiClickAbsoluteTolerance.Width / 2),
                                            -(d_mouseButtonMultiClickAbsoluteTolerance.Height / 2)));
            }

            // reset timer for this tracker.
            tkr.d_timer.Restart();

            if (d_generateMouseClickEvents)
            {
                switch (tkr.d_click_count)
                {
                case 2:
                    return(InjectMouseButtonDoubleClick(button));

                case 3:
                    return(InjectMouseButtonTripleClick(button));
                }
            }

            var value = SemanticValue.SV_CursorPressHold;

            if (IsControlPressed())
            {
                value = SemanticValue.SV_SelectCumulative;
            }
            else if (IsShiftPressed())
            {
                value = SemanticValue.SV_SelectRange;
            }

            var semanticEvent = new SemanticInputEvent((int)value);

            semanticEvent.d_payload.source = PointerSourceHelper.ConvertToPointerSource(button);

            return(d_inputReceiver.InjectInputEvent(semanticEvent));
        }