Restrict tile_pos_in_workspace_view to tiles in view
Browse files at this commitc858d6a9bf7d70106d766c74e26bc7d8daf3c6dfParent: b6fc9d91 changed file +11 -1
- src/layout/scrolling.rs +11 -1
src/layout/scrolling.rsmodified+11 -1
| @@ -2464,6 +2464,7 @@ impl<W: LayoutElement> ScrollingSpace<W> { | |||
| 2464 | 2464 | ||
| 2465 | pub fn tiles_with_ipc_layouts(&self) -> impl Iterator<Item = (&Tile<W>, WindowLayout)> { | 2465 | pub fn tiles_with_ipc_layouts(&self) -> impl Iterator<Item = (&Tile<W>, WindowLayout)> { |
| 2466 | let scale = self.scale; | 2466 | let scale = self.scale; |
| 2467 | + let view = Rectangle::from_size(self.view_size); | ||
| 2467 | let view_pos = self.target_view_pos(); | 2468 | let view_pos = self.target_view_pos(); |
| 2468 | 2469 | ||
| 2469 | self.columns | 2470 | self.columns |
| @@ -2482,12 +2483,21 @@ impl<W: LayoutElement> ScrollingSpace<W> { | |||
| 2482 | // Round to physical pixels. | 2483 | // Round to physical pixels. |
| 2483 | let pos = pos.to_physical_precise_round(scale).to_logical(scale); | 2484 | let pos = pos.to_physical_precise_round(scale).to_logical(scale); |
| 2484 | 2485 | ||
| 2485 | - let layout = WindowLayout { | 2486 | + let mut layout = WindowLayout { |
| 2486 | // Our indices are 1-based, consistent with the actions. | 2487 | // Our indices are 1-based, consistent with the actions. |
| 2487 | pos_in_scrolling_layout: Some((col_idx + 1, tile_idx + 1)), | 2488 | pos_in_scrolling_layout: Some((col_idx + 1, tile_idx + 1)), |
| 2488 | tile_pos_in_workspace_view: Some(pos.into()), | 2489 | tile_pos_in_workspace_view: Some(pos.into()), |
| 2489 | ..tile.ipc_layout_template() | 2490 | ..tile.ipc_layout_template() |
| 2490 | }; | 2491 | }; |
| 2492 | + | ||
| 2493 | + // Clear out tile_pos_in_workspace_view for tiles outside of the workspace | ||
| 2494 | + // view to avoid IPC spam. E.g. so that any scrolling on a workspace with | ||
| 2495 | + // 100 columns didn't have to send 100 window layout changes. | ||
| 2496 | + let bbox = Rectangle::new(pos, Size::from(layout.tile_size)); | ||
| 2497 | + if bbox.intersection(view).is_none() { | ||
| 2498 | + layout.tile_pos_in_workspace_view = None; | ||
| 2499 | + } | ||
| 2500 | + | ||
| 2491 | (tile, layout) | 2501 | (tile, layout) |
| 2492 | }) | 2502 | }) |
| 2493 | }) | 2503 | }) |