Merge pull request #26 from mebibytedraco/new_window-no-active-window-fix

Handle case where there is no active window
main
Ry 2023-07-24 20:56:16 -07:00 committed by GitHub
commit 5a67c5bd8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -150,6 +150,11 @@ new_window:
call get_window_overlay_number ; get the overlay number of the new window
mov r10, r0
mov.8 r0, [active_window_offset] ; get the active window's overlay number
cmp r0, 0xFF ; is there no active window?
ifnz jmp new_window_active_window
pop r0
jmp new_window_skip_swap
new_window_active_window:
mul r0, 4
add r0, window_list
mov r1, [r0]
@ -159,6 +164,7 @@ new_window:
pop r0
cmp r11, r10 ; if the active window is on a higher overlay, swap
ifnc call swap_windows
new_window_skip_swap:
; finally, add this window to the window list
push r0