Fix mouse comparisons for shell

This commit is contained in:
shikhin 2023-03-27 14:35:41 +05:30
parent f726a128ed
commit 86050094eb
1 changed files with 14 additions and 12 deletions

View File

@ -228,23 +228,25 @@ mouse:
cmp byte [si + window.status], WINDOW_MOVE
jne .not_move
call move
call move
.not_move:
cmp byte [si + window.status], WINDOW_RESIZE
jne .not_resize
call resize
call resize
.not_resize:
sub cx, [si + window.x]
jc .outside
cmp [si + window.width], cx
jle .outside
add cx, [si + window.x]
sub bx, [si + window.y]
jc .outside
cmp [si + window.height], bx
jle .outside
add bx, [si + window.y]
cmp cx, [si + window.x]
jl .outside ; x < window_x
cmp bx, [si + window.y]
jl .outside ; y < window_y
mov bp, [si + window.x]
add bp, [si + window.width]
cmp bp, cx
jle .outside ; window_x + window_width <= x
mov bp, [si + window.y]
add bp, [si + window.height]
cmp bp, bx
jle .outside ; window_y + window_height <= y
cmp byte [si + window.mouse_released_inside], 0
je .not_clicking