kernel: Fix clicking menu item when different window is directly under

This commit is contained in:
Ry 2022-12-25 14:51:36 -08:00
parent fddfd78829
commit 455a909255
2 changed files with 16 additions and 2 deletions

View File

@ -35,6 +35,8 @@ event_manager_task_loop:
ifz call add_event_to_active_window
cmp r0, EVENT_TYPE_MENU_CLICK
ifz call add_event_to_active_window
cmp r0, EVENT_TYPE_MENU_ACK
ifz call add_event_to_active_window
cmp r0, EVENT_TYPE_MENU_UPDATE
ifz call add_event_to_active_window
@ -58,6 +60,18 @@ event_manager_task_mouse_event:
push r1
push r2
; if a menu is open, don't continue
; this is hacky as fuck
push r0
in r0, 0x8000031D ; overlay 29: enable status
cmp r0, 0
ifnz pop r0
ifnz pop r2
ifnz pop r1
ifnz pop r0
ifnz ret
pop r0
; find which overlay was clicked on
mov r0, r1
mov r1, r2

View File

@ -2,7 +2,7 @@
; given a position on screen, find which enabled overlay (if any) is covering it
; if multiple overlays are covering the same position, the highest priority one will be returned
; overlay 31 (the mouse cursor) is ignored
; overlays 31, 30, and 29 (mouse cursor, menu bar, menu) are ignored
; inputs:
; r0: X coordinate
; r1: Y coordinate
@ -12,7 +12,7 @@ find_overlay_convering_position:
push r2
push r31
mov r31, 31
mov r31, 29
find_overlay_convering_position_loop:
mov r2, r31
dec r2