pub fn refresh(&mut self) {
        self.windows.retain(|w| w.toplevel().alive());

        for output in &mut self.outputs {
            output_state(self.id, output)
                .surfaces
                .retain(|s| s.as_ref().is_alive());
        }

        for window in &self.windows {
            let bbox = window_rect(window, &self.id);
            let kind = window.toplevel();

            for output in &self.outputs {
                let output_geometry = self
                    .output_geometry(output)
                    .unwrap_or_else(|| Rectangle::from_loc_and_size((0, 0), (0, 0)));
                let mut output_state = output_state(self.id, output);

                // Check if the bounding box of the toplevel intersects with
                // the output, if not no surface in the tree can intersect with
                // the output.
                if !output_geometry.overlaps(bbox) {
                    if let Some(surface) = kind.get_surface() {
                        output_leave(output, &mut output_state.surfaces, surface, &self.logger);
                    }
                    continue;
                }

                if let Some(surface) = kind.get_surface() {
                    output_update(
                        output,
                        output_geometry,
                        &mut output_state.surfaces,
                        surface,
                        window_loc(window, &self.id),
                        &self.logger,
                    );

                    for (popup, location) in PopupManager::popups_for_surface(surface)
                        .ok()
                        .into_iter()
                        .flatten()
                    {
                        if let Some(surface) = popup.get_surface() {
                            let location = window_loc(window, &self.id) + window.geometry().loc + location
                                - popup.geometry().loc;
                            output_update(
                                output,
                                output_geometry,
                                &mut output_state.surfaces,
                                surface,
                                location,
                                &self.logger,
                            );
                        }
                    }
                }
            }
        }
    }
/// 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.
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.
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 .
pub fn refresh(&mut self) {
        self.windows.retain(|w| w.toplevel().alive());
        for output in &mut self.outputs {
            output_state(self.id, output)
                .surfaces
                .retain(|s| s.as_ref().is_alive());
        }
        for window in &self.windows {
            let bbox = window_rect(window, &self.id);
            let kind = window.toplevel();
            for output in &self.outputs {
                let output_geometry = self
                    .output_geometry(output)
                    .unwrap_or_else(|| Rectangle::from_loc_and_size((0, 0), (0, 0)));
                let mut output_state = output_state(self.id, output);
                // Check if the bounding box of the toplevel intersects with
                // the output, if not no surface in the tree can intersect with
                // the output.
                if !output_geometry.overlaps(bbox) {
                    if let Some(surface) = kind.get_surface() {
                        output_leave(output, &mut output_state.surfaces, surface, &self.logger);
                    }
                    continue;
                }
                if let Some(surface) = kind.get_surface() {
                    output_update(
                        output,
                        output_geometry,
                        &mut output_state.surfaces,
                        surface,
                        window_loc(window, &self.id),
                        &self.logger,
                    );
                    for (popup, location) in PopupManager::popups_for_surface(surface)
                        .ok()
                        .into_iter()
                        .flatten()
                    {
                        if let Some(surface) = popup.get_surface() {
                            let location = window_loc(window, &self.id) + window.geometry().loc + location
                                - popup.geometry().loc;
                            output_update(
                                output,
                                output_geometry,
                                &mut output_state.surfaces,
                                surface,
                                location,
                                &self.logger,
                            );
                        }
                    }
                }
            }
        }
    }
pub fn refresh ( & mut self ) { self . windows . retain ( | w | w . toplevel ( ) . alive ( ) ) ; for output in & mut self . outputs { output_state ( self . id , output ) . surfaces . retain ( | s | s . as_ref ( ) . is_alive ( ) ) ; } for window in & self . windows { let bbox = window_rect ( window , & self . id ) ; let kind = window . toplevel ( ) ; for output in & self . outputs { let output_geometry = self . output_geometry ( output ) . unwrap_or_else ( | | Rectangle :: from_loc_and_size ( ( 0 , 0 ) , ( 0 , 0 ) ) ) ; let mut output_state = output_state ( self . id , output ) ; // Check if the bounding box of the toplevel intersects with // the output, if not no surface in the tree can intersect with // the output. if ! output_geometry . overlaps ( bbox ) { if let Some ( surface ) = kind . get_surface ( ) { output_leave ( output , & mut output_state . surfaces , surface , & self . logger ) ; } continue ; } if let Some ( surface ) = kind . get_surface ( ) { output_update ( output , output_geometry , & mut output_state . surfaces , surface , window_loc ( window , & self . id ) , & self . logger , ) ; for ( popup , location ) in PopupManager :: popups_for_surface ( surface ) . ok ( ) . into_iter ( ) . flatten ( ) { if let Some ( surface ) = popup . get_surface ( ) { let location = window_loc ( window , & self . id ) + window . geometry ( ) . loc + location - popup . geometry ( ) . loc ; output_update ( output , output_geometry , & mut output_state . surfaces , surface , location , & self . logger , ) ; } } } } } }
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.
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 .
&mut self
&mut self