space: Clarify state reset on `map_output`

This commit is contained in:
Victor Brekenfeld 2022-01-06 18:35:37 +01:00
parent 14d10e4863
commit 75929919ba
1 changed files with 9 additions and 2 deletions

View File

@ -193,11 +193,17 @@ impl Space {
/// The scale is the what is rendered for the given output /// The scale is the what is rendered for the given output
/// and may be fractional. It is independent from the integer scale /// and may be fractional. It is independent from the integer scale
/// reported to clients by the output. /// reported to clients by the output.
///
/// *Note:* Remapping an output does reset it's damage memory.
pub fn map_output<P: Into<Point<i32, Logical>>>(&mut self, output: &Output, scale: f64, location: P) { pub fn map_output<P: Into<Point<i32, Logical>>>(&mut self, output: &Output, scale: f64, location: P) {
let mut state = output_state(self.id, output); let mut state = output_state(self.id, output);
*state = OutputState { *state = OutputState {
location: location.into(), location: location.into(),
render_scale: scale, 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::<Vec<_>>(),
// resets last_seen and old_damage, if remapped
..Default::default() ..Default::default()
}; };
if !self.outputs.contains(output) { if !self.outputs.contains(output) {
@ -289,8 +295,9 @@ impl Space {
outputs outputs
} }
/// Refresh some internal values and update client state /// Refresh some internal values and update client state,
/// based on the position of windows and outputs. /// 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 /// Needs to be called periodically, at best before every
/// wayland socket flush. /// wayland socket flush.