From 68157372d61f489df58cc5b845628c935aa22231 Mon Sep 17 00:00:00 2001 From: shikhin Date: Thu, 23 Mar 2023 08:34:27 +0530 Subject: [PATCH] Reduce flickering while resizing windows --- shell.asm | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/shell.asm b/shell.asm index dee0323..6f1cb48 100644 --- a/shell.asm +++ b/shell.asm @@ -263,35 +263,49 @@ mouse: ; si = pointer to window structure resize: push dx + push bp + + xor bp, bp ; Change? mov dx, [si + window.res_y] sub dx, bx - jc .x + jc .end_y cmp dx, WINDOW_MIN_HEIGHT - jl .x + jl .end_y cmp dx, ROWS - jg .x + jg .end_y + cmp [si + window.y], bx + je .end_y + inc bp mov [si + window.y], bx mov [si + window.height], dx - .x: + .end_y: mov dx, [si + window.res_x] sub dx, cx - jc .done + jc .end_x cmp dx, WINDOW_MIN_WIDTH - jl .done + jl .end_x cmp dx, COLUMNS - jg .done + jg .end_x + cmp [si + window.x], cx + je .end_x + inc bp mov [si + window.x], cx mov [si + window.width], dx - .done: - pop dx + .end_x: + test bp, bp + jz .end call render_file_window call request_redraw + + .end: + pop bp + pop dx ret ; in: @@ -311,7 +325,7 @@ move: jne .change jmp .end - .change + .change: mov [si + window.y], bx mov [si + window.x], dx