diff options
Diffstat (limited to 'crates/wayland/src/winit')
| -rw-r--r-- | crates/wayland/src/winit/capture.rs | 5 | ||||
| -rw-r--r-- | crates/wayland/src/winit/connect.rs | 1 | ||||
| -rw-r--r-- | crates/wayland/src/winit/render.rs | 4 |
3 files changed, 10 insertions, 0 deletions
diff --git a/crates/wayland/src/winit/capture.rs b/crates/wayland/src/winit/capture.rs index 3813559..6e03dd8 100644 --- a/crates/wayland/src/winit/capture.rs +++ b/crates/wayland/src/winit/capture.rs @@ -98,6 +98,11 @@ impl WaylandPlatform { let mut occluders: Vec<srdwm_core::Rect> = Vec::new(); let focused = self.wm.borrow().focused_id(); for id in self.wm.borrow().visible_windows_front_to_back().map(|w| w.id).collect::<Vec<_>>() { + // Matches the render loops: a capture must not show a frame the + // screen does not (see `window_has_content`). + if !crate::state::CompState::has_content(&self.state.windows_shown_once, &self.state.id_to_window, id) { + continue; + } let Some(w) = self.wm.borrow().window(id).cloned() else { continue }; if let Some(deco) = self.state.decorations.get(&id) { if let Ok(elem) = MemoryRenderBufferRenderElement::from_buffer(renderer, (w.geometry.x as f64, w.geometry.y as f64), deco, None, None, None, Kind::Unspecified) { diff --git a/crates/wayland/src/winit/connect.rs b/crates/wayland/src/winit/connect.rs index aa59d9d..cca991c 100644 --- a/crates/wayland/src/winit/connect.rs +++ b/crates/wayland/src/winit/connect.rs @@ -168,6 +168,7 @@ impl WaylandPlatform { dead_layer_surfaces: HashSet::new(), hidden_layer_surfaces: HashMap::new(), layer_surfaces_shown_once: HashSet::new(), + windows_shown_once: HashSet::new(), decorations: HashMap::new(), border_top_decorations: HashMap::new(), border_bottom_decorations: HashMap::new(), diff --git a/crates/wayland/src/winit/render.rs b/crates/wayland/src/winit/render.rs index 432ebba..d49351f 100644 --- a/crates/wayland/src/winit/render.rs +++ b/crates/wayland/src/winit/render.rs @@ -236,6 +236,10 @@ impl WaylandPlatform { let monitor_bounds: Vec<srdwm_core::Rect> = self.wm.borrow().monitors().iter().map(|m| m.full_geometry).collect(); let mut occluders: Vec<srdwm_core::Rect> = Vec::with_capacity(ids.len()); for id in ids { + // See `window_has_content`: no buffer yet means no frame yet. + if !crate::state::CompState::has_content(&self.state.windows_shown_once, &self.state.id_to_window, id) { + continue; + } let Some(w) = self.wm.borrow().window(id).cloned() else { continue }; // `w.geometry` is the animation's target, not necessarily where // the window is actually drawn this frame - see the matching |