code wiki / (root) / nx_nishios_events.nx

nx_nishios_events.nx

buildroot/runtime/nx_nishios_events.nx

7254 B112 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic nishios
docsdependenciesstructsconstsfunctions

about

nx_nishios_events.nx -- NishiOS GUI rung-3: an INPUT EVENT LOOP (interactivity). A desktop you can't touch isn't an OS GUI. This adds the real loop: data-driven windows (a window table), a click handler that RAISES the window under the cursor (focus -> z-order changes from the event), and cursor tracking. It renders frame 0 (win "files" on top), processes a CLICK on the lower "terminal" window, then renders frame 1 -- where that window is now raised to the front. The z-order change between the two frames IS the proof the event loop works. The event SOURCE is scripted here (the emu has no live PS/2 mouse; that driver is the wiring rung), but the event-handling LOGIC -- hit-testing, focus-raise, cursor move, re-render -- is real. KAT: frame0 overlap shows the top window; after the click, frame1 overlap shows the RAISED window; the cursor moved to the click point; both frames exported as real BMPs. HONEST SCOPE: scripted events + 2 windows. Live PS/2 input, drag, a full ASCII font, and wiring into the boot kernel's framebuffer are the next rungs. No hw writes (Rule 26). expect_exit: 0 license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_fb.nx nx_nishios_events.nx

imports: nx_fb.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main ev_puts fb_nishi_font fb_gly render_frame fb_rect fb_setpx draw_all fb_window fb_rect ↻ fb_text fb_char fb_rect ↻ fb_cursor sys_mmap fb_setpx ↻ fb_bmp_save sys_mmap ↻ fb_p32 fb_p16 sys_openat_wr sys_write sys_close raise_win sys_openat_wr ↻ ev_num

structs

none

consts

15const K_MAGIC_192054: i64 = 192054

functions

17func ev_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main
18func ev_num(v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 }
called by 1: main
22func draw_all(fb: *u8, W: i64, H: i64, font: *u8, idx: *u8, win: *i64, n: i64) -> i64
called by 1: render_frame calls 1: fb_window
44func raise_win(win: *i64, n: i64, px: i64, py: i64) -> i64
called by 1: main
60func render_frame(fb: *u8, W: i64, H: i64, font: *u8, idx: *u8, win: *i64, n: i64, cx: i64, cy: i64, path: *u8) -> i64
69func main() -> i64