forge
Explore
Log in

Don't you dare go Hollow

layout/scrolling: Inline popup_target_rect up to ScrollingSpace

Browse files at this commit

206673702452b4bcab1851fb2b17cdfa0682f6fdIvan MolodetskikhParent: f918eab
src/layout/scrolling.rsmodified+18 -22
@@ -2437,9 +2437,24 @@ impl<W: LayoutElement> ScrollingSpace<W> {
2437 }2437 }
2438 2438
2439 pub fn popup_target_rect(&self, id: &W::Id) -> Option<Rectangle<f64, Logical>> {2439 pub fn popup_target_rect(&self, id: &W::Id) -> Option<Rectangle<f64, Logical>> {
2440- self.columns2440+ for col in &self.columns {
2441- .iter()2441+ for (tile, pos) in col.tiles() {
2442- .find_map(|col| col.popup_target_rect(id))2442+ if tile.window().id() == id {
2443+ // In the scrolling layout, we try to position popups horizontally within the
2444+ // window geometry (so they remain visible even if the window scrolls flush with
2445+ // the left/right edge of the screen), and vertically wihin the whole view size.
2446+ let width = tile.window_size().w;
2447+ let height = self.view_size.h;
2448+
2449+ let mut target = Rectangle::from_size(Size::from((width, height)));
2450+ target.loc.y -= pos.y;
2451+ target.loc.y -= tile.window_loc().y;
2452+
2453+ return Some(target);
2454+ }
2455+ }
2456+ }
2457+ None
2443 }2458 }
2444 2459
2445 pub fn toggle_width(&mut self) {2460 pub fn toggle_width(&mut self) {
@@ -4756,25 +4771,6 @@ impl<W: LayoutElement> Column<W> {
4756 self.update_tile_sizes(true);4771 self.update_tile_sizes(true);
4757 }4772 }
4758 4773
4759- fn popup_target_rect(&self, id: &W::Id) -> Option<Rectangle<f64, Logical>> {
4760- for (tile, pos) in self.tiles() {
4761- if tile.window().id() == id {
4762- // In the scrolling layout, we try to position popups horizontally within the
4763- // window geometry (so they remain visible even if the window scrolls flush with
4764- // the left/right edge of the screen), and vertically wihin the whole view size.
4765- let width = tile.window_size().w;
4766- let height = self.view_size.h;
4767-
4768- let mut target = Rectangle::from_size(Size::from((width, height)));
4769- target.loc.y -= pos.y;
4770- target.loc.y -= tile.window_loc().y;
4771-
4772- return Some(target);
4773- }
4774- }
4775- None
4776- }
4777-
4778 fn tiles_origin(&self) -> Point<f64, Logical> {4774 fn tiles_origin(&self) -> Point<f64, Logical> {
4779 let mut origin = Point::from((0., 0.));4775 let mut origin = Point::from((0., 0.));
4780 4776