Changed to invalidate display control when locking/unlocking cursor
Added build scripts
This commit is contained in:
parent
3594cbd9df
commit
b1ba66c848
35
README.md
Normal file
35
README.md
Normal file
@ -0,0 +1,35 @@
|
||||
# Cursor GuardRail
|
||||
|
||||
> A utility for locking the cursor to one or more monitors.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## Features
|
||||
|
||||
- Lock the cursor to one of more monitors
|
||||
- Good for old games that don't implement cursor boundaries
|
||||
- Ideal for when you have monitors for non-interactive displays
|
||||
|
||||
## Screenshots
|
||||
|
||||
[](wiki/screenshot-1.png) [](wiki/screenshot-2.png)
|
||||
|
||||
---
|
||||
|
||||
## Releases & Builds
|
||||
|
||||
See [Releases](/Ray/cursor-guardrail-utility/releases)
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
This software uses a number of dependencies and assets from third-parties.
|
||||
These developers and artists deserve due credit for their work and for their commitment to sharing their work freely.
|
||||
Each product is released under their own particular license, for more information please visit their websites.
|
||||
|
||||
- [Lucide](https://lucide.dev/icons/)
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the least restrictive terms of its dependencies, viz. MIT License.
|
||||
52
build-installer.iss
Normal file
52
build-installer.iss
Normal file
@ -0,0 +1,52 @@
|
||||
; Script generated by the Inno Setup Script Wizard.
|
||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||
|
||||
#define MyAppName "CursorGuardRail"
|
||||
#define MyAppVersion "0.1.0.119"
|
||||
#define MyAppPublisher "Hi, I'm Ray"
|
||||
#define MyAppURL "https://git.hiimray.co.uk/Ray/cursor-guardrail-utility"
|
||||
#define MyAppExeName "cursorguardrail.exe"
|
||||
|
||||
#define AppSourcePath "L:\gitea-hiimray\cursor-guardrail-utility\bin"
|
||||
#define AppReleasePath "L:\gitea-hiimray\cursor-guardrail-utility\bin"
|
||||
#define AppReleaseName "cursorguardrail-installer"
|
||||
|
||||
[Setup]
|
||||
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
|
||||
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
|
||||
AppId={{472ED37C-C4FC-4B72-8BC3-C281A6E0D2F9}
|
||||
AppName={#MyAppName}
|
||||
AppVersion={#MyAppVersion}
|
||||
AppPublisher={#MyAppPublisher}
|
||||
AppPublisherURL={#MyAppURL}
|
||||
AppSupportURL={#MyAppURL}
|
||||
AppUpdatesURL={#MyAppURL}
|
||||
DefaultDirName={autopf}\{#MyAppName}
|
||||
DefaultGroupName={#MyAppName}
|
||||
DisableProgramGroupPage=yes
|
||||
; Remove the following line to run in administrative install mode (install for all users.)
|
||||
PrivilegesRequired=lowest
|
||||
OutputDir={#AppReleasePath}
|
||||
OutputBaseFilename={#AppReleaseName}
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
WizardStyle=modern
|
||||
|
||||
[Languages]
|
||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
|
||||
[Tasks]
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||
|
||||
[Files]
|
||||
Source: "{#AppSourcePath}\cursorguardrail.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||
|
||||
[Icons]
|
||||
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
|
||||
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
|
||||
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
|
||||
|
||||
[Run]
|
||||
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
||||
|
||||
@ -5,6 +5,10 @@ rmdir /s /q "source\obj\"
|
||||
dotnet restore CursorGuardRail.slnx
|
||||
dotnet publish CursorGuardRail.slnx -r win-x64 -c Release /p:PublishSingleFile=true /p:SelfContained=false /p:PublishReadyToRunfalse=true /p:PublishDir="..\bin\"
|
||||
|
||||
"C:\B\Portable Files (dev)\Inno Setup\v6.0.4-2\app\ISCC.exe" "build-installer.iss"
|
||||
|
||||
"C:\B\Portable Files\7-Zip (Portable)\26.02\App\7-Zip64\7z.exe" a -t7z "bin\cursorguardrail.7z" ".\bin\cursorguardrail.exe" -mx9
|
||||
|
||||
rmdir /s /q "source\bin\"
|
||||
rmdir /s /q "source\obj\"
|
||||
|
||||
|
||||
@ -131,21 +131,26 @@ namespace CursorGuardRail
|
||||
if (!_lockCursorArea.HasValue || _lockCursorArea == Rectangle.Empty)
|
||||
{
|
||||
this.IsCursorLocked = false;
|
||||
screensLayout1.ShowArea = false;
|
||||
return;
|
||||
}
|
||||
|
||||
_timer.Start();
|
||||
//notifyIcon1.Visible = true;
|
||||
screensLayout1.ShowArea = true;
|
||||
|
||||
if (this.HideOnLock) this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
_lockCursorArea = null;
|
||||
|
||||
ClipCursor(Rectangle.Empty);
|
||||
|
||||
notifyIcon1.Visible = value || !this.Visible;
|
||||
|
||||
if (_timer.Enabled) _timer.Stop();
|
||||
|
||||
screensLayout1.ShowArea = false;
|
||||
}
|
||||
}
|
||||
} = false;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
@ -48,11 +49,14 @@ namespace CursorGuardRail.Windows.Forms
|
||||
TextRenderer.DrawText(g, label, font, rect, foreColour, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.NoPadding| TextFormatFlags.EndEllipsis);
|
||||
}
|
||||
|
||||
if (this.Screens.Any(x => x.IsSelected))
|
||||
if (this.ShowArea)
|
||||
{
|
||||
var area = CalcMaxBound(this.Screens.Where(x => x.IsSelected).Select(x => x.Bound).ToList());
|
||||
if (this.Screens.Any(x => x.IsSelected))
|
||||
{
|
||||
var area = CalcMaxBound(this.Screens.Where(x => x.IsSelected).Select(x => x.Bound).ToList());
|
||||
|
||||
g.DrawRectangle(selectedAreaBorderColour, area);
|
||||
g.DrawRectangle(selectedAreaBorderColour, area);
|
||||
}
|
||||
}
|
||||
|
||||
g.Flush();
|
||||
@ -146,11 +150,22 @@ namespace CursorGuardRail.Windows.Forms
|
||||
private set
|
||||
{
|
||||
field = value;
|
||||
|
||||
//this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Always), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool ShowArea
|
||||
{
|
||||
get => field;
|
||||
set
|
||||
{
|
||||
field = value;
|
||||
|
||||
this.Invalidate();
|
||||
}
|
||||
} = false;
|
||||
|
||||
|
||||
private decimal ScaleRatio
|
||||
{
|
||||
get
|
||||
|
||||
Loading…
Reference in New Issue
Block a user