From cbc088cc14c202631d552fb715662aafd3647b38 Mon Sep 17 00:00:00 2001 From: Elias youssef Date: Fri, 6 Aug 2021 11:59:27 +0200 Subject: [PATCH] Changed lock checking to more accurate way. --- .../LockCursorInMonitor-Setup.vdproj | 10 +++++----- LockCursorInMonitor/LockCursorInMonitor.csproj | 6 +++--- LockCursorInMonitor/MainWindow.xaml.cs | 8 +++++--- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/LockCursorInMonitor-Setup/LockCursorInMonitor-Setup.vdproj b/LockCursorInMonitor-Setup/LockCursorInMonitor-Setup.vdproj index 9ad147d..2ef495f 100644 --- a/LockCursorInMonitor-Setup/LockCursorInMonitor-Setup.vdproj +++ b/LockCursorInMonitor-Setup/LockCursorInMonitor-Setup.vdproj @@ -150,7 +150,7 @@ { "{3C67513D-01DD-4637-8A68-80971EB9504F}:_4B7F930C463547A49921AAFD90BD61F3" { - "DefaultLocation" = "8:[ProgramFilesFolder][Manufacturer]\\[ProductName]" + "DefaultLocation" = "8:[ProgramFilesFolder]\\[ProductName]" "Name" = "8:#1925" "AlwaysCreate" = "11:FALSE" "Condition" = "8:" @@ -198,15 +198,15 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:LockCursorInMonitor" - "ProductCode" = "8:{2343CEDB-1AD3-46C1-9143-D0F40F1F9B89}" - "PackageCode" = "8:{154C40A3-DE73-4B6E-8270-B5B92CE649EA}" + "ProductCode" = "8:{6D8A2970-F8BB-424E-A02B-2A0A8B768394}" + "PackageCode" = "8:{2D57C566-6473-41BA-9938-1EA4E8D934BF}" "UpgradeCode" = "8:{E256B94A-F1CF-45D4-82B2-08AB1F2D4A97}" "AspNetVersion" = "8:2.0.50727.0" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:TRUE" "DetectNewerInstalledVersion" = "11:TRUE" "InstallAllUsers" = "11:FALSE" - "ProductVersion" = "8:1.2.0" + "ProductVersion" = "8:1.3.1" "Manufacturer" = "8:Elias Youssef" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:https://github.com/Eliasyoussef47" @@ -734,7 +734,7 @@ { "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_E5EA2BE7C9E3414C9855C96432181527" { - "SourcePath" = "8:..\\LockCursorInMonitor\\obj\\Debug\\netcoreapp3.1\\apphost.exe" + "SourcePath" = "8:..\\LockCursorInMonitor\\obj\\Release\\netcoreapp3.1\\apphost.exe" "TargetName" = "8:" "Tag" = "8:" "Folder" = "8:_4B7F930C463547A49921AAFD90BD61F3" diff --git a/LockCursorInMonitor/LockCursorInMonitor.csproj b/LockCursorInMonitor/LockCursorInMonitor.csproj index 38073c4..bd4a7d8 100644 --- a/LockCursorInMonitor/LockCursorInMonitor.csproj +++ b/LockCursorInMonitor/LockCursorInMonitor.csproj @@ -13,9 +13,9 @@ Lock Cursor In Monitor Lock Cursor In Monitor allows you to confine the cursor to the current screen when needed. LockCursorInMonitor-icon.png - 1.3.0.0 - 1.3.0.0 - 1.3.0 + 1.3.1.0 + 1.3.1.0 + 1.3.1 diff --git a/LockCursorInMonitor/MainWindow.xaml.cs b/LockCursorInMonitor/MainWindow.xaml.cs index 2e51941..8b23250 100644 --- a/LockCursorInMonitor/MainWindow.xaml.cs +++ b/LockCursorInMonitor/MainWindow.xaml.cs @@ -98,7 +98,7 @@ private void GlobalHookFocusChanged(object sender, MouseEventExtArgs e) CursorLock.LockCursor(); } // Ctrl not pressed. - else if (CursorLock.Locked && ctrlKeyState <= 0) + else if (CursorLock.Locked && ctrlKeyState >= 0) { CursorLock.UnlockCursor(); } @@ -107,11 +107,13 @@ private void GlobalHookFocusChanged(object sender, MouseEventExtArgs e) private void GlobalHookFocusChanged(object sender, Forms.MouseEventArgs e) { int ctrlKeyState = Native.GetKeyState(VirtualKeyStates.VK_CONTROL); - if (!CursorLock.Locked && ctrlKeyState < 0) + // Ctrl is pressed. + if (ctrlKeyState < 0) { CursorLock.LockCursor(); } - else if (CursorLock.Locked && ctrlKeyState <= 0) + // Ctrl not pressed. + else if (ctrlKeyState >= 0) { CursorLock.UnlockCursor(); }