Browse Source

more merging

Charlie Kindel 5 years ago
parent
commit
da02d63281
1 changed files with 0 additions and 67 deletions
  1. 0 67
      Terminal.Gui/ConsoleDrivers/NetDriver.cs

+ 0 - 67
Terminal.Gui/ConsoleDrivers/NetDriver.cs

@@ -12,73 +12,6 @@ using NStack;
 
 
 namespace Terminal.Gui {
 namespace Terminal.Gui {
 
 
-	/// <summary>
-	/// Mainloop intended to be used with the .NET System.Console API, and can
-	/// be used on Windows and Unix, it is cross platform but lacks things like
-	/// file descriptor monitoring.
-	/// </summary>
-	class NetMainLoop : IMainLoopDriver {
-		AutoResetEvent keyReady = new AutoResetEvent (false);
-		AutoResetEvent waitForProbe = new AutoResetEvent (false);
-		ConsoleKeyInfo? windowsKeyResult = null;
-		public Action<ConsoleKeyInfo> WindowsKeyPressed;
-		MainLoop mainLoop;
-
-		public NetMainLoop ()
-		{
-		}
-
-		void WindowsKeyReader ()
-		{
-			while (true) {
-				waitForProbe.WaitOne ();
-				windowsKeyResult = Console.ReadKey (true);
-				keyReady.Set ();
-			}
-		}
-
-		void IMainLoopDriver.Setup (MainLoop mainLoop)
-		{
-			this.mainLoop = mainLoop;
-			Thread readThread = new Thread (WindowsKeyReader);
-			readThread.Start ();
-		}
-
-		void IMainLoopDriver.Wakeup ()
-		{
-		}
-
-		bool IMainLoopDriver.EventsPending (bool wait)
-		{
-			long now = DateTime.UtcNow.Ticks;
-
-			int waitTimeout;
-			if (mainLoop.timeouts.Count > 0) {
-				waitTimeout = (int)((mainLoop.timeouts.Keys [0] - now) / TimeSpan.TicksPerMillisecond);
-				if (waitTimeout < 0)
-					return true;
-			} else
-				waitTimeout = -1;
-
-			if (!wait)
-				waitTimeout = 0;
-
-			windowsKeyResult = null;
-			waitForProbe.Set ();
-			keyReady.WaitOne (waitTimeout);
-			return windowsKeyResult.HasValue;
-		}
-
-		void IMainLoopDriver.MainIteration ()
-		{
-			if (windowsKeyResult.HasValue) {
-				if (WindowsKeyPressed != null)
-					WindowsKeyPressed (windowsKeyResult.Value);
-				windowsKeyResult = null;
-			}
-		}
-	}
-
 	internal class NetDriver : ConsoleDriver {
 	internal class NetDriver : ConsoleDriver {
 		int cols, rows;
 		int cols, rows;
 		public override int Cols => cols;
 		public override int Cols => cols;