Skip to content

Commit

Permalink
don't cancel until first scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
user726687 authored Sep 12, 2024
1 parent 8b26b17 commit 9ac9220
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions LibreScroll.au3
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ Func Child($args)
Global $g_scrollVel = [0,0]
Global $g_scrollAccu = [0,0]
Global $g_trigger_isDown = False
Global $g_cancel_pending = False
Local $_ = DllStructCreate('ushort page;ushort usage;dword flags;hwnd target')
Local $size = DllStructGetSize($_)
$_.page = 1
Expand Down Expand Up @@ -180,18 +181,19 @@ Func WM_INPUT($h,$m,$w,$l)
If $raw.ButtonFlags Then
If BitAnd(32,$raw.ButtonFlags) Then
$g_trigger_isDown = False
$g_cancel_pending = False
If Not $g_flickMode Then
$g_scrollVel[0] = 0
$g_scrollVel[1] = 0
EndIf
DllCall($user32dll,'bool','ClipCursor','struct*',Null)
ElseIf BitAnd(16,$raw.ButtonFlags) Then
SendCancel()
$g_scrollAccu[0] = 0
$g_scrollAccu[1] = 0
$g_scrollVel[0] = 0
$g_scrollVel[1] = 0
$g_trigger_isDown = True
$g_cancel_pending = True
DllCall($user32dll,'bool','GetCursorPos','struct*',$rect)
$rect.x2 = $rect.x1 + 1
$rect.y2 = $rect.y1 + 1
Expand Down Expand Up @@ -280,7 +282,13 @@ Func SendScroll($deltaX,$deltaY)
$sendY = $multipleY*$g_threshold_y
$residue[1] -= $sendY
EndIf
If $sendX<>0 or $sendY<>0 Then ScrollMouseXY($sendX,$sendY)
If $sendX<>0 or $sendY<>0 Then
If $g_cancel_pending Then
$g_cancel_pending = False
SendCancel()
EndIf
ScrollMouseXY($sendX,$sendY)
EndIf
EndFunc

Func ScrollMouseXY($dx,$dy)
Expand Down

0 comments on commit 9ac9220

Please sign in to comment.