Tidy up after the sizing rework

The caps model landed in pieces, and the pieces left seams. This joins them
up, and fixes two things the reread turned up.

Deferred subsurface syncing is gone. `needs_tiles` existed because `select`
had no queue handle to sync with, so main.rs grew a bespoke event loop to
notice the flag afterwards. The dispatch handlers are handed a handle
already: pass it down and let `select` do the work itself. main.rs is back
to one uniform `pump`.

The layout is built once, in run(), and passed to App::new, rather than
built there and again inside it. `display` moves from Settings, which is
what App needs, to Options, which is what the caller needs it for.

`timeout = 0` meant an immediate deadline, so uncommenting the line in the
shipped config would have made wl-pick exit before you saw it. Zero now
means no timeout, which is what the comment beside it always claimed.

`timeout` was also settable but documented nowhere -- not in --help, not in
the README. Both now list every key config.rs accepts.

Theme::default's max-width/max-height were placeholder pixel counts that
happened to match one monitor. They are i32::MAX now: no cap of their own,
with Layout clamping to the display.
This commit is contained in:
Milad Alizadeh
2026-09-06 11:01:11 +01:00
parent 86319aa309
commit 1f5b735541
7 changed files with 77 additions and 69 deletions
+3 -10
View File
@@ -56,12 +56,9 @@ pub struct Settings {
pub theme: Theme,
pub live: Live,
pub fps: u32,
/// Integer scale of the display the overlay renders on.
/// Integer scale of the display the overlay renders on, and its name, so
/// the overlay maps there rather than wherever the compositor would put it.
pub scale: i32,
/// That display's logical size, which the grid is fitted into.
pub display: (i32, i32),
/// And its name, so the overlay maps there rather than wherever the
/// compositor would have put it.
pub output: String,
}
@@ -90,8 +87,6 @@ pub struct App {
pub(crate) sel: usize,
/// First row of the grid on screen. The rest scroll.
pub(crate) scroll: i32,
/// Set when the viewport moved and the subsurfaces need re-placing.
pub(crate) needs_tiles: bool,
pub(crate) shift: bool,
/// Where the pointer is, and which tile it pressed. Hovering deliberately
@@ -158,16 +153,15 @@ impl App {
qh: &QueueHandle<Self>,
targets: Vec<Target>,
settings: Settings,
layout: Layout,
) -> Result<Self, Box<dyn Error>> {
let Settings {
theme,
live,
fps,
scale,
display,
output,
} = settings;
let layout = Layout::new(&theme, targets.len() as i32, display);
// Bind everything up front so a compositor missing a protocol fails
// here, with a name, rather than halfway through a capture.
let mut app = Self {
@@ -190,7 +184,6 @@ impl App {
scale,
sel: 0,
scroll: 0,
needs_tiles: false,
shift: false,
hover: None,
pressed: None,