Commit Graph
250 Commits
Author SHA1 Message Date
waozi 4d806387d9 Support sticky UI windows on X11 2026-08-19 20:43:22 -03:00
waozi 2ddeeecbdd Allow apps to provide system theme palettes 2026-08-19 20:13:31 -03:00
waozi 2d641c1137 Draw menu bars as frame overlays 2026-08-19 17:41:19 -03:00
waozi 4b6d9da887 Add reusable app runtime helpers 2026-08-19 17:19:08 -03:00
waozi 594941f421 Add reusable terminal pane widget 2026-08-19 16:19:04 -03:00
waozi e0c588cd23 Add Linux desktop integration helpers 2026-08-19 15:47:56 -03:00
waozi aed0aff31b ui_window: expose StealUICoreWindowClose for direct close polling
The bridged SDL_QUIT still has to survive the app's event loop; apps
that prefer determinism (or whose backend never latches pushed quit
events) can instead poll the recorded close request next to their tray
actions and run their own close flow.
2026-08-19 14:57:49 -03:00
waozi 06a32a6ee6 ui_window: bridge core-window close and drag on the SDL path
SDL2 delivers the main window's close request (X button, Alt+F4, WM
delete) as SDL_WINDOWEVENT_CLOSE; the raylib SDL backend only latches
SDL_QUIT, so the close button did nothing. The event watch records
close requests for windows that are not ours, and PumpUIWindows -
called by SetUIFrame once per frame, where calling into SDL is safe -
pushes the bridged SDL_QUIT.

Borderless secondary windows had no drag support on the SDL path at
all (IsUIWindowDragged was a stub): the watch now records press,
relative motion and release, and PumpUIWindows applies the window
move, mirroring the Xlib path. GetUIWindowPosition also stops
reporting a constant 0,0.
2026-08-19 14:51:35 -03:00
waozi 4ad9d1cbdb kry_update: arch-aware AppImage appcast key
AppImages are per-arch, so the download key is now appimage-amd64 /
appimage-arm64 (windows stays bare — the zip bundles every arch exe).
Publishers with a single arch can keep one artifact; multi-arch
publishers list one channel per arch and each machine resolves its
own. Tests and the Go binding updated; nothing has shipped under the
old key yet.
2026-08-19 14:15:24 -03:00
waozi dd5f9fc356 kry_std: kry_update_flow — the embeddable self-update lifecycle 2026-08-19 14:01:25 -03:00
waozi af46dc6109 kry_std: self-update primitives — download, verify, apply
kry_http grows a streaming file sink (kry_http_download) with byte and
fraction progress, sized for artifacts instead of in-memory bodies.
kry_sha256 adds dependency-free FIPS 180-4 hashing (streaming + file +
hex compare). kry_update ties them together: appcast-channel downloads
staged under XDG_DATA_HOME/LOCALAPPDATA with sha256 verification (bad
files are removed), AppImage staging that copies next to the running
image and atomically renames over it (plus re-exec in apply), and a
Windows portable swap script spawned detached from %TEMP%. Tests cover
hash vectors, verified/failed downloads via file://, and AppImage
staging; the exec'ing apply path stays untested by design.
2026-08-19 13:37:20 -03:00
waozi 845f43931e kry_std: add kry_update desktop update-check module
Appcast fetch/parse over kry_http + kry_json, semver compare, and
desktop channel detection (AppImage/Snap/Flatpak env, /usr|/opt
package installs, Windows portable). Poll-based so a frame loop can
watch it; file:// appcasts keep tests offline. Also stub
kry_http_partial in the no-libcurl branch so nothing links unresolved.
2026-08-19 13:08:54 -03:00
waozi b969d0f36b locale: detect the system default locale (GetDefaultLocaleCode)
Apps had no way to follow the system locale - inbe hard-defaulted to
English for every fresh profile. GetDefaultLocaleCode resolves
LANGUAGE/LC_ALL/LC_MESSAGES/LANG down to an available catalog
(pt_BR.UTF-8 -> pt) and returns "en" when nothing matches.
2026-08-18 18:47:28 -03:00
waozi eb9967ce29 theme: drop the dedicated Aero palette, keep the style palette-agnostic
The Aero widget style derives its glass tints from whichever palette is
active, so a 13th palette entry was redundant. Remove THEME_AERO (and
its ini mirrors, locale label and picker slot); the style now defaults
to Sky. Saved theme ids beyond the shrunken count normalize through the
existing out-of-range fallback.
2026-08-18 18:08:54 -03:00
github-actions[bot] a32db3d723 release: bump version to v0.1.20 2026-08-18 20:12:01 +00:00
github-actions[bot] 0e3e30e2f5 release: bump version to v0.1.19 2026-08-18 20:01:22 +00:00
github-actions[bot] 45db79bf24 release: bump version to v0.1.18 2026-08-18 19:38:59 +00:00
waozi 3319143452 kry_sw: track the dirty rectangle per call
KrySwDirty previously reported the full frame. Drawing ops now union
their clip-intersected bounds into an accumulator (fill_rect covers
rects, circles, rings, blits and the bitmap font; text marks its
string bbox so the atlas path is included), and KrySwDirty became
one-shot: it reports everything drawn since the previous read and
resets, so hosts can present partial frames.
2026-08-18 16:17:29 -03:00
waozi 8c8bbb0dfa theme: add the Aero widget style
Add THEME_STYLE_AERO after MATERIAL so existing app clamps treat it as
invalid (SYSTEM fallback) until they opt in. The style renders Windows
Vista/7 glass from plain primitives only - translucent fills, gloss
highlights, hover glow, layered shadows, inset fields, gradient tracks -
so every backend (raylib, Android, web, software, null) draws the same
picture.

