Пример #1
0
 private void onGazeEvent(object sender, GazeEventArgs e)
 {
     this.gazeCount++;
     if (config.drawGazePositionRectangles)
     {
         GazeLib.drawRectangle((int)e.x, (int)e.y);
     }
     if (this.gazeCount % config.runOnEveryXGazeDispatch == 0)
     {
         long stamp = GazeLib.getTimestamp();
         this.windowGazeTimestamps[this.currentlyActiveWindow] = stamp;
         Point  point                = new Point((int)e.x, (int)e.y);
         IntPtr windowAtGaze         = WinLib.WindowFromPoint(point);
         IntPtr topLevelWindowAtGaze = WinLib.getTopLevelWindow(windowAtGaze);
         if (isTargetWindow(topLevelWindowAtGaze))
         {
             if (topLevelWindowAtGaze != this.currentlyActiveWindow)
             {
                 forwardGazeIfGazedLongEnough(topLevelWindowAtGaze, stamp);
             }
             else
             {
                 onSameWindowGaze(topLevelWindowAtGaze, stamp);
             }
         }
     }
 }
Пример #2
0
        protected override void onTimerTick(object source, ElapsedEventArgs e)
        {
            long now = GazeLib.getTimestamp();

            foreach (IntPtr window in this.visibleWindows.ToList())
            {
                if (window != this.currentlyActiveWindow &&
                    this.windowGazeTimestamps.ContainsKey(window))
                {
                    string processName = WinLib.getProcessName(window);
                    if (!this.recentlyActiveWindows.Contains(window))
                    {
                        long timeInactiveMs = now - this.windowGazeTimestamps[window];
                        if (timeInactiveMs > config.windowInactiveThresholdMs)
                        {
                            startAnimation(window, processName);
                        }
                    }
                    else
                    {
                        log.debug("Not hiding window {0} because it's in recently queue", processName);
                    }
                }
            }
        }
Пример #3
0
        private void onTimerTick(object source, ElapsedEventArgs e)
        {
            this.tickCount++;
            this.timesCount++;
            if (this.tickCount < 10)
            {
                this.y += 100;
            }
            else if (this.tickCount < 25)
            {
                this.x += 100;
            }
            else if (this.tickCount < 33)
            {
                this.y -= 100;
            }
            else if (this.tickCount < 48)
            {
                this.x -= 100;
            }

            GazeEvent(this, new GazeEventArgs(x, y, GazeLib.getTimestamp()));
        }