From 7f0dee4df015fdbbd57ac1afcd15008b16859067 Mon Sep 17 00:00:00 2001 From: user726687 <98432183+user726687@users.noreply.github.com> Date: Sat, 22 Oct 2022 01:50:38 +0800 Subject: [PATCH] v1.1 (#3) * Update TPMouse.au3 * Update TPMouse.au3 * Update README.md * Update README.md * Update README.md * Update TPMouse.au3 * Update README.md --- README.md | 13 ++++++++----- TPMouse.au3 | 29 ++++++++++++++--------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index aedcee5..29ecfb3 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ Inspired by [rvaiya/warpd](https://github.com/rvaiya/warpd). ## Inertia Mode ![image](https://user-images.githubusercontent.com/98432183/196675010-b380b898-6e97-4aa9-baf4-c35e0fb185fe.png) -1. Press `Alt` `Shift` `C` to activate inertia mode. You'll see your main cursor switched to a crosshair. -2. Use `I`/`J`/`K`/`L` to move the cursor, hold `Shift` to apply brakes for slower/more precise movement, release `Shift` to reset velocity. Hold `CapsLk` to scroll vertically/horizontally. +1. Press `LShift` `RShift` `C` to activate inertia mode. You'll see your main cursor switched to a crosshair. +2. Use `I`/`J`/`K`/`L` to move the cursor. Hold `Shift` to brake for more precise movement, hold `CapsLk` to scroll vertically/horizontally. 3. Press `F`/`E`/`R` to left/right/middle click at the cursor position. 4. Press `Esc` to quit mode. @@ -15,7 +15,7 @@ Inspired by [rvaiya/warpd](https://github.com/rvaiya/warpd). ## Grid Mode ![image](https://user-images.githubusercontent.com/98432183/196675614-28eff1a1-c074-48a5-9ebe-ae8bf969e853.png) -1. Press `Alt` `Shift` `G` to activate overlay. You'll see your main cursor switched to a crosshair, and a thin grey border surrounding your screen. +1. Press `LShift` `RShift` `G` to activate overlay. You'll see your main cursor switched to a crosshair, and a thin grey border surrounding your screen. 2. Press `I`/`J`/`K`/`L` to bisect the warp region and move your cursor to its center. 3. Press `F`/`E`/`R` to left/right/middle click at the cursor position. 4. Press `Esc` to quit mode. @@ -25,9 +25,12 @@ Inspired by [rvaiya/warpd](https://github.com/rvaiya/warpd). ### Inertia Mode -https://user-images.githubusercontent.com/98432183/196684128-eadbc7df-fec6-48e6-a283-36c4c8c0cde8.mp4 +https://user-images.githubusercontent.com/98432183/197256799-fe5e3e8d-9a2e-4c41-bd52-31b4a287499c.mp4 + + ### Grid Mode -https://user-images.githubusercontent.com/98432183/196685474-30aa53ad-60a1-45b8-8d82-21a3b0aa0819.mp4 + +https://user-images.githubusercontent.com/98432183/197257714-67d517bf-c344-434c-a5cb-0c25db4bb2d4.mp4 diff --git a/TPMouse.au3 b/TPMouse.au3 index 7ae8eb6..7d238d7 100644 --- a/TPMouse.au3 +++ b/TPMouse.au3 @@ -3,7 +3,7 @@ _Singleton('TPMouse',0) Opt('GUICloseOnESC',False) Opt('TrayMenuMode',3) Opt('TrayOnEventMode',1) -TrayItemSetOnEvent(TrayCreateItem('Exit'),Quit) +TrayItemSetOnEvent(TrayCreateItem('Quit TPMouse'),Quit) TraySetIcon('%windir%\Cursors\aero_link_xl.cur') TraySetToolTip('TPMouse - Inactive') Global $user32 = DllOpen('user32.dll') @@ -69,7 +69,7 @@ Func ProcessKeypress($struct) If SingletonInertia() Then SingletonInertia('deactivate') SingletonOverlay('activate') DllCall($user32, "bool", "SetSystemCursor", "handle", CopyIcon($hCursors[2]), "dword", 32512) - TraySetIcon("%windir%\Cursors\aero_move_xl.cur") + TraySetIcon("%windir%\Cursors\aero_pin_xl.cur") TraySetToolTip('TPMouse - Grid') EndIf EndIf @@ -79,7 +79,7 @@ Func ProcessKeypress($struct) If SingletonOverlay() Then SingletonOverlay('deactivate') SingletonInertia('activate') DllCall($user32, "bool", "SetSystemCursor", "handle", CopyIcon($hCursors[1]), "dword", 32512) - TraySetIcon("%windir%\Cursors\aero_pen_xl.cur") + TraySetIcon("%windir%\Cursors\aero_person_xl.cur") TraySetToolTip('TPMouse - Inertia') EndIf EndIf @@ -98,10 +98,9 @@ Func ProcessKeypress($struct) Case 0x52 ; R SingletonMoupress('mb3',Not BitAnd(0x0001,$struct.Flags)) Case 0x10 ; shift - If BitAnd(0x0001,$struct.Flags) Then SingletonInertia('clip',15) + If BitAnd(1,$struct.Flags) Then SingletonInertia('clip',15) Case 0x14 ; caps SingletonInertia('lock',Not BitAnd(0x0001,$struct.Flags)) - If $struct.MakeCode = 0x36 Then SingletonInertia('lock',Not BitAnd(0x0001,$struct.Flags)) EndSwitch EndFunc @@ -295,13 +294,13 @@ Func SingletonKeyState($vKey=Null, $make=Null, $flag=Null) Local $after = Not BitAnd(1,$flag) Switch $vKey Case 0x10 ; shift - If $change Then $self[($make=0x36?0xA1:0xA0)]=$after ; (vkey,e0,mk) of lshift is (0xA0,0x00,0x2A), of rshift is (0xA1,0x00,0x36) + If $change Then $self[($make=0x36?0xA1:0xA0)]=$after ; (vkey,e0,mk) of lshift is (0xA0,0x00,0x2A), of rshift is (0xA1,0x00,0x36) Return ( $self[0xA0] or $self[0xA1] ) Case 0x11 ; ctrl - If $change Then $self[(BitAnd(2,$flag)?0xA3:0xA2)]=$after ; (vkey,e0,mk) of lctrl is (0xA2,0x00,0x1D), of rctrl is (0xA3,0xE0,0x1D) + If $change Then $self[(BitAnd(2,$flag)?0xA3:0xA2)]=$after ; (vkey,e0,mk) of lctrl is (0xA2,0x00,0x1D), of rctrl is (0xA3,0xE0,0x1D) Return ( $self[0xA2] or $self[0xA3] ) Case 0x12 ; alt - If $change Then $self[(BitAnd(2,$flag)?0xA5:0xA4)]=$after ; (vkey,e0,mk) of lalt is (0xA4,0x00,0x38), of ralt is (0xA5,0xE0,0x38) + If $change Then $self[(BitAnd(2,$flag)?0xA5:0xA4)]=$after ; (vkey,e0,mk) of lalt is (0xA4,0x00,0x38), of ralt is (0xA5,0xE0,0x38) Return ( $self[0xA4] or $self[0xA5] ) Case Else If $vKey Then @@ -509,37 +508,37 @@ Func DisableHotKeys() HotKeySet('+r') EndFunc func i() - Local $struct = DllStructCreate('ushort Flags;ushort VKey') + Local $struct = DllStructCreate('ushort MakeCode;ushort Flags;ushort VKey;') $struct.Vkey = 0x49 ProcessKeypress($struct) endfunc func j() - Local $struct = DllStructCreate('ushort Flags;ushort VKey') + Local $struct = DllStructCreate('ushort MakeCode;ushort Flags;ushort VKey;') $struct.Vkey = 0x4A ProcessKeypress($struct) endfunc func k() - Local $struct = DllStructCreate('ushort Flags;ushort VKey') + Local $struct = DllStructCreate('ushort MakeCode;ushort Flags;ushort VKey;') $struct.Vkey = 0x4B ProcessKeypress($struct) endfunc func l() - Local $struct = DllStructCreate('ushort Flags;ushort VKey') + Local $struct = DllStructCreate('ushort MakeCode;ushort Flags;ushort VKey;') $struct.Vkey = 0x4C ProcessKeypress($struct) endfunc func f() - Local $struct = DllStructCreate('ushort Flags;ushort VKey') + Local $struct = DllStructCreate('ushort MakeCode;ushort Flags;ushort VKey;') $struct.Vkey = 0x46 ProcessKeypress($struct) endfunc func e() - Local $struct = DllStructCreate('ushort Flags;ushort VKey') + Local $struct = DllStructCreate('ushort MakeCode;ushort Flags;ushort VKey;') $struct.Vkey = 0x45 ProcessKeypress($struct) endfunc func r() - Local $struct = DllStructCreate('ushort Flags;ushort VKey') + Local $struct = DllStructCreate('ushort MakeCode;ushort Flags;ushort VKey;') $struct.Vkey = 0x52 ProcessKeypress($struct) endfunc