srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/crates/core/src/manager/input_pin.rs
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2025-11-07 14:04:00 +0200
committersrdusr <[email protected]>2025-11-07 14:04:00 +0200
commitea78f94027ecd2c690904a6d7729e9e3cc190a20 (patch)
treefe622c0cd12a2fe077501a26f0077c51d41b4209 /crates/core/src/manager/input_pin.rs
parenta8991f65602abc5ecee740c443c58fa96ecd15e1 (diff)
downloadsrdwm-ea78f94027ecd2c690904a6d7729e9e3cc190a20.tar.gz
srdwm-ea78f94027ecd2c690904a6d7729e9e3cc190a20.zip
Make tiling's master/stack ratio live, add settings readback everywhere
Investigated the "tiling needs a lot of work" report directly. The MasterStackLayout algorithm itself was already correct; the real gap was that dragging or resizing a tiled window did nothing durable (raw geometry that the next arrange_workspace silently discarded), and master_ratio/master_count had no live path at all (config-file only). A resize-drag on the shared master/stack boundary now live-adjusts TilingConfig::master_ratio and re-arranges the group immediately; srd set master_ratio/master_count do the same for a keybind or script. Found and fixed a real bug while building this: start_resize's own focus_window call re-stacks its target in self.order before the ratio-drag decision used to be made, silently misclassifying real master-column grabs. Fixed by deciding ratio-drag status (and freezing the membership snapshot it depends on) before that raise happens, applying MasterStackLayout directly against the frozen snapshot rather than re-deriving membership from the by-then-reordered live order. Live- verified in a nested compositor, not just unit-tested. Also closes the readback gaps flagged directly by the AGS peer session: border_width/border_color/corner_radius/decoration_mode/gap_inner/ gap_outer/master_ratio/master_count were all live-settable via srd set with no way to read the current value back, and pin_input had no readback at all. SettingsResponse now reports all of them; a new pinned_inputs query (srd pinned inputs) lists every currently pinned pid/window.
Diffstat (limited to 'crates/core/src/manager/input_pin.rs')
-rw-r--r--crates/core/src/manager/input_pin.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/crates/core/src/manager/input_pin.rs b/crates/core/src/manager/input_pin.rs
index e3a7fbf..9280004 100644
--- a/crates/core/src/manager/input_pin.rs
+++ b/crates/core/src/manager/input_pin.rs
@@ -32,6 +32,38 @@ impl WindowManager {
pub fn drain_pin_input_requests(&mut self) -> Vec<(i32, Option<WindowId>)> {
std::mem::take(&mut self.pin_input_requests)
}
+
+ /// Records `pid`'s *actual current* pin state, once the Wayland
+ /// backend has genuinely applied it (`CompState::
+ /// set_virtual_pointer_pin`) - not the request queue above, which is
+ /// drained and forgotten the instant the backend picks it up. Without
+ /// this there was no readback path at all: an IPC caller could ask to
+ /// pin a window blind, but never confirm the pin actually took, or ask
+ /// "is pid X pinned to anything right now" later. Flagged directly by
+ /// the AGS peer session as exactly this gap.
+ pub fn set_pinned_window(&mut self, pid: i32, window: Option<WindowId>) {
+ match window {
+ Some(w) => {
+ self.pinned_windows.insert(pid, w);
+ }
+ None => {
+ self.pinned_windows.remove(&pid);
+ }
+ }
+ }
+
+ /// `pid`'s currently pinned window, if any - the read side of
+ /// `set_pinned_window`.
+ pub fn pinned_window(&self, pid: i32) -> Option<WindowId> {
+ self.pinned_windows.get(&pid).copied()
+ }
+
+ /// Every currently pinned pid and its window - what the IPC
+ /// `"pinned_inputs"` query lists in full, rather than requiring a
+ /// caller to already know which pids to ask about individually.
+ pub fn all_pinned_windows(&self) -> impl Iterator<Item = (i32, WindowId)> + '_ {
+ self.pinned_windows.iter().map(|(&pid, &w)| (pid, w))
+ }
}
#[cfg(test)]