diff --git a/wayland-server/CHANGELOG.md b/wayland-server/CHANGELOG.md index daf3a146fef..f8e717e4cf6 100644 --- a/wayland-server/CHANGELOG.md +++ b/wayland-server/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased - Add `flush_clients` method to server `DisplayHandle`. +- Implement `AsFd` for `Display` so it can easily be used in a `calloop` source. #### Breaking changes diff --git a/wayland-server/src/display.rs b/wayland-server/src/display.rs index 20a2af614d4..fb3e8def6f1 100644 --- a/wayland-server/src/display.rs +++ b/wayland-server/src/display.rs @@ -1,6 +1,7 @@ use std::{os::unix::net::UnixStream, sync::Arc}; use wayland_backend::{ + io_lifetimes::{AsFd, BorrowedFd}, protocol::ObjectInfo, server::{Backend, ClientData, GlobalId, Handle, InitError, InvalidId, ObjectId}, }; @@ -66,6 +67,13 @@ impl Display { } } +impl AsFd for Display { + /// Provides fd from [`Backend::poll_fd`] for polling. + fn as_fd(&self) -> BorrowedFd<'_> { + self.backend.poll_fd() + } +} + /// A handle to the Wayland display /// /// A display handle may be constructed from a [`Handle`] using it's [`From`] implementation.