<NME> output.rs
<BEF> use crate::{
    output::Output,
    utils::{Logical, Point},
};

use std::{
    cell::{RefCell, RefMut},
    collections::HashMap,
};

#[derive(Clone, Default)]
pub struct OutputState {
    pub location: Point<i32, Logical>,
}

pub type OutputUserdata = RefCell<HashMap<usize, OutputState>>;
pub fn output_state(space: usize, o: &Output) -> RefMut<'_, OutputState> {
    let userdata = o.user_data();
    userdata.insert_if_missing(OutputUserdata::default);
    RefMut::map(userdata.get::<OutputUserdata>().unwrap().borrow_mut(), |m| {
        m.entry(space).or_default()
    })
}
    // old_damage represents the damage from the last n render iterations
    // used to track the damage for different buffer ages
    pub old_damage: VecDeque<Vec<Rectangle<i32, Physical>>>,
    // physical geometry of the toplevels from the last render iteration
    pub last_toplevel_state: IndexMap<ToplevelId, Rectangle<i32, Physical>>,
    // output geometry from the last render iteration
    // used to react on output geometry changes, like damaging
    // the whole output

<MSG> space: track the element zindex and damage on change

fixes artificats if a window is activated but not moved
and does not damage the whole buffer

<DFF> @@ -41,8 +41,8 @@ pub struct OutputState {
     // old_damage represents the damage from the last n render iterations
     // used to track the damage for different buffer ages
     pub old_damage: VecDeque<Vec<Rectangle<i32, Physical>>>,
-    // physical geometry of the toplevels from the last render iteration
-    pub last_toplevel_state: IndexMap<ToplevelId, Rectangle<i32, Physical>>,
+    // z_index and physical geometry of the toplevels from the last render iteration
+    pub last_toplevel_state: IndexMap<ToplevelId, (usize, Rectangle<i32, Physical>)>,
     // output geometry from the last render iteration
     // used to react on output geometry changes, like damaging
     // the whole output

space: track the element zindex and damage on change