hotkey for mouse capture
hide it when captured on widnows
This commit is contained in:
parent
82523d9e1c
commit
5c662effdf
|
@ -66,6 +66,7 @@ namespace BizHawk.Client.Common
|
|||
Bind("General", "Toggle Messages");
|
||||
Bind("General", "Toggle Display Nothing");
|
||||
Bind("General", "Accept Background Input");
|
||||
Bind("General", "Capture Mouse");
|
||||
|
||||
Bind("Save States", "Save State 1", "Shift+F1");
|
||||
Bind("Save States", "Save State 2", "Shift+F2");
|
||||
|
|
|
@ -170,6 +170,7 @@ namespace BizHawk.Client.Common
|
|||
public string UpdateLatestVersion { get; set; } = "";
|
||||
public string UpdateIgnoreVersion { get; set; } = "";
|
||||
public bool SkipOutdatedOsCheck { get; set; }
|
||||
public bool CaptureMouse { get; set; } = false;
|
||||
|
||||
public bool SkipSuperuserPrivsCheck { get; set; }
|
||||
|
||||
|
|
|
@ -149,6 +149,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
case "Accept Background Input":
|
||||
ToggleBackgroundInput();
|
||||
break;
|
||||
case "Capture Mouse":
|
||||
ToggleCaptureMouse();
|
||||
break;
|
||||
|
||||
// Save States
|
||||
case "Save State 1":
|
||||
|
|
|
@ -856,6 +856,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
return _exitCode;
|
||||
}
|
||||
|
||||
LockMouse(Config.CaptureMouse);
|
||||
|
||||
// incantation required to get the program reliably on top of the console window
|
||||
// we might want it in ToggleFullscreen later, but here, it needs to happen regardless
|
||||
BringToFront();
|
||||
|
@ -2313,7 +2315,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|| Math.Abs(_lastMouseAutoHidePos.X - mousePos.X) > 5
|
||||
|| Math.Abs(_lastMouseAutoHidePos.Y - mousePos.Y) > 5;
|
||||
|
||||
if (!shouldUpdateCursor)
|
||||
if (!shouldUpdateCursor || Config.CaptureMouse)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -2803,6 +2805,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
AddOnScreenMessage($"Background Input {(Config.AcceptBackgroundInput ? "enabled" : "disabled")}");
|
||||
}
|
||||
|
||||
private void ToggleCaptureMouse()
|
||||
{
|
||||
Config.CaptureMouse = !Config.CaptureMouse;
|
||||
LockMouse(Config.CaptureMouse);
|
||||
AddOnScreenMessage($"Capture Mouse {(Config.CaptureMouse ? "enabled" : "disabled")}");
|
||||
}
|
||||
|
||||
private void VsyncMessage()
|
||||
{
|
||||
AddOnScreenMessage($"Display Vsync set to {(Config.VSync ? "on" : "off")}");
|
||||
|
@ -4826,10 +4835,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
var fbLocation = Point.Subtract(Bounds.Location, new(PointToClient(Location)));
|
||||
fbLocation.Offset(_presentationPanel.Control.Location);
|
||||
Cursor.Clip = new(fbLocation, _presentationPanel.Control.Size);
|
||||
Cursor.Hide();
|
||||
_presentationPanel.Control.Cursor = Properties.Resources.BlankCursor;
|
||||
_cursorHidden = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Cursor.Clip = Rectangle.Empty;
|
||||
Cursor.Show();
|
||||
_presentationPanel.Control.Cursor = Cursors.Default;
|
||||
_cursorHidden = false;
|
||||
}
|
||||
|
||||
// Cursor.Clip is a no-op on Linux, so we need this too
|
||||
|
|
Loading…
Reference in New Issue