ipc: Provide a value for tile_pos_in_workspace_view in scrolling layout
Browse files at this commitb6fc9d9c59bc5529aa0313d5205cb427b25dad1cParent: 2c0b3111 changed file +24 -9
- src/layout/scrolling.rs +24 -9
src/layout/scrolling.rsmodified+24 -9
| @@ -2463,18 +2463,33 @@ impl<W: LayoutElement> ScrollingSpace<W> { | |||
| 2463 | } | 2463 | } |
| 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; | ||
| 2467 | + let view_pos = self.target_view_pos(); | ||
| 2468 | + | ||
| 2466 | self.columns | 2469 | self.columns |
| 2467 | .iter() | 2470 | .iter() |
| 2471 | + .zip(self.column_xs(self.data.iter().copied())) | ||
| 2468 | .enumerate() | 2472 | .enumerate() |
| 2469 | - .flat_map(move |(col_idx, col)| { | 2473 | + .flat_map(move |(col_idx, (col, col_x))| { |
| 2470 | - col.tiles().enumerate().map(move |(tile_idx, (tile, _))| { | 2474 | + // Do not include animated render offset here consistently with floating. |
| 2471 | - let layout = WindowLayout { | 2475 | + let col_off = Point::from((col_x - view_pos, 0.)); |
| 2472 | - // Our indices are 1-based, consistent with the actions. | 2476 | + |
| 2473 | - pos_in_scrolling_layout: Some((col_idx + 1, tile_idx + 1)), | 2477 | + col.tiles() |
| 2474 | - ..tile.ipc_layout_template() | 2478 | + .enumerate() |
| 2475 | - }; | 2479 | + .map(move |(tile_idx, (tile, tile_off))| { |
| 2476 | - (tile, layout) | 2480 | + // Do not include animated render offset here consistently with floating. |
| 2477 | - }) | 2481 | + let pos = col_off + tile_off; |
| 2482 | + // Round to physical pixels. | ||
| 2483 | + let pos = pos.to_physical_precise_round(scale).to_logical(scale); | ||
| 2484 | + | ||
| 2485 | + let layout = WindowLayout { | ||
| 2486 | + // Our indices are 1-based, consistent with the actions. | ||
| 2487 | + pos_in_scrolling_layout: Some((col_idx + 1, tile_idx + 1)), | ||
| 2488 | + tile_pos_in_workspace_view: Some(pos.into()), | ||
| 2489 | + ..tile.ipc_layout_template() | ||
| 2490 | + }; | ||
| 2491 | + (tile, layout) | ||
| 2492 | + }) | ||
| 2478 | }) | 2493 | }) |
| 2479 | } | 2494 | } |
| 2480 | 2495 | ||