Files
ltk/CHANGELOG.md
T
admin 96a9e88051
CI / build + test (push) Canceled after 0s
CI / cargo audit (push) Canceled after 0s
Back as a navigation request: App::on_back, BackAtRoot, NavStack and docs/navigation.md; renew the text-input enable on a press; fit an oversized window_size_hint to the screen
Three changes that came out of making the shell's back button work across Eydos the way it does on Android. The first is the feature; the other two are gaps it exposed.
Back is no longer Escape. forge turns its back gesture and button into the `XF86Back` key for the focused client, and ltk treated that key as an alias of `Escape`: close transient UI, else drop the focus and reach `on_key_with_modifiers`. That is "cancel", and it is all an app could get: nothing navigated, and nothing ever left the app. `XF86Back` is now a back request with its own order, one layer per request, top-most first: transient UI the runtime owns (open xdg-popup overlays, the built-in context menu, a text selection, the top-most pressable carrying an `on_escape`, i.e. a dialog's cancel), then text-input focus, then the new `App::on_back`, then `on_key_with_modifiers( XF86_Back )` so an app that bound the key itself keeps receiving it (crustace does, for its launcher), then `App::back_at_root`. The first step is what Escape already did; it moves out of `handle_key_escape` into `AppData::dismiss_transient` in the new `input/keyboard/back.rs`, which both paths call, so Escape behaves exactly as before. Text focus comes before the app on purpose: with a keyboard covering half the screen, back means "put the keyboard away", and navigating instead would discard what the user was typing. A compositor that folds its keyboard itself, as forge now does, only lets the next request through, which makes this step the fallback for the ones that do not.
`App::on_back` returns a `BackResponse`: `Message( msg )` with the message that undoes the top-most piece of navigation state, `Unhandled` at the root, or `Consumed` for a host whose back stack lives elsewhere and cannot be inspected ahead of time. `Consumed` exists for rustdroid: an Android app keeps its activities, fragments and back callbacks in its own code, so the host can only hand the request over. `App::back_at_root` then picks `Minimize` (the default), `Close` (through `on_close_requested`, which can still veto) or `Ignore`. Minimising is what a root activity does on Android since version 12 and what suits an app the user comes back to: a browser keeps its tabs, a call goes on. It is also the single point where the two stacks meet: the navigation stack belongs to the app's model, the task stack to the compositor, and `xdg_toplevel.set_minimized` is the one standard request between them, so no custom protocol carries navigation state out of the process and clients that are not ltk apps keep working. Only `ShellMode::Window` surfaces react at the root; a panel or a lock screen that minimised itself would be a bug.
Three consequences of back being a navigation request rather than input: the key leaves the default `App::key_repeats` set, since a held button would empty the whole stack; it is no longer reported through `App::on_raw_key`, so a host forwarding raw keys into an embedded web view or guest toolkit stops leaking it as a keystroke; and the mouse's back button (`BTN_SIDE` / `BTN_BACK`) enters through the same `handle_back`. `focused_text_input` becomes `pub( crate )` for the new module.
The answer is derived, not recorded, and that is the design decision worth writing down. The runtime keeps no navigation stack of its own. Its entries would have to be messages, which are not serialisable (the trait puts no serde bound on `Message`, by design), so it could not survive a relaunch; and a list of "things to undo" drifts the first time the user leaves a screen some other way, through its own close button or a link, leaving a back press that does nothing visible. An answer computed from the model cannot disagree with it. This is also what ties back to the session persistence added earlier: navigation state is both what `on_back` reads and what `save_state` should persist, and keeping the two the same is what makes back retrace the same places after a session restore or a crash, with nothing extra to serialise. Persist less and a restored app opens on the right screen with nothing behind it; persist more and it restores a menu the user had closed.
`NavStack<R>` packages that rule for the common case, an app made of screens. It is a plain value the app keeps in its model, never seen by the runtime: `push`, `pop`, `replace` (the sideways move back should not retrace), `pop_to_root`, `reset`, `current`, `current_mut`, `iter`, `depth`, `can_pop`, and `back( msg )`, which answers `on_back` directly. It is stored as a root plus the routes above it rather than as a `Vec`, so "never empty" holds by construction, including after deserialising an old or damaged state file, and it derives serde whenever `R` does. Six unit tests cover it, a serde round trip among them, and its rustdoc example is a complete `App` where one object answers `on_back`, `save_state` and `restore_state`.
Documentation, since the point is for app authors to take navigation state into account. The new `docs/navigation.md` is the reference: transient UI versus navigation state and the test that separates them, the back order and the reason for each step, why the answer is derived, how it lines up with session state, `NavStack`, apps that embed a web view (whose page history is navigation state too, to be persisted with ltk-webkit's `session_state`), hosts with a foreign back stack, the root, who owns which stack, and an author's checklist. `architecture.md` gains a group in the trait surface and a paragraph in the state patterns, `onboarding.md` and the README index link to it, and in the cookbook the multi-screen recipe now uses `NavStack` with `on_back` and persists the stack without serde, which keeps it compiled by the Markdown doctest harness (that harness links `ltk` alone, so the serde example in `navigation.md` is marked `ignore` and compiled as `NavStack`'s own doctest instead). `BackResponse`, `BackAtRoot` and `NavStack` are exported at the crate root and in the `ltk::window` facade.
Behaviour change for existing apps, also recorded under Changed: a window app that implements neither `on_back` nor the key is now minimised on back at its root, where nothing happened before; `BackAtRoot::Ignore` restores that. With a text input focused, back only drops the focus and the app sees the next request, where it used to get the key in the same press.
Renew the text-input enable on a press. Moving the focus between two text fields, or pressing the one already focused, only committed the refreshed content type on the existing `zwp_text_input_v3`. `activate_text_input` now sends `enable` first, as GTK does when a focused entry is clicked. A compositor that folded its on-screen keyboard while the field kept the focus, which is what back now does, has no other way to learn that the user wants it again: the text-input never stopped being active, so there was nothing for it to observe. ltk sends neither surrounding text nor a cursor rectangle, so the only state `enable` resets is the content type set right after it.
Fit an oversized `window_size_hint` to the screen. The hint is pinned as `min_size == max_size` before the first commit, when no output is known yet, so an app asking for a phone-shaped 720x1440 window on a 1080p desktop got a toplevel taller than the screen; rustdroid carried a dead branch that tried to avoid this from a screen size nothing could give it. The first configure is the earliest point the hint can be checked, and the protocol has the right input for it: `xdg_toplevel.configure_bounds`, exposed by sctk as `WindowConfigure::suggested_bounds` and ignored until now. The new `event_loop/window_fit.rs` holds `fit_within`, which scales a size down keeping its aspect ratio until it fits and leaves one that fits untouched (four unit tests), and `AppData::fit_size_hint`, run once behind the new `pending_size_hint_fit` latch: it uses the compositor's bounds when sent and otherwise 90 % of the first output's logical size, since panels and decorations are unknown from the client side. When the hint has to shrink, `min_size` (and `max_size` for a non-resizable window) is re-pinned to the fitted size, which is kept in `fitted_size_hint` and replaces the app's hint as the fallback for later configures that carry no size; without that the window would grow back on the next one. On that one configure the fitted size wins over the compositor's `new_size`, which was derived from the oversized pin. `App::window_size_hint` documents the rule with the worked example (720x1440 opens as 486x972 on a 1080p output).
The back order needs a live Wayland connection to exercise and has no test; the unit tests cover `NavStack` and `fit_within`.
2026-09-20 23:23:26 +02:00

29 KiB

Changelog

All notable changes to ltk are documented here. The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Unreleased

Added

  • App::on_back() / BackResponse — the app's answer to a back request (the shell's back button or gesture, delivered as XF86Back, or a mouse's BTN_SIDE / BTN_BACK). Back peels one layer per request: transient UI the runtime owns (xdg-popups, context menu, text selection, a dialog's on_escape), then text-input focus, then on_back, then on_key_with_modifiers( XF86_Back ) for apps that bound the key themselves, then back_at_root. BackResponse::Message carries the message that undoes the top-most piece of navigation state, Consumed is for hosts whose back stack lives elsewhere (an embedded Android runtime), Unhandled means the root. Default Unhandled.

  • App::back_at_root() / BackAtRoot — what back does with nothing left to go back to: Minimize (default; xdg_toplevel.set_minimized, the app and its state stay alive), Close (through on_close_requested) or Ignore. Only ShellMode::Window surfaces react; layer-shell and session-lock surfaces never do.

  • NavStack<R> — navigation state for an app made of screens, kept in the app's model: push / pop / replace / pop_to_root / reset / current / iter, never empty, serialisable whenever R is. back( msg ) answers on_back, and persisting the same value from save_state makes back retrace the same screens after a session restore.

  • docs/navigation.md — the navigation-state model: transient UI versus navigation state, the back order and its rationale, why the answer is derived instead of recorded, how it lines up with save_state, embedded web views, foreign back stacks, and an author's checklist. architecture.md, onboarding.md and the cookbook's multi-screen and session-state recipes point to it; the multi-screen recipe now uses NavStack.

  • App::claims_raw_touch_at( x, y ) — per-press variant of claims_raw_touch: a finger landing where the app returns true rides the raw on_touch_* stream through the auxiliary-slot path and clears the widget focus, while fingers landing elsewhere keep driving the gesture machine. Lets an app embed a self-contained input consumer (a WebView) next to regular widgets. Only consulted for the main surface; default false.

  • App::fullscreen() — desired fullscreen state of the toplevel at runtime, polled after every batch of updates; a change is forwarded as xdg_toplevel.set_fullscreen / unset_fullscreen. The built-in titlebar is not painted while the compositor reports the window as fullscreen. Default None (window state left alone).

  • PatternGrid::size( impl Into<Length> ) — explicit side for the square grid, resolved through Canvas::resolve_geom like the other geometry overrides; without it the theme's fluid default still applies. A lock screen can now size the grid from the surface (a share of the width in portrait, of the free height in landscape) instead of being capped at the default.

  • xdg-session-management-v1 (client) — before the first commit of a ShellMode::Window toplevel the runtime binds xdg_session_manager_v1, issues get_session( reason, stored_id ) and restore_toplevel( toplevel, "main" ), so a supporting compositor restores window geometry on every launch. Bindings are generated in-tree from the vendored XML under protocols/ with wayland-scanner (src/protocol/).

  • Runtime session persistence — $XDG_STATE_HOME/<app_id>/session.json (compositor session id, clean-exit marker, pid) plus state.bin (the bytes from App::save_state), written atomically with mode 0600; saved every 30 s when the bytes changed, on close and on signal; handed back through App::restore_state before the first frame only on a session restore (LTK_SESSION_RESTORE=1) or after an unclean exit. Module src/session_state.rs.

  • Layer::Window overlays — an OverlaySpec with layer: Layer::Window is materialised as an ordinary xdg_toplevel of the given fixed size instead of a layer-shell surface: decorated, stacked and listed by the compositor like an application window. Anchor, exclusive zone and keyboard exclusivity are ignored; the compositor's close button delivers on_dismiss. App::overlay_title( id ) (defaulted to the app id) names it. Layer-shell apps now bind xdg_wm_base when available so they can open one.

  • Clean exit on SIGTERM / SIGINT — the runtime installs a calloop signal source and leaves the event loop instead of dying, so save_state runs and ltk::run returns.

  • Slider::on_release / VSlider::on_release — fired once with the final value when the drag ends, so an app can keep an expensive commit (a subprocess, a D-Bus round trip, a compositor reconfigure) off the per-motion on_change path and still move the thumb live. The gesture machine emits it from the slider branch of on_release; on_change alone behaves exactly as before.

  • Viewport::local_viewport() — resolve the child's viewport-relative (vw / vh / vmin) and fluid Lengths against the viewport's own rect instead of the root layout viewport the sub-canvas inherits. For fixed-size floating mini-UIs (a phone-shaped panel pinned to a corner of a desktop-wide surface) whose content is calibrated against the panel rect; scroll-like clips should keep the default inheritance.

  • ListItem::height( impl Into<Length> ) / ListItem::font_size( impl Into<Length> ) — override the theme row height (floored at the label's rendered height so text never clips) and the primary-label font size, mirroring the Toggle / Radio height() builders, so dense menus can trade the touch-target generosity for row density.

  • Accessibility text scale — set_text_scale / text_scale global multiplier (clamped [0.5, 3.0]) applied to every resolved font size (Canvas::resolve_font and the stock-widget font_px path); geometry is untouched. The run loop reads org.gnome.desktop.interface text-scaling-factor at startup and follows external changes via a gsettings monitor watcher thread, repainting on change — every ltk app tracks the desktop's "large text" setting live with no app-side wiring (silently fixed at 1.0 when gsettings is missing). Embedders driving core::UiSurface call set_text_scale themselves.

  • Per-canvas pixel density — Canvas::set_density pins a canvas (and the sub-canvases derived from it) to its own density factor for Length::dp resolution, overriding the process set_density global; Canvas::density reads the effective value. New Canvas::resolve_geom / Canvas::resolve_font resolve an explicit Length in geometry / font space with the canvas' density — widgets now route caller-supplied lengths through them, so a dp override follows the canvas it draws on. The hook for surfaces on outputs whose DPI differs from the process-wide one (an overlay on a second monitor, an embedder with several UiSurfaces).

  • Length::resolve_with_density — Length::resolve with an explicit density for LengthBase::Dp, instead of the process density().

  • docs/backends.md — the canonical software/GLES capability matrix: what renders identically, what degrades gracefully on software (gradients, shadows, backdrop blur, bottom fade) and what is GPU-only, replacing per-method rustdoc archaeology. Linked from README, onboarding and the architecture known-gaps list.

  • Clippy in CI — the test job lints with cargo clippy --workspace --all-targets --features test-support -- -D warnings; make clippy mirrors the invocation locally.

  • ListItem::trailing_icon( rgba, w, h ) — right-aligned icon slot (disclosure arrow) drawn at TRAILING_ICON_SIZE (21 px) and vertically centered, alongside the existing leading icon. Coexists with trailing text, which shifts to the icon's left. Symbolic icons should be pre-tinted by the caller (tint_symbolic), matching the leading-icon contract.

  • ListItem::pad_h( impl Into<Length> ) — per-item override of the horizontal inset between the row edge and its content; without it the theme default (16 px) applies.

  • Row::align_top() / Row::fill_height() — pin children to the row's top edge instead of the default vertical centering, or stretch every non-spacer child to the row's inner height (the row itself is still sized by its tallest child), for siblings whose natural heights differ by a few font-metric pixels.

  • App::window_resizable() — return false to keep the min_size == max_size pin from window_size_hint for the toplevel's lifetime, declaring a fixed-size window compositors must not resize. Default true.

  • App::claims_raw_touch() — return true to receive the primary finger through the raw on_touch_down / move / up stream, bypassing the built-in single-slot gesture machine entirely (widget presses, taps and swipes stop working on touch), for surfaces that are one self-contained input consumer such as an embedded WebView or a game canvas.

  • Responsive sizing system with two selectable modes via WidgetScaling (Fluid / Physical; set_widget_scaling / widget_scaling, default Fluid). New Length constructors — orient( portrait, landscape ) (a percentage of the width in portrait, of the height in landscape), fluid( px ) (surface-proportional, calibrated against set_fluid_reference and bounded by FLUID_MIN / FLUID_MAX), dp( px ) (constant physical size scaled by set_density / density), and widget( px ) (picks fluid or dp per the active mode). Canvas::geom_px (geometry, physical layout space) and Canvas::font_px (font, bridging the logical / physical split per mode) give widgets and apps one resolution path.

  • Button::font_size / height / width and TextEdit::height builders, all impl Into<Length>, so control boxes scale with the surface. Text::line_height( mult ) opens the gap between wrapped lines. Separator::pad_v (with Length::px( 0.0 ) for a flush divider).

  • Performance guardrails: opt-in diagnostics via LTK_PERF_WARN=1 (stuck animation, sustained software-render animation, low poll_interval) and a ~30 Hz software-animation cap overridable with App::cap_software_animation.

  • grid_min_cell( width ) and WrapGrid::max_columns( n ) — adaptive grid: the column count is derived at layout time from the available width so every cell is at least width wide (any Length; never fewer than one column), re-derived on every resize; max_columns caps the count so cells grow instead of multiplying on wide surfaces. grid( n ) keeps the fixed-count behaviour.

  • Vertical flex: flex( child ) now distributes leftover height inside a Column, mirroring its leftover-width behaviour in a Row — weights split the spare space between flex / spacer siblings, the child draws inside the allocated share, and it contributes zero to the column's natural height like a weight-only spacer.

  • make stylecheck / scripts/style-check.sh — mechanical checks for the grep-verifiable subset of the style guide (tab indentation, spaces inside attribute brackets), wired into CI. The whole tree was normalized to pass (82 attribute sites).

  • ltk::orientation() / viewport_size() / set_viewport_size and the Orientation enum — the runtime records the main surface's physical dimensions on every configure, so view() can branch a layout on portrait vs landscape (match ltk::orientation() { … }) without tracking on_resize by hand; the portrait/landscape rule matches Length::orient (square counts as portrait). Embedders driving core::UiSurface directly call set_viewport_size themselves. examples/clip_path.rs demonstrates it.

  • test-support Cargo feature gates the test_support module so third-party builds never see it (ltk's own make test enables it).

Changed

  • XF86Back is no longer an alias of Escape. It used to run the Escape path: close transient UI, else drop the focus and reach on_key_with_modifiers. It is now a back request with its own order (see App::on_back under Added). Visible differences for an existing app: with a text input focused, back only drops the focus and the app sees the next request, where it used to get the key in the same press; the key is no longer reported through App::on_raw_key, so hosts forwarding raw keys into an embedded view stop leaking it to the page; it no longer auto-repeats by default (App::key_repeats); and a ShellMode::Window app that handles neither on_back nor the key is minimised on back at its root, where nothing happened before — return BackAtRoot::Ignore from back_at_root to keep the old behaviour. An app that binds XF86_Back in on_key / on_key_with_modifiers keeps receiving it. Escape itself is unchanged; its transient-UI step is now shared with back as AppData::dismiss_transient.
  • A window_size_hint larger than the screen is shrunk to fit. The hint is pinned as min_size == max_size before the first commit, when no output is known yet, so an app asking for a phone-shaped 720x1440 window on a 1080p desktop got a toplevel taller than the screen. On the first configure the runtime now fits the hint, keeping its aspect ratio, inside the compositor's xdg_toplevel.configure_bounds (WindowConfigure::suggested_bounds) or, when it sends none, inside 90 % of the first output's logical size; min_size (and max_size for a non-resizable window) is re-pinned to the fitted size, which also replaces the hint as the fallback when later configures carry no size. A hint that fits is untouched. event_loop/window_fit.rs, with unit tests for the fitting rule.
  • A press on a text field renews the text-input enable. Moving the focus between two text fields, or pressing the one already focused, used to commit only the refreshed content type on the existing zwp_text_input_v3. It now sends enable first, as GTK does when a focused entry is clicked: a compositor that folded its on-screen keyboard while the field kept the focus (the back button does) has no other way to learn that the user wants it again, since the text-input never stopped being active. ltk sends neither surrounding text nor a cursor rectangle, so the state enable resets is only the content type set right after it.
  • The software backend's ARGB8888 conversion works on whole pixels. SoftwareCanvas::write_to_wayland_buf swapped red and blue with a byte-by-byte loop over the frame; it now reads each pixel as a u32, exchanges the two channels with masks and shifts, and lets the compiler vectorise it. Compositors that offer ABGR8888 were never affected.
  • Breaking: App::app_id, App::save_state and App::restore_state are new mandatory trait methods — every implementor must add them (shell components: constant id, None, no-op). xdg_toplevel.set_app_id and the AccessKit application name now come from app_id() (previously "ltk" / "ltk-app"); the app_id element of the deprecated window_config tuple is ignored. Crate version bumped to 0.3.0.
  • Button::icon_size takes impl Into<Length> and resolves through Canvas::resolve_geom, joining font_size / height / width. A bare f32 still means Length::px — every existing call keeps its exact size — but a caller can now pass Length::widget( n ) to have an icon button follow the widget-scaling mode the way stock icons do. Without it an explicit icon_size was the one geometry setter that ignored the mode, so a 21 px back arrow sat next to a list_item chevron that fluid sizing had grown well past 21 and looked visibly smaller.
  • Length::dp now applies the density at resolution time, not at construction. The value carries its design pixels in a new LengthBase::Dp variant and resolve multiplies by the density in effect when it runs, so a set_density change takes effect on the next paint without rebuilding the view's lengths — previously a dp value was frozen to the density read when it was constructed. Behaviour is unchanged for code that sets density once at startup.
  • The GLES image texture cache is now bounded to 32 MiB of estimated GPU memory with least-recently-drawn eviction (the in-use entry is never evicted). Previously it grew without limit for the canvas' lifetime, so a stream of distinct buffers (photo carousel, video thumbnails) could exhaust GPU memory.
  • OverlaySpec::size is now ( Length, Length ) (was ( u32, u32 )), resolved against the main surface when the overlay is materialized; wrap existing sizes in Length::px( … ) for the old fixed behaviour.
  • TextEdit::font_size, TextEdit::fixed_width and Separator::thickness now take impl Into<Length> (were f32), resolved like the button label (font space) / geometry space; the f32 sentinels are gone (f32 call sites still compile via Into<Length>).
  • Dependency pins: fontdue = "=0.9.3" and ignore = "=0.4.23" are pinned exactly because newer releases require a rustc newer than the declared Rust 1.85 MSRV (Debian stable's toolchain).
  • Renamed set_design_reference / design_reference → set_fluid_reference / fluid_reference. Length::dp changed meaning — it used to be a surface-proportional value, and that behaviour now lives on Length::fluid; dp is the constant-physical-size unit.
  • Widget struct fields are now pub( crate ) (configured through builders), except the value / state types apps read or construct (Time, Date, ComboState).

Fixed

  • A focus request reaches a widget scrolled out of view. Scroll viewports drop the widgets outside their visible area from the hit-test list, so App::take_focus_request for a text input that a tap had just added below the fold (a password field under the selected network of a Wi-Fi list) never found it — and the runtime kept re-requesting a rebuild and a redraw every frame while it waited. Widgets with a WidgetId that a scroll clips are now recorded with their content position (scroll_clipped); a request whose target is among them moves that viewport with the same rule keyboard navigation uses (scroll::offset_into_view) and is satisfied on the next frame. The wait is bounded to a few drawn frames, after which the request is dropped instead of spinning.
  • Fast two-thumb typing no longer drops taps. A finger landing while another was still down went to the auxiliary slot and never reached the gesture machine, so on a touch keypad every overlapping tap was lost. A finger landing on a primary that is still a plain press (GestureState::is_plain_press: no drag, scroll, swipe or slider in flight) now commits that press as a tap at its last position and takes the primary slot; the earlier finger's release reports through App::on_touch_up. Presses that have become a drag keep the old behaviour, so a second finger during a pattern stroke or a slider drag still stays out of the gesture machine.
  • PatternGrid::on_node fires once per node, not once per motion event. Every touch motion within a node's snap radius re-emitted the node's message and requested a repaint, so drawing a pattern rebuilt and re-rastered the surface at the touchscreen's motion rate. The gesture machine now remembers the node the finger is over (last_pattern_node) and emits only on change; a Slider move outcome without a message no longer requests a redraw.
  • A tap on a button survives finger motion inside the button. Any travel past the slop turned the press into a vertical or horizontal drag and its release skipped the button, so a thumb that rolled on a large key lost the tap. While the pressed widget fires on press (WidgetHandlers::has_press) and the finger is still inside its rect, motion is ignored; the swipe machinery takes over from the original press point once the finger leaves, and presses inside a scroll viewport are unaffected.
  • Gesture thresholds are logical pixels. The 8 px travel that turns a press into a scroll, swipe or drag, and the 6 px stray that cancels a touch long-press, were compared against physical coordinates, so on a scale-2 panel they were 4 and 3 logical px and an ordinary thumb tap became a vertical drag whose release skipped the button. SwipeConfig now carries the surface's buffer scale and the machine reads the thresholds through SwipeConfig::slop / stray.
  • A 1:1 opaque image is a row copy in the software renderer. With the premultiplied copy cached, drawing it unscaled with no clip and full alpha now copies rows into the canvas instead of running tiny-skia's bilinear pipeline over every pixel, which is what a full-surface backdrop cost on every frame.
  • The software renderer premultiplies an image once, not on every draw. SoftwareCanvas::draw_image_data converted the whole source to premultiplied alpha in floating point on each call, so a full-surface backdrop cost a pass over every pixel per frame on top of the blit. Premultiplied copies are now kept in a 32 MiB least-recently-drawn cache keyed by size, content fingerprint and alpha, the same key the GLES texture cache uses (fingerprint_rgba moves to render::helpers to be shared).
  • Rows no longer spill their children out of the layout. Row distributed leftover width but had no notion of a shortfall: leftover floored at zero, so a cluster wider than its rect kept every preferred width and overflowed — symmetrically, since the no-spacer branch centres it, which is why both end labels of a segmented control were clipped at once. The shortfall now comes off the widest children first (water filling), so a long title gives up its width while the icon beside it keeps its size, and equal siblings — a segmented control — share it evenly; pinned spacers keep their width, and Row::no_shrink() opts out for strips deliberately wider than their viewport. Button elides its label into the rect it is granted, so shrinking degrades to a truncated label rather than clipped glyphs; the truncation rule moves to one crate-internal helper shared with ListItem.
  • ListItem labels no longer run under the trailing slot. The label and subtitle were painted with no width limit, so a title longer than the row overlapped the trailing text or the disclosure icon instead of truncating. The trailing slots are now laid out first and both lines are elided with an ellipsis against the space they leave, matching what Text already did.
  • Text inputs no longer insert mid-string when the value grows after focus. Focusing a text input pinned the cursor to a snapshot of value.len(); if the value kept growing without the widget seeing keystrokes (a field fed over IPC), the first normally-delivered key inserted at the stale position. The focus-time cursor is now an end-of-value sentinel that every consumer clamps to the current value length, collapsing to a concrete position on the first real keystroke or click.
  • Single-line caret height now follows the text line. The caret spanned rect.height - 16, so a field taller than its text line grew an oversized caret; it now measures font_size + 4 and is vertically centered like the text, matching the multiline caret.
  • Dialog action buttons no longer overflow the card on large surfaces. The card's width cap was a fixed 480 px while the stock buttons inside grow fluidly with the surface, so on windows past the design size the right-aligned action row ran off the card's right edge. Dialog::max_width now takes impl Into<Length> (f32 call sites keep compiling as fixed px) and the default is Length::fluid( 480.0 ), matching the buttons' scaling curve.
  • App::on_pointer_axis now triggers a view rebuild and repaint. The raw axis hook (wheel/touchpad outside any ltk scroll viewport) fired the app callback but never requested a redraw, so state mutated there (a wheel-stepped carousel, an embedder-scrolled canvas) did not repaint until the next unrelated event.
  • Dialog cards no longer double-pad their interior. The inner card column carried the column() 16 px default padding on top of the container's CARD_PADDING (24 px), giving the content 40 px of interior inset per side and squeezing the action row until its buttons clipped on narrow windows. The inner column is now flush and the interior inset is CARD_PADDING alone; the centering column's margin to the surface edges is explicit.
  • Time-picker digits no longer overflow their boxes. The editable digit fields paired a fluid font (font_size_fluid) with a fixed 72 px box, so on any surface where the fluid font resolved larger than its design size the glyphs outgrew the field. The box is now Length::fluid( 72.0 ) — the same curve and clamp factors as the font, so both scale in lockstep.
  • Content inside a scroll no longer renders smaller than the rest of the surface. Scroll viewports draw their child into a sub-canvas sized to the viewport rect, and fluid Length resolution (Canvas::geom_px / font_px — icon sizes, row heights, paddings, font sizes) resolved against that smaller canvas instead of the surface, shrinking everything inside any scroll by the width ratio (~13 % in a 360 px window with 24 px margins). Sub-canvases now inherit the root canvas's layout viewport (viewport_layout / viewport_logical), propagated through nested sub-canvases, so geometry resolves identically inside and outside offscreen content.

0.2.0 - 2026-06-25

This release adds the primitives an embedder needs to drive ltk as the render backend for a retained, externally-owned widget tree (for example projecting an Android view hierarchy onto an ltk surface). Each is kept general rather than tied to one consumer.

Added

  • Canvas::set_clip_path — anti-aliased clipping to an arbitrary vector path (&[PathCmd]) on both backends. The software backend installs a tiny-skia coverage mask; the GLES backend captures the clipped draws into an offscreen layer and composites them back through an anti-aliased coverage mask. Complements the existing rect clip (set_clip_rects) for shaped clips such as a circular avatar, a rounded card or a VectorDrawable mask. See examples/clip_path.rs.
  • Canvas::fill_path / Canvas::stroke_path over a new PathCmd command list (MoveTo / LineTo / QuadTo / CubicTo / Close, in surface coordinates) — renders an arbitrary vector path, a Path, a VectorDrawable or a Lottie frame. The software backend rasterises directly with tiny-skia; the GLES backend rasterises into a tiny-skia pixmap and uploads it, so both backends share the same path rasteriser and stay at visual parity.
  • Canvas::read_rgba_pixels — reads any canvas into tightly packed straight-alpha RGBA8 (top-left row first), on both the GLES and software backends (the software path un-premultiplies its pixmap). Canvas::is_software lets a caller branch on the backend (e.g. honour a real path clip on software but only a bounding rect on GLES).
  • measure_text( text, size ) (re-exported at the crate root) — measures one line with the default UI font and the system fallback chain, returning (width, line_height) in pixels without a live Canvas, for an embedder's measure pass that must match the renderer's metrics. Backed by a process-wide cached primary-font handle.
  • Stack::push_placed — appends a child at an exact rect, bypassing alignment and intrinsic sizing, so a view tree whose geometry is computed elsewhere can be projected onto a Stack in paint order. Stack::push_placed_clipped additionally clips the child's subtree to a rect (Android's clipChildren): overflowing content is not painted.
  • ExternalSource::Cpu and the External::cpu constructor — an immediate-mode CPU drawing closure invoked once per frame with the canvas and the widget's laid-out rect, working on both backends. Hosts a custom View.onDraw straight onto the ltk canvas without a GL texture round-trip, unlike the existing Texture source which only renders on GLES.
  • RichText widget — wrapped paragraph text carrying a Msg per clickable link range; the layout pass emits one hit rect per link line so taps land on the link rather than the whole paragraph. The ltk side of an Android Spanned carrying URLSpan / ClickableSpan.

Fixed

  • GLES clip-layer composite no longer renders path-clipped content vertically flipped: the offscreen layer was sampled at the inverted screen Y. The software backend was unaffected.
  • Gesture: the horizontal pager is driven only once the swipe axis locks horizontal. Previously the pre-lock lateral drift of a vertical gesture could arm the consumer's pager without a matching release event, which could freeze the surface until an unrelated gesture reset it.
  • Software/GLES parity: the software backend now snaps glyph pen positions and image destinations to integer pixels (rounding to nearest), matching the GLES backend. Previously it truncated, so text and 1:1 images could land up to half a pixel off between backends and sample ~1 px softer.

Changed

  • Default theme launcher SVGs replaced with renderer-compatible versions.

0.1.0 - 2026-03-10

Added

  • Initial release.