fn initial_events(&self, config: &impl Config) -> Vec<DisplayEvent> {
        let mut events = vec![];
        if let Some(workspaces) = config.workspaces() {
            if workspaces.is_empty() {
                // tell manager about existing screens
                self.xw.get_screens().into_iter().for_each(|screen| {
                    let e = DisplayEvent::ScreenCreate(screen);
                    events.push(e);
                });
            } else {
                for wsc in &workspaces {
                    let mut screen = Screen::from(wsc);
                    screen.root = WindowHandle::XlibHandle(self.root);
                    let e = DisplayEvent::ScreenCreate(screen);
                    events.push(e);
                }
            }
        }

        // tell manager about existing windows
        self.find_all_windows().into_iter().for_each(|w| {
            let cursor = self.xw.get_cursor_point().ok().unwrap_or_default();
            let e = DisplayEvent::WindowCreate(w, cursor.0, cursor.1);
            events.push(e);
        });

        events
    }
/// Return a vec of events for setting up state of WM.
Return a vec of events for setting up state of WM.
Return a vec of events for setting up state of WM .
fn initial_events(&self, config: &impl Config) -> Vec<DisplayEvent> {
        let mut events = vec![];
        if let Some(workspaces) = config.workspaces() {
            if workspaces.is_empty() {
                // tell manager about existing screens
                self.xw.get_screens().into_iter().for_each(|screen| {
                    let e = DisplayEvent::ScreenCreate(screen);
                    events.push(e);
                });
            } else {
                for wsc in &workspaces {
                    let mut screen = Screen::from(wsc);
                    screen.root = WindowHandle::XlibHandle(self.root);
                    let e = DisplayEvent::ScreenCreate(screen);
                    events.push(e);
                }
            }
        }
        // tell manager about existing windows
        self.find_all_windows().into_iter().for_each(|w| {
            let cursor = self.xw.get_cursor_point().ok().unwrap_or_default();
            let e = DisplayEvent::WindowCreate(w, cursor.0, cursor.1);
            events.push(e);
        });
        events
    }
fn initial_events ( & self , config : & impl Config ) -> Vec < DisplayEvent > { let mut events = vec ! [ ] ; if let Some ( workspaces ) = config . workspaces ( ) { if workspaces . is_empty ( ) { // tell manager about existing screens self . xw . get_screens ( ) . into_iter ( ) . for_each ( | screen | { let e = DisplayEvent :: ScreenCreate ( screen ) ; events . push ( e ) ; } ) ; } else { for wsc in & workspaces { let mut screen = Screen :: from ( wsc ) ; screen . root = WindowHandle :: XlibHandle ( self . root ) ; let e = DisplayEvent :: ScreenCreate ( screen ) ; events . push ( e ) ; } } } // tell manager about existing windows self . find_all_windows ( ) . into_iter ( ) . for_each ( | w | { let cursor = self . xw . get_cursor_point ( ) . ok ( ) . unwrap_or_default ( ) ; let e = DisplayEvent :: WindowCreate ( w , cursor . 0 , cursor . 1 ) ; events . push ( e ) ; } ) ; events }
Return a vec of events for setting up state of WM.
Return a vec of events for setting up state of WM .
&self
config
&impl Config
&self
config
&impl Config