diff --git a/shell.asm b/shell.asm index ccab412..5c42648 100644 --- a/shell.asm +++ b/shell.asm @@ -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