forge
Explore
Log in

Don't you dare go Hollow

layout: Change active_tile_visual_rectangle() to window

Browse files at this commit

0650e7b640e94f38dcde759003d5a8dbadc847d1Ivan MolodetskikhParent: dd1c3bc
New functionality needs window specifically, and existing logic will be
fine with window too.
src/layout/floating.rsmodified+6 -5
@@ -345,16 +345,17 @@ impl<W: LayoutElement> FloatingSpace<W> {
345 compute_toplevel_bounds(border_config, self.working_area.size)345 compute_toplevel_bounds(border_config, self.working_area.size)
346 }346 }
347 347
348- /// Returns the geometry of the active tile relative to and clamped to the working area.348+ /// Returns the geometry of the active window relative to and clamped to the working area.
349 ///349 ///
350 /// During animations, assumes the final tile position.350 /// During animations, assumes the final tile position.
351- pub fn active_tile_visual_rectangle(&self) -> Option<Rectangle<f64, Logical>> {351+ pub fn active_window_visual_rectangle(&self) -> Option<Rectangle<f64, Logical>> {
352 let (tile, offset) = self.tiles_with_offsets().next()?;352 let (tile, offset) = self.tiles_with_offsets().next()?;
353 353
354- let tile_size = tile.tile_size();354+ let window_pos = offset + tile.window_loc();
355- let tile_rect = Rectangle::new(offset, tile_size);355+ let window_size = tile.window_size();
356+ let window_rect = Rectangle::new(window_pos, window_size);
356 357
357- self.working_area.intersection(tile_rect)358+ self.working_area.intersection(window_rect)
358 }359 }
359 360
360 pub fn popup_target_rect(&self, id: &W::Id) -> Option<Rectangle<f64, Logical>> {361 pub fn popup_target_rect(&self, id: &W::Id) -> Option<Rectangle<f64, Logical>> {
src/layout/monitor.rsmodified+3 -3
@@ -1342,15 +1342,15 @@ impl<W: LayoutElement> Monitor<W> {
1342 self.clean_up_workspaces();1342 self.clean_up_workspaces();
1343 }1343 }
1344 1344
1345- /// Returns the geometry of the active tile relative to and clamped to the output.1345+ /// Returns the geometry of the active window relative to and clamped to the output.
1346 ///1346 ///
1347 /// During animations, assumes the final view position.1347 /// During animations, assumes the final view position.
1348- pub fn active_tile_visual_rectangle(&self) -> Option<Rectangle<f64, Logical>> {1348+ pub fn active_window_visual_rectangle(&self) -> Option<Rectangle<f64, Logical>> {
1349 if self.overview_open {1349 if self.overview_open {
1350 return None;1350 return None;
1351 }1351 }
1352 1352
1353- self.active_workspace_ref().active_tile_visual_rectangle()1353+ self.active_workspace_ref().active_window_visual_rectangle()
1354 }1354 }
1355 1355
1356 fn workspace_size(&self, zoom: f64) -> Size<f64, Logical> {1356 fn workspace_size(&self, zoom: f64) -> Size<f64, Logical> {
src/layout/scrolling.rsmodified+6 -6
@@ -2540,10 +2540,10 @@ impl<W: LayoutElement> ScrollingSpace<W> {
2540 Some(hint_area)2540 Some(hint_area)
2541 }2541 }
2542 2542
2543- /// Returns the geometry of the active tile relative to and clamped to the view.2543+ /// Returns the geometry of the active window relative to and clamped to the view.
2544 ///2544 ///
2545 /// During animations, assumes the final view position.2545 /// During animations, assumes the final view position.
2546- pub fn active_tile_visual_rectangle(&self) -> Option<Rectangle<f64, Logical>> {2546+ pub fn active_window_visual_rectangle(&self) -> Option<Rectangle<f64, Logical>> {
2547 let col = self.columns.get(self.active_column_idx)?;2547 let col = self.columns.get(self.active_column_idx)?;
2548 2548
2549 let final_view_offset = self.view_offset.target();2549 let final_view_offset = self.view_offset.target();
@@ -2551,12 +2551,12 @@ impl<W: LayoutElement> ScrollingSpace<W> {
2551 2551
2552 let (tile, tile_off) = col.tiles().nth(col.active_tile_idx).unwrap();2552 let (tile, tile_off) = col.tiles().nth(col.active_tile_idx).unwrap();
2553 2553
2554- let tile_pos = view_off + tile_off;2554+ let window_pos = view_off + tile_off + tile.window_loc();
2555- let tile_size = tile.tile_size();2555+ let window_size = tile.window_size();
2556- let tile_rect = Rectangle::new(tile_pos, tile_size);2556+ let window_rect = Rectangle::new(window_pos, window_size);
2557 2557
2558 let view = Rectangle::from_size(self.view_size);2558 let view = Rectangle::from_size(self.view_size);
2559- view.intersection(tile_rect)2559+ view.intersection(window_rect)
2560 }2560 }
2561 2561
2562 pub fn popup_target_rect(&self, id: &W::Id) -> Option<Rectangle<f64, Logical>> {2562 pub fn popup_target_rect(&self, id: &W::Id) -> Option<Rectangle<f64, Logical>> {
src/layout/workspace.rsmodified+3 -3
@@ -1609,11 +1609,11 @@ impl<W: LayoutElement> Workspace<W> {
1609 floating.chain(scrolling)1609 floating.chain(scrolling)
1610 }1610 }
1611 1611
1612- pub fn active_tile_visual_rectangle(&self) -> Option<Rectangle<f64, Logical>> {1612+ pub fn active_window_visual_rectangle(&self) -> Option<Rectangle<f64, Logical>> {
1613 if self.floating_is_active.get() {1613 if self.floating_is_active.get() {
1614- self.floating.active_tile_visual_rectangle()1614+ self.floating.active_window_visual_rectangle()
1615 } else {1615 } else {
1616- self.scrolling.active_tile_visual_rectangle()1616+ self.scrolling.active_window_visual_rectangle()
1617 }1617 }
1618 }1618 }
1619 1619
src/niri.rsmodified+1 -1
@@ -934,7 +934,7 @@ impl State {
934 let monitor = self.niri.layout.monitor_for_output(output).unwrap();934 let monitor = self.niri.layout.monitor_for_output(output).unwrap();
935 935
936 let mut rv = false;936 let mut rv = false;
937- let rect = monitor.active_tile_visual_rectangle();937+ let rect = monitor.active_window_visual_rectangle();
938 938
939 if let Some(rect) = rect {939 if let Some(rect) = rect {
940 let output_geo = self.niri.global_space.output_geometry(output).unwrap();940 let output_geo = self.niri.global_space.output_geometry(output).unwrap();