From cd7605d237e5385886a50c2bac753ed9fb479946 Mon Sep 17 00:00:00 2001 From: Morilli <35152647+Morilli@users.noreply.github.com> Date: Mon, 2 Dec 2024 00:07:19 +0100 Subject: [PATCH] fix code --- src/BizHawk.Client.EmuHawk/Extensions/ControlExtensions.cs | 4 +--- .../tools/TAStudio/BookmarksBranchesBox.cs | 4 ++-- .../tools/TAStudio/TAStudio.ListView.cs | 4 +--- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/Extensions/ControlExtensions.cs b/src/BizHawk.Client.EmuHawk/Extensions/ControlExtensions.cs index d7d5e2ee479..8bdda06e54d 100644 --- a/src/BizHawk.Client.EmuHawk/Extensions/ControlExtensions.cs +++ b/src/BizHawk.Client.EmuHawk/Extensions/ControlExtensions.cs @@ -92,9 +92,7 @@ public static DialogResult ShowDialogOnScreen(this Form form) var topLeft = new Point( Math.Max(0, form.Location.X), Math.Max(0, form.Location.Y)); - var screen = Screen.AllScreens - .Where(s => s.WorkingArea.Contains(topLeft)) - .FirstOrDefault(); + var screen = Screen.AllScreens.First(s => s.WorkingArea.Contains(topLeft)); var w = screen.WorkingArea.Right - form.Bounds.Right; var h = screen.WorkingArea.Bottom - form.Bounds.Bottom; if (h < 0) topLeft.Y += h; diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs index 4c7c96beaed..293bdd2957f 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs @@ -661,8 +661,8 @@ private void BranchView_PointedCellChanged(object sender, InputRoll.CellEventArg location.Offset(width + Width, 0); } - Math.Max(0, location.Y); - var screen = Screen.AllScreens.Where(s => s.WorkingArea.Contains(location)).FirstOrDefault(); + location.Y = Math.Max(0, location.Y); + var screen = Screen.AllScreens.First(s => s.WorkingArea.Contains(location)); var h = screen.WorkingArea.Bottom - bottom; if (h < 0) diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs index 00058664abc..6e05848efca 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs @@ -824,9 +824,7 @@ private void TasView_MouseUp(object sender, MouseEventArgs e) var bottomRight = new Point( topLeft.X + RightClickMenu.Width, topLeft.Y + RightClickMenu.Height); - var screen = Screen.AllScreens - .Where(s => s.WorkingArea.Contains(topLeft)) - .FirstOrDefault(); + var screen = Screen.AllScreens.First(s => s.WorkingArea.Contains(topLeft)); // if we don't fully fit, move to the other side of the pointer if (bottomRight.X > screen.WorkingArea.Right) offset.X -= RightClickMenu.Width;