Rendering parity (software ↔ GLES). The software backend now rounds glyph pen positions and image destinations to the nearest integer pixel, matching what the GLES backend already did; previously it truncated, so text and 1:1 images could land up to half a pixel off between the two backends and the bilinear sample read ~1 px softer than the source. Gradients and shadows are deliberately left unimplemented on the software backend, and the GLES multi-rect `glScissor` clip is left coarse on purpose: making it exact would need stencil bits the EGL config does not carry, or routing the partial-redraw path through the offscreen clip layer, which would break its `fill` / `clear_rects_transparent` scissor semantics. Adds software-backend pixel tests covering the snapping. Font resolution unification. The system-font candidate chain, `find_font_opt` and `load_default_font_bytes` lived in two copies (`render/helpers` and `gles_render/helpers`) that had already diverged — one resolved through `find_font_opt`, the other inlined the candidate loop — and now live once in `system_fonts`. The two per-backend `OnceLock` default-font caches and `primary_handle` collapse into a single `system_fonts::default_handle`. Module docs and the `font_registry` caller are updated accordingly. Shared image validation and rect inflation. `draw_image_data`'s dimension check and its one-line warning were byte-duplicated across both backends and are now `render::helpers::validate_rgba_dims`. The six manual symmetric `Rect`-inflate literals in the GLES primitives reuse the existing `Rect::expand`. FrameState and DrawCtx de-duplication. The eleven `SurfaceState` fields the draw pass owns and threads through `DrawCtx` — `widget_rects`, the cursor / selection maps, the scroll state, `accessible_extras`, `prev_focused` / `prev_hovered` / `prev_pressed` — move into a `FrameState` sub-struct. The per-frame `build_draw_ctx` / `commit_draw_ctx` helpers can then borrow `&mut ss.frame`, disjoint from `ss.canvas` and `ss.pool`, so the four frame paths (software / GLES × full / partial) replace their duplicated `DrawCtx` construction and write-back with a single helper call each. A whole-`SurfaceState` borrow could not express this (partial borrows do not cross function boundaries), which is why the helpers take the sub-struct. `content_dirty` stays on `SurfaceState` — it is an invalidation flag, not frame state — and is reset at the call site. rich_text tests. Adds the previously-missing `tests.rs` for the `RichText` widget: one hit rect per visual line a link spans (the widget's core invariant), the single-line and no-link cases, preferred-size growth with hard line breaks, and `map_msg` range preservation — all headless against a software `Canvas`, with line counts forced by `\n` so they do not depend on any system font's measured width. Documentation. Fills the rustdoc gaps on the embedder-facing surface: `core::UiSurface` accessors, the `egl_context` public API, the `GlesCanvas` methods, `theme::typography` and `theme::error`, and the `RichText` / `Text` builders; adds a crate-level "Rendering backends" overview. `CHANGELOG.md` is added (0.2.0 / 0.1.0), and `docs/widgets.md` / `docs/cookbook.md` gain `rich_text`, `external`, and the CPU-draw / path-clip / externally-laid-out-tree recipes. `debian/changelog` gets the 0.2.0-1 entry. Private intra-doc links to `system_fonts` are demoted to code spans so `cargo doc` is warning-free. Packaging. The `libltk-dev` registry crate shipped a `Cargo.toml` declaring the `lookup` bench while the `Makefile` install copied only `src/`, so Cargo refused to parse the manifest over a missing `benches/lookup.rs`; the install now ships `benches/` as well (the file alone satisfies the parse — criterion is a dev-dependency and is not resolved when the crate is consumed as a library). `Cargo.toml` is bumped to 0.2.0 to match the package version and the `ltk-0.2.0` registry directory.
62 lines
2.4 KiB
TOML
62 lines
2.4 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",
|
|
]
|
|
|
|
[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
|