From 282c434fda8ac5c1f2fdaf75ceaf3977458f79f2 Mon Sep 17 00:00:00 2001 From: Brandon Thetford Date: Wed, 21 Feb 2024 02:12:00 -0700 Subject: [PATCH] Invert the if for even less nesting --- Terminal.Gui/Application.cs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Terminal.Gui/Application.cs b/Terminal.Gui/Application.cs index 43c7c2d9a..1fe847201 100644 --- a/Terminal.Gui/Application.cs +++ b/Terminal.Gui/Application.cs @@ -1601,25 +1601,25 @@ public static partial class Application bool AdornmentHandledMouseEvent (Adornment? frame) { - if (frame?.Thickness.Contains (frame.FrameToScreen (), a.MouseEvent.X, a.MouseEvent.Y) is true) + if (frame?.Thickness.Contains (frame.FrameToScreen (), a.MouseEvent.X, a.MouseEvent.Y) is not true) { - Point boundsPoint = frame.ScreenToBounds (a.MouseEvent.X, a.MouseEvent.Y); - - var me = new MouseEvent - { - X = boundsPoint.X, - Y = boundsPoint.Y, - Flags = a.MouseEvent.Flags, - OfX = boundsPoint.X, - OfY = boundsPoint.Y, - View = frame - }; - frame.OnMouseEvent (me); - - return true; + return false; } - return false; + Point boundsPoint = frame.ScreenToBounds (a.MouseEvent.X, a.MouseEvent.Y); + + var me = new MouseEvent + { + X = boundsPoint.X, + Y = boundsPoint.Y, + Flags = a.MouseEvent.Flags, + OfX = boundsPoint.X, + OfY = boundsPoint.Y, + View = frame + }; + frame.OnMouseEvent (me); + + return true; } static bool OutsideRect (Point p, Rectangle r) { return p.X < 0 || p.X > r.Right || p.Y < 0 || p.Y > r.Bottom; }