From 5679d30dca8aaf1281dfdccb351b3c731475f3a9 Mon Sep 17 00:00:00 2001 From: Craig Huggins Date: Wed, 25 Jun 2025 21:49:25 +1000 Subject: [PATCH 1/2] Patch for index out of bounds, much simpler than current pull request from Rolzad73:master --- main/Forms/frmMain.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/main/Forms/frmMain.cs b/main/Forms/frmMain.cs index 19d67ba..45ff914 100644 --- a/main/Forms/frmMain.cs +++ b/main/Forms/frmMain.cs @@ -200,12 +200,13 @@ private void SetLocation() public static List FindDockedTaskBars() { List dockedRects = new List(); + bool hasDockedRects = false; foreach (var tmpScrn in Screen.AllScreens) { + Rectangle rect = new Rectangle(); + if (!tmpScrn.Bounds.Equals(tmpScrn.WorkingArea)) { - Rectangle rect = new Rectangle(); - var leftDockedWidth = Math.Abs((Math.Abs(tmpScrn.Bounds.Left) - Math.Abs(tmpScrn.WorkingArea.Left))); var topDockedHeight = Math.Abs((Math.Abs(tmpScrn.Bounds.Top) - Math.Abs(tmpScrn.WorkingArea.Top))); var rightDockedWidth = ((tmpScrn.Bounds.Width - leftDockedWidth) - tmpScrn.WorkingArea.Width); @@ -216,6 +217,7 @@ public static List FindDockedTaskBars() rect.Y = tmpScrn.Bounds.Top; rect.Width = leftDockedWidth; rect.Height = tmpScrn.Bounds.Height; + hasDockedRects = true; } else if ((rightDockedWidth > 0)) { @@ -223,6 +225,7 @@ public static List FindDockedTaskBars() rect.Y = tmpScrn.Bounds.Top; rect.Width = rightDockedWidth; rect.Height = tmpScrn.Bounds.Height; + hasDockedRects = true; } else if ((topDockedHeight > 0)) { @@ -230,6 +233,7 @@ public static List FindDockedTaskBars() rect.Y = tmpScrn.Bounds.Top; rect.Width = tmpScrn.WorkingArea.Width; rect.Height = topDockedHeight; + hasDockedRects = true; } else if ((bottomDockedHeight > 0)) { @@ -237,17 +241,16 @@ public static List FindDockedTaskBars() rect.Y = tmpScrn.WorkingArea.Bottom; rect.Width = tmpScrn.WorkingArea.Width; rect.Height = bottomDockedHeight; + hasDockedRects = true; } else { // Nothing found! } - - dockedRects.Add(rect); } + dockedRects.Add(rect); } - - if (dockedRects.Count == 0) + if (!hasDockedRects) { // Taskbar is set to "Auto-Hide". } From fef49bac4319b870b59c7e69cadffce895630d4a Mon Sep 17 00:00:00 2001 From: Craig Huggins Date: Wed, 25 Jun 2025 21:55:02 +1000 Subject: [PATCH 2/2] Add debugging support. Start debug built exe and it will wait for debugger to attach Add a break point after waiting for debugger in client.cs, line 33 --- main/client.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main/client.cs b/main/client.cs index 36903ce..2d50e3d 100644 --- a/main/client.cs +++ b/main/client.cs @@ -24,6 +24,10 @@ static class client static void Main() { +#if DEBUG + while (!Debugger.IsAttached) { System.Threading.Thread.Sleep(1000); } +#endif + // Use existing methods to obtain cursor already imported as to not import any extra functions // Pass as two variables instead of Point due to Point requiring System.Drawing int cursorX = Cursor.Position.X;