- UIStyleTokens preset: 4px/8px radii, translucent control/panel alpha,
  gloss shine, soft shadow offset
- New src/ui/ui_aero.c: UIAeroScheme derived from the active palette
  (GetUIAeroScheme) plus paint helpers for controls, glass panels,
  inset fields and gradient tracks
- ui_draw_control_background/ui_draw_box_background route Aero through
  the new helpers, so shared-path widgets pick glass up for free
- New THEME_AERO palette (13th, the style default) with sky-glass light
  and slate-blue dark scopes + themes/aero*.ini mirrors
- Theme settings picker offers the style; locale gains theme_aero
- Go binding ThemeStyleAero
2026-08-18 16:10:15 -03:00
github-actions[bot] 0cebd2e63d release: bump version to v0.1.17 2026-08-18 18:56:24 +00:00
github-actions[bot] 6e08dce906 release: bump version to v0.1.16 2026-08-18 16:26:59 +00:00
waozi 62eff75d38 tray+notify: SetDesktopTrayIcon emblem swap, action-capable notifications
- SetDesktopTrayIcon(path) swaps the tray icon at runtime (empty restores
  the icon InitDesktopTray resolved): the emblem/attention state apps show
  while unseen notifications wait. gtk_dl gains gtk_status_icon_set_from_file.
- SendNotificationAction + PollNotificationAction extend the notification
  API with one action button per popup on the GDBus backend: Notify's
  daemon id is kept with the caller's URL, an ActionInvoked subscription
  resolves the click, and Poll hands (action, url) to the app's main loop
  while pumping the dispatch context so it also works without one. Other
  backends degrade to the plain send.
- go/kryui: bindings (SetNotificationAppName, NotificationSupported,
  SendNotificationAction, PollNotificationAction, SetDesktopTrayIcon).
2026-08-18 12:46:52 -03:00
waozi 5351b21eaa ui: build and test the secondary window paths
The secondary-window presenter had no callers and no build coverage:
nothing compiled the UI_WINDOW_HAVE_SDL branch (the Wayland and
SDL-bundled path), and no test exercised the public API at all, so
recent presenter fixes could only be validated by reading the code.

- Compile ui_window.c with -DUI_WINDOW_HAVE_SDL in make test so the SDL
  presenter cannot rot uncompiled.
- Add a ui_window smoke test covering the headless contract: Open fails
  cleanly without a main window, and every entry point is NULL-safe.
- OpenUIWindow now requires IsWindowReady() on both the X11 and SDL
  paths: the content texture allocation needs the app's live GL context.
