From 75929919ba98f1144e9781e0f303a5f5ffc428d0 Mon Sep 17 00:00:00 2001 From: Victor Brekenfeld Date: Thu, 6 Jan 2022 18:35:37 +0100 Subject: [PATCH] space: Clarify state reset on `map_output` --- src/desktop/space/mod.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/desktop/space/mod.rs b/src/desktop/space/mod.rs index 0565bf1..47116b4 100644 --- a/src/desktop/space/mod.rs +++ b/src/desktop/space/mod.rs @@ -193,11 +193,17 @@ impl Space { /// The scale is the what is rendered for the given output /// and may be fractional. It is independent from the integer scale /// reported to clients by the output. + /// + /// *Note:* Remapping an output does reset it's damage memory. pub fn map_output>>(&mut self, output: &Output, scale: f64, location: P) { let mut state = output_state(self.id, output); *state = OutputState { location: location.into(), render_scale: scale, + // keep surfaces, we still need to inform them of leaving, + // if they don't overlap anymore during refresh. + surfaces: state.surfaces.drain(..).collect::>(), + // resets last_seen and old_damage, if remapped ..Default::default() }; if !self.outputs.contains(output) { @@ -289,8 +295,9 @@ impl Space { outputs } - /// Refresh some internal values and update client state - /// based on the position of windows and outputs. + /// Refresh some internal values and update client state, + /// meaning this will handle output enter and leave events + /// for mapped outputs and windows based on their position. /// /// Needs to be called periodically, at best before every /// wayland socket flush.