srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/crates/core/src/manager/monitors.rs
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2024-11-26 23:16:00 +0200
committersrdusr <[email protected]>2024-11-26 23:16:00 +0200
commit87f5c04b2593dc49409644e69e7962b73d26b9d8 (patch)
tree5a1da319c9f5e81489af44a4a576eada595b9a22 /crates/core/src/manager/monitors.rs
parentfe92f6e6b8ab680c9603cc6bcf16c98555c378ae (diff)
downloadsrdwm-87f5c04b2593dc49409644e69e7962b73d26b9d8.tar.gz
srdwm-87f5c04b2593dc49409644e69e7962b73d26b9d8.zip
Add Monitor::maximize_geometry: maximize covers a dock, still stops at a top bar
toggle_maximize previously targeted full_geometry outright (past every reserved zone), on an earlier request specifically about the dock - which also silently let it extend behind a top bar's zone, reported back as its own bug once live-tested. maximize_geometry is a third rect distinct from geometry (every zone) and full_geometry (none): full_geometry with only a top-anchored bar's exclusive zone subtracted back out. New test locks in dock-covered/bar-respected together.
Diffstat (limited to 'crates/core/src/manager/monitors.rs')
-rw-r--r--crates/core/src/manager/monitors.rs34
1 files changed, 33 insertions, 1 deletions
diff --git a/crates/core/src/manager/monitors.rs b/crates/core/src/manager/monitors.rs
index 173e07d..9783e14 100644
--- a/crates/core/src/manager/monitors.rs
+++ b/crates/core/src/manager/monitors.rs
@@ -74,7 +74,10 @@ impl WindowManager {
continue;
}
let Some(monitor) = live.iter().find(|m| m.id == window.monitor) else { continue };
- let target = if window.fullscreen { monitor.full_geometry } else { monitor.geometry };
+ // Maximize and fullscreen target different rects now - see
+ // `Monitor::maximize_geometry`'s doc comment for why a maximized
+ // window still stops at a top bar while fullscreen does not.
+ let target = if window.maximized { monitor.maximize_geometry } else { monitor.full_geometry };
if window.geometry != target {
window.geometry = target;
}
@@ -85,6 +88,35 @@ impl WindowManager {
&self.monitors
}
+ /// Queues a request to move output `id` to `(x, y)` in the shared
+ /// global space - the primitive monitor mirroring (and any other
+ /// output-arrangement UI) needs: position two outputs at the same
+ /// coordinates and they show the same desktop region, no separate
+ /// "mirror" concept required anywhere in this compositor. Core cannot
+ /// apply this itself (it doesn't own real output hardware - see this
+ /// field's own doc comment on `WindowManager`); the backend drains and
+ /// applies it on its own next poll via `drain_output_position_requests`.
+ ///
+ /// Replaces (not accumulates) any still-pending request for the same
+ /// `id`: only the *latest* requested position for a given output
+ /// matters if several arrive before the backend's next drain, the same
+ /// "last write wins" semantics `srd set`'s other live-config values
+ /// already have.
+ pub fn request_output_position(&mut self, id: MonitorId, x: i32, y: i32) {
+ self.output_position_requests.retain(|(existing, _, _)| *existing != id);
+ self.output_position_requests.push((id, x, y));
+ }
+
+ /// Takes every currently-queued output-position request, leaving the
+ /// queue empty. The backend calls this once per poll pass; requests
+ /// that arrive between two polls are still captured (nothing is lost
+ /// between drains, unlike a single `Option`), just coalesced to one
+ /// per output id per drain by `request_output_position`'s own
+ /// replace-not-accumulate behaviour.
+ pub fn drain_output_position_requests(&mut self) -> Vec<(MonitorId, i32, i32)> {
+ std::mem::take(&mut self.output_position_requests)
+ }
+
pub fn primary_monitor(&self) -> Option<&Monitor> {
self.monitors.iter().find(|m| m.primary).or_else(|| self.monitors.first())
}