Subversion Repositories Kolibri OS

Rev

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

Rev 5851 Rev 5853
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 5851 $
8
$Revision: 5853 $
9
 
9
 
10
 
10
 
Line 33... Line 33...
33
endg
33
endg
Line 34... Line 34...
34
 
34
 
35
iglobal
35
iglobal
36
;--------------------------------------
36
;--------------------------------------
37
align 4
-
 
38
mouse_delay             dd 10
37
align 4
39
mouse_speed_factor:
38
mouse_speed_factor      dw 1
40
                        dd 3
-
 
41
mouse_timer_ticks       dd 0
39
mouse_delay             db 1
42
mouse_doubleclick_delay db 64
40
mouse_doubleclick_delay db 64
Line 43... Line 41...
43
endg
41
endg
Line 489... Line 487...
489
        mov     [BTN_DOWN], eax
487
        mov     [BTN_DOWN], eax
490
;--------------------------------------
488
;--------------------------------------
491
        mov     eax, [XMoving]
489
        mov     eax, [XMoving]
492
        test    [BtnState], 0x80000000
490
        test    [BtnState], 0x80000000
493
        jnz     .absolute_x
491
        jnz     .absolute_x
-
 
492
        test    eax, eax
-
 
493
        jz      @f
494
        call    mouse_acceleration
494
        call    mouse_acceleration
495
        add     ax, [MOUSE_X]
495
        add     ax, [MOUSE_X]
496
        cmp     ax, 0
-
 
497
        jge     .check_x
496
        jns     .check_x
498
        mov     eax, 0
497
        xor     eax, eax
499
        jmp     .set_x
498
        jmp     .set_x
500
 .absolute_x:
499
 .absolute_x:
501
        mov     edx, [_display.width]
500
        mov     edx, [_display.width]
502
        mul     edx
501
        mul     edx
503
        shr     eax, 15
502
        shr     eax, 15
Line 507... Line 506...
507
        mov     ax, word[_display.width]
506
        mov     ax, word[_display.width]
508
        dec     ax
507
        dec     ax
509
 .set_x:
508
 .set_x:
510
        mov     [MOUSE_X], ax
509
        mov     [MOUSE_X], ax
511
;--------------------------------------
510
;--------------------------------------
-
 
511
@@:
512
        mov     eax, [YMoving]
512
        mov     eax, [YMoving]
513
        test    [BtnState], 0x40000000
513
        test    [BtnState], 0x40000000
514
        jnz     .absolute_y
514
        jnz     .absolute_y
-
 
515
        test    eax, eax
-
 
516
        jz      @f
515
        neg     eax
517
        neg     eax
516
        call    mouse_acceleration
518
        call    mouse_acceleration
517
        add     ax, [MOUSE_Y]
519
        add     ax, [MOUSE_Y]
518
        cmp     ax, 0
-
 
519
        jge     .check_y
520
        jns     .check_y
520
        mov     ax, 0
521
        xor     eax, eax
521
        jmp     .set_y
522
        jmp     .set_y
522
 .absolute_y:
523
 .absolute_y:
523
        mov     edx, [_display.height]
524
        mov     edx, [_display.height]
524
        mul     edx
525
        mul     edx
525
        shr     eax, 15
526
        shr     eax, 15
Line 529... Line 530...
529
        mov     ax, word[_display.height]
530
        mov     ax, word[_display.height]
530
        dec     ax
531
        dec     ax
531
 .set_y:
532
 .set_y:
532
        mov     [MOUSE_Y], ax
533
        mov     [MOUSE_Y], ax
533
;--------------------------------------
534
;--------------------------------------
-
 
535
@@:
534
        mov     eax, [VScroll]
536
        mov     eax, [VScroll]
535
        test    eax, eax
537
        test    eax, eax
536
        jz      @f
538
        jz      @f
537
        add     [MOUSE_SCROLL_V], ax
539
        add     [MOUSE_SCROLL_V], ax
538
        bts     word [BTN_DOWN], 15
540
        bts     word [BTN_DOWN], 15
Line 542... Line 544...
542
        jz      @f
544
        jz      @f
543
        add     [MOUSE_SCROLL_H], ax
545
        add     [MOUSE_SCROLL_H], ax
544
        bts     dword [BTN_DOWN], 23
546
        bts     dword [BTN_DOWN], 23
545
@@:
547
@@:
546
        mov     [mouse_active], 1
548
        mov     [mouse_active], 1
547
        mov     eax, [timer_ticks]
-
 
548
        mov     [mouse_timer_ticks], eax
-
 
549
        call    wakeup_osloop
549
        call    wakeup_osloop
550
        ret
550
        ret
551
endp
551
endp
Line 552... Line 552...
552
 
552
 
Line 553... Line 553...
553
;-----------------------------------------------------------------------------
553
;-----------------------------------------------------------------------------
554
 
554
 
-
 
555
align 4
-
 
556
mouse_acceleration:
-
 
557
        cmp     [mouse_delay], 1
555
align 4
558
        jz      .slight
556
mouse_acceleration:
-
 
557
        push    eax
-
 
558
        mov     eax, [timer_ticks]
-
 
559
        sub     eax, [mouse_timer_ticks]
-
 
560
        cmp     eax, [mouse_delay]
-
 
561
        pop     eax
-
 
562
        ja      @f
-
 
563
        ;push  edx
-
 
564
        imul    eax, [mouse_speed_factor]
559
        jc      .end
-
 
560
        push    eax
-
 
561
@@:
-
 
562
        neg     eax
-
 
563
        jl      @b
-
 
564
        mov     edx, eax
-
 
565
        shr     edx, 1
-
 
566
        jc      @f
-
 
567
        mul     dl
-
 
568
        add     eax, edx
-
 
569
        jmp     .next
-
 
570
@@:
-
 
571
        inc     edx
-
 
572
        mul     dl
-
 
573
.next:
-
 
574
        pop     edx
-
 
575
        test    edx, edx
-
 
576
        jns     .end
-
 
577
        neg     eax
-
 
578
        jmp     .end
-
 
579
;--------------------------------------
-
 
580
.slight:
-
 
581
        shl     eax, 1
-
 
582
        js      @f
-
 
583
        dec     eax
-
 
584
        jmp     .end
-
 
585
@@:
-
 
586
        inc     eax
565
        ;pop   edx
587
.end: