A shell built on ltk had no way to show something as a regular window: every overlay is a layer-shell surface, and layer-shell surfaces are either below all application windows or above all of them. crustace's "closing applications…" card ran into exactly that — on the overlay layer it covered the applications' own "save changes?" prompts, on the bottom layer it vanished behind their windows — and what that card wants is to be one window among the others: decorated by the compositor, stackable, listed in the switcher and the dock. `Layer` gains a `Window` variant. An `OverlaySpec` carrying it is materialised by the reconciler as an `xdg_toplevel` (sctk `Window`, server-side decorations) instead of a layer surface: `size` is its fixed size, applied through min/max size (a zero component falls back to a default, since a toplevel cannot "fill"); anchor, exclusive zone and keyboard exclusivity are ignored. The window's app_id is `App::app_id()` and its title comes from the new, defaulted `App::overlay_title( id )`, so the compositor's window lists show something meaningful. `WindowHandler::configure` and `request_close` now resolve which surface a window belongs to: the main window keeps its behaviour, an overlay window is configured through its own `SurfaceState` (with the window geometry set to the configured size) and the compositor's close button delivers the spec's `on_dismiss` instead of exiting the app. Layer-shell applications now bind `xdg_wm_base` when the compositor offers it, so they can open such a window later. Adding a variant keeps every existing `OverlaySpec` literal compiling; the new trait method has a default. The showcase example now also saves and restores `last_pressed`, bumping its private state format to version 2 with the note kept last so its line breaks survive.
20 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
-
xdg-session-management-v1(client) — before the first commit of aShellMode::Windowtoplevel the runtime bindsxdg_session_manager_v1, issuesget_session( reason, stored_id )andrestore_toplevel( toplevel, "main" ), so a supporting compositor restores window geometry on every launch. Bindings are generated in-tree from the vendored XML underprotocols/withwayland-scanner(src/protocol/). -
Runtime session persistence —
$XDG_STATE_HOME/<app_id>/session.json(compositor session id, clean-exit marker, pid) plusstate.bin(the bytes fromApp::save_state), written atomically with mode0600; saved every 30 s when the bytes changed, on close and on signal; handed back throughApp::restore_statebefore the first frame only on a session restore (LTK_SESSION_RESTORE=1) or after an unclean exit. Modulesrc/session_state.rs. -
Layer::Windowoverlays — anOverlaySpecwithlayer: Layer::Windowis materialised as an ordinaryxdg_toplevelof 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 deliverson_dismiss.App::overlay_title( id )(defaulted to the app id) names it. Layer-shell apps now bindxdg_wm_basewhen 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, sosave_stateruns andltk::runreturns. -
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-motionon_changepath and still move the thumb live. The gesture machine emits it from the slider branch ofon_release;on_changealone behaves exactly as before. -
Viewport::local_viewport()— resolve the child's viewport-relative (vw/vh/vmin) and fluidLengths 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 theToggle/Radioheight()builders, so dense menus can trade the touch-target generosity for row density. -
Accessibility text scale —
set_text_scale/text_scaleglobal multiplier (clamped[0.5, 3.0]) applied to every resolved font size (Canvas::resolve_fontand the stock-widgetfont_pxpath); geometry is untouched. The run loop readsorg.gnome.desktop.interface text-scaling-factorat startup and follows external changes via agsettings monitorwatcher 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 whengsettingsis missing). Embedders drivingcore::UiSurfacecallset_text_scalethemselves. -
Per-canvas pixel density —
Canvas::set_densitypins a canvas (and the sub-canvases derived from it) to its own density factor forLength::dpresolution, overriding the processset_densityglobal;Canvas::densityreads the effective value. NewCanvas::resolve_geom/Canvas::resolve_fontresolve an explicitLengthin geometry / font space with the canvas' density — widgets now route caller-supplied lengths through them, so adpoverride 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 severalUiSurfaces). -
Length::resolve_with_density—Length::resolvewith an explicit density forLengthBase::Dp, instead of the processdensity(). -
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
testjob lints withcargo clippy --workspace --all-targets --features test-support -- -D warnings;make clippymirrors the invocation locally. -
ListItem::trailing_icon( rgba, w, h )— right-aligned icon slot (disclosure arrow) drawn atTRAILING_ICON_SIZE(21 px) and vertically centered, alongside the existing leadingicon. Coexists withtrailingtext, 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()— returnfalseto keep themin_size == max_sizepin fromwindow_size_hintfor the toplevel's lifetime, declaring a fixed-size window compositors must not resize. Defaulttrue. -
App::claims_raw_touch()— returntrueto receive the primary finger through the rawon_touch_down/move/upstream, 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, defaultFluid). NewLengthconstructors —orient( portrait, landscape )(a percentage of the width in portrait, of the height in landscape),fluid( px )(surface-proportional, calibrated againstset_fluid_referenceand bounded byFLUID_MIN/FLUID_MAX),dp( px )(constant physical size scaled byset_density/density), andwidget( px )(picks fluid or dp per the active mode).Canvas::geom_px(geometry, physical layout space) andCanvas::font_px(font, bridging the logical / physical split per mode) give widgets and apps one resolution path. -
Button::font_size/height/widthandTextEdit::heightbuilders, allimpl Into<Length>, so control boxes scale with the surface.Text::line_height( mult )opens the gap between wrapped lines.Separator::pad_v(withLength::px( 0.0 )for a flush divider). -
Performance guardrails: opt-in diagnostics via
LTK_PERF_WARN=1(stuck animation, sustained software-render animation, lowpoll_interval) and a ~30 Hz software-animation cap overridable withApp::cap_software_animation. -
grid_min_cell( width )andWrapGrid::max_columns( n )— adaptive grid: the column count is derived at layout time from the available width so every cell is at leastwidthwide (anyLength; never fewer than one column), re-derived on every resize;max_columnscaps 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 aColumn, mirroring its leftover-width behaviour in aRow— 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_sizeand theOrientationenum — the runtime records the main surface's physical dimensions on every configure, soview()can branch a layout on portrait vs landscape (match ltk::orientation() { … }) without trackingon_resizeby hand; the portrait/landscape rule matchesLength::orient(square counts as portrait). Embedders drivingcore::UiSurfacedirectly callset_viewport_sizethemselves.examples/clip_path.rsdemonstrates it. -
test-supportCargo feature gates thetest_supportmodule so third-party builds never see it (ltk's ownmake testenables it).
Changed
- Breaking:
App::app_id,App::save_stateandApp::restore_stateare new mandatory trait methods — every implementor must add them (shell components: constant id,None, no-op).xdg_toplevel.set_app_idand the AccessKit application name now come fromapp_id()(previously"ltk"/"ltk-app"); theapp_idelement of the deprecatedwindow_configtuple is ignored. Crate version bumped to 0.3.0. Button::icon_sizetakesimpl Into<Length>and resolves throughCanvas::resolve_geom, joiningfont_size/height/width. A baref32still meansLength::px— every existing call keeps its exact size — but a caller can now passLength::widget( n )to have an icon button follow the widget-scaling mode the way stock icons do. Without it an expliciticon_sizewas the one geometry setter that ignored the mode, so a 21 px back arrow sat next to alist_itemchevron that fluid sizing had grown well past 21 and looked visibly smaller.Length::dpnow applies the density at resolution time, not at construction. The value carries its design pixels in a newLengthBase::Dpvariant andresolvemultiplies by the density in effect when it runs, so aset_densitychange takes effect on the next paint without rebuilding the view's lengths — previously adpvalue 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::sizeis now( Length, Length )(was( u32, u32 )), resolved against the main surface when the overlay is materialized; wrap existing sizes inLength::px( … )for the old fixed behaviour.TextEdit::font_size,TextEdit::fixed_widthandSeparator::thicknessnow takeimpl Into<Length>(weref32), resolved like the button label (font space) / geometry space; thef32sentinels are gone (f32call sites still compile viaInto<Length>).- Dependency pins:
fontdue = "=0.9.3"andignore = "=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::dpchanged meaning — it used to be a surface-proportional value, and that behaviour now lives onLength::fluid;dpis 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
- Rows no longer spill their children out of the layout.
Rowdistributed leftover width but had no notion of a shortfall:leftoverfloored 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, andRow::no_shrink()opts out for strips deliberately wider than their viewport.Buttonelides 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 withListItem. ListItemlabels 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 whatTextalready 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 measuresfont_size + 4and 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_widthnow takesimpl Into<Length>(f32 call sites keep compiling as fixed px) and the default isLength::fluid( 480.0 ), matching the buttons' scaling curve. App::on_pointer_axisnow 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'sCARD_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 isCARD_PADDINGalone; 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 nowLength::fluid( 72.0 )— the same curve and clamp factors as the font, so both scale in lockstep. - Content inside a
scrollno longer renders smaller than the rest of the surface. Scroll viewports draw their child into a sub-canvas sized to the viewport rect, and fluidLengthresolution (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 aVectorDrawablemask. Seeexamples/clip_path.rs.Canvas::fill_path/Canvas::stroke_pathover a newPathCmdcommand list (MoveTo/LineTo/QuadTo/CubicTo/Close, in surface coordinates) — renders an arbitrary vector path, aPath, aVectorDrawableor 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_softwarelets 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 liveCanvas, 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_clippedadditionally clips the child's subtree to a rect (Android'sclipChildren): overflowing content is not painted.ExternalSource::Cpuand theExternal::cpuconstructor — 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 customView.onDrawstraight onto the ltk canvas without a GL texture round-trip, unlike the existingTexturesource which only renders on GLES.RichTextwidget — wrapped paragraph text carrying aMsgper 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 AndroidSpannedcarryingURLSpan/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.