aboutsummaryrefslogtreecommitdiff
path: root/src/layout/tile.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2025-03-01 09:45:57 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2025-03-10 07:59:14 +0300
commitb351f6ff220560d96a260d8dd3ad794000923481 (patch)
treef2bd1a777fe9f932fea2cfeba3677cbb39b634eb /src/layout/tile.rs
parent12817a682d666e81e30b5a723d6419baf74cdb1c (diff)
downloadniri-b351f6ff220560d96a260d8dd3ad794000923481.tar.gz
niri-b351f6ff220560d96a260d8dd3ad794000923481.tar.bz2
niri-b351f6ff220560d96a260d8dd3ad794000923481.zip
Keep track of RenderElementStates in offscreens
This both avoids sending frame callbacks to surfaces invisible on the offscreen (fixing Firefox with subsurface compositing in the process), and fixes searching for split popups during the resize animation.
Diffstat (limited to 'src/layout/tile.rs')
-rw-r--r--src/layout/tile.rs27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/layout/tile.rs b/src/layout/tile.rs
index a93e4a6f..89f0e6ab 100644
--- a/src/layout/tile.rs
+++ b/src/layout/tile.rs
@@ -888,7 +888,7 @@ impl<W: LayoutElement> Tile<W> {
clip_to_geometry
};
- if let Some((elem_current, _sync_point)) = current {
+ if let Some((elem_current, _sync_point, mut data)) = current {
let texture_current = elem_current.texture().clone();
// The offset and size are computed in physical pixels and converted to
// logical with the same `scale`, so converting them back with rounding
@@ -908,10 +908,13 @@ impl<W: LayoutElement> Tile<W> {
clip_to_geometry,
win_alpha,
);
- // FIXME: with split popups, this will use the resize element ID for
- // popups, but we want the real IDs.
- self.window
- .set_offscreen_element_id(Some(elem.id().clone()));
+
+ // We're drawing the resize shader, not the offscreen directly.
+ data.id = elem.id().clone();
+
+ // This is not a problem for split popups as the code will look for them by
+ // original id when it doesn't find them on the offscreen.
+ self.window.set_offscreen_data(Some(data));
resize_shader = Some(elem.into());
}
}
@@ -928,7 +931,6 @@ impl<W: LayoutElement> Tile<W> {
)
.into(),
);
- self.window.set_offscreen_element_id(None);
}
}
@@ -1058,6 +1060,8 @@ impl<W: LayoutElement> Tile<W> {
let mut alpha_anim_elem = None;
let mut window_elems = None;
+ self.window().set_offscreen_data(None);
+
if let Some(open) = &self.open_animation {
let renderer = renderer.as_gles_renderer();
let elements =
@@ -1071,9 +1075,8 @@ impl<W: LayoutElement> Tile<W> {
scale,
tile_alpha,
) {
- Ok(elem) => {
- self.window()
- .set_offscreen_element_id(Some(elem.id().clone()));
+ Ok((elem, data)) => {
+ self.window().set_offscreen_data(Some(data));
open_anim_elem = Some(elem.into());
}
Err(err) => {
@@ -1086,12 +1089,11 @@ impl<W: LayoutElement> Tile<W> {
self.render_inner(renderer, Point::from((0., 0.)), scale, focus_ring, target);
let elements = elements.collect::<Vec<TileRenderElement<_>>>();
match alpha.offscreen.render(renderer, scale, &elements) {
- Ok((elem, _sync)) => {
+ Ok((elem, _sync, data)) => {
let offset = elem.offset();
let elem = elem.with_alpha(tile_alpha).with_offset(location + offset);
- self.window()
- .set_offscreen_element_id(Some(elem.id().clone()));
+ self.window().set_offscreen_data(Some(data));
alpha_anim_elem = Some(elem.into());
}
Err(err) => {
@@ -1101,7 +1103,6 @@ impl<W: LayoutElement> Tile<W> {
}
if open_anim_elem.is_none() && alpha_anim_elem.is_none() {
- self.window().set_offscreen_element_id(None);
window_elems = Some(self.render_inner(renderer, location, scale, focus_ring, target));
}