Procházet zdrojové kódy

Fixes #698 StatusBar position on resizing. (#699)

* Fixes #698 StatusBar position on resizing.

* Changed to LayoutComplete in StatusBar.
BDisp před 5 roky
rodič
revize
a6a3c99703
2 změnil soubory, kde provedl 23 přidání a 25 odebrání
  1. 22 24
      Terminal.Gui/Core/Toplevel.cs
  2. 1 1
      Terminal.Gui/Views/StatusBar.cs

+ 22 - 24
Terminal.Gui/Core/Toplevel.cs

@@ -269,31 +269,28 @@ namespace Terminal.Gui {
 
 		internal void PositionToplevels ()
 		{
-			if (this != Application.Top) {
-				EnsureVisibleBounds (this, Frame.X, Frame.Y, out int nx, out int ny);
-				if ((nx != Frame.X || ny != Frame.Y) && LayoutStyle != LayoutStyle.Computed) {
-					X = nx;
-					Y = ny;
+			foreach (var top in Subviews) {
+				if (top is Toplevel) {
+					PositionToplevel ((Toplevel)top);
 				}
-			} else {
-				foreach (var top in Subviews) {
-					if (top is Toplevel) {
-						EnsureVisibleBounds ((Toplevel)top, top.Frame.X, top.Frame.Y, out int nx, out int ny);
-						if ((nx != top.Frame.X || ny != top.Frame.Y) && top.LayoutStyle != LayoutStyle.Computed) {
-							top.X = nx;
-							top.Y = ny;
-						}
-						if (StatusBar != null) {
-							if (ny + top.Frame.Height > Driver.Rows - 1) {
-								if (top.Height is Dim.DimFill)
-									top.Height = Dim.Fill () - 1;
-							}
-							if (StatusBar.Frame.Y != Driver.Rows - 1) {
-								StatusBar.Y = Driver.Rows - 1;
-								SetNeedsDisplay ();
-							}
-						}
-					}
+			}
+		}
+
+		private void PositionToplevel (Toplevel top)
+		{
+			EnsureVisibleBounds (top, top.Frame.X, top.Frame.Y, out int nx, out int ny);
+			if ((nx != top.Frame.X || ny != top.Frame.Y) && top.LayoutStyle != LayoutStyle.Computed) {
+				top.X = nx;
+				top.Y = ny;
+			}
+			if (StatusBar != null) {
+				if (ny + top.Frame.Height > Driver.Rows - 1) {
+					if (top.Height is Dim.DimFill)
+						top.Height = Dim.Fill () - 1;
+				}
+				if (StatusBar.Frame.Y != Driver.Rows - 1) {
+					StatusBar.Y = Driver.Rows - 1;
+					SetNeedsDisplay ();
 				}
 			}
 		}
@@ -311,6 +308,7 @@ namespace Terminal.Gui {
 					// (the bounds passed to us).
 					Clear (bounds);
 					Driver.SetAttribute (Colors.Base.Normal);
+					PositionToplevels ();
 				}
 				foreach (var view in Subviews) {
 					if (view.Frame.IntersectsWith (bounds)) {

+ 1 - 1
Terminal.Gui/Views/StatusBar.cs

@@ -90,7 +90,7 @@ namespace Terminal.Gui {
 			Width = Dim.Fill ();
 			Height = 1;
 
-			Application.Resized += (e) => {
+			LayoutComplete += (e) => {
 				X = 0;
 				Height = 1;
 				if (SuperView == null || SuperView == Application.Top) {