- Document the -DUI_WINDOW_HAVE_SDL opt-in in ui_window.h.
2026-08-18 12:40:23 -03:00
github-actions[bot] 307a502c2a release: bump version to v0.1.15 2026-08-18 03:07:39 +00:00
github-actions[bot] 1e7281b398 release: bump version to v0.1.14 2026-08-18 02:45:25 +00:00
waozi 3078f2d0e7 ui: route retained focus traversal 2026-08-17 21:58:59 -03:00
waozi 15020a797b runtime: enforce one app instance by default 2026-08-17 21:46:45 -03:00
github-actions[bot] ed82dcc42c release: bump version to v0.1.13 2026-08-18 00:04:15 +00:00
waozi 81867525a6 ui: retain selected font for deferred text 2026-08-17 19:06:15 -03:00
github-actions[bot] e7f7a273b1 release: bump version to v0.1.12 2026-08-17 22:05:16 +00:00
waozi f8f5cd4c71 ui: add retained declarative tree and typed events 2026-08-17 18:55:05 -03:00
github-actions[bot] b7819e3a26 release: bump version to v0.1.11 2026-08-17 21:00:45 +00:00
github-actions[bot] 714db005e9 release: bump version to v0.1.10 2026-08-17 20:44:04 +00:00
waozi 525e7aa1cb ui: add fixed-subset font sources 2026-08-17 17:35:16 -03:00
github-actions[bot] b72e374421 release: bump version to v0.1.9 2026-08-17 17:44:02 +00:00
github-actions[bot] f1fb6ff277 release: bump version to v0.1.8 2026-08-17 16:17:39 +00:00
waozi 99bd4a01a9 ui: finalize deferred overlays at frame end 2026-08-17 12:20:36 -03:00
waozi cce6e637ee ui: add scroll-safe multiline text selection 2026-08-17 11:54:01 -03:00
waozi b407fdfe16 go: add secure password fields 2026-08-17 11:40:36 -03:00
waozi cafd406e89 krb caps: reference host backends — storage, audio
src/krb/krb_caps.c: flat-file key/value storage (KRB_CAP_STORE_DIR,
atomic replace-and-append), KrbFn adaptors, and KrbCapInstallDefaults
binding storage.get/set + audio.play/stop. The raylib surface host
installs a real audio hook (LoadSound/PlaySound/StopSound) via
constructor, so cartridges on desktop get working audio; headless
hosts return -1 rather than pretending. tests/krb_caps_test.c covers
install count, set/get/replace/missing round-trip, and the audio
hook; wired into make test. All suites green; 11/11 cross-engine
byte-identical.
2026-08-17 08:23:56 -03:00
waozi 882b5e546f krb: plan-08 capability registry
Well-known capability imports (cap.storage.get/set, cap.http.get,
cap.audio.play/stop, cap.notify) with KrbCapBind: hosts bind
implementations into free slots without cartridge-side import
entries; unknown capabilities refuse. Verified: slot bind + call
fires, unknown id returns -1. Cartridges invoke capabilities through
OP_CALL_HOST or BUTTON binds like any import.
2026-08-17 08:18:48 -03:00
waozi 41687a5e48 KrbAutoMount: state initializers render without a host
DATA nodes now carry their initializer (ints in x, CSTRs via text),
and KrbAutoMount(img) binds them into malloc'd slots. krb-run and
krb-sdl both call it, so bound counters, checkbox defaults, and
TextField contents render identically with or without generated
host binds. Cross-engine 11/11 byte-identical; suites green,
goldens regenerated.
2026-08-17 08:15:25 -03:00
waozi d11c4b0b5a atlas: raylib's ascent-shifted glyph offsets + per-mille UI scale
The instrumented ui_text.c run pinned the native tier facts: ui
scale 1.125 (title tier base=27px for a 24 logical size), advances
w=9/adv=10 for 'L' — and glyph offsetY of +6 where raw stbtt gives
-15. raylib rtext.c line 730 adds (int)(ascent*scale) to every
offsetY: glyph offsets are line-top-relative. k2b_atlas now applies
the same shift; per-glyph values match the app trace exactly
('L' off=(1,6), 'a' (0,10)).

kry_sw's UI scale is per-mille (1.125 isn't expressible in integer
percent) with the same (int)(px*s+0.5) rounding as ScaleUIPx; the
native harness threads KRB_EXACT_UI_SCALE. The language cartridge
is now authored in logical units.

Native parity: 6423 -> 5765/307200; glyph positions track the
native within ~1-2px per element. Remaining: fractional-advance
storage (raylib keeps float advanceX; the u16 truncation drifts
~0.5px/glyph) and the title's measured width, under investigation.
Cross-engine: 8/8 byte-identical, suites green, goldens updated.
2026-08-17 06:56:02 -03:00
waozi 0b2c447d5d krb v2: animated geometry — WHM session screen runs live in-cartridge
New VM pieces: OP_MOD, and OP_NODE_SET (pops an i16 and patches a
node's x/y/w/h through a mutable node overlay allocated on first
use). TIME is now a first-class term in expressions. The k2b program
compiler was restructured around an ordered instruction stream
(updates, draws, guard/else brackets interleaved in source order) so
conditional assignments compile correctly — previously both branches
of an if always ran, last-write-wins. Updates accept full
term-or-term-arith-term right sides including % and TIME.

