public ClickDetector(ClickStatus status, CursorCapture capture, CustomizationParameters parameters, MainForm form)
 {
     this.status = status;
     this.capture = capture;
     this.parameters = parameters;
     this.form = form;
     this.lastClick = new cursorInTime(-50, -50, null);
     InitTimer();
     this.automator = new CUIAutomation();
 }
Beispiel #2
0
 public ClickDetector(ClickStatus status, CursorCapture capture, CustomizationParameters parameters, MainForm form)
 {
     this.status     = status;
     this.capture    = capture;
     this.parameters = parameters;
     this.form       = form;
     this.lastClick  = new cursorInTime(-50, -50, null);
     InitTimer();
     this.automator      = new CUIAutomation();
     this.lastSentToBack = 0;
 }
Beispiel #3
0
        // This is called every timer1.Interval
        private void timer1_Tick(object sender, EventArgs e)
        {
            // Take snapshot of current cursor
            cursorInTime cursor = CursorCapture.CaptureCursor();

            if (cursor == null)
            {
                cursor.cursor.Dispose();
                return;
            }

            if (this.parameters.layoutValues.autoHide)
            {
                // Magic Number for hiding (fix this)
                if (this.lastSentToBack >= 50)
                {
                    if (Win32Stuff.GetForegroundWindow() == this.form.Handle)
                    {
                        if (!this.form.Bounds.Contains(cursor.p) && !this.form.fetcher.Bounds.Contains(cursor.p))
                        {
                            this.lastSentToBack = 0;
                            this.form.SendToBack();
                            this.form.Hide();
                        }
                    }
                }
            }
            this.lastSentToBack++;

            if (this.status.getCurrentMode() == null && this.status.getBackgroundMode() == ProgramMode.sleepClick)
            {
                cursor.cursor.Dispose();
                return;
            }

            MouseTracker.Add(cursor);

            if (MouseTracker.Count >= 10)
            {
                // Check if the mouse has dwelled and proceed from there
                int currentCursorIndex = this.checkDwell();
                if (currentCursorIndex != -1)
                {
                    // There was a dwell, so we should click
                    checkDragThenClick(currentCursorIndex);
                }
                else
                {
                    // The last click position is not valid anymore, clear it
                    this.lastClick = new cursorInTime(-50, -50, null);
                }
            }
        }