Mods by vhanla:

- Window is grabbed to drag only if you CLICK on its grab area (ie. the title bar) 
- Button is selected only if it is clicked on its area

git-svn-id: svn://kolibrios.org@415 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
heavyiron 2007-03-12 21:54:24 +00:00
parent 2a81124ad8
commit 5efd9e7bcf
4 changed files with 2870 additions and 2792 deletions

View File

@ -458,9 +458,11 @@ checkbuttons:
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed cmp [BTN_DOWN],byte 0 ; mouse buttons pressed
jnz @f jnz @f
;..................................... start 1/5 : modified by vhanla .............................
mov [bPressedMouseXY_B],0
;..................................... end 1/5 : modified by vhanla .............................
ret ret
@@: @@:
pushad pushad
xor esi, esi xor esi, esi
@ -472,6 +474,20 @@ checkbuttons:
ret ret
@@: @@:
;..................................... start 2/5 : modified by vhanla .............................
;here i catch the coordinates when the mouse's button is clicked
push ax
cmp [bPressedMouseXY_B],0;FALSE
jnz @f
mov [bPressedMouseXY_B],1;TRUE - it was already clicked
mov ax,[MOUSE_X]
mov [mx],ax
mov ax,[MOUSE_Y]
mov [my],ax
@@:
pop ax
;and it is only refreshed after the mouse's button release
;..................................... end 2/5 : modified by vhanla .............................
push esi push esi
inc edx inc edx
@ -496,10 +512,6 @@ checkbuttons:
shl eax,4 shl eax,4
add eax,edi add eax,edi
;......................start 1/2 : modified by vhanla .............................
mov [buttonid],eax
;......................end 1/2 : modified by vhanla .............................
; check that button is at top of windowing stack ; check that button is at top of windowing stack
movzx ebx,word [eax] movzx ebx,word [eax]
@ -534,7 +546,9 @@ checkbuttons:
mov ecx, [ebx+WDATA.box.left] ; window x start mov ecx, [ebx+WDATA.box.left] ; window x start
movzx edx,word [eax+4] ; button x start movzx edx,word [eax+4] ; button x start
add edx,ecx add edx,ecx
mov cx,[MOUSE_X] ;..................................... start 3/5 : modified by vhanla .............................
mov cx,[mx] ;mov cx,[MOUSE_X]
;..................................... end 3/5 : modified by vhanla .............................
cmp edx,ecx cmp edx,ecx
jg buttonnewcheck jg buttonnewcheck
@ -550,7 +564,9 @@ checkbuttons:
mov ecx, [ebx+WDATA.box.top] ; window y start mov ecx, [ebx+WDATA.box.top] ; window y start
movzx edx,word [eax+8] ; button y start movzx edx,word [eax+8] ; button y start
add edx,ecx add edx,ecx
mov cx,[MOUSE_Y] ;..................................... start 4/5 : modified by vhanla .............................
mov cx,[my] ;mov cx,[MOUSE_Y]
;..................................... start 4/5 : modified by vhanla .............................
cmp edx,ecx cmp edx,ecx
jg buttonnewcheck jg buttonnewcheck
@ -591,11 +607,13 @@ checkbuttons:
call negativebutton call negativebutton
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background mov [MOUSE_BACKGROUND],byte 0 ; no mouse background
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse
;..................................... start 2/2 : modified by vhanla ............................. ;..................................... start 5/5 : modified by vhanla .............................
; check coordinates ; check coordinates
jmp afterbuttonid jmp @f
buttonid dd 0x0 ;here a will backup the eax value mx dw 0x0 ; keeps the x mouse's position when it was clicked
afterbuttonid: my dw 0x0 ; keeps the y mouse's position when it was clicked
bPressedMouseXY_B db 0x0
@@:
pusha pusha
; mouse x >= button x ? ; mouse x >= button x ?
@ -645,4 +663,4 @@ yes_on_button:
popa popa
ret ret
;..................................... end 2/2 : modified by vhanla ................................ ;..................................... end 5/5 : modified by vhanla ................................

View File

@ -1189,13 +1189,33 @@ checkwindows:
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ? cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ?
jne .mouse_buttons_pressed jne .mouse_buttons_pressed
;..................................... start 1/4 : modified by vhanla .................
mov [bPressedMouseXY_W],0
;..................................... end 1/4 : modified by vhanla ...................
popad popad
ret ret
.mouse_buttons_pressed: .mouse_buttons_pressed:
;..................................... start 2/4 : modified by vhanla .................
jmp @f
bPressedMouseXY_W db 0x0
@@:
;..................................... end 2/4 : modified by vhanla ...................
mov esi,[TASK_COUNT] mov esi,[TASK_COUNT]
inc esi inc esi
;..................................... start 3/4 : modified by vhanla .................
push ax
cmp [bPressedMouseXY_W],0
jnz @f
mov [bPressedMouseXY_W],1
mov ax,[MOUSE_X]
mov [mx],ax
mov ax,[MOUSE_Y]
mov [my],ax
@@:
pop ax
;..................................... end 3/4 : modified by vhanla ...................
cwloop: cwloop:
cmp esi,2 cmp esi,2
jb .exit jb .exit
@ -1213,9 +1233,10 @@ checkwindows:
test [edi+WDATA.fl_wstate],WSTATE_MINIMIZED test [edi+WDATA.fl_wstate],WSTATE_MINIMIZED
jnz cwloop jnz cwloop
movzx eax, word [MOUSE_X] ;..................................... start 4/4 : modified by vhanla .................
movzx ebx, word [MOUSE_Y] movzx eax, word [mx]; movzx eax,word[MOUSE_X]
movzx ebx, word [my]; movzx ebx,word[MOUSE_Y]
;..................................... endt 4/4 : modified by vhanla ..................
cmp ecx, eax cmp ecx, eax
jae cwloop jae cwloop
cmp edx, ebx cmp edx, ebx

