layout: Animate column/tile movement between workspaces
Browse files at this commit782f459010e8463a354d97f2fde21d65dbe6a613Parent: ded793d6 changed files +355 -85
- src/layout/floating.rs +23 -4
- src/layout/mod.rs +25 -0
- src/layout/monitor.rs +174 -48
- src/layout/scrolling.rs +68 -14
- src/layout/tile.rs +32 -2
- src/layout/workspace.rs +33 -17
src/layout/floating.rsmodified+23 -4
| @@ -16,6 +16,7 @@ use super::{ | |||
| 16 | ConfigureIntent, InteractiveResizeData, LayoutElement, Options, RemovedTile, SizeFrac, | 16 | ConfigureIntent, InteractiveResizeData, LayoutElement, Options, RemovedTile, SizeFrac, |
| 17 | }; | 17 | }; |
| 18 | use crate::animation::{Animation, Clock}; | 18 | use crate::animation::{Animation, Clock}; |
| 19 | +use crate::layout::RenderLayer; | ||
| 19 | use crate::niri_render_elements; | 20 | use crate::niri_render_elements; |
| 20 | use crate::render_helpers::renderer::NiriRenderer; | 21 | use crate::render_helpers::renderer::NiriRenderer; |
| 21 | use crate::render_helpers::xray::XrayPos; | 22 | use crate::render_helpers::xray::XrayPos; |
| @@ -265,9 +266,19 @@ impl<W: LayoutElement> FloatingSpace<W> { | |||
| 265 | self.tiles.iter().any(Tile::are_transitions_ongoing) || !self.closing_windows.is_empty() | 266 | self.tiles.iter().any(Tile::are_transitions_ongoing) || !self.closing_windows.is_empty() |
| 266 | } | 267 | } |
| 267 | 268 | ||
| 268 | - pub fn update_render_elements(&mut self, is_active: bool, view_rect: Rectangle<f64, Logical>) { | 269 | + pub fn update_render_elements( |
| 270 | + &mut self, | ||
| 271 | + is_active: bool, | ||
| 272 | + view_rect: Rectangle<f64, Logical>, | ||
| 273 | + layer: RenderLayer, | ||
| 274 | + ) { | ||
| 269 | let active = self.active_window_id.clone(); | 275 | let active = self.active_window_id.clone(); |
| 270 | for (tile, offset) in self.tiles_with_offsets_mut() { | 276 | for (tile, offset) in self.tiles_with_offsets_mut() { |
| 277 | + // Skip tiles belonging to a different render layer. | ||
| 278 | + if layer.is_normal() == tile.is_moving_between_workspaces() { | ||
| 279 | + continue; | ||
| 280 | + } | ||
| 281 | + | ||
| 271 | let id = tile.window().id(); | 282 | let id = tile.window().id(); |
| 272 | let is_active = is_active && Some(id) == active.as_ref(); | 283 | let is_active = is_active && Some(id) == active.as_ref(); |
| 273 | 284 | ||
| @@ -1057,6 +1068,7 @@ impl<W: LayoutElement> FloatingSpace<W> { | |||
| 1057 | xray_pos: XrayPos, | 1068 | xray_pos: XrayPos, |
| 1058 | view_rect: Rectangle<f64, Logical>, | 1069 | view_rect: Rectangle<f64, Logical>, |
| 1059 | focus_ring: bool, | 1070 | focus_ring: bool, |
| 1071 | + layer: RenderLayer, | ||
| 1060 | push: &mut dyn FnMut(FloatingSpaceRenderElement<R>), | 1072 | push: &mut dyn FnMut(FloatingSpaceRenderElement<R>), |
| 1061 | ) { | 1073 | ) { |
| 1062 | let scale = Scale::from(self.scale); | 1074 | let scale = Scale::from(self.scale); |
| @@ -1064,13 +1076,20 @@ impl<W: LayoutElement> FloatingSpace<W> { | |||
| 1064 | // Draw the closing windows on top of the other windows. | 1076 | // Draw the closing windows on top of the other windows. |
| 1065 | // | 1077 | // |
| 1066 | // FIXME: I guess this should rather preserve the stacking order when the window is closed. | 1078 | // FIXME: I guess this should rather preserve the stacking order when the window is closed. |
| 1067 | - for closing in self.closing_windows.iter().rev() { | 1079 | + if layer.is_normal() { |
| 1068 | - let elem = closing.render(ctx.as_gles(), view_rect, scale); | 1080 | + for closing in self.closing_windows.iter().rev() { |
| 1069 | - push(elem.into()); | 1081 | + let elem = closing.render(ctx.as_gles(), view_rect, scale); |
| 1082 | + push(elem.into()); | ||
| 1083 | + } | ||
| 1070 | } | 1084 | } |
| 1071 | 1085 | ||
| 1072 | let active = self.active_window_id.clone(); | 1086 | let active = self.active_window_id.clone(); |
| 1073 | for (tile, tile_pos) in self.tiles_with_render_positions() { | 1087 | for (tile, tile_pos) in self.tiles_with_render_positions() { |
| 1088 | + // Skip tiles belonging to a different render layer. | ||
| 1089 | + if layer.is_normal() == tile.is_moving_between_workspaces() { | ||
| 1090 | + continue; | ||
| 1091 | + } | ||
| 1092 | + | ||
| 1074 | // For the active tile, draw the focus ring. | 1093 | // For the active tile, draw the focus ring. |
| 1075 | let focus_ring = focus_ring && Some(tile.window().id()) == active.as_ref(); | 1094 | let focus_ring = focus_ring && Some(tile.window().id()) == active.as_ref(); |
| 1076 | 1095 | ||
src/layout/mod.rsmodified+25 -0
| @@ -558,6 +558,14 @@ struct OverviewGesture { | |||
| 558 | value: f64, | 558 | value: f64, |
| 559 | } | 559 | } |
| 560 | 560 | ||
| 561 | +/// Layer of windows to render. | ||
| 562 | +#[derive(Clone, Copy)] | ||
| 563 | +pub enum RenderLayer { | ||
| 564 | + Normal, | ||
| 565 | + /// Windows currently moving between workspaces. | ||
| 566 | + MovingBetweenWorkspaces, | ||
| 567 | +} | ||
| 568 | + | ||
| 561 | impl SizingMode { | 569 | impl SizingMode { |
| 562 | #[must_use] | 570 | #[must_use] |
| 563 | pub fn is_normal(&self) -> bool { | 571 | pub fn is_normal(&self) -> bool { |
| @@ -687,6 +695,16 @@ impl OverviewProgress { | |||
| 687 | } | 695 | } |
| 688 | } | 696 | } |
| 689 | 697 | ||
| 698 | +impl RenderLayer { | ||
| 699 | + /// Returns `true` if the render layer is [`Normal`]. | ||
| 700 | + /// | ||
| 701 | + /// [`Normal`]: RenderLayer::Normal | ||
| 702 | + #[must_use] | ||
| 703 | + pub fn is_normal(&self) -> bool { | ||
| 704 | + matches!(self, Self::Normal) | ||
| 705 | + } | ||
| 706 | +} | ||
| 707 | + | ||
| 690 | impl<W: LayoutElement> Layout<W> { | 708 | impl<W: LayoutElement> Layout<W> { |
| 691 | pub fn new(clock: Clock, config: &Config) -> Self { | 709 | pub fn new(clock: Clock, config: &Config) -> Self { |
| 692 | Self::with_options_and_workspaces(clock, config, Options::from_config(config)) | 710 | Self::with_options_and_workspaces(clock, config, Options::from_config(config)) |
| @@ -4304,6 +4322,13 @@ impl<W: LayoutElement> Layout<W> { | |||
| 4304 | let new_tile_render_loc = ws_geo.loc + tile_offset.upscale(zoom); | 4322 | let new_tile_render_loc = ws_geo.loc + tile_offset.upscale(zoom); |
| 4305 | 4323 | ||
| 4306 | tile.animate_move_from((tile_render_loc - new_tile_render_loc).downscale(zoom)); | 4324 | tile.animate_move_from((tile_render_loc - new_tile_render_loc).downscale(zoom)); |
| 4325 | + | ||
| 4326 | + // Interactive move into floating barely animates (it doesn't really move after | ||
| 4327 | + // being dropped), so setting it as moving between workspaces would just cause it to | ||
| 4328 | + // awkwardly sit unclipped for a moment before the animation runs out. | ||
| 4329 | + if !matches!(position, InsertPosition::Floating) { | ||
| 4330 | + tile.set_anim_y_between_workspaces(); | ||
| 4331 | + } | ||
| 4307 | } | 4332 | } |
| 4308 | MonitorSet::NoOutputs { workspaces, .. } => { | 4333 | MonitorSet::NoOutputs { workspaces, .. } => { |
| 4309 | if workspaces.is_empty() { | 4334 | if workspaces.is_empty() { |
src/layout/monitor.rsmodified+174 -48
| @@ -20,6 +20,7 @@ use super::workspace::{ | |||
| 20 | use super::{compute_overview_zoom, ActivateWindow, HitType, LayoutElement, Options}; | 20 | use super::{compute_overview_zoom, ActivateWindow, HitType, LayoutElement, Options}; |
| 21 | use crate::animation::{Animation, Clock}; | 21 | use crate::animation::{Animation, Clock}; |
| 22 | use crate::input::swipe_tracker::SwipeTracker; | 22 | use crate::input::swipe_tracker::SwipeTracker; |
| 23 | +use crate::layout::RenderLayer; | ||
| 23 | use crate::niri_render_elements; | 24 | use crate::niri_render_elements; |
| 24 | use crate::render_helpers::renderer::NiriRenderer; | 25 | use crate::render_helpers::renderer::NiriRenderer; |
| 25 | use crate::render_helpers::shadow::ShadowRenderElement; | 26 | use crate::render_helpers::shadow::ShadowRenderElement; |
| @@ -815,6 +816,7 @@ impl<W: LayoutElement> Monitor<W> { | |||
| 815 | } else { | 816 | } else { |
| 816 | self.active_workspace_idx | 817 | self.active_workspace_idx |
| 817 | }; | 818 | }; |
| 819 | + let source_id = self.workspaces[source_workspace_idx].id(); | ||
| 818 | 820 | ||
| 819 | let new_idx = min(idx, self.workspaces.len() - 1); | 821 | let new_idx = min(idx, self.workspaces.len() - 1); |
| 820 | if new_idx == source_workspace_idx { | 822 | if new_idx == source_workspace_idx { |
| @@ -832,6 +834,11 @@ impl<W: LayoutElement> Monitor<W> { | |||
| 832 | }; | 834 | }; |
| 833 | let window = window.clone(); | 835 | let window = window.clone(); |
| 834 | 836 | ||
| 837 | + let mut old_render_pos = workspace | ||
| 838 | + .tiles_with_render_positions() | ||
| 839 | + .find_map(|(tile, offset, _visible)| (tile.window().id() == &window).then_some(offset)) | ||
| 840 | + .unwrap(); | ||
| 841 | + | ||
| 835 | let transaction = Transaction::new(); | 842 | let transaction = Transaction::new(); |
| 836 | let removed = workspace.remove_tile(&window, transaction); | 843 | let removed = workspace.remove_tile(&window, transaction); |
| 837 | 844 | ||
| @@ -855,6 +862,31 @@ impl<W: LayoutElement> Monitor<W> { | |||
| 855 | if self.workspace_switch.is_none() { | 862 | if self.workspace_switch.is_none() { |
| 856 | self.clean_up_workspaces(); | 863 | self.clean_up_workspaces(); |
| 857 | } | 864 | } |
| 865 | + | ||
| 866 | + let new_idx = self.idx_of_ws(new_id).unwrap(); | ||
| 867 | + | ||
| 868 | + // Animate vertical movement between workspaces. | ||
| 869 | + // | ||
| 870 | + // Recompute the source idx in case some workspace was removed during clean-up. If the | ||
| 871 | + // source workspace itself was removed, don't bother animating this since the removal is | ||
| 872 | + // instant anyway. | ||
| 873 | + if let Some(source_workspace_idx) = self.idx_of_ws(source_id) { | ||
| 874 | + old_render_pos.y += | ||
| 875 | + self.workspace_size_with_gap(1.).h * (source_workspace_idx as f64 - new_idx as f64); | ||
| 876 | + } | ||
| 877 | + | ||
| 878 | + let (tile, new_render_pos) = self.workspaces[new_idx] | ||
| 879 | + .tiles_with_render_positions_mut(false) | ||
| 880 | + .find(|(tile, _)| tile.window().id() == &window) | ||
| 881 | + .unwrap(); | ||
| 882 | + // If the view is following the tile, match the animation. | ||
| 883 | + let config = if activate { | ||
| 884 | + self.options.animations.workspace_switch.0 | ||
| 885 | + } else { | ||
| 886 | + self.options.animations.window_movement.0 | ||
| 887 | + }; | ||
| 888 | + tile.animate_move_from_with_config(old_render_pos - new_render_pos, config); | ||
| 889 | + tile.set_anim_y_between_workspaces(); | ||
| 858 | } | 890 | } |
| 859 | 891 | ||
| 860 | pub fn move_column_to_workspace_up(&mut self, activate: bool) { | 892 | pub fn move_column_to_workspace_up(&mut self, activate: bool) { |
| @@ -886,11 +918,38 @@ impl<W: LayoutElement> Monitor<W> { | |||
| 886 | return; | 918 | return; |
| 887 | } | 919 | } |
| 888 | 920 | ||
| 889 | - let Some(column) = workspace.remove_active_column() else { | 921 | + let Some(id) = workspace.scrolling().active_column().map(Column::id) else { |
| 890 | return; | 922 | return; |
| 891 | }; | 923 | }; |
| 924 | + let mut old_render_pos = workspace | ||
| 925 | + .scrolling() | ||
| 926 | + .columns_with_render_positions() | ||
| 927 | + .find_map(|(col, pos)| (col.id() == id).then_some(pos)) | ||
| 928 | + .unwrap(); | ||
| 892 | 929 | ||
| 930 | + let column = workspace.remove_active_column().unwrap(); | ||
| 931 | + | ||
| 932 | + // Animate vertical movement between workspaces. | ||
| 933 | + old_render_pos.y += | ||
| 934 | + self.workspace_size_with_gap(1.).h * (source_workspace_idx as f64 - new_idx as f64); | ||
| 935 | + | ||
| 936 | + let new_id = self.workspaces[new_idx].id(); | ||
| 893 | self.add_column(new_idx, column, activate); | 937 | self.add_column(new_idx, column, activate); |
| 938 | + | ||
| 939 | + let new_idx = self.idx_of_ws(new_id).unwrap(); | ||
| 940 | + let (column, new_render_pos) = self.workspaces[new_idx] | ||
| 941 | + .scrolling_mut() | ||
| 942 | + .columns_with_render_positions_mut() | ||
| 943 | + .find(|(col, _pos)| col.id() == id) | ||
| 944 | + .unwrap(); | ||
| 945 | + // If the view is following the tile, match the animation. | ||
| 946 | + let config = if activate { | ||
| 947 | + self.options.animations.workspace_switch.0 | ||
| 948 | + } else { | ||
| 949 | + self.options.animations.window_movement.0 | ||
| 950 | + }; | ||
| 951 | + column.animate_move_from_with_config(old_render_pos - new_render_pos, config); | ||
| 952 | + column.set_anim_y_between_workspaces(); | ||
| 894 | } | 953 | } |
| 895 | 954 | ||
| 896 | pub fn switch_workspace_up(&mut self) { | 955 | pub fn switch_workspace_up(&mut self) { |
| @@ -1014,8 +1073,12 @@ impl<W: LayoutElement> Monitor<W> { | |||
| 1014 | .as_ref() | 1073 | .as_ref() |
| 1015 | .and_then(|hint| hint.workspace.existing_id()); | 1074 | .and_then(|hint| hint.workspace.existing_id()); |
| 1016 | 1075 | ||
| 1076 | + for ws in &mut self.workspaces { | ||
| 1077 | + ws.update_render_elements(is_active, RenderLayer::MovingBetweenWorkspaces); | ||
| 1078 | + } | ||
| 1079 | + | ||
| 1017 | for (ws, geo) in self.workspaces_with_render_geo_mut(true) { | 1080 | for (ws, geo) in self.workspaces_with_render_geo_mut(true) { |
| 1018 | - ws.update_render_elements(is_active); | 1081 | + ws.update_render_elements(is_active, RenderLayer::Normal); |
| 1019 | 1082 | ||
| 1020 | if Some(ws.id()) == insert_hint_ws_id { | 1083 | if Some(ws.id()) == insert_hint_ws_id { |
| 1021 | insert_hint_ws_geo = Some(geo); | 1084 | insert_hint_ws_geo = Some(geo); |
| @@ -1421,15 +1484,22 @@ impl<W: LayoutElement> Monitor<W> { | |||
| 1421 | }) | 1484 | }) |
| 1422 | } | 1485 | } |
| 1423 | 1486 | ||
| 1424 | - pub fn workspaces_with_render_geo( | 1487 | + pub fn workspaces_with_render_geo_cull( |
| 1425 | &self, | 1488 | &self, |
| 1489 | + cull: bool, | ||
| 1426 | ) -> impl Iterator<Item = (&Workspace<W>, Rectangle<f64, Logical>)> { | 1490 | ) -> impl Iterator<Item = (&Workspace<W>, Rectangle<f64, Logical>)> { |
| 1427 | let output_geo = Rectangle::from_size(self.view_size); | 1491 | let output_geo = Rectangle::from_size(self.view_size); |
| 1428 | 1492 | ||
| 1429 | let geo = self.workspaces_render_geo(); | 1493 | let geo = self.workspaces_render_geo(); |
| 1430 | zip(self.workspaces.iter(), geo) | 1494 | zip(self.workspaces.iter(), geo) |
| 1431 | // Cull out workspaces outside the output. | 1495 | // Cull out workspaces outside the output. |
| 1432 | - .filter(move |(_ws, geo)| geo.intersection(output_geo).is_some()) | 1496 | + .filter(move |(_ws, geo)| !cull || geo.intersection(output_geo).is_some()) |
| 1497 | + } | ||
| 1498 | + | ||
| 1499 | + pub fn workspaces_with_render_geo( | ||
| 1500 | + &self, | ||
| 1501 | + ) -> impl Iterator<Item = (&Workspace<W>, Rectangle<f64, Logical>)> { | ||
| 1502 | + self.workspaces_with_render_geo_cull(true) | ||
| 1433 | } | 1503 | } |
| 1434 | 1504 | ||
| 1435 | pub fn workspaces_with_render_geo_idx( | 1505 | pub fn workspaces_with_render_geo_idx( |
| @@ -1599,28 +1669,6 @@ impl<W: LayoutElement> Monitor<W> { | |||
| 1599 | // Ceil the height in physical pixels. | 1669 | // Ceil the height in physical pixels. |
| 1600 | let height = (self.view_size.h * scale).ceil() as i32; | 1670 | let height = (self.view_size.h * scale).ceil() as i32; |
| 1601 | 1671 | ||
| 1602 | - // Crop the elements to prevent them overflowing, currently visible during a workspace | ||
| 1603 | - // switch. | ||
| 1604 | - // | ||
| 1605 | - // HACK: crop to infinite bounds at least horizontally where we | ||
| 1606 | - // know there's no workspace joining or monitor bounds, otherwise | ||
| 1607 | - // it will cut pixel shaders and mess up the coordinate space. | ||
| 1608 | - // There's also a damage tracking bug which causes glitched | ||
| 1609 | - // rendering for maximized GTK windows. | ||
| 1610 | - // | ||
| 1611 | - // FIXME: use proper bounds after fixing the Crop element. | ||
| 1612 | - let crop_bounds = if self.workspace_switch.is_some() || self.overview_progress.is_some() { | ||
| 1613 | - Rectangle::new( | ||
| 1614 | - Point::from((-i32::MAX / 2, 0)), | ||
| 1615 | - Size::from((i32::MAX, height)), | ||
| 1616 | - ) | ||
| 1617 | - } else { | ||
| 1618 | - Rectangle::new( | ||
| 1619 | - Point::from((-i32::MAX / 2, -i32::MAX / 2)), | ||
| 1620 | - Size::from((i32::MAX, i32::MAX)), | ||
| 1621 | - ) | ||
| 1622 | - }; | ||
| 1623 | - | ||
| 1624 | let zoom = self.overview_zoom(); | 1672 | let zoom = self.overview_zoom(); |
| 1625 | 1673 | ||
| 1626 | let insert_hint_render_loc = self | 1674 | let insert_hint_render_loc = self |
| @@ -1639,32 +1687,110 @@ impl<W: LayoutElement> Monitor<W> { | |||
| 1639 | ) | 1687 | ) |
| 1640 | }; | 1688 | }; |
| 1641 | 1689 | ||
| 1642 | - for (ws, geo) in self.workspaces_with_render_geo() { | 1690 | + // Draw in passes for correct Z ordering during window movement between workspaces: |
| 1643 | - // Macro instead of closure because ws and insert hint have different elem types. | 1691 | + // - floating windows moving between workspaces |
| 1644 | - macro_rules! push { | 1692 | + // - normal floating windows |
| 1645 | - () => {{ | 1693 | + // - scrolling windows moving between workspaces |
| 1646 | - &mut |elem| { | 1694 | + // - normal scrolling windows |
| 1647 | - let elem = CropRenderElement::from_element(elem, scale, crop_bounds); | 1695 | + for pass in 0..4 { |
| 1648 | - if let Some(elem) = elem { | 1696 | + // Don't cull when drawing windows moving between workspaces so that windows moving to |
| 1649 | - let elem = MonitorInnerRenderElement::from(elem); | 1697 | + // workspaces off-screen will still render. |
| 1650 | - push(scale_relocate(geo, elem)); | 1698 | + let cull = matches!(pass, 1 | 3); |
| 1651 | - } | 1699 | + |
| 1652 | - } | 1700 | + // Crop the elements to prevent them overflowing, currently visible during a workspace |
| 1653 | - }}; | 1701 | + // switch. |
| 1654 | - } | 1702 | + // |
| 1655 | - | 1703 | + // HACK: crop to infinite bounds at least horizontally where we |
| 1656 | - let xray_pos = XrayPos::new(geo.loc, zoom); | 1704 | + // know there's no workspace joining or monitor bounds, otherwise |
| 1705 | + // it will cut pixel shaders and mess up the coordinate space. | ||
| 1706 | + // There's also a damage tracking bug which causes glitched | ||
| 1707 | + // rendering for maximized GTK windows. | ||
| 1708 | + // | ||
| 1709 | + // FIXME: use proper bounds after fixing the Crop element. | ||
| 1710 | + // | ||
| 1711 | + // Also, check cull here to avoid cropping windows moving between workspaces. | ||
| 1712 | + // | ||
| 1713 | + // FIXME: for cull=true, it might be better visually to crop to a workspace-high region | ||
| 1714 | + // anchored to the window/column as it moves between workspaces, to prevent overflowing | ||
| 1715 | + // windows from appearing and disappearing. | ||
| 1716 | + let crop_bounds = | ||
| 1717 | + if cull && (self.workspace_switch.is_some() || self.overview_progress.is_some()) { | ||
| 1718 | + Rectangle::new( | ||
| 1719 | + Point::from((-i32::MAX / 2, 0)), | ||
| 1720 | + Size::from((i32::MAX, height)), | ||
| 1721 | + ) | ||
| 1722 | + } else { | ||
| 1723 | + Rectangle::new( | ||
| 1724 | + Point::from((-i32::MAX / 2, -i32::MAX / 2)), | ||
| 1725 | + Size::from((i32::MAX, i32::MAX)), | ||
| 1726 | + ) | ||
| 1727 | + }; | ||
| 1657 | 1728 | ||
| 1658 | - ws.render_floating(ctx.r(), xray_pos, focus_ring, push!()); | 1729 | + for (ws, geo) in self.workspaces_with_render_geo_cull(cull) { |
| 1730 | + // Macro instead of closure because ws and insert hint have different elem types. | ||
| 1731 | + macro_rules! push { | ||
| 1732 | + () => {{ | ||
| 1733 | + &mut |elem| { | ||
| 1734 | + let elem = CropRenderElement::from_element(elem, scale, crop_bounds); | ||
| 1735 | + if let Some(elem) = elem { | ||
| 1736 | + let elem = MonitorInnerRenderElement::from(elem); | ||
| 1737 | + push(scale_relocate(geo, elem)); | ||
| 1738 | + } | ||
| 1739 | + } | ||
| 1740 | + }}; | ||
| 1741 | + } | ||
| 1659 | 1742 | ||
| 1660 | - if let Some(loc) = insert_hint_render_loc { | 1743 | + let xray_pos = XrayPos::new(geo.loc, zoom); |
| 1661 | - if loc.workspace == InsertWorkspace::Existing(ws.id()) { | 1744 | + |
| 1662 | - self.insert_hint_element | 1745 | + match pass { |
| 1663 | - .render(ctx.renderer, loc.location, push!()); | 1746 | + 0 => { |
| 1747 | + ws.render_floating( | ||
| 1748 | + ctx.r(), | ||
| 1749 | + xray_pos, | ||
| 1750 | + focus_ring, | ||
| 1751 | + RenderLayer::MovingBetweenWorkspaces, | ||
| 1752 | + push!(), | ||
| 1753 | + ); | ||
| 1754 | + } | ||
| 1755 | + 1 => { | ||
| 1756 | + ws.render_floating( | ||
| 1757 | + ctx.r(), | ||
| 1758 | + xray_pos, | ||
| 1759 | + focus_ring, | ||
| 1760 | + RenderLayer::Normal, | ||
| 1761 | + push!(), | ||
| 1762 | + ); | ||
| 1763 | + | ||
| 1764 | + if let Some(loc) = insert_hint_render_loc { | ||
| 1765 | + if loc.workspace == InsertWorkspace::Existing(ws.id()) { | ||
| 1766 | + self.insert_hint_element.render( | ||
| 1767 | + ctx.renderer, | ||
| 1768 | + loc.location, | ||
| 1769 | + push!(), | ||
| 1770 | + ); | ||
| 1771 | + } | ||
| 1772 | + } | ||
| 1773 | + } | ||
| 1774 | + 2 => { | ||
| 1775 | + ws.render_scrolling( | ||
| 1776 | + ctx.r(), | ||
| 1777 | + xray_pos, | ||
| 1778 | + focus_ring, | ||
| 1779 | + RenderLayer::MovingBetweenWorkspaces, | ||
| 1780 | + push!(), | ||
| 1781 | + ); | ||
| 1782 | + } | ||
| 1783 | + _ => { | ||
| 1784 | + ws.render_scrolling( | ||
| 1785 | + ctx.r(), | ||
| 1786 | + xray_pos, | ||
| 1787 | + focus_ring, | ||
| 1788 | + RenderLayer::Normal, | ||
| 1789 | + push!(), | ||
| 1790 | + ); | ||
| 1791 | + } | ||
| 1664 | } | 1792 | } |
| 1665 | } | 1793 | } |
| 1666 | - | ||
| 1667 | - ws.render_scrolling(ctx.r(), xray_pos, focus_ring, push!()); | ||
| 1668 | } | 1794 | } |
| 1669 | } | 1795 | } |
| 1670 | 1796 | ||
src/layout/scrolling.rsmodified+68 -14
| @@ -18,7 +18,7 @@ use super::workspace::{InteractiveResize, ResolvedSize}; | |||
| 18 | use super::{ConfigureIntent, HitType, InteractiveResizeData, LayoutElement, Options, RemovedTile}; | 18 | use super::{ConfigureIntent, HitType, InteractiveResizeData, LayoutElement, Options, RemovedTile}; |
| 19 | use crate::animation::{Animation, Clock}; | 19 | use crate::animation::{Animation, Clock}; |
| 20 | use crate::input::swipe_tracker::SwipeTracker; | 20 | use crate::input::swipe_tracker::SwipeTracker; |
| 21 | -use crate::layout::SizingMode; | 21 | +use crate::layout::{RenderLayer, SizingMode}; |
| 22 | use crate::niri_render_elements; | 22 | use crate::niri_render_elements; |
| 23 | use crate::render_helpers::renderer::NiriRenderer; | 23 | use crate::render_helpers::renderer::NiriRenderer; |
| 24 | use crate::render_helpers::xray::XrayPos; | 24 | use crate::render_helpers::xray::XrayPos; |
| @@ -306,6 +306,10 @@ pub enum ScrollDirection { | |||
| 306 | struct MoveAnimation { | 306 | struct MoveAnimation { |
| 307 | anim: Animation, | 307 | anim: Animation, |
| 308 | from: f64, | 308 | from: f64, |
| 309 | + /// Whether this animation is for moving the tile between workspaces. | ||
| 310 | + /// | ||
| 311 | + /// Controls whether the tile is rendered uncropped and above others. | ||
| 312 | + is_between_workspaces: bool, | ||
| 309 | } | 313 | } |
| 310 | 314 | ||
| 311 | impl<W: LayoutElement> ScrollingSpace<W> { | 315 | impl<W: LayoutElement> ScrollingSpace<W> { |
| @@ -422,11 +426,16 @@ impl<W: LayoutElement> ScrollingSpace<W> { | |||
| 422 | || !self.closing_windows.is_empty() | 426 | || !self.closing_windows.is_empty() |
| 423 | } | 427 | } |
| 424 | 428 | ||
| 425 | - pub fn update_render_elements(&mut self, is_active: bool) { | 429 | + pub fn update_render_elements(&mut self, is_active: bool, layer: RenderLayer) { |
| 426 | let view_pos = Point::from((self.view_pos(), 0.)); | 430 | let view_pos = Point::from((self.view_pos(), 0.)); |
| 427 | let view_size = self.view_size; | 431 | let view_size = self.view_size; |
| 428 | let active_idx = self.active_column_idx; | 432 | let active_idx = self.active_column_idx; |
| 429 | for (col_idx, (col, col_x)) in self.columns_mut().enumerate() { | 433 | for (col_idx, (col, col_x)) in self.columns_mut().enumerate() { |
| 434 | + // Skip columns belonging to a different render layer. | ||
| 435 | + if layer.is_normal() == col.is_moving_between_workspaces() { | ||
| 436 | + continue; | ||
| 437 | + } | ||
| 438 | + | ||
| 430 | let is_active = is_active && col_idx == active_idx; | 439 | let is_active = is_active && col_idx == active_idx; |
| 431 | let col_off = Point::from((col_x, 0.)); | 440 | let col_off = Point::from((col_x, 0.)); |
| 432 | let col_pos = view_pos - col_off - col.render_offset(); | 441 | let col_pos = view_pos - col_off - col.render_offset(); |
| @@ -2938,15 +2947,18 @@ impl<W: LayoutElement> ScrollingSpace<W> { | |||
| 2938 | mut ctx: RenderCtx<R>, | 2947 | mut ctx: RenderCtx<R>, |
| 2939 | xray_pos: XrayPos, | 2948 | xray_pos: XrayPos, |
| 2940 | focus_ring: bool, | 2949 | focus_ring: bool, |
| 2950 | + layer: RenderLayer, | ||
| 2941 | push: &mut dyn FnMut(ScrollingSpaceRenderElement<R>), | 2951 | push: &mut dyn FnMut(ScrollingSpaceRenderElement<R>), |
| 2942 | ) { | 2952 | ) { |
| 2943 | let scale = Scale::from(self.scale); | 2953 | let scale = Scale::from(self.scale); |
| 2944 | 2954 | ||
| 2945 | // Draw the closing windows on top of the other windows. | 2955 | // Draw the closing windows on top of the other windows. |
| 2946 | - let view_rect = Rectangle::new(Point::from((self.view_pos(), 0.)), self.view_size); | 2956 | + if layer.is_normal() { |
| 2947 | - for closing in self.closing_windows.iter().rev() { | 2957 | + let view_rect = Rectangle::new(Point::from((self.view_pos(), 0.)), self.view_size); |
| 2948 | - let elem = closing.render(ctx.as_gles(), view_rect, scale); | 2958 | + for closing in self.closing_windows.iter().rev() { |
| 2949 | - push(elem.into()); | 2959 | + let elem = closing.render(ctx.as_gles(), view_rect, scale); |
| 2960 | + push(elem.into()); | ||
| 2961 | + } | ||
| 2950 | } | 2962 | } |
| 2951 | 2963 | ||
| 2952 | if self.columns.is_empty() { | 2964 | if self.columns.is_empty() { |
| @@ -2957,6 +2969,12 @@ impl<W: LayoutElement> ScrollingSpace<W> { | |||
| 2957 | 2969 | ||
| 2958 | // This matches self.tiles_with_render_positions(). | 2970 | // This matches self.tiles_with_render_positions(). |
| 2959 | for (col, col_pos) in self.columns_with_render_positions() { | 2971 | for (col, col_pos) in self.columns_with_render_positions() { |
| 2972 | + // Skip columns belonging to a different render layer. | ||
| 2973 | + if layer.is_normal() == col.is_moving_between_workspaces() { | ||
| 2974 | + first = false; | ||
| 2975 | + continue; | ||
| 2976 | + } | ||
| 2977 | + | ||
| 2960 | // Draw the tab indicator on top. | 2978 | // Draw the tab indicator on top. |
| 2961 | { | 2979 | { |
| 2962 | let pos = col_pos.to_physical_precise_round(scale).to_logical(scale); | 2980 | let pos = col_pos.to_physical_precise_round(scale).to_logical(scale); |
| @@ -4133,6 +4151,34 @@ impl<W: LayoutElement> Column<W> { | |||
| 4133 | || self.tiles.iter().any(Tile::are_transitions_ongoing) | 4151 | || self.tiles.iter().any(Tile::are_transitions_ongoing) |
| 4134 | } | 4152 | } |
| 4135 | 4153 | ||
| 4154 | + pub fn is_moving_between_workspaces(&self) -> bool { | ||
| 4155 | + self.move_y_animation | ||
| 4156 | + .as_ref() | ||
| 4157 | + .is_some_and(|anim| anim.is_between_workspaces) | ||
| 4158 | + || self | ||
| 4159 | + .move_x_animation | ||
| 4160 | + .as_ref() | ||
| 4161 | + .is_some_and(|anim| anim.is_between_workspaces) | ||
| 4162 | + // When moving a window between workspaces into the scrolling layout, it will be | ||
| 4163 | + // immediately put into a new column, however the Y move animation and the | ||
| 4164 | + // moving-between-workspaces flag will be set on the tile rather than on that new | ||
| 4165 | + // column. Since the scrolling layout rendering checks moving between workspaces | ||
| 4166 | + // per-column rather than per-tile, we need to include the tiles here. | ||
| 4167 | + // | ||
| 4168 | + // This is not always visually correct: for example, interactive-moving a tile into an | ||
| 4169 | + // otherwise stationary column will now cause that entire column to draw unculled. I'm | ||
| 4170 | + // not sure there's a good solution overall for all edge cases here. Consider that the | ||
| 4171 | + // column tab indicator needs to draw on top of the tiles, but in this counterexample | ||
| 4172 | + // above, the column is stationary, so the single moving tile would instead need to draw | ||
| 4173 | + // on top of the tab indicator. | ||
| 4174 | + // | ||
| 4175 | + // I'm going with this simple check for now that should look ok in most cases. | ||
| 4176 | + || self | ||
| 4177 | + .tiles | ||
| 4178 | + .iter() | ||
| 4179 | + .any(|tile| tile.is_moving_between_workspaces()) | ||
| 4180 | + } | ||
| 4181 | + | ||
| 4136 | pub fn update_render_elements(&mut self, is_active: bool, view_rect: Rectangle<f64, Logical>) { | 4182 | pub fn update_render_elements(&mut self, is_active: bool, view_rect: Rectangle<f64, Logical>) { |
| 4137 | let active_idx = self.active_tile_idx; | 4183 | let active_idx = self.active_tile_idx; |
| 4138 | for (tile_idx, (tile, tile_off)) in self.tiles_mut().enumerate() { | 4184 | for (tile_idx, (tile, tile_off)) in self.tiles_mut().enumerate() { |
| @@ -4227,15 +4273,16 @@ impl<W: LayoutElement> Column<W> { | |||
| 4227 | from_x_offset: f64, | 4273 | from_x_offset: f64, |
| 4228 | config: niri_config::Animation, | 4274 | config: niri_config::Animation, |
| 4229 | ) { | 4275 | ) { |
| 4230 | - let current_offset = self | 4276 | + let (current_offset, current_between) = |
| 4231 | - .move_x_animation | 4277 | + self.move_x_animation.as_ref().map_or((0., false), |move_| { |
| 4232 | - .as_ref() | 4278 | + (move_.from * move_.anim.value(), move_.is_between_workspaces) |
| 4233 | - .map_or(0., |move_| move_.from * move_.anim.value()); | 4279 | + }); |
| 4234 | 4280 | ||
| 4235 | let anim = Animation::new(self.clock.clone(), 1., 0., 0., config); | 4281 | let anim = Animation::new(self.clock.clone(), 1., 0., 0., config); |
| 4236 | self.move_x_animation = Some(MoveAnimation { | 4282 | self.move_x_animation = Some(MoveAnimation { |
| 4237 | anim, | 4283 | anim, |
| 4238 | from: from_x_offset + current_offset, | 4284 | from: from_x_offset + current_offset, |
| 4285 | + is_between_workspaces: current_between, | ||
| 4239 | }); | 4286 | }); |
| 4240 | } | 4287 | } |
| 4241 | 4288 | ||
| @@ -4251,15 +4298,16 @@ impl<W: LayoutElement> Column<W> { | |||
| 4251 | from_y_offset: f64, | 4298 | from_y_offset: f64, |
| 4252 | config: niri_config::Animation, | 4299 | config: niri_config::Animation, |
| 4253 | ) { | 4300 | ) { |
| 4254 | - let current_offset = self | 4301 | + let (current_offset, current_between) = |
| 4255 | - .move_y_animation | 4302 | + self.move_y_animation.as_ref().map_or((0., false), |move_| { |
| 4256 | - .as_ref() | 4303 | + (move_.from * move_.anim.value(), move_.is_between_workspaces) |
| 4257 | - .map_or(0., |move_| move_.from * move_.anim.value()); | 4304 | + }); |
| 4258 | 4305 | ||
| 4259 | let anim = Animation::new(self.clock.clone(), 1., 0., 0., config); | 4306 | let anim = Animation::new(self.clock.clone(), 1., 0., 0., config); |
| 4260 | self.move_y_animation = Some(MoveAnimation { | 4307 | self.move_y_animation = Some(MoveAnimation { |
| 4261 | anim, | 4308 | anim, |
| 4262 | from: from_y_offset + current_offset, | 4309 | from: from_y_offset + current_offset, |
| 4310 | + is_between_workspaces: current_between, | ||
| 4263 | }); | 4311 | }); |
| 4264 | } | 4312 | } |
| 4265 | 4313 | ||
| @@ -4274,6 +4322,12 @@ impl<W: LayoutElement> Column<W> { | |||
| 4274 | } | 4322 | } |
| 4275 | } | 4323 | } |
| 4276 | 4324 | ||
| 4325 | + pub fn set_anim_y_between_workspaces(&mut self) { | ||
| 4326 | + if let Some(anim) = &mut self.move_y_animation { | ||
| 4327 | + anim.is_between_workspaces = true; | ||
| 4328 | + } | ||
| 4329 | + } | ||
| 4330 | + | ||
| 4277 | /// Returns whether this column is currently fullscreen. | 4331 | /// Returns whether this column is currently fullscreen. |
| 4278 | /// | 4332 | /// |
| 4279 | /// As in, if it contains one currently-fullscreen tile, or in tabbed mode, if it contains at | 4333 | /// As in, if it contains one currently-fullscreen tile, or in tabbed mode, if it contains at |
src/layout/tile.rsmodified+32 -2
| @@ -160,6 +160,10 @@ struct ResizeAnimation { | |||
| 160 | struct MoveAnimation { | 160 | struct MoveAnimation { |
| 161 | anim: Animation, | 161 | anim: Animation, |
| 162 | from: f64, | 162 | from: f64, |
| 163 | + /// Whether this animation is for moving the tile between workspaces. | ||
| 164 | + /// | ||
| 165 | + /// Controls whether the tile is rendered uncropped and above others. | ||
| 166 | + is_between_workspaces: bool, | ||
| 163 | } | 167 | } |
| 164 | 168 | ||
| 165 | #[derive(Debug)] | 169 | #[derive(Debug)] |
| @@ -456,6 +460,16 @@ impl<W: LayoutElement> Tile<W> { | |||
| 456 | .is_some_and(|alpha| !alpha.anim.is_done()) | 460 | .is_some_and(|alpha| !alpha.anim.is_done()) |
| 457 | } | 461 | } |
| 458 | 462 | ||
| 463 | + pub fn is_moving_between_workspaces(&self) -> bool { | ||
| 464 | + self.move_y_animation | ||
| 465 | + .as_ref() | ||
| 466 | + .is_some_and(|anim| anim.is_between_workspaces) | ||
| 467 | + || self | ||
| 468 | + .move_x_animation | ||
| 469 | + .as_ref() | ||
| 470 | + .is_some_and(|anim| anim.is_between_workspaces) | ||
| 471 | + } | ||
| 472 | + | ||
| 459 | pub fn update_render_elements(&mut self, is_active: bool, view_rect: Rectangle<f64, Logical>) { | 473 | pub fn update_render_elements(&mut self, is_active: bool, view_rect: Rectangle<f64, Logical>) { |
| 460 | let rules = self.window.rules(); | 474 | let rules = self.window.rules(); |
| 461 | let animated_tile_size = self.animated_tile_size(); | 475 | let animated_tile_size = self.animated_tile_size(); |
| @@ -593,7 +607,11 @@ impl<W: LayoutElement> Tile<W> { | |||
| 593 | let current_offset = self.render_offset().x; | 607 | let current_offset = self.render_offset().x; |
| 594 | 608 | ||
| 595 | // Preserve the previous config if ongoing. | 609 | // Preserve the previous config if ongoing. |
| 596 | - let anim = self.move_x_animation.take().map(|move_| move_.anim); | 610 | + let move_ = self.move_x_animation.take(); |
| 611 | + let current_between = move_ | ||
| 612 | + .as_ref() | ||
| 613 | + .is_some_and(|move_| move_.is_between_workspaces); | ||
| 614 | + let anim = move_.map(|move_| move_.anim); | ||
| 597 | let anim = anim | 615 | let anim = anim |
| 598 | .map(|anim| anim.restarted(1., 0., 0.)) | 616 | .map(|anim| anim.restarted(1., 0., 0.)) |
| 599 | .unwrap_or_else(|| Animation::new(self.clock.clone(), 1., 0., 0., config)); | 617 | .unwrap_or_else(|| Animation::new(self.clock.clone(), 1., 0., 0., config)); |
| @@ -601,6 +619,7 @@ impl<W: LayoutElement> Tile<W> { | |||
| 601 | self.move_x_animation = Some(MoveAnimation { | 619 | self.move_x_animation = Some(MoveAnimation { |
| 602 | anim, | 620 | anim, |
| 603 | from: from + current_offset, | 621 | from: from + current_offset, |
| 622 | + is_between_workspaces: current_between, | ||
| 604 | }); | 623 | }); |
| 605 | } | 624 | } |
| 606 | 625 | ||
| @@ -612,7 +631,11 @@ impl<W: LayoutElement> Tile<W> { | |||
| 612 | let current_offset = self.render_offset().y; | 631 | let current_offset = self.render_offset().y; |
| 613 | 632 | ||
| 614 | // Preserve the previous config if ongoing. | 633 | // Preserve the previous config if ongoing. |
| 615 | - let anim = self.move_y_animation.take().map(|move_| move_.anim); | 634 | + let move_ = self.move_y_animation.take(); |
| 635 | + let current_between = move_ | ||
| 636 | + .as_ref() | ||
| 637 | + .is_some_and(|move_| move_.is_between_workspaces); | ||
| 638 | + let anim = move_.map(|move_| move_.anim); | ||
| 616 | let anim = anim | 639 | let anim = anim |
| 617 | .map(|anim| anim.restarted(1., 0., 0.)) | 640 | .map(|anim| anim.restarted(1., 0., 0.)) |
| 618 | .unwrap_or_else(|| Animation::new(self.clock.clone(), 1., 0., 0., config)); | 641 | .unwrap_or_else(|| Animation::new(self.clock.clone(), 1., 0., 0., config)); |
| @@ -620,6 +643,7 @@ impl<W: LayoutElement> Tile<W> { | |||
| 620 | self.move_y_animation = Some(MoveAnimation { | 643 | self.move_y_animation = Some(MoveAnimation { |
| 621 | anim, | 644 | anim, |
| 622 | from: from + current_offset, | 645 | from: from + current_offset, |
| 646 | + is_between_workspaces: current_between, | ||
| 623 | }); | 647 | }); |
| 624 | } | 648 | } |
| 625 | 649 | ||
| @@ -639,6 +663,12 @@ impl<W: LayoutElement> Tile<W> { | |||
| 639 | self.move_y_animation = None; | 663 | self.move_y_animation = None; |
| 640 | } | 664 | } |
| 641 | 665 | ||
| 666 | + pub fn set_anim_y_between_workspaces(&mut self) { | ||
| 667 | + if let Some(anim) = &mut self.move_y_animation { | ||
| 668 | + anim.is_between_workspaces = true; | ||
| 669 | + } | ||
| 670 | + } | ||
| 671 | + | ||
| 642 | pub fn animate_alpha(&mut self, from: f64, to: f64, config: niri_config::Animation) { | 672 | pub fn animate_alpha(&mut self, from: f64, to: f64, config: niri_config::Animation) { |
| 643 | let from = from.clamp(0., 1.); | 673 | let from = from.clamp(0., 1.); |
| 644 | let to = to.clamp(0., 1.); | 674 | let to = to.clamp(0., 1.); |
src/layout/workspace.rsmodified+33 -17
| @@ -28,6 +28,7 @@ use super::{ | |||
| 28 | RemovedTile, SizeFrac, | 28 | RemovedTile, SizeFrac, |
| 29 | }; | 29 | }; |
| 30 | use crate::animation::Clock; | 30 | use crate::animation::Clock; |
| 31 | +use crate::layout::RenderLayer; | ||
| 31 | use crate::niri_render_elements; | 32 | use crate::niri_render_elements; |
| 32 | use crate::render_helpers::renderer::NiriRenderer; | 33 | use crate::render_helpers::renderer::NiriRenderer; |
| 33 | use crate::render_helpers::shadow::ShadowRenderElement; | 34 | use crate::render_helpers::shadow::ShadowRenderElement; |
| @@ -375,21 +376,26 @@ impl<W: LayoutElement> Workspace<W> { | |||
| 375 | self.scrolling.are_transitions_ongoing() || self.floating.are_transitions_ongoing() | 376 | self.scrolling.are_transitions_ongoing() || self.floating.are_transitions_ongoing() |
| 376 | } | 377 | } |
| 377 | 378 | ||
| 378 | - pub fn update_render_elements(&mut self, is_active: bool) { | 379 | + pub fn update_render_elements(&mut self, is_active: bool, layer: RenderLayer) { |
| 379 | self.scrolling | 380 | self.scrolling |
| 380 | - .update_render_elements(is_active && !self.floating_is_active.get()); | 381 | + .update_render_elements(is_active && !self.floating_is_active.get(), layer); |
| 381 | 382 | ||
| 382 | let view_rect = Rectangle::from_size(self.view_size); | 383 | let view_rect = Rectangle::from_size(self.view_size); |
| 383 | - self.floating | 384 | + self.floating.update_render_elements( |
| 384 | - .update_render_elements(is_active && self.floating_is_active.get(), view_rect); | 385 | + is_active && self.floating_is_active.get(), |
| 385 | - | 386 | + view_rect, |
| 386 | - self.shadow.update_render_elements( | 387 | + layer, |
| 387 | - self.view_size, | ||
| 388 | - true, | ||
| 389 | - CornerRadius::default(), | ||
| 390 | - self.scale.fractional_scale(), | ||
| 391 | - 1., | ||
| 392 | ); | 388 | ); |
| 389 | + | ||
| 390 | + if layer.is_normal() { | ||
| 391 | + self.shadow.update_render_elements( | ||
| 392 | + self.view_size, | ||
| 393 | + true, | ||
| 394 | + CornerRadius::default(), | ||
| 395 | + self.scale.fractional_scale(), | ||
| 396 | + 1., | ||
| 397 | + ); | ||
| 398 | + } | ||
| 393 | } | 399 | } |
| 394 | 400 | ||
| 395 | pub fn update_config(&mut self, base_options: Rc<Options>) { | 401 | pub fn update_config(&mut self, base_options: Rc<Options>) { |
| @@ -1613,11 +1619,12 @@ impl<W: LayoutElement> Workspace<W> { | |||
| 1613 | ctx: RenderCtx<R>, | 1619 | ctx: RenderCtx<R>, |
| 1614 | xray_pos: XrayPos, | 1620 | xray_pos: XrayPos, |
| 1615 | focus_ring: bool, | 1621 | focus_ring: bool, |
| 1622 | + layer: RenderLayer, | ||
| 1616 | push: &mut dyn FnMut(WorkspaceRenderElement<R>), | 1623 | push: &mut dyn FnMut(WorkspaceRenderElement<R>), |
| 1617 | ) { | 1624 | ) { |
| 1618 | let scrolling_focus_ring = focus_ring && !self.floating_is_active(); | 1625 | let scrolling_focus_ring = focus_ring && !self.floating_is_active(); |
| 1619 | self.scrolling | 1626 | self.scrolling |
| 1620 | - .render(ctx, xray_pos, scrolling_focus_ring, &mut |elem| { | 1627 | + .render(ctx, xray_pos, scrolling_focus_ring, layer, &mut |elem| { |
| 1621 | push(elem.into()) | 1628 | push(elem.into()) |
| 1622 | }); | 1629 | }); |
| 1623 | } | 1630 | } |
| @@ -1627,18 +1634,23 @@ impl<W: LayoutElement> Workspace<W> { | |||
| 1627 | ctx: RenderCtx<R>, | 1634 | ctx: RenderCtx<R>, |
| 1628 | xray_pos: XrayPos, | 1635 | xray_pos: XrayPos, |
| 1629 | focus_ring: bool, | 1636 | focus_ring: bool, |
| 1637 | + layer: RenderLayer, | ||
| 1630 | push: &mut dyn FnMut(WorkspaceRenderElement<R>), | 1638 | push: &mut dyn FnMut(WorkspaceRenderElement<R>), |
| 1631 | ) { | 1639 | ) { |
| 1632 | - if !self.is_floating_visible() { | 1640 | + if !self.is_floating_visible() && layer.is_normal() { |
| 1633 | return; | 1641 | return; |
| 1634 | } | 1642 | } |
| 1635 | 1643 | ||
| 1636 | let view_rect = Rectangle::from_size(self.view_size); | 1644 | let view_rect = Rectangle::from_size(self.view_size); |
| 1637 | let floating_focus_ring = focus_ring && self.floating_is_active(); | 1645 | let floating_focus_ring = focus_ring && self.floating_is_active(); |
| 1638 | - self.floating | 1646 | + self.floating.render( |
| 1639 | - .render(ctx, xray_pos, view_rect, floating_focus_ring, &mut |elem| { | 1647 | + ctx, |
| 1640 | - push(elem.into()) | 1648 | + xray_pos, |
| 1641 | - }); | 1649 | + view_rect, |
| 1650 | + floating_focus_ring, | ||
| 1651 | + layer, | ||
| 1652 | + &mut |elem| push(elem.into()), | ||
| 1653 | + ); | ||
| 1642 | } | 1654 | } |
| 1643 | 1655 | ||
| 1644 | pub fn render_shadow<R: NiriRenderer>( | 1656 | pub fn render_shadow<R: NiriRenderer>( |
| @@ -1964,6 +1976,10 @@ impl<W: LayoutElement> Workspace<W> { | |||
| 1964 | &self.scrolling | 1976 | &self.scrolling |
| 1965 | } | 1977 | } |
| 1966 | 1978 | ||
| 1979 | + pub fn scrolling_mut(&mut self) -> &mut ScrollingSpace<W> { | ||
| 1980 | + &mut self.scrolling | ||
| 1981 | + } | ||
| 1982 | + | ||
| 1967 | pub fn floating(&self) -> &FloatingSpace<W> { | 1983 | pub fn floating(&self) -> &FloatingSpace<W> { |
| 1968 | &self.floating | 1984 | &self.floating |
| 1969 | } | 1985 | } |