浏览代码

Expand nullability context and mark a couple things nullable

Brandon Thetford 1 年之前
父节点
当前提交
64488be380
共有 2 个文件被更改,包括 5 次插入3 次删除
  1. 2 2
      Terminal.Gui/Application.cs
  2. 3 1
      Terminal.Gui/Views/ToplevelOverlapped.cs

+ 2 - 2
Terminal.Gui/Application.cs

@@ -1397,8 +1397,9 @@ public static partial class Application
         UnGrabbedMouse?.Invoke (view, new ViewEventArgs (view));
     }
 
+    #nullable enable
     // Used by OnMouseEvent to track the last view that was clicked on.
-    internal static View _mouseEnteredView;
+    internal static View? _mouseEnteredView;
 
     /// <summary>Event fired when a mouse move or click occurs. Coordinates are screen relative.</summary>
     /// <remarks>
@@ -1410,7 +1411,6 @@ public static partial class Application
     /// </remarks>
     public static event EventHandler<MouseEventEventArgs> MouseEvent;
 
-    #nullable enable
     /// <summary>Called when a mouse event occurs. Raises the <see cref="MouseEvent"/> event.</summary>
     /// <remarks>This method can be used to simulate a mouse event, e.g. in unit tests.</remarks>
     /// <param name="a">The mouse event with coordinates relative to the screen.</param>

+ 3 - 1
Terminal.Gui/Views/ToplevelOverlapped.cs

@@ -38,11 +38,12 @@ public static partial class Application
         }
     }
 
+    #nullable enable
     /// <summary>
     ///     The <see cref="Toplevel"/> object used for the application on startup which
     ///     <see cref="Toplevel.IsOverlappedContainer"/> is true.
     /// </summary>
-    public static Toplevel OverlappedTop
+    public static Toplevel? OverlappedTop
     {
         get
         {
@@ -54,6 +55,7 @@ public static partial class Application
             return null;
         }
     }
+    #nullable restore
 
     /// <summary>Brings the superview of the most focused overlapped view is on front.</summary>
     public static void BringOverlappedTopToFront ()