Fixed exit when running

This commit is contained in:
Ray 2026-07-11 16:52:42 +01:00
parent b4cb6ee8c8
commit 3188cda3e4

View File

@ -69,7 +69,17 @@ namespace CursorGuardRail
protected override void OnFormClosing(FormClosingEventArgs e) protected override void OnFormClosing(FormClosingEventArgs e)
{ {
if ((this.HideOnClose && !_requestExit) || _timer.Enabled) // On exit requested, exit
if (_requestExit)
{
if (_timer.Enabled) _timer.Stop();
ClipCursor(Rectangle.Empty);
return;
}
// Always hide instead of close, if running
if (this.HideOnClose || _timer.Enabled)
{ {
e.Cancel = true; e.Cancel = true;
@ -77,10 +87,6 @@ namespace CursorGuardRail
return; return;
} }
if (_timer.Enabled) _timer.Stop();
ClipCursor(Rectangle.Empty);
base.OnFormClosing(e); base.OnFormClosing(e);
} }