aboutsummaryrefslogtreecommitdiff
path: root/src/layout.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2023-12-19 20:56:00 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-12-19 20:56:00 +0400
commite259061cbcfaf3a52a9eb2016b949cdc42e45db3 (patch)
tree9c6a3c4ba1f3d282e017599474280a0fd828e106 /src/layout.rs
parent206493bb354fd56140e8bf00592c6dd683a6a117 (diff)
downloadniri-e259061cbcfaf3a52a9eb2016b949cdc42e45db3.tar.gz
niri-e259061cbcfaf3a52a9eb2016b949cdc42e45db3.tar.bz2
niri-e259061cbcfaf3a52a9eb2016b949cdc42e45db3.zip
Implement popup unconstraining
Using my new Smithay implementation.
Diffstat (limited to 'src/layout.rs')
-rw-r--r--src/layout.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/layout.rs b/src/layout.rs
index 86cc7d70..b53529f5 100644
--- a/src/layout.rs
+++ b/src/layout.rs
@@ -795,6 +795,33 @@ impl<W: LayoutElement> Layout<W> {
None
}
+ pub fn window_y(&self, window: &W) -> Option<i32> {
+ match &self.monitor_set {
+ MonitorSet::Normal { monitors, .. } => {
+ for mon in monitors {
+ for ws in &mon.workspaces {
+ for col in &ws.columns {
+ if let Some(idx) = col.windows.iter().position(|w| w == window) {
+ return Some(col.window_y(idx));
+ }
+ }
+ }
+ }
+ }
+ MonitorSet::NoOutputs { workspaces, .. } => {
+ for ws in workspaces {
+ for col in &ws.columns {
+ if let Some(idx) = col.windows.iter().position(|w| w == window) {
+ return Some(col.window_y(idx));
+ }
+ }
+ }
+ }
+ }
+
+ None
+ }
+
pub fn update_output_size(&mut self, output: &Output) {
let MonitorSet::Normal { monitors, .. } = &mut self.monitor_set else {
panic!()