private void ThreadLoop() { while (!cancelToken.IsCancellationRequested) { ISInputData input = outputQueue.Take(); if (SwitchThreadDesktop) { WinDesktop.SwitchThreadToInputDesktop(); SwitchThreadDesktop = false; } outManager.Send(input); } ISLogger.Write("Exited output thread loop"); }
private void TimerCallback(object sync) { Thread.CurrentThread.Name = "CursorMonitorThread"; if (SwitchToInputDesktop) { SwitchToInputDesktop = false; WinDesktop.SwitchThreadToInputDesktop(); } if (!GetCursorPos(out POINT pos)) { if (!WinDesktop.GetThreadDesktop().InputDesktop) { WinDesktop.SwitchThreadToInputDesktop(); } return; } if (pos.Y == screenBounds.Top) { EdgeHit?.Invoke(this, BoundEdge.Top); } else if (pos.Y == screenBounds.Bottom) { EdgeHit?.Invoke(this, BoundEdge.Bottom); } else if (pos.X == screenBounds.Left) { EdgeHit?.Invoke(this, BoundEdge.Left); } else if (pos.X == screenBounds.Right) { EdgeHit?.Invoke(this, BoundEdge.Right); } }