Skip to content

Commit d7f1431

Browse files
author
Nikolaos Protopapas
committed
fix: resolve all build warnings and exclude minimized windows from hit-testing
- Fix duplicate <summary> tag in RenderCoordinator - Suppress null dereference warnings on _windowSystem in Window.Layout and Window.State - Suppress CS0067 for unused interface-required events in VideoControl - Suppress CS0414 for MouseEnter in TreeControl - Exclude minimized windows from GetWindowAtPoint hit-testing
1 parent 42292d3 commit d7f1431

6 files changed

Lines changed: 10 additions & 6 deletions

File tree

SharpConsoleUI/Controls/TreeControl/TreeControl.Mouse.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ public partial class TreeControl
4242
/// </summary>
4343
public event EventHandler<MouseEventArgs>? MouseRightClick;
4444

45-
#pragma warning disable CS0067 // Event never raised (interface requirement)
45+
#pragma warning disable CS0067, CS0414 // Event never raised / assigned but never used (interface requirement)
4646
/// <summary>
4747
/// Occurs when the mouse enters the control area.
4848
/// </summary>
4949
public event EventHandler<MouseEventArgs>? MouseEnter;
50-
#pragma warning restore CS0067
50+
#pragma warning restore CS0067, CS0414
5151

5252
/// <summary>
5353
/// Occurs when the mouse leaves the control area.

SharpConsoleUI/Controls/VideoControl/VideoControl.Mouse.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ public partial class VideoControl
2626
public event EventHandler<MouseEventArgs>? MouseClick;
2727

2828
/// <inheritdoc/>
29+
#pragma warning disable CS0067 // Event never raised (interface requirement)
2930
public event EventHandler<MouseEventArgs>? MouseDoubleClick;
31+
#pragma warning restore CS0067
3032

3133
/// <inheritdoc/>
3234
public event EventHandler<MouseEventArgs>? MouseRightClick;
@@ -38,7 +40,9 @@ public partial class VideoControl
3840
public event EventHandler<MouseEventArgs>? MouseLeave;
3941

4042
/// <inheritdoc/>
43+
#pragma warning disable CS0067 // Event never raised (interface requirement)
4144
public event EventHandler<MouseEventArgs>? MouseMove;
45+
#pragma warning restore CS0067
4246

4347
/// <inheritdoc/>
4448
public bool ProcessMouseEvent(MouseEventArgs args)

SharpConsoleUI/Rendering/RenderCoordinator.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,6 @@ private void RenderPanel(Panel.Panel? panel, int y, Color themeFg, Color themeBg
694694
_consoleDriver.WriteBufferRegion(0, y, buffer, 0, 0, buffer.Width, themeBg);
695695
}
696696

697-
/// <summary>
698697
/// <summary>
699698
/// Checks if a window is completely covered by other windows (with caching).
700699
/// </summary>

SharpConsoleUI/Window.Layout.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public void RemovePortal(IWindowControl ownerControl, LayoutNode portalNode)
107107
// Use the full desktop as the buffer so submenus can extend in any direction.
108108
// BufferOrigin maps buffer (0,0) to the window's content origin, so
109109
// window-content-relative coordinates (used by dropdown.Bounds) work directly.
110-
var desktopDims = _windowSystem.DesktopDimensions;
110+
var desktopDims = _windowSystem!.DesktopDimensions;
111111
var bufferSize = new System.Drawing.Size(desktopDims.Width, desktopDims.Height);
112112
var bufferOrigin = new System.Drawing.Point(contentOriginX, contentOriginY);
113113

@@ -131,7 +131,7 @@ private void RemoveDesktopPortal(IWindowControl ownerControl, LayoutNode portalN
131131
if (_desktopPortalMap.TryGetValue(portalNode, out var desktopPortal))
132132
{
133133
_desktopPortalMap.Remove(portalNode);
134-
_windowSystem.DesktopPortalService.RemovePortal(desktopPortal);
134+
_windowSystem!.DesktopPortalService.RemovePortal(desktopPortal);
135135
}
136136
}
137137

SharpConsoleUI/Window.State.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ public void SetIsActive(bool value)
503503
if (CloseOnDeactivate)
504504
{
505505
// Defer close to avoid re-entrancy — we're inside SetIsActive
506-
_windowSystem.EnqueueOnUIThread(() => Close(force: true));
506+
_windowSystem!.EnqueueOnUIThread(() => Close(force: true));
507507
}
508508
}
509509
InvalidateBorderCache();

SharpConsoleUI/Windows/WindowQueryHelper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ public static Window FindWindowToActivate(Window targetWindow, ConsoleWindowSyst
9393
{
9494
List<Window> windows = context.Windows.Values
9595
.Where(window =>
96+
window.State != WindowState.Minimized &&
9697
point.X >= window.Left &&
9798
point.X < window.Left + window.Width &&
9899
point.Y - context.DesktopUpperLeft.Y >= window.Top &&

0 commit comments

Comments
 (0)