Precise mouse settings

git-svn-id: svn://kolibrios.org@6230 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
pathoswithin 2016-02-15 00:31:38 +00:00
parent 3dfbd4d145
commit 01933bf0b2

View File

@ -35,8 +35,8 @@ endg
iglobal iglobal
;-------------------------------------- ;--------------------------------------
align 4 align 4
mouse_speed_factor dw 1 mouse_speed_factor dw 4
mouse_delay db 1 mouse_delay db 3
mouse_doubleclick_delay db 64 mouse_doubleclick_delay db 64
endg endg
@ -480,7 +480,7 @@ redrawmouse:
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
align 4 align 4
proc set_mouse_data stdcall uses edx, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword proc set_mouse_data stdcall uses ecx edx, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword
mov eax, [BtnState] mov eax, [BtnState]
and eax, 0x3FFFFFFF ; Top 2 bits are used to flag absolute movements and eax, 0x3FFFFFFF ; Top 2 bits are used to flag absolute movements
@ -551,35 +551,17 @@ proc set_mouse_data stdcall uses edx, BtnState:dword, XMoving:dword, YMoving:dwo
endp endp
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; 3 = (x+1)^2 /4
; 2 = (x+2)^2 /8
; 1 = (x+3)^2 /16
align 4
mouse_acceleration: mouse_acceleration:
cmp [mouse_delay], 0 neg ax
jz .end jl mouse_acceleration
push eax add al, [mouse_delay]
@@:
neg eax
jl @b
inc eax
cmp [mouse_delay], 3
adc eax, 0
cmp [mouse_delay], 2
adc eax, 0
mul al mul al
shr eax, 2 mov cx, [mouse_speed_factor]
cmp [mouse_delay], 2 dec ax
jz .2 shr ax, cl
jnc .3 inc ax
shr eax, 1 test eax, eax
.2: jns @f
shr eax, 1 neg ax
.3: @@:
pop edx
test edx, edx
jns .end
neg eax
.end:
imul [mouse_speed_factor]
ret ret