From 304f3a374408bb6a5a04ebb7d4652c631395f5c6 Mon Sep 17 00:00:00 2001 From: srdusr <99972264+srdusr@users.noreply.github.com> Date: Sun, 26 Oct 2025 22:58:00 +0200 Subject: Live-expose monitor split, clean up leftover debug diagnostics srd.monitor.split only ever ran at Lua config load despite being a plain WindowManager mutation that every backend's monitors() already reads fresh on each call. Adds srd dispatch set output split [rows|columns] (IPC set_monitor_split), same id-resolves-to-name pattern set_output_enabled already uses. Also removes eight log::warn!("XXX-DIAG ...") lines left behind from live debugging in the multi-session shift that landed in 3c41fc4 - the same "temporary, never removed" pattern already fixed twice earlier this session. Several fired on genuinely constant interaction (every title change, every workspace switch, every layer-shell surface hide), not just a one-off leftover. Left xdg_shell.rs's own POPUP-GEOM-DIAG/ POPUP-GRAB-DIAG alone - that one is a still-open, self-documented investigation, not litter. Also documents (docs/TODO.md, not a code change) a live incident where creating a second fake monitor visibly corrupted the real monitor's position and kept drifting with no further input - not root-caused srdwm-side, flagged to the AGS peer session since a fake monitor's real wl_output global is indistinguishable from a real hotplug to GDK/GTK. And documents a deliberate decision not to blind-port window decoration rendering onto the experimental, never-live-tested GPU render path. --- crates/platform/src/ipc/dispatch.rs | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'crates/platform/src/ipc/dispatch.rs') diff --git a/crates/platform/src/ipc/dispatch.rs b/crates/platform/src/ipc/dispatch.rs index 313a79c..665cb59 100644 --- a/crates/platform/src/ipc/dispatch.rs +++ b/crates/platform/src/ipc/dispatch.rs @@ -219,7 +219,6 @@ pub(crate) fn handle_request(line: &[u8], wm: &std::rc::Rc { let Some(id) = id else { return (err("missing id"), false) }; - let before = wm.borrow().current_workspace(); // `switch_workspace_on_monitor` falls straight through to the // ordinary shared-mode `switch_workspace` when `workspace. // per_monitor` is off, so this is the one call site that works @@ -239,9 +238,6 @@ pub(crate) fn handle_request(line: &[u8], wm: &std::rc::Rc = wm.borrow().workspaces().iter().map(|w| w.id).collect(); - log::warn!("WS-IPC-DIAG requested_id={id} before={before} after={after} known_ids={known:?}"); (ok(), true) } // `{"cmd":"set_output_position","id":,"x":,"y":}` @@ -322,6 +318,34 @@ pub(crate) fn handle_request(line: &[u8], wm: &std::rc::Rc, + // "rows":}` - 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. + "set_monitor_split" => { + let name = match req.get("name").and_then(|v| v.as_str()) { + Some(name) => Some(name.to_string()), + None => id.and_then(|id| wm.borrow().monitors().iter().find(|m| m.id == id as srdwm_core::MonitorId).map(|m| m.name.clone())), + }; + let Some(name) = name else { return (err("missing name, or an id matching a currently-connected monitor"), false) }; + let Some(parts) = req.get("parts").and_then(|v| v.as_u64()) else { + 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); + (ok(), true) + } // `{"cmd":"capture_workspace","id":,"path":, // "width":,"height":}` - `width`/`height` are optional, // both or neither. Exists for a workspace switcher's thumbnail -- cgit v1.2.3