aboutsummaryrefslogtreecommitdiff
path: root/src/layout
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2025-06-09 13:39:08 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2025-06-09 13:39:55 +0300
commit206673702452b4bcab1851fb2b17cdfa0682f6fd (patch)
tree7b6a395d9d294bb8f5ed3acd026de2e25ee7eaf6 /src/layout
parentf918eabe6a144e78c62c3fc0cfa7fe32e4623e5a (diff)
downloadniri-206673702452b4bcab1851fb2b17cdfa0682f6fd.tar.gz
niri-206673702452b4bcab1851fb2b17cdfa0682f6fd.tar.bz2
niri-206673702452b4bcab1851fb2b17cdfa0682f6fd.zip
layout/scrolling: Inline popup_target_rect up to ScrollingSpace
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/scrolling.rs40
1 files changed, 18 insertions, 22 deletions
diff --git a/src/layout/scrolling.rs b/src/layout/scrolling.rs
index e2d3a6db..63569064 100644
--- a/src/layout/scrolling.rs
+++ b/src/layout/scrolling.rs
@@ -2437,9 +2437,24 @@ impl<W: LayoutElement> ScrollingSpace<W> {
}
pub fn popup_target_rect(&self, id: &W::Id) -> Option<Rectangle<f64, Logical>> {
- self.columns
- .iter()
- .find_map(|col| col.popup_target_rect(id))
+ for col in &self.columns {
+ for (tile, pos) in col.tiles() {
+ if tile.window().id() == id {
+ // In the scrolling layout, we try to position popups horizontally within the
+ // window geometry (so they remain visible even if the window scrolls flush with
+ // the left/right edge of the screen), and vertically wihin the whole view size.
+ let width = tile.window_size().w;
+ let height = self.view_size.h;
+
+ let mut target = Rectangle::from_size(Size::from((width, height)));
+ target.loc.y -= pos.y;
+ target.loc.y -= tile.window_loc().y;
+
+ return Some(target);
+ }
+ }
+ }
+ None
}
pub fn toggle_width(&mut self) {
@@ -4756,25 +4771,6 @@ impl<W: LayoutElement> Column<W> {
self.update_tile_sizes(true);
}
- fn popup_target_rect(&self, id: &W::Id) -> Option<Rectangle<f64, Logical>> {
- for (tile, pos) in self.tiles() {
- if tile.window().id() == id {
- // In the scrolling layout, we try to position popups horizontally within the
- // window geometry (so they remain visible even if the window scrolls flush with
- // the left/right edge of the screen), and vertically wihin the whole view size.
- let width = tile.window_size().w;
- let height = self.view_size.h;
-
- let mut target = Rectangle::from_size(Size::from((width, height)));
- target.loc.y -= pos.y;
- target.loc.y -= tile.window_loc().y;
-
- return Some(target);
- }
- }
- None
- }
-
fn tiles_origin(&self) -> Point<f64, Logical> {
let mut origin = Point::from((0., 0.));