Subversion Repositories Kolibri OS

Rev

Rev 473 | Rev 593 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 473 Rev 479
Line 1... Line 1...
1
$Revision: 473 $
1
$Revision: 479 $
2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3
;;                                                              ;;
3
;;                                                              ;;
4
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
4
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
5
;; Distributed under terms of the GNU General Public License    ;;
5
;; Distributed under terms of the GNU General Public License    ;;
6
;;                                                              ;;
6
;;                                                              ;;
Line 24... Line 24...
24
  mousedata   dd  0x0
24
  mousedata   dd  0x0
25
endg
25
endg
Line 26... Line 26...
26
 
26
 
27
iglobal
27
iglobal
28
mouse_delay     dd  10
28
mouse_delay        dd 10
-
 
29
mouse_speed_factor: dd 3
29
mouse_speed_factor dw 3
30
mouse_timer_ticks  dd 0
Line 30... Line -...
30
endg
-
 
31
 
31
endg
Line 32... Line 32...
32
include 'm_ps2.inc'
32
 
33
include 'm_com.inc'
33
include 'm_com.inc'
Line 386... Line 386...
386
        popfd
386
        popfd
387
nodmp:
387
nodmp:
388
        popad
388
        popad
389
        ret
389
        ret
Line -... Line 390...
-
 
390
 
-
 
391
proc set_mouse_data stdcall, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword
-
 
392
    
-
 
393
    mov  eax,[BtnState]
-
 
394
    mov  [BTN_DOWN],eax
-
 
395
 
-
 
396
    mov  eax,[XMoving]
-
 
397
    call mouse_acceleration
-
 
398
    add  ax,[MOUSE_X]    ;[XCoordinate]
-
 
399
    cmp  ax,0
-
 
400
    jge  @@M1
-
 
401
    mov  eax,0
-
 
402
    jmp  @@M2
-
 
403
@@M1:
-
 
404
    cmp  ax,[ScreenWidth]   ;ScreenLength
-
 
405
    jl   @@M2
-
 
406
    mov  ax,[ScreenWidth]   ;ScreenLength-1
-
 
407
 
-
 
408
@@M2:
-
 
409
    mov  [MOUSE_X],ax     ;[XCoordinate]
-
 
410
 
-
 
411
    mov  eax,[YMoving]
-
 
412
    neg  eax
-
 
413
    call mouse_acceleration
-
 
414
 
-
 
415
    add  ax,[MOUSE_Y]   ;[YCoordinate]
-
 
416
    cmp  ax,0
-
 
417
    jge  @@M3
-
 
418
    mov  ax,0
-
 
419
    jmp  @@M4
-
 
420
@@M3:
-
 
421
    cmp  ax,[ScreenHeight]  ;ScreenHeigth
-
 
422
    jl   @@M4
-
 
423
    mov  ax,[ScreenHeight] ;ScreenHeigth-1
-
 
424
 
-
 
425
@@M4:
-
 
426
    mov  [MOUSE_Y],ax     ;[YCoordinate]
-
 
427
 
-
 
428
    mov  eax,[VScroll]
-
 
429
    add  [MOUSE_SCROLL_V],ax
-
 
430
    
-
 
431
    mov  eax,[HScroll]
-
 
432
    add  [MOUSE_SCROLL_H],ax
-
 
433
 
-
 
434
    mov  [mouse_active],1
-
 
435
    mov  eax,[timer_ticks]
-
 
436
    mov  [mouse_timer_ticks],eax
-
 
437
    ret
-
 
438
endp
-
 
439
 
-
 
440
mouse_acceleration:
-
 
441
        push  eax
-
 
442
        mov   eax,[timer_ticks]
-
 
443
        sub   eax,[mouse_timer_ticks]
-
 
444
        cmp   eax,[mouse_delay]
-
 
445
        pop   eax
-
 
446
        ja    @f
-
 
447
        ;push  edx
-
 
448
        imul  eax,[mouse_speed_factor]
-
 
449
        ;pop   edx
-
 
450
@@:
-
 
451
        ret