Browse Source

Prevent crash on Linux/Mac introduced in 0.80

miguel 5 years ago
parent
commit
ad8461d6af
3 changed files with 19 additions and 1 deletions
  1. 1 1
      Example/Example.csproj
  2. 12 0
      Example/demo.cs
  3. 6 0
      Terminal.Gui/Drivers/CursesDriver.cs

+ 1 - 1
Example/Example.csproj

@@ -21,7 +21,7 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <ExternalConsole>true</ExternalConsole>
-    <PlatformTarget>x86</PlatformTarget>
+    <PlatformTarget>x64</PlatformTarget>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
     <Optimize>true</Optimize>

+ 12 - 0
Example/demo.cs

@@ -512,6 +512,18 @@ static class Demo {
 		});
 
 		win.Add (drag, dragText);
+#if false
+		var label = new Label ("Fitler") {
+			X = 2
+		};
+		var spacing = 20;
+
+		var button = new Button ("apply") {
+			X = Pos.Right (label) + spacing + 2,
+			Y = 0
+		};
+#endif
+
 
 		top.Add (win);
 		//top.Add (menu);

+ 6 - 0
Terminal.Gui/Drivers/CursesDriver.cs

@@ -299,6 +299,12 @@ namespace Terminal.Gui {
 				Colors.Error.HotNormal = Curses.A_BOLD | Curses.A_REVERSE;
 				Colors.Error.HotFocus = Curses.A_REVERSE;
 			}
+			Colors.TopLevel = new ColorScheme ();
+
+			Colors.TopLevel.Normal = MakeColor (Curses.COLOR_GREEN, Curses.COLOR_BLACK);
+			Colors.TopLevel.Focus = MakeColor (Curses.COLOR_WHITE, Curses.COLOR_CYAN);
+			Colors.TopLevel.HotNormal = MakeColor (Curses.COLOR_YELLOW, Curses.COLOR_BLACK);
+			Colors.TopLevel.HotFocus = MakeColor (Curses.COLOR_YELLOW, Curses.COLOR_CYAN);
 		}
 
 		static int MapColor (Color color)