examples/26_inbe_whm_session.kry: the Wim Hof session as a cartridge —
TIME -> elapsed -> phase -> triangle wave -> animated ring radius via
AnimNode('ring0','w',&radius), breath counter with clamp, in/out
phase text. Verified across frames: t=0/600ms/5s produce the exact
expected phase, radius, and breath values. Eight exactness screens
byte-identical kry_sw == SDL.
2026-08-16 23:35:48 -03:00
waozi f087c0654d krb v2: screen navigation — the whole app in one cartridge
KRB_FLAG_NAV buttons write a screen id to a state path on press
(cartridge-owned navigation; no host import). k2b compiles
NavButton(label, x, y, w, h, &state.screen, id). Screens are guarded
node ranges over one state field; examples/23_inbe_app.kry is Inner
Breeze as a single 6 MB cartridge — language, settings, and manual
screens with dropdowns, scroll, checkboxes, and the breath ring,
navigable end to end (verified: Next/Manual/Back transitions via
injected clicks). Scroll containers now draw a 1px outline instead
of a filled rect. All five exactness screens byte-identical
kry_sw == SDL.
2026-08-16 23:01:39 -03:00
waozi e9fe1e17e0 krb v2: dropdown controls
KRB_CTRL_DROPDOWN (kind 4) implemented end to end: the control record's
reserved options_off/option_count now carry consecutive NUL-terminated
option strings (k2b appends them without interning so they stay
contiguous; Dropdown(id,x,y,w,"a;b;c",&val)). Click toggles the popup,
clicking a row writes the selected index to the bound int and closes.
Loader initializes the open-dropdown slot to -1 (0 is a valid index).
2026-08-16 22:11:03 -03:00
waozi 84bd26de20 krb v2: text input — TEXTINPUT node + typed-codepoint vtable path
New node type 13: bounded field drawing the mounted CSTR with a
blinking caret when focused (click to focus). Typed input flows through
the new optional KryBackend.text_key (codepoints, 0x08 backspace):
kry_sw queues via KrySwText (drained per frame by Advance), the raylib
surface backend maps GetCharPressed, SDL maps SDL_TEXTINPUT/BACKSPACE,
krb-web exports krb_web_text from keypress events. UTF-8 runes append
and strip correctly. k2b compiles TextField(x,y,w,h,&state.field).

Verified: click-focus, typing with backspace, and that unfocused
fields ignore keys.
2026-08-16 22:06:53 -03:00
waozi cb6faf430d krb v2: scroll containers
SCROLL node (type 12): viewport bounds, content height in font_size,
mounted pixel offset at name_off. Children (parent = scroll index)
draw translated by -offset and clipped to the viewport; a new
optional KryBackend.wheel entry drives the offset when the pointer is
over the viewport, clamped to [0, content_h - h]. Implemented in
kry_sw (+KrySwWheel injection), the raylib surface backend, the null
and recorder backends; krb-sdl maps SDL_MOUSEWHEEL, krb-web exposes
krb_web_wheel from canvas wheel events. k2b compiles

  Scroll(x, y, w, h, contentH, &state.off) ... EndScroll()

bracketing child widgets (parent-linked). Fixed a compounding-offset
bug where draw_tree's origin was mutated across children.
2026-08-16 22:03:44 -03:00
waozi c1be0cb82d k2b+engines: KFA1 glyph atlas — antialiased Noto text in cartridges
- k2b bakes a per-cartridge atlas (stb_truetype over the vendored
  NotoSans) covering the cartridge's charset at its used pixel sizes,
  embeds it as the kind 1 asset '@atlas'. K2B_FONT overrides the face.
- kry_sw renders atlas text: UTF-8 decoding, per-glyph advances,
  source-over coverage blending, nearest-size scaling; measure uses
  real advance widths. KrySwSetAtlas installs it; krb-run, krb-sdl,
  and krb-web all load '@atlas' after KrbLoad.
- Cartridge cap raised 64 KiB -> 16 MiB (output buffer static) to fit
  atlases/images; krb_cartridge_test budget adjusted. Engine goldens
  regenerated (atlas advances change text layout).
- Fixed on the way: atlas record stride (18 bytes), pack buffer
  ownership, and a realloc'd-header write in the baker.

Verified: 'Ag' at 24px renders as antialiased glyphs from embedded
bytes; full krb suite green.
2026-08-16 21:59:11 -03:00
waozi 8672d9f305 style tokens: fixed-pixel corner radii, not size fractions
control_radius/panel_radius were normalized 0..0.5 fractions of the
control's size, so a token tuned for a button exploded into a full
pill on tall controls (text inputs). Tokens are now unscaled pixels,
converted per-draw via ui_radius_px() (DPI-scaled, clamped to 0.5
normalized). Material: 4px controls / 6px panels; retro/system: 2px
controls / square panels. Removed ui_control_radius(), which leaked
the mixed-unit ambiguity.
2026-08-16 21:39:08 -03:00