View File

@ -458,9 +458,11 @@ checkbuttons:
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed cmp [BTN_DOWN],byte 0 ; mouse buttons pressed
jnz @f jnz @f
;..................................... start 1/5 : modified by vhanla .............................
mov [bPressedMouseXY_B],0
;..................................... end 1/5 : modified by vhanla .............................
ret ret
@@: @@:
pushad pushad
xor esi, esi xor esi, esi
@ -472,6 +474,20 @@ checkbuttons:
ret ret
@@: @@:
;..................................... start 2/5 : modified by vhanla .............................
;here i catch the coordinates when the mouse's button is clicked
push ax
cmp [bPressedMouseXY_B],0;FALSE
jnz @f
mov [bPressedMouseXY_B],1;TRUE - it was already clicked
mov ax,[MOUSE_X]
mov [mx],ax
mov ax,[MOUSE_Y]
mov [my],ax
@@:
pop ax
;and it is only refreshed after the mouse's button release
;..................................... end 2/5 : modified by vhanla .............................
push esi push esi
inc edx inc edx
@ -496,10 +512,6 @@ checkbuttons:
shl eax,4 shl eax,4
add eax,edi add eax,edi
;......................start 1/2 : modified by vhanla .............................
mov [buttonid],eax
;......................end 1/2 : modified by vhanla .............................
; check that button is at top of windowing stack ; check that button is at top of windowing stack
movzx ebx,word [eax] movzx ebx,word [eax]
@ -534,7 +546,9 @@ checkbuttons:
mov ecx, [ebx+WDATA.box.left] ; window x start mov ecx, [ebx+WDATA.box.left] ; window x start
movzx edx,word [eax+4] ; button x start movzx edx,word [eax+4] ; button x start
add edx,ecx add edx,ecx
mov cx,[MOUSE_X] ;..................................... start 3/5 : modified by vhanla .............................
mov cx,[mx] ;mov cx,[MOUSE_X]
;..................................... end 3/5 : modified by vhanla .............................
cmp edx,ecx cmp edx,ecx
jg buttonnewcheck jg buttonnewcheck
@ -550,7 +564,9 @@ checkbuttons:
mov ecx, [ebx+WDATA.box.top] ; window y start mov ecx, [ebx+WDATA.box.top] ; window y start
movzx edx,word [eax+8] ; button y start movzx edx,word [eax+8] ; button y start
add edx,ecx add edx,ecx
mov cx,[MOUSE_Y] ;..................................... start 4/5 : modified by vhanla .............................
mov cx,[my] ;mov cx,[MOUSE_Y]
;..................................... start 4/5 : modified by vhanla .............................
cmp edx,ecx cmp edx,ecx
jg buttonnewcheck jg buttonnewcheck
@ -591,11 +607,13 @@ checkbuttons:
call negativebutton call negativebutton
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background mov [MOUSE_BACKGROUND],byte 0 ; no mouse background
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse
;..................................... start 2/2 : modified by vhanla ............................. ;..................................... start 5/5 : modified by vhanla .............................
; check coordinates ; check coordinates
jmp afterbuttonid jmp @f
buttonid dd 0x0 ;here a will backup the eax value mx dw 0x0 ; keeps the x mouse's position when it was clicked
afterbuttonid: my dw 0x0 ; keeps the y mouse's position when it was clicked
bPressedMouseXY_B db 0x0
@@:
pusha pusha
; mouse x >= button x ? ; mouse x >= button x ?
@ -645,4 +663,4 @@ yes_on_button:
popa popa
ret ret
;..................................... end 2/2 : modified by vhanla ................................ ;..................................... end 5/5 : modified by vhanla ................................

View File

@ -1189,13 +1189,33 @@ checkwindows:
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ? cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ?
jne .mouse_buttons_pressed jne .mouse_buttons_pressed
;..................................... start 1/4 : modified by vhanla .................
mov [bPressedMouseXY_W],0
;..................................... end 1/4 : modified by vhanla ...................
popad popad
ret ret
.mouse_buttons_pressed: .mouse_buttons_pressed:
;..................................... start 2/4 : modified by vhanla .................
jmp @f
bPressedMouseXY_W db 0x0
@@:
;..................................... end 2/4 : modified by vhanla ...................
mov esi,[TASK_COUNT] mov esi,[TASK_COUNT]
inc esi inc esi
;..................................... start 3/4 : modified by vhanla .................
push ax
cmp [bPressedMouseXY_W],0
jnz @f
mov [bPressedMouseXY_W],1
mov ax,[MOUSE_X]
mov [mx],ax
mov ax,[MOUSE_Y]
mov [my],ax
@@:
pop ax
;..................................... end 3/4 : modified by vhanla ...................
cwloop: cwloop:
cmp esi,2 cmp esi,2
jb .exit jb .exit
@ -1213,9 +1233,10 @@ checkwindows:
test [edi+WDATA.fl_wstate],WSTATE_MINIMIZED test [edi+WDATA.fl_wstate],WSTATE_MINIMIZED
jnz cwloop jnz cwloop
movzx eax, word [MOUSE_X] ;..................................... start 4/4 : modified by vhanla .................
movzx ebx, word [MOUSE_Y] movzx eax, word [mx]; movzx eax,word[MOUSE_X]
movzx ebx, word [my]; movzx ebx,word[MOUSE_Y]
;..................................... endt 4/4 : modified by vhanla ..................
cmp ecx, eax cmp ecx, eax
jae cwloop jae cwloop
cmp edx, ebx cmp edx, ebx