From b0b32bea6a891e4d41a8cf19dee11438a10e67a6 Mon Sep 17 00:00:00 2001 From: feos Date: Wed, 5 Mar 2025 19:47:09 +0300 Subject: [PATCH] mouse capture: restrict to center various toolbars may exist near screen edges, we don't want them to be triggered when hawk has "captured" the mouse, especially in fullscreen. I considered taking into account when hawk window is partly offscreen but it's hard to expect anyone would play that way - normal scenario is fullscreen, so screen edges are automatically pushed away from. dialogs covering hawk are even less likely to remain during mouse capture, so we don't care about mouse appearing on them. --- src/BizHawk.Client.EmuHawk/MainForm.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index aa36d51796..e89161d8e2 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -4876,9 +4876,11 @@ namespace BizHawk.Client.EmuHawk { if (wantCapture) { + var size = _presentationPanel.Control.Size; var fbLocation = Point.Subtract(Bounds.Location, new(PointToClient(Location))); fbLocation.Offset(_presentationPanel.Control.Location); - Cursor.Clip = new(fbLocation, _presentationPanel.Control.Size); + fbLocation.Offset(new Point(size.Width / 2, size.Height / 2)); + Cursor.Clip = new(fbLocation, new(1, 1)); Cursor.Hide(); _presentationPanel.Control.Cursor = Properties.Resources.BlankCursor; _cursorHidden = true;