The signalfd-based source (calloop's `signals` feature) needs SIGTERM and SIGINT blocked in every thread of the process, since the kernel hands a process-directed signal to any thread that does not block it. calloop only blocks them in the thread that creates the source, so the runtime depended on `ltk::run` being entered before the app spawned any thread — a constraint apps do not honour: crustace-notifier builds its tokio runtime and its D-Bus thread first, and in that configuration a SIGTERM lands on a tokio worker and kills the process outright, skipping the clean exit (`save_state`, `mark_clean_exit`) entirely. The blocked mask had a second consequence: it is inherited across fork and exec, and Rust's std deliberately does not reset it in the child. Every process an ltk app spawns from a thread created after `ltk::run` therefore started with SIGTERM blocked. For the `gsettings monitor` child of the text-scale watcher this meant it never died on systemd's stop, so the unit's cgroup stayed populated until `TimeoutStopSec` (90 s) expired and systemd resorted to SIGKILL — visible as a stop job holding up every session shutdown. `install_signal_source` now installs a `sigaction` handler for SIGTERM and SIGINT that writes the signal number to a non-blocking `O_CLOEXEC` pipe (an atomic load and a `write`, errno preserved); the read end is a calloop `Generic` source that drains the pipe and sets `exit_requested`. A handler is process-wide, so the clean exit works no matter which thread receives the signal or when it was created, and no thread blocks anything, so children inherit a clean mask. `SA_RESTART` keeps the handler from injecting spurious EINTRs into the app's own threads; the pipe wakes the event loop regardless. `text_scale` additionally clears the child's mask in `pre_exec` before running `gsettings`, as a guard against a mask already dirty when the process was launched. The `save_state` docs drop the caveat about threads started before `run`, the ordering comment at the call site goes with the constraint it described, and the `signals` feature is dropped from calloop. `libc` becomes a direct dependency for `sigaction`, `pipe2` and `sigprocmask`. Tests: `child_starts_with_clear_signal_mask` blocks SIGTERM in the test thread, spawns a child through the helper and checks its `SigBlk` in `/proc`, with the inverse control asserting that std really does inherit the mask (the reason the helper exists); `handler_writes_signal_to_pipe` exercises the handler directly and through a real `sigaction` + `raise`, then restores `SIG_DFL`.
74 lines
2.9 KiB
TOML
74 lines
2.9 KiB
TOML
[package]
|
|
name = "ltk"
|
|
version = "0.3.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.3"
|
|
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"
|
|
# Transitive dep of rust-i18n (globwalk → ignore); 0.4.24+ needs a rustc
|
|
# newer than Debian's 1.85, and its manifest does not declare that MSRV.
|
|
ignore = "=0.4.23"
|
|
libc = "0.2"
|
|
wayland-protocols = { version = "0.32", features = ["client", "unstable", "staging"] }
|
|
wayland-egl = "0.32"
|
|
wayland-scanner = "0.31"
|
|
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
|