From a4710d792a1b16698fc30b9e97e6c08c82129d6d Mon Sep 17 00:00:00 2001 From: srdusr <99972264+srdusr@users.noreply.github.com> Date: Wed, 29 Oct 2025 22:24:00 +0200 Subject: 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. --- crates/wayland/src/udev/platform.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'crates/wayland') diff --git a/crates/wayland/src/udev/platform.rs b/crates/wayland/src/udev/platform.rs index 4012e3c..37abf5d 100644 --- a/crates/wayland/src/udev/platform.rs +++ b/crates/wayland/src/udev/platform.rs @@ -603,6 +603,19 @@ impl Platform for UdevPlatform { self.pending.borrow_mut().push(CoreEvent::MonitorAdded(srdwm_core::Monitor::new(0, "", srdwm_core::Rect::new(0, 0, 0, 0)))); } } + // Applies any `srd dispatch set output split` IPC requests queued + // since the last poll - see `WindowManager::monitor_split_ + // requests`'s own doc comment for why this needs the same "apply, + // then push a recompute event" shape `set_output_position`'s own + // drain just above uses, rather than `set_monitor_split` being + // called straight from the IPC dispatch handler. + let split_requests = self.state.wm.borrow_mut().drain_monitor_split_requests(); + if !split_requests.is_empty() { + for (name, parts, rows) in split_requests { + self.state.wm.borrow_mut().set_monitor_split(name, parts, rows); + } + self.pending.borrow_mut().push(CoreEvent::MonitorAdded(srdwm_core::Monitor::new(0, "", srdwm_core::Rect::new(0, 0, 0, 0)))); + } // Applies any `srd set_output_enabled` IPC requests queued since // the last poll - `disable_connector_by_name`/`enable_connector_ // by_name` already push their own `MonitorRemoved`/`MonitorAdded` -- cgit v1.2.3