diff options
| author | srdusr <[email protected]> | 2025-10-29 22:24:00 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2025-10-29 22:24:00 +0200 |
| commit | a4710d792a1b16698fc30b9e97e6c08c82129d6d (patch) | |
| tree | 9d56a3c2106db783e1fad0cf817ecc1d7510bd8f /crates/platform/src/ipc/dispatch.rs | |
| parent | 9592fd7acb5b68f3fae139dfac22b728c35b6198 (diff) | |
| download | srdwm-a4710d792a1b16698fc30b9e97e6c08c82129d6d.tar.gz srdwm-a4710d792a1b16698fc30b9e97e6c08c82129d6d.zip | |
Fix set_monitor_split never actually reaching srd monitors
Live-tested right after shipping it and caught immediately: srd dispatch
set output split returned ok, but srd monitors kept reporting the whole,
unsplit output. WindowManager::monitors is a passive cache, only
refreshed when a backend re-queries and calls set_monitors again - the
IPC handler mutated the split map directly but never triggered that
requery, unlike set_output_position's own drain site, which already
pushes a "just go recompute" event after applying.
Makes it a proper queued cross-boundary request instead, the same shape
as every other backend-owned effect on this socket: WindowManager::
request_monitor_split/drain_monitor_split_requests, dispatch queues
instead of mutating, the udev backend's poll drains it, applies via
set_monitor_split, and pushes the same recompute event. srd.monitor.
split's Lua config-time path is untouched - it runs before the very
first startup query, so it never had this problem.
Diffstat (limited to 'crates/platform/src/ipc/dispatch.rs')
| -rw-r--r-- | crates/platform/src/ipc/dispatch.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/crates/platform/src/ipc/dispatch.rs b/crates/platform/src/ipc/dispatch.rs index 665cb59..918b7e0 100644 --- a/crates/platform/src/ipc/dispatch.rs +++ b/crates/platform/src/ipc/dispatch.rs @@ -322,17 +322,17 @@ pub(crate) fn handle_request(line: &[u8], wm: &std::rc::Rc<std::cell::RefCell<Wi // "rows":<bool, optional, default false>}` - the live CLI/IPC path // for `srd.monitor.split(name, parts, direction)` (`crates/config/ // src/engine/general.rs`'s own `fn_monitor_split`), which until now - // only ever ran once at config load. `WindowManager:: - // set_monitor_split` just mutates `monitor_splits`, and every - // backend's own `monitors()` already reads that map fresh on every - // single call (see the udev platform's own `monitors()`) - so, - // unlike `set_output_position`/`set_output_enabled` above, this - // needs no queue-and-drain at all: the very next `monitors()` query - // already reflects it. `parts` <= 1 clears an existing split, same - // as the Lua function. Same "resolve id to a name first" fallback - // `set_output_enabled` above already uses, since a caller working - // from a numeric id shouldn't have to look the name up itself - // first just to turn around and split it. + // only ever ran once at config load. Queued via `request_monitor_ + // split`, same cross-boundary "core has no way to trigger its own + // requery" reasoning as `set_output_position` above - see + // `WindowManager::monitor_split_requests`'s own doc comment for the + // real, live-reproduced staleness bug that came from calling + // `set_monitor_split` directly here on a first attempt. `parts` <= + // 1 clears an existing split, same as the Lua function. Same + // "resolve id to a name first" fallback `set_output_enabled` above + // already uses, since a caller working from a numeric id shouldn't + // have to look the name up itself first just to turn around and + // split it. "set_monitor_split" => { let name = match req.get("name").and_then(|v| v.as_str()) { Some(name) => Some(name.to_string()), @@ -343,7 +343,7 @@ pub(crate) fn handle_request(line: &[u8], wm: &std::rc::Rc<std::cell::RefCell<Wi return (err("missing parts"), false); }; let rows = req.get("rows").and_then(|v| v.as_bool()).unwrap_or(false); - wm.borrow_mut().set_monitor_split(name, parts as u32, rows); + wm.borrow_mut().request_monitor_split(name, parts as u32, rows); (ok(), true) } // `{"cmd":"capture_workspace","id":<workspace id>,"path":<string>, |