diff --git a/src/compositor/mod.rs b/src/compositor/mod.rs index 2ba51a7..927401c 100644 --- a/src/compositor/mod.rs +++ b/src/compositor/mod.rs @@ -60,19 +60,19 @@ //! //! // Instanciate the CompositorHandler and give it to the event loop //! let compositor_hid = event_loop.add_handler_with_init( -//! MyCompositorHandler::new(Myhandler::new()) +//! MyCompositorHandler::new(MyHandler{ /* ... */ }, None /* put a logger here */) //! ); //! //! // Register it as a handler for wl_compositor -//! event_loop.register_global::(compositor_hid); +//! event_loop.register_global::(compositor_hid, 4); //! //! // Register it as a handler for wl_subcompositor -//! event_loop.register_global::(compositor_hid); +//! event_loop.register_global::(compositor_hid, 1); //! //! // retrieve the token needed to access the surfaces' metadata //! let compositor_token = { //! let state = event_loop.state(); -//! state.get_handler::>(handler_id).get_token() +//! state.get_handler::(compositor_hid).get_token() //! }; //! //! // You're now ready to go! @@ -110,7 +110,7 @@ pub enum Damage { Full, /// A rectangle containing the damaged zone, in surface coordinates Surface(Rectangle), - /// A rectangle containing the smaazed zone, in buffer coordinates + /// A rectangle containing the damaged zone, in buffer coordinates /// /// Note: Buffer scaling must be taken into consideration Buffer(Rectangle), @@ -435,9 +435,21 @@ impl CompositorHandler { /// at creation of the `CompositorHandler`. #[allow(unused_variables)] pub trait Handler { - /// See `wayland_server::protocol::wl_surface::Handler::commit` + /// The double-buffered state has been validated by the client + /// + /// At this point, the pending state that has been accumulated in the `SurfaceAttributes` associated + /// to this surface should be integrated into the current state of the surface. + /// + /// See [`wayland_server::protocol::wl_surface::Handler::commit`](https://docs.rs/wayland-server/*/wayland_server/protocol/wl_surface/trait.Handler.html#method.commit) + /// for more details fn commit(&mut self, evlh: &mut EventLoopHandle, client: &Client, surface: &wl_surface::WlSurface) {} - /// See `wayland_server::protocol::wl_surface::Handler::frame` + /// The client asks to be notified when would be a good time to update the contents of this surface + /// + /// You must keep the provided `WlCallback` and trigger it at the appropriate time by calling + /// its `done()` method. + /// + /// See [`wayland_server::protocol::wl_surface::Handler::frame`](https://docs.rs/wayland-server/*/wayland_server/protocol/wl_surface/trait.Handler.html#method.frame) + /// for more details fn frame(&mut self, evlh: &mut EventLoopHandle, client: &Client, surface: &wl_surface::WlSurface, callback: wl_callback::WlCallback) { } diff --git a/src/compositor/tree.rs b/src/compositor/tree.rs index a78558f..8a77bd3 100644 --- a/src/compositor/tree.rs +++ b/src/compositor/tree.rs @@ -35,7 +35,7 @@ pub enum RoleStatus { /// This surface does not have any role NoRole, /// This surface is a subsurface - Sursurface, + Subsurface, /// This surface has a role other than subsurface /// /// It is thus the root of a subsurface tree that will @@ -102,7 +102,7 @@ impl SurfaceData { let data_mutex = Self::get_data(surface); let data_guard = data_mutex.lock().unwrap(); match (data_guard.has_role, data_guard.parent.is_some()) { - (true, true) => RoleStatus::Sursurface, + (true, true) => RoleStatus::Subsurface, (true, false) => RoleStatus::HasRole, (false, false) => RoleStatus::NoRole, (false, true) => unreachable!(),