pub fn init_explicit_synchronization_global<L>(
    display: &mut Display,
    logger: L,
) -> Global<ZwpLinuxExplicitSynchronizationV1>
where
    L: Into<Option<::slog::Logger>>,
{
    let _log =
        crate::slog_or_fallback(logger).new(slog::o!("smithay_module" => "wayland_explicit_synchronization"));

    display.create_global::<ZwpLinuxExplicitSynchronizationV1, _>(
        2,
        Filter::new(
            move |(sync, _version): (Main<ZwpLinuxExplicitSynchronizationV1>, _), _, _| {
                sync.quick_assign(move |explicit_sync, req, _| {
                    if let zwp_linux_explicit_synchronization_v1::Request::GetSynchronization {
                        id,
                        surface,
                    } = req
                    {
                        let exists = with_states(&surface, |states| {
                            states.data_map.insert_if_missing(|| ESUserData {
                                state: RefCell::new(None),
                            });
                            states
                                .data_map
                                .get::<ESUserData>()
                                .map(|ud| ud.state.borrow().is_some())
                                .unwrap()
                        })
                        .unwrap_or(false);
                        if exists {
                            explicit_sync.as_ref().post_error(
                                zwp_linux_explicit_synchronization_v1::Error::SynchronizationExists as u32,
                                "The surface already has a synchronization object associated.".into(),
                            );
                            return;
                        }
                        let surface_sync = implement_surface_sync(id, surface.clone());
                        with_states(&surface, |states| {
                            let data = states.data_map.get::<ESUserData>().unwrap();
                            *data.state.borrow_mut() = Some(surface_sync);
                        })
                        .unwrap();
                    }
                });
            },
        ),
    )
}
/// Initialize the explicit synchronization global
///
/// See module-level documentation for its use.
Initialize the explicit synchronization global
See module-level documentation for its use.
Initialize the explicit synchronization global See module - level documentation for its use .
pub fn init_explicit_synchronization_global<L>(
    display: &mut Display,
    logger: L,
) -> Global<ZwpLinuxExplicitSynchronizationV1>
where
    L: Into<Option<::slog::Logger>>,
{
    let _log =
        crate::slog_or_fallback(logger).new(slog::o!("smithay_module" => "wayland_explicit_synchronization"));
    display.create_global::<ZwpLinuxExplicitSynchronizationV1, _>(
        2,
        Filter::new(
            move |(sync, _version): (Main<ZwpLinuxExplicitSynchronizationV1>, _), _, _| {
                sync.quick_assign(move |explicit_sync, req, _| {
                    if let zwp_linux_explicit_synchronization_v1::Request::GetSynchronization {
                        id,
                        surface,
                    } = req
                    {
                        let exists = with_states(&surface, |states| {
                            states.data_map.insert_if_missing(|| ESUserData {
                                state: RefCell::new(None),
                            });
                            states
                                .data_map
                                .get::<ESUserData>()
                                .map(|ud| ud.state.borrow().is_some())
                                .unwrap()
                        })
                        .unwrap_or(false);
                        if exists {
                            explicit_sync.as_ref().post_error(
                                zwp_linux_explicit_synchronization_v1::Error::SynchronizationExists as u32,
                                "The surface already has a synchronization object associated.".into(),
                            );
                            return;
                        }
                        let surface_sync = implement_surface_sync(id, surface.clone());
                        with_states(&surface, |states| {
                            let data = states.data_map.get::<ESUserData>().unwrap();
                            *data.state.borrow_mut() = Some(surface_sync);
                        })
                        .unwrap();
                    }
                });
            },
        ),
    )
}
pub fn init_explicit_synchronization_global < L > ( display : & mut Display , logger : L , ) -> Global < ZwpLinuxExplicitSynchronizationV1 > where L : Into < Option < :: slog :: Logger > > , { let _log = crate :: slog_or_fallback ( logger ) . new ( slog :: o ! ( " " " " ) ) ; display . create_global :: < ZwpLinuxExplicitSynchronizationV1 , _ > ( 2 , Filter :: new ( move | ( sync , _version ) : ( Main < ZwpLinuxExplicitSynchronizationV1 > , _ ) , _ , _ | { sync . quick_assign ( move | explicit_sync , req , _ | { if let zwp_linux_explicit_synchronization_v1 :: Request :: GetSynchronization { id , surface , } = req { let exists = with_states ( & surface , | states | { states . data_map . insert_if_missing ( | | ESUserData { state : RefCell :: new ( None ) , } ) ; states . data_map . get :: < ESUserData > ( ) . map ( | ud | ud . state . borrow ( ) . is_some ( ) ) . unwrap ( ) } ) . unwrap_or ( false ) ; if exists { explicit_sync . as_ref ( ) . post_error ( zwp_linux_explicit_synchronization_v1 :: Error :: SynchronizationExists as u32 , " " . into ( ) , ) ; return ; } let surface_sync = implement_surface_sync ( id , surface . clone ( ) ) ; with_states ( & surface , | states | { let data = states . data_map . get :: < ESUserData > ( ) . unwrap ( ) ; * data . state . borrow_mut ( ) = Some ( surface_sync ) ; } ) . unwrap ( ) ; } } ) ; } , ) , ) }
Initialize the explicit synchronization global
See module-level documentation for its use.
Initialize the explicit synchronization global See module - level documentation for its use .
display
&mut Display
logger
L
display
&mut Display
logger
L