Responsive scaling. ltk now offers two first-class ways to size a UI so it adapts across screens, chosen per process via `WidgetScaling { Fluid, Physical }` (`set_widget_scaling` / `widget_scaling`, default `Fluid`). Fluid sizing (`Length::fluid( px )`) makes a design pixel a proportion of the surface's smaller side, calibrated against a reference width (`set_fluid_reference` / `fluid_reference`, 412 px default) and bounded by `FLUID_MIN` / `FLUID_MAX`; physical sizing (`Length::dp( px )`) is a constant-physical-size pixel scaled by display density (`set_density` / `density`). `Length` gains `orient( portrait, landscape )` — resolve one value in portrait, another in landscape — plus `widget( px )`, which picks fluid or dp per the active mode. Canvas exposes `geom_px` (geometry, resolved in physical layout space) and `font_px` (font size, bridging logical / physical per mode) so widgets and apps share one resolution path. Note the rename: `set_design_reference` / `design_reference` became `set_fluid_reference` / `fluid_reference`, and `Length::dp` changed meaning — the old surface-proportional behaviour now lives on `Length::fluid`.
Widgets. Every stock widget resolves its default geometry and font through the widget-scaling mode instead of frozen pixels, so a whole UI scales coherently without per-call units. New size builders where they were missing: `button` gains `font_size` / `height`, `text_edit` gains `height` / `font_size_fluid`, `separator` gains `pad_v`, and assorted widgets accept a `Length` where they previously took only `f32`.
Overlays. `OverlaySpec::size` is now `( Length, Length )` instead of `( u32, u32 )`, resolved against the main surface when the overlay is materialized, so overlays can scale with the display; `Length::px( … )` reproduces the old fixed sizing.
API stabilization (toward 1.0). Widget struct fields are now `pub( crate )` — they are configured through builders, not field access — except the value / state types apps genuinely read or construct (`Time`, `Date`, `ComboState`), which stay public. The internal `test_support` helpers move behind a `test-support` Cargo feature (off by default, so third-party builds never see them; ltk's own `make test` enables it). `Separator` drops its `0.0`-means-mode sentinel for `Option<Length>`, so an explicit `pad_v( 0.0 )` is a real flush divider distinct from the mode-following default.
Performance guardrails. Opt-in diagnostics via `LTK_PERF_WARN=1` warn about stuck animations, sustained software-render animation, and low `poll_interval`; software-rendered animation is capped near 30 Hz to spare CPU on machines that fall back off EGL. Apps can override the cap with `App::cap_software_animation`.
Docs and build. The two scaling modes are documented in README, onboarding and architecture, with the earlier gradient / backdrop doc drift cleaned up. The Makefile now ships the `locales/` directory into the packaged crate (fixing i18n keys rendering raw for downstreams), builds the new `responsive` example, and runs tests with `--features test-support`.
69 lines
2.7 KiB
TOML
69 lines
2.7 KiB
TOML
[package]
|
|
name = "ltk"
|
|
version = "0.2.0"
|
|
edition = "2021"
|
|
rust-version = "1.85"
|
|
# MSRV-aware resolver: keep a fresh resolve on deps compatible with rust-version (Debian stable = 1.85).
|
|
resolver = "3"
|
|
license = "LGPL-2.1-only"
|
|
description = "Lightweight declarative Wayland UI toolkit. Elm-shaped App / view / update model with GLES and software rendering backends, layer-shell support, runtime theming and a runtime-free core surface for embedding."
|
|
repository = "https://github.com/liberux/ltk"
|
|
documentation = "https://docs.rs/ltk"
|
|
homepage = "https://liberux.net"
|
|
readme = "README.md"
|
|
keywords = [ "wayland", "ui", "gui", "toolkit", "layer-shell" ]
|
|
categories = [ "gui", "rendering", "os::linux-apis" ]
|
|
authors = [ "Liberux Labs, S. L. <info@liberux.net>" ]
|
|
exclude = [
|
|
"target/*",
|
|
"debian/*",
|
|
"themes/*",
|
|
"liberux.toml",
|
|
"TODO",
|
|
]
|
|
|
|
[features]
|
|
# Exposes `ltk::test_support` — internal helpers (widget handlers, laid-out
|
|
# widget lookup, slider math) used only by ltk's own integration tests. Not
|
|
# part of the stable public API; off by default so third-party builds never
|
|
# see it. `make test` enables it.
|
|
test-support = []
|
|
|
|
[dependencies]
|
|
chrono = { version = "0.4", features = ["clock"] }
|
|
serde = { version = "1.0", features = ["derive"] }
|
|
serde_json = "1.0"
|
|
smithay-client-toolkit = { version = "0.20", features = ["calloop", "calloop-wayland-source", "xkbcommon"] }
|
|
calloop = "0.14"
|
|
calloop-wayland-source = "0.4"
|
|
tiny-skia = "0.12"
|
|
fontdue = "0.9"
|
|
unicode-bidi = "0.3"
|
|
rustybuzz = "0.14"
|
|
image = { version = "=0.25.9", default-features = false, features = ["png", "jpeg", "webp"] }
|
|
resvg = "0.44"
|
|
rust-i18n = "3"
|
|
wayland-protocols = { version = "0.32", features = ["client", "unstable", "staging"] }
|
|
wayland-egl = "0.32"
|
|
khronos-egl = { version = "6", features = ["dynamic"] }
|
|
glow = "0.17"
|
|
raw-window-handle = "0.6"
|
|
# AT-SPI2 / accessibility is delegated to AccessKit so we get the same
|
|
# Node / Role / TreeUpdate model the rest of the Rust GUI ecosystem
|
|
# (egui, iced via the COSMIC fork, dioxus) is converging on. The
|
|
# Linux platform adapter (`accesskit_unix`) handles every D-Bus
|
|
# detail — registering against `org.a11y.Bus`, exposing the
|
|
# `org.a11y.atspi.Accessible` interface hierarchy, translating
|
|
# `Action`s back into our event loop, emitting state-changed signals
|
|
# — so this crate only has to construct an `accesskit::TreeUpdate`
|
|
# from `widget_rects` once per frame.
|
|
accesskit = "0.17"
|
|
accesskit_unix = "0.13"
|
|
|
|
[dev-dependencies]
|
|
criterion = { version = "0.5", features = ["html_reports"] }
|
|
|
|
[[bench]]
|
|
name = "lookup"
|
|
harness = false
|