fix intra-doc links
This commit is contained in:
parent
e5a1afd306
commit
e696ce4c35
|
@ -182,9 +182,9 @@ pub trait AsDmabuf {
|
|||
}
|
||||
|
||||
impl AsDmabuf for Dmabuf {
|
||||
type Error = ();
|
||||
type Error = std::convert::Infallible;
|
||||
|
||||
fn export(&self) -> Result<Dmabuf, ()> {
|
||||
fn export(&self) -> Result<Dmabuf, std::convert::Infallible> {
|
||||
Ok(self.clone())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! Module for Buffers created using [libgbm](reexports::gbm).
|
||||
//! Module for Buffers created using [libgbm](gbm).
|
||||
//!
|
||||
//! The re-exported `GbmDevice` implements the [`Allocator`](super::Allocator) trait
|
||||
//! and `GbmBuffer` satisfies the [`Buffer`](super::Buffer) trait while also allowing
|
||||
//! The re-exported [`GbmDevice`](gbm::Device) implements the [`Allocator`](super::Allocator) trait
|
||||
//! and [`GbmBuffer`](gbm::BufferObject) satisfies the [`Buffer`](super::Buffer) trait while also allowing
|
||||
//! conversions to and from [dmabufs](super::dmabuf).
|
||||
|
||||
use super::{
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
//! buffer creation and handling from various sources.
|
||||
//!
|
||||
//! Allocators provided:
|
||||
//! - Dumb Buffers through [`backend::drm::DrmDevice`]
|
||||
//! - Gbm Buffers through [`reexports::gbm::Device`]
|
||||
//! - Dumb Buffers through [`crate::backend::drm::DrmDevice`]
|
||||
//! - Gbm Buffers through [`::gbm::Device`]
|
||||
//!
|
||||
//! Buffer types supported:
|
||||
//! - [DumbBuffers](dumb::DumbBuffer)
|
||||
//! - [gbm BufferObjects](reexports::gbm::BufferObject)
|
||||
//! - [GbmBuffers](::gbm::BufferObject)
|
||||
//! - [DmaBufs](dmabuf::Dmabuf)
|
||||
//!
|
||||
//! Helpers:
|
||||
|
|
|
@ -258,14 +258,14 @@ impl<A: AsRawFd + 'static> DrmDevice<A> {
|
|||
/// Initialization of surfaces happens through the types provided by
|
||||
/// [`drm-rs`](drm).
|
||||
///
|
||||
/// - [`crtc`](drm::control::crtc)s represent scanout engines of the device pointing to one framebuffer. \
|
||||
/// - [`crtcs`](drm::control::crtc) represent scanout engines of the device pointing to one framebuffer. \
|
||||
/// Their responsibility is to read the data of the framebuffer and export it into an "Encoder". \
|
||||
/// The number of crtc's represent the number of independant output devices the hardware may handle.
|
||||
/// - [`plane`](drm::control::plane)s represent a single plane on a crtc, which is composite together with
|
||||
/// - [`planes`](drm::control::plane) represent a single plane on a crtc, which is composite together with
|
||||
/// other planes on the same crtc to present the final image.
|
||||
/// - [`mode`](drm::control::Mode) describes the resolution and rate of images produced by the crtc and \
|
||||
/// has to be compatible with the provided `connectors`.
|
||||
/// - [`connectors`] - List of connectors driven by the crtc. At least one(!) connector needs to be \
|
||||
/// - [`connectors`](drm::control::connector) - List of connectors driven by the crtc. At least one(!) connector needs to be \
|
||||
/// attached to a crtc in smithay.
|
||||
pub fn create_surface(
|
||||
&self,
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
//use crate::backend::graphics::SwapBuffersError;
|
||||
use crate::backend::SwapBuffersError;
|
||||
use drm::control::{connector, crtc, plane, Mode, RawResourceHandle};
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// Errors thrown by the [`DrmDevice`](::backend::drm::DrmDevice)
|
||||
/// and the [`DrmSurface`](::backend::drm::DrmSurface).
|
||||
/// Errors thrown by the [`DrmDevice`](crate::backend::drm::DrmDevice)
|
||||
/// and the [`DrmSurface`](crate::backend::drm::DrmSurface).
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum Error {
|
||||
/// Unable to acquire DRM master
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
//!
|
||||
//! A [`framebuffer`](drm::control::framebuffer) represents a buffer you may be rendering to, see `Surface` below.
|
||||
//!
|
||||
//! A [`plane`](drm::controll::plane) adds another layer on top of the crtcs, which allow us to layer multiple images on top of each other more efficiently
|
||||
//! A [`plane`](drm::control::plane) adds another layer on top of the crtcs, which allow us to layer multiple images on top of each other more efficiently
|
||||
//! then by combining the rendered images in the rendering phase, e.g. via OpenGL. Planes can be explicitly used by the user.
|
||||
//! Every device has at least one primary plane used to display an image to the whole crtc. Additionally cursor and overlay planes may be present.
|
||||
//! Cursor planes are usually very restricted in size and meant to be used for hardware cursors, while overlay planes may
|
||||
|
@ -57,8 +57,8 @@
|
|||
//! The drm infrastructure makes no assumptions about the used renderer and does not interface with them directly.
|
||||
//! It just provides a way to create framebuffers from various buffer types (mainly `DumbBuffer`s and hardware-backed gbm `BufferObject`s).
|
||||
//!
|
||||
//! Buffer management and details about the various types can be found in the [`allocator`-Module](backend::allocator) and
|
||||
//! renderering abstractions, which can target these buffers can be found in the [`renderer`-Module](backend::renderer).
|
||||
//! Buffer management and details about the various types can be found in the [`allocator`-Module](crate::backend::allocator) and
|
||||
//! renderering abstractions, which can target these buffers can be found in the [`renderer`-Module](crate::backend::renderer).
|
||||
|
||||
pub(crate) mod device;
|
||||
pub(self) mod error;
|
||||
|
@ -72,8 +72,6 @@ pub use device::{device_bind, DevPath, DeviceHandler, DrmDevice, DrmSource};
|
|||
pub use error::Error as DrmError;
|
||||
#[cfg(feature = "backend_gbm")]
|
||||
pub use render::{DrmRenderSurface, Error as DrmRenderError};
|
||||
#[cfg(feature = "backend_session")]
|
||||
pub use session::{DrmDeviceObserver, DrmSurfaceObserver};
|
||||
pub use surface::DrmSurface;
|
||||
|
||||
use drm::control::{plane, crtc, Device as ControlDevice, PlaneType};
|
||||
|
|
|
@ -265,7 +265,7 @@ where
|
|||
}
|
||||
|
||||
/// Returns the pending [`connector`](drm::control::connector)s
|
||||
/// used after the next [`commit`](Surface::commit) of this [`Surface`]
|
||||
/// used for the next frame as submitted by [`finish`](Renderer::finish) of this [`DrmRenderSurface`]
|
||||
pub fn pending_connectors(&self) -> impl IntoIterator<Item = connector::Handle> {
|
||||
self.drm.pending_connectors()
|
||||
}
|
||||
|
|
|
@ -18,10 +18,7 @@ use crate::{
|
|||
signaling::{Linkable, Signaler},
|
||||
};
|
||||
|
||||
/// [`SessionObserver`](SessionObserver)
|
||||
/// linked to the [`DrmDevice`](DrmDevice)
|
||||
/// it was created from.
|
||||
pub struct DrmDeviceObserver<A: AsRawFd + 'static> {
|
||||
struct DrmDeviceObserver<A: AsRawFd + 'static> {
|
||||
dev_id: dev_t,
|
||||
dev: Weak<DrmDeviceInternal<A>>,
|
||||
privileged: bool,
|
||||
|
@ -103,7 +100,7 @@ impl<A: AsRawFd + 'static> DrmDeviceObserver<A> {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct DrmSurfaceObserver<A: AsRawFd + 'static> {
|
||||
struct DrmSurfaceObserver<A: AsRawFd + 'static> {
|
||||
dev_id: dev_t,
|
||||
crtc: crtc::Handle,
|
||||
surf: Weak<DrmSurfaceInternal<A>>,
|
||||
|
|
|
@ -68,7 +68,7 @@ impl<A: AsRawFd + 'static> DrmSurface<A> {
|
|||
}
|
||||
|
||||
/// Returns the pending [`connector`](drm::control::connector)s
|
||||
/// used after the next [`commit`](Surface::commit) of this [`Surface`]
|
||||
/// used after the next [`commit`](DrmSurface::commit) of this [`DrmSurface`]
|
||||
pub fn pending_connectors(&self) -> impl IntoIterator<Item = connector::Handle> {
|
||||
match &*self.internal {
|
||||
DrmSurfaceInternal::Atomic(surf) => surf.pending_connectors(),
|
||||
|
@ -180,9 +180,9 @@ impl<A: AsRawFd + 'static> DrmSurface<A> {
|
|||
/// Returns true whenever any state changes are pending to be commited
|
||||
///
|
||||
/// The following functions may trigger a pending commit:
|
||||
/// - [`add_connector`](Surface::add_connector)
|
||||
/// - [`remove_connector`](Surface::remove_connector)
|
||||
/// - [`use_mode`](Surface::use_mode)
|
||||
/// - [`add_connector`](DrmSurface::add_connector)
|
||||
/// - [`remove_connector`](DrmSurface::remove_connector)
|
||||
/// - [`use_mode`](DrmSurface::use_mode)
|
||||
pub fn commit_pending(&self) -> bool {
|
||||
match &*self.internal {
|
||||
DrmSurfaceInternal::Atomic(surf) => surf.commit_pending(),
|
||||
|
@ -194,12 +194,12 @@ impl<A: AsRawFd + 'static> DrmSurface<A> {
|
|||
///
|
||||
/// *Note*: This will trigger a full modeset on the underlying device,
|
||||
/// potentially causing some flickering. Check before performing this
|
||||
/// operation if a commit really is necessary using [`commit_pending`](RawSurface::commit_pending).
|
||||
/// operation if a commit really is necessary using [`commit_pending`](DrmSurface::commit_pending).
|
||||
///
|
||||
/// This operation is not necessarily blocking until the crtc is in the desired state,
|
||||
/// but will trigger a `vblank` event once done.
|
||||
/// Make sure to [set a `DeviceHandler`](Device::set_handler) and
|
||||
/// [register the belonging `Device`](device_bind) before to receive the event in time.
|
||||
/// Make sure to [set a `DeviceHandler`](crate::backend::drm::DrmDevice::set_handler) and
|
||||
/// [register the belonging `Device`](crate::backend::drm::device_bind) before to receive the event in time.
|
||||
pub fn commit<'a>(&self, mut framebuffers: impl Iterator<Item=&'a (framebuffer::Handle, plane::Handle)>, event: bool) -> Result<(), Error> {
|
||||
match &*self.internal {
|
||||
DrmSurfaceInternal::Atomic(surf) => surf.commit(framebuffers, event),
|
||||
|
@ -220,8 +220,8 @@ impl<A: AsRawFd + 'static> DrmSurface<A> {
|
|||
/// This will not cause the crtc to modeset.
|
||||
///
|
||||
/// This operation is not blocking and will produce a `vblank` event once swapping is done.
|
||||
/// Make sure to [set a `DeviceHandler`](Device::set_handler) and
|
||||
/// [register the belonging `Device`](device_bind) before to receive the event in time.
|
||||
/// Make sure to [set a `DeviceHandler`](crate::backend::drm::DrmDevice::set_handler) and
|
||||
/// [register the belonging `DrmDevice`](crate::backend::drm::device_bind) before to receive the event in time.
|
||||
pub fn page_flip<'a>(&self, mut framebuffers: impl Iterator<Item=&'a (framebuffer::Handle, plane::Handle)>, event: bool) -> Result<(), Error> {
|
||||
match &*self.internal {
|
||||
DrmSurfaceInternal::Atomic(surf) => surf.page_flip(framebuffers, event),
|
||||
|
@ -416,7 +416,7 @@ impl<A: AsRawFd + 'static> DrmSurface<A> {
|
|||
) -> Result<bool, Error> {
|
||||
match &*self.internal {
|
||||
DrmSurfaceInternal::Atomic(surf) => surf.test_plane_buffer(fb, plane, position, size),
|
||||
DrmSurfaceInternal::Legacy(surf) => { Ok(false) }
|
||||
DrmSurfaceInternal::Legacy(_) => { Ok(false) }
|
||||
// There is no test-commiting with the legacy interface
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,7 +139,6 @@ impl EGLContext {
|
|||
context_attributes.push(ffi::egl::NONE as i32);
|
||||
|
||||
trace!(log, "Creating EGL context...");
|
||||
// TODO: Support shared contexts
|
||||
let context = wrap_egl_call(|| unsafe {
|
||||
ffi::egl::CreateContext(
|
||||
**display.display,
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
use std::collections::HashSet;
|
||||
use std::ffi::CStr;
|
||||
use std::fmt;
|
||||
use std::mem::MaybeUninit;
|
||||
use std::ops::Deref;
|
||||
use std::sync::Arc;
|
||||
|
@ -145,7 +144,7 @@ fn select_platform_display<N: EGLNativeDisplay + 'static>(
|
|||
}
|
||||
|
||||
impl EGLDisplay {
|
||||
/// Create a new [`EGLDisplay`] from a given [`NativeDisplay`](native::NativeDisplay)
|
||||
/// Create a new [`EGLDisplay`] from a given [`EGLNativeDisplay`]
|
||||
pub fn new<N, L>(native: &N, logger: L) -> Result<EGLDisplay, Error>
|
||||
where
|
||||
N: EGLNativeDisplay + 'static,
|
||||
|
@ -213,7 +212,7 @@ impl EGLDisplay {
|
|||
})
|
||||
}
|
||||
|
||||
/// Finds a compatible [`EGLConfig`] for a given set of requirements
|
||||
/// Finds a compatible EGLConfig for a given set of requirements
|
||||
pub fn choose_config(
|
||||
&self,
|
||||
attributes: GlAttributes,
|
||||
|
@ -524,10 +523,10 @@ impl EGLDisplay {
|
|||
///
|
||||
/// ## Errors
|
||||
///
|
||||
/// This might return [`EglExtensionNotSupported`](ErrorKind::EglExtensionNotSupported)
|
||||
/// This might return [`EglExtensionNotSupported`](Error::EglExtensionNotSupported)
|
||||
/// if binding is not supported by the EGL implementation.
|
||||
///
|
||||
/// This might return [`OtherEGLDisplayAlreadyBound`](ErrorKind::OtherEGLDisplayAlreadyBound)
|
||||
/// This might return [`OtherEGLDisplayAlreadyBound`](Error::OtherEGLDisplayAlreadyBound)
|
||||
/// if called for the same [`Display`] multiple times, as only one egl display may be bound at any given time.
|
||||
#[cfg(all(feature = "use_system_lib", feature = "wayland_frontend"))]
|
||||
pub fn bind_wl_display(&self, display: &Display) -> Result<EGLBufferReader, Error> {
|
||||
|
@ -656,9 +655,9 @@ fn get_dmabuf_formats(
|
|||
Ok((texture_formats, render_formats))
|
||||
}
|
||||
|
||||
/// Type to receive [`EGLImages`] for EGL-based [`WlBuffer`]s.
|
||||
/// Type to receive [`EGLBuffer`] for EGL-based [`WlBuffer`]s.
|
||||
///
|
||||
/// Can be created by using [`EGLGraphicsBackend::bind_wl_display`].
|
||||
/// Can be created by using [`EGLDisplay::bind_wl_display`].
|
||||
#[cfg(feature = "use_system_lib")]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct EGLBufferReader {
|
||||
|
@ -675,11 +674,10 @@ impl EGLBufferReader {
|
|||
}
|
||||
}
|
||||
|
||||
/// Try to receive [`EGLImages`] from a given [`WlBuffer`].
|
||||
/// Try to receive [`EGLBuffer`] from a given [`WlBuffer`].
|
||||
///
|
||||
/// In case the buffer is not managed by EGL (but e.g. the [`wayland::shm` module](::wayland::shm))
|
||||
/// a [`BufferAccessError::NotManaged`](::backend::egl::BufferAccessError::NotManaged) is returned with the original buffer
|
||||
/// to render it another way.
|
||||
/// In case the buffer is not managed by EGL (but e.g. the [`wayland::shm` module](crate::wayland::shm))
|
||||
/// a [`BufferAccessError::NotManaged`](crate::backend::egl::BufferAccessError::NotManaged) is returned.
|
||||
pub fn egl_buffer_contents(
|
||||
&self,
|
||||
buffer: &WlBuffer,
|
||||
|
@ -777,7 +775,7 @@ impl EGLBufferReader {
|
|||
|
||||
/// Try to receive the dimensions of a given [`WlBuffer`].
|
||||
///
|
||||
/// In case the buffer is not managed by EGL (but e.g. the [`wayland::shm` module](::wayland::shm)) or the
|
||||
/// In case the buffer is not managed by EGL (but e.g. the [`wayland::shm` module](crate::wayland::shm)) or the
|
||||
/// context has been lost, `None` is returned.
|
||||
pub fn egl_buffer_dimensions(&self, buffer: &WlBuffer) -> Option<(i32, i32)> {
|
||||
let mut width: i32 = 0;
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
//! The types of this module can be used to initialize hardware acceleration rendering
|
||||
//! based on EGL for clients as it may enabled usage of `EGLImage` based [`WlBuffer`](wayland_server::protocol::wl_buffer::WlBuffer)s.
|
||||
//!
|
||||
//! To use it bind any backend implementing the [`EGLGraphicsBackend`](::backend::egl::EGLGraphicsBackend) trait, that shall do the
|
||||
//! To use it bind the [`EGLDisplay`] trait, that shall do the
|
||||
//! rendering (so pick a fast one), to the [`wayland_server::Display`] of your compositor.
|
||||
//! Note only one backend may be bound to any [`Display`](wayland_server::Display) at any time.
|
||||
//!
|
||||
//! You may then use the resulting [`EGLDisplay`](::backend::egl::EGLDisplay) to receive [`EGLImages`](::backend::egl::EGLImages)
|
||||
//! You may then use the resulting [`EGLDisplay`] to receive [`EGLBuffer`]
|
||||
//! of an EGL-based [`WlBuffer`](wayland_server::protocol::wl_buffer::WlBuffer) for rendering.
|
||||
|
||||
/*
|
||||
|
@ -238,7 +238,7 @@ impl Format {
|
|||
}
|
||||
}
|
||||
|
||||
/// Images of the EGL-based [`WlBuffer`].
|
||||
/// Images of the EGL-based [`WlBuffer`](wayland_server::protocol::wl_buffer::WlBuffer).
|
||||
#[cfg(feature = "wayland_frontend")]
|
||||
#[derive(Debug)]
|
||||
pub struct EGLBuffer {
|
||||
|
|
|
@ -207,7 +207,7 @@ pub unsafe trait EGLNativeSurface: Send + Sync {
|
|||
}
|
||||
|
||||
/// Adds additional semantics when calling
|
||||
/// [EGLSurface::swap_buffers](::backend::egl::surface::EGLSurface::swap_buffers)
|
||||
/// [EGLSurface::swap_buffers](crate::backend::egl::surface::EGLSurface::swap_buffers)
|
||||
///
|
||||
/// Only implement if required by the backend.
|
||||
fn swap_buffers(
|
||||
|
|
|
@ -528,7 +528,7 @@ pub trait InputBackend: Sized {
|
|||
/// Access the input configuration interface
|
||||
fn input_config(&mut self) -> &mut Self::InputConfig;
|
||||
|
||||
/// Processes new events of the underlying backend and drives the [`InputHandler`].
|
||||
/// Processes new events and calls the provided callback.
|
||||
///
|
||||
/// The callback can only assume its second argument to be usable if the event is
|
||||
/// `InputEvent::ConfigChanged`.
|
||||
|
|
|
@ -349,7 +349,7 @@ unsafe fn texture_program(gl: &ffi::Gles2, frag: &'static str) -> Result<Gles2Pr
|
|||
}
|
||||
|
||||
impl Gles2Renderer {
|
||||
/// Creates a new OpenGL ES 2 renderer from a given [`EGLContext`](backend::egl::EGLBuffer).
|
||||
/// Creates a new OpenGL ES 2 renderer from a given [`EGLContext`](crate::backend::egl::EGLBuffer).
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
|
|
|
@ -5,30 +5,30 @@
|
|||
//!
|
||||
//! ### Initialization
|
||||
//!
|
||||
//! To initialize a session just call [`AutoSession::new`](::backend::session::auto::AutoSession::new).
|
||||
//! To initialize a session just call [`AutoSession::new`].
|
||||
//! A new session will be opened, if the any available interface is successful and will be closed once the
|
||||
//! [`AutoSessionNotifier`](::backend::session::auto::AutoSessionNotifier) is dropped.
|
||||
//! [`AutoSessionNotifier`] is dropped.
|
||||
//!
|
||||
//! ### Usage of the session
|
||||
//!
|
||||
//! The session may be used to open devices manually through the [`Session`] interface
|
||||
//! or be passed to other objects that need it to open devices themselves.
|
||||
//! The [`AutoSession`](::backend::session::auto::AutoSession) is clonable
|
||||
//! The [`AutoSession`] is clonable
|
||||
//! and may be passed to multiple devices easily.
|
||||
//!
|
||||
//! Examples for those are e.g. the [`LibinputInputBackend`](::backend::libinput::LibinputInputBackend)
|
||||
//! (its context might be initialized through a [`Session`] via the [`LibinputSessionInterface`](::backend::libinput::LibinputSessionInterface)).
|
||||
//! Examples for those are e.g. the [`LibinputInputBackend`](crate::backend::libinput::LibinputInputBackend)
|
||||
//! (its context might be initialized through a [`Session`] via the [`LibinputSessionInterface`](crate::backend::libinput::LibinputSessionInterface)).
|
||||
//!
|
||||
//! ### Usage of the session notifier
|
||||
//!
|
||||
//! The notifier might be used to pause device access, when the session gets paused (e.g. by
|
||||
//! switching the tty via [`AutoSession::change_vt`](::backend::session::Session::change_vt))
|
||||
//! switching the tty via [`AutoSession::change_vt`](crate::backend::session::Session::change_vt))
|
||||
//! and to automatically enable it again, when the session becomes active again.
|
||||
//!
|
||||
//! It is crucial to avoid errors during that state. Examples for object that might be registered
|
||||
//! for notifications are the [`Libinput`](input::Libinput) context or the [`Device`](::backend::drm::Device).
|
||||
//! for notifications are the [`Libinput`](input::Libinput) context or the [`DrmDevice`](crate::backend::drm::DrmDevice).
|
||||
//!
|
||||
//! The [`AutoSessionNotifier`](::backend::session::auto::AutoSessionNotifier) is to be inserted into
|
||||
//! The [`AutoSessionNotifier`] is to be inserted into
|
||||
//! a calloop event source to have its events processed.
|
||||
|
||||
#[cfg(feature = "backend_session_logind")]
|
||||
|
@ -53,7 +53,7 @@ pub enum AutoSession {
|
|||
Direct(Rc<RefCell<DirectSession>>),
|
||||
}
|
||||
|
||||
/// [`SessionNotifier`] using the best available interface
|
||||
/// Notifier using the best available interface
|
||||
#[derive(Debug)]
|
||||
pub enum AutoSessionNotifier {
|
||||
/// Logind session notifier
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//!
|
||||
//! Implementation of the [`Session`](::backend::session::Session) trait through the logind dbus interface.
|
||||
//! Implementation of the [`Session`](crate::backend::session::Session) trait through the logind dbus interface.
|
||||
//!
|
||||
//! This requires systemd and dbus to be available and started on the system.
|
||||
//!
|
||||
|
@ -7,31 +7,31 @@
|
|||
//!
|
||||
//! ### Initialization
|
||||
//!
|
||||
//! To initialize a session just call [`LogindSession::new`](::backend::session::dbus::logind::LogindSession::new).
|
||||
//! To initialize a session just call [`LogindSession::new`].
|
||||
//! A new session will be opened, if the call is successful and will be closed once the
|
||||
//! [`LogindSessionNotifier`](::backend::session::dbus::logind::LogindSessionNotifier) is dropped.
|
||||
//! [`LogindSessionNotifier`] is dropped.
|
||||
//!
|
||||
//! ### Usage of the session
|
||||
//!
|
||||
//! The session may be used to open devices manually through the [`Session`](::backend::session::Session) interface
|
||||
//! The session may be used to open devices manually through the [`Session`](crate::backend::session::Session) interface
|
||||
//! or be passed to other objects that need it to open devices themselves.
|
||||
//! The [`LogindSession`](::backend::session::dbus::logind::LogindSession) is clonable
|
||||
//! The [`LogindSession`] is clonable
|
||||
//! and may be passed to multiple devices easily.
|
||||
//!
|
||||
//! Examples for those are e.g. the [`LibinputInputBackend`](::backend::libinput::LibinputInputBackend)
|
||||
//! (its context might be initialized through a [`Session`](::backend::session::Session) via the
|
||||
//! [`LibinputSessionInterface`](::backend::libinput::LibinputSessionInterface)).
|
||||
//! Examples for those are e.g. the [`LibinputInputBackend`](crate::backend::libinput::LibinputInputBackend)
|
||||
//! (its context might be initialized through a [`Session`](crate::backend::session::Session) via the
|
||||
//! [`LibinputSessionInterface`](crate::backend::libinput::LibinputSessionInterface)).
|
||||
//!
|
||||
//! ### Usage of the session notifier
|
||||
//!
|
||||
//! The notifier might be used to pause device access, when the session gets paused (e.g. by
|
||||
//! switching the tty via [`LogindSession::change_vt`](::backend::session::Session::change_vt))
|
||||
//! switching the tty via [`LogindSession::change_vt`](crate::backend::session::Session::change_vt))
|
||||
//! and to automatically enable it again, when the session becomes active again.
|
||||
//!
|
||||
//! It is crucial to avoid errors during that state. Examples for object that might be registered
|
||||
//! for notifications are the [`Libinput`](input::Libinput) context or the [`Device`](::backend::drm::Device).
|
||||
//! for notifications are the [`Libinput`](input::Libinput) context or the [`DrmDevice`](crate::backend::drm::DrmDevice).
|
||||
//!
|
||||
//! The [`LogindSessionNotifier`](::backend::session::dbus::logind::LogindSessionNotifier) is to be inserted into
|
||||
//! The [`LogindSessionNotifier`] is to be inserted into
|
||||
//! a calloop event source to have its events processed.
|
||||
|
||||
use crate::{
|
||||
|
@ -93,7 +93,7 @@ pub struct LogindSession {
|
|||
seat: String,
|
||||
}
|
||||
|
||||
/// [`SessionNotifier`] via the logind dbus interface
|
||||
/// Notifier for the logind dbus interface
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct LogindSessionNotifier {
|
||||
internal: Rc<LogindSessionImpl>,
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
//! The session may be used to open devices manually through the [`Session`] interface
|
||||
//! or be passed to other objects that need it to open devices themselves.
|
||||
//!
|
||||
//! Examples for those are e.g. the [`LibinputInputBackend`](::backend::libinput::LibinputInputBackend)
|
||||
//! (its context might be initialized through a [`Session`] via the [`LibinputSessionInterface`](::backend::libinput::LibinputSessionInterface)).
|
||||
//! Examples for those are e.g. the [`LibinputInputBackend`](crate::backend::libinput::LibinputInputBackend)
|
||||
//! (its context might be initialized through a [`Session`] via the [`LibinputSessionInterface`](crate::backend::libinput::LibinputSessionInterface)).
|
||||
//!
|
||||
//! In case you want to pass the same [`Session`] to multiple objects, [`Session`] is implement for
|
||||
//! every `Rc<RefCell<Session>>` or `Arc<Mutex<Session>>`.
|
||||
|
@ -36,13 +36,13 @@
|
|||
//! ### Usage of the session notifier
|
||||
//!
|
||||
//! The notifier might be used to pause device access, when the session gets paused (e.g. by
|
||||
//! switching the tty via [`DirectSession::change_vt`](::backend::session::Session::change_vt))
|
||||
//! switching the tty via [`DirectSession::change_vt`](crate::backend::session::Session::change_vt))
|
||||
//! and to automatically enable it again, when the session becomes active again.
|
||||
//!
|
||||
//! It is crucial to avoid errors during that state. Examples for object that might be registered
|
||||
//! for notifications are the [`Libinput`](input::Libinput) context or the [`Device`](::backend::drm::Device).
|
||||
//! for notifications are the [`Libinput`](input::Libinput) context or the [`DrmDevice`](crate::backend::drm::DrmDevice).
|
||||
//!
|
||||
//! The [`DirectSessionNotifier`](::backend::session::direct::DirectSessionNotifier) is to be inserted into
|
||||
//! The [`DirectSessionNotifier`] is to be inserted into
|
||||
//! a calloop event source to have its events processed.
|
||||
|
||||
use super::{AsErrno, Session, Signal as SessionSignal};
|
||||
|
@ -152,7 +152,7 @@ pub struct DirectSession {
|
|||
logger: ::slog::Logger,
|
||||
}
|
||||
|
||||
/// [`SessionNotifier`] via the virtual terminal direct kernel interface
|
||||
/// Notifier of the virtual terminal direct kernel interface
|
||||
pub struct DirectSessionNotifier {
|
||||
tty: RawFd,
|
||||
active: Arc<AtomicBool>,
|
||||
|
@ -367,7 +367,7 @@ impl Drop for DirectSession {
|
|||
}
|
||||
}
|
||||
|
||||
/// Ids of registered [`SessionObserver`]s of the [`DirectSessionNotifier`]
|
||||
/// Ids of registered observers of the [`DirectSessionNotifier`]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||
pub struct Id(usize);
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
//!
|
||||
//! Provides `udev` related functionality for automated device scanning.
|
||||
//!
|
||||
//! This module mainly provides the [`UdevBackend`](::backend::udev::UdevBackend), which
|
||||
//! This module mainly provides the [`UdevBackend`], which
|
||||
//! monitors available DRM devices and acts as an event source, generating events whenever these
|
||||
//! devices change.
|
||||
//!
|
||||
//! *Note:* Once inserted into the event loop, the [`UdevBackend`](::backend::udev::UdevBackend) will
|
||||
//! *Note:* Once inserted into the event loop, the [`UdevBackend`] will
|
||||
//! only notify you about *changes* in the device list. To get an initial snapshot of the state during
|
||||
//! your initialization, you need to call its `device_list` method.
|
||||
//!
|
||||
|
@ -218,8 +218,8 @@ pub enum UdevEvent {
|
|||
|
||||
/// Returns the path of the primary GPU device if any
|
||||
///
|
||||
/// Might be used for filtering in [`UdevHandler::device_added`] or for manual
|
||||
/// [`LegacyDrmDevice`](::backend::drm::legacy::LegacyDrmDevice) initialization.
|
||||
/// Might be used for filtering of [`UdevEvent::Added`] or for manual
|
||||
/// [`DrmDevice`](crate::backend::drm::DrmDevice) initialization.
|
||||
pub fn primary_gpu<S: AsRef<str>>(seat: S) -> IoResult<Option<PathBuf>> {
|
||||
let mut enumerator = Enumerator::new()?;
|
||||
enumerator.match_subsystem("drm")?;
|
||||
|
@ -252,7 +252,7 @@ pub fn primary_gpu<S: AsRef<str>>(seat: S) -> IoResult<Option<PathBuf>> {
|
|||
|
||||
/// Returns the paths of all available GPU devices
|
||||
///
|
||||
/// Might be used for manual [`LegacyDrmDevice`](::backend::drm::legacy::LegacyDrmDevice)
|
||||
/// Might be used for manual [`DrmDevice`](crate::backend::drm::DrmDevice)
|
||||
/// initialization.
|
||||
pub fn all_gpus<S: AsRef<str>>(seat: S) -> IoResult<Vec<PathBuf>> {
|
||||
let mut enumerator = Enumerator::new()?;
|
||||
|
|
|
@ -63,8 +63,7 @@ pub struct WindowSize {
|
|||
pub scale_factor: f64,
|
||||
}
|
||||
|
||||
/// Window with an active EGL Context created by `winit`. Implements the
|
||||
/// [`EGLGraphicsBackend`] and [`GLGraphicsBackend`] graphics backend trait
|
||||
/// Window with an active EGL Context created by `winit`. Implements the [`Renderer`] trait
|
||||
#[derive(Debug)]
|
||||
pub struct WinitGraphicsBackend {
|
||||
renderer: Gles2Renderer,
|
||||
|
@ -90,8 +89,7 @@ pub struct WinitInputBackend {
|
|||
size: Rc<RefCell<WindowSize>>,
|
||||
}
|
||||
|
||||
/// Create a new [`WinitGraphicsBackend`], which implements the [`EGLGraphicsBackend`]
|
||||
/// and [`GLGraphicsBackend`] graphics backend trait and a corresponding [`WinitInputBackend`],
|
||||
/// Create a new [`WinitGraphicsBackend`], which implements the [`Renderer`] trait and a corresponding [`WinitInputBackend`],
|
||||
/// which implements the [`InputBackend`] trait
|
||||
pub fn init<L>(logger: L) -> Result<(WinitGraphicsBackend, WinitInputBackend), Error>
|
||||
where
|
||||
|
@ -106,8 +104,7 @@ where
|
|||
)
|
||||
}
|
||||
|
||||
/// Create a new [`WinitGraphicsBackend`], which implements the [`EGLGraphicsBackend`]
|
||||
/// and [`GLGraphicsBackend`] graphics backend trait, from a given [`WindowBuilder`]
|
||||
/// Create a new [`WinitGraphicsBackend`], which implements the [`Renderer`] trait, from a given [`WindowBuilder`]
|
||||
/// struct and a corresponding [`WinitInputBackend`], which implements the [`InputBackend`] trait
|
||||
pub fn init_from_builder<L>(
|
||||
builder: WindowBuilder,
|
||||
|
@ -128,8 +125,7 @@ where
|
|||
)
|
||||
}
|
||||
|
||||
/// Create a new [`WinitGraphicsBackend`], which implements the [`EGLGraphicsBackend`]
|
||||
/// and [`GLGraphicsBackend`] graphics backend trait, from a given [`WindowBuilder`]
|
||||
/// Create a new [`WinitGraphicsBackend`], which implements the [`Renderer`] trait, from a given [`WindowBuilder`]
|
||||
/// struct, as well as given [`GlAttributes`] for further customization of the rendering pipeline and a
|
||||
/// corresponding [`WinitInputBackend`], which implements the [`InputBackend`] trait.
|
||||
pub fn init_from_builder_with_gl_attr<L>(
|
||||
|
@ -629,11 +625,10 @@ impl InputBackend for WinitInputBackend {
|
|||
unsafe { &mut CONFIG }
|
||||
}
|
||||
|
||||
/// Processes new events of the underlying event loop to drive the set [`InputHandler`].
|
||||
/// Processes new events of the underlying event loop and calls the provided callback.
|
||||
///
|
||||
/// You need to periodically call this function to keep the underlying event loop and
|
||||
/// [`WinitWindow`] active. Otherwise the window may no respond to user interaction and no
|
||||
/// input events will be received by a set [`InputHandler`].
|
||||
/// [`WinitWindow`] active. Otherwise the window may no respond to user interaction.
|
||||
///
|
||||
/// Returns an error if the [`WinitWindow`] the window has been closed. Calling
|
||||
/// `dispatch_new_events` again after the [`WinitWindow`] has been closed is considered an
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
//!
|
||||
//! ### Initialization
|
||||
//!
|
||||
//! To initialize this implementation, use the [`compositor_init`](::wayland::compositor::compositor_init)
|
||||
//! To initialize this implementation, use the [`compositor_init`]
|
||||
//! method provided by this module. It'll require you to first define as few things, as shown in
|
||||
//! this example:
|
||||
//!
|
||||
|
@ -56,16 +56,16 @@
|
|||
//!
|
||||
//! As you can see in the previous example, in the end we are retrieving a token from
|
||||
//! the `init` function. This token is necessary to retrieve the metadata associated with
|
||||
//! a surface. It can be cloned. See [`CompositorToken`](::wayland::compositor::CompositorToken)
|
||||
//! a surface. It can be cloned. See [`CompositorToken`]
|
||||
//! for the details of what it enables you.
|
||||
//!
|
||||
//! The surface metadata is held in the [`SurfaceAttributes`](::wayland::compositor::SurfaceAttributes)
|
||||
//! The surface metadata is held in the [`SurfaceAttributes`]
|
||||
//! struct. In contains double-buffered state pending from the client as defined by the protocol for
|
||||
//! [`wl_surface`](wayland_server::protocol::wl_surface), as well as your user-defined type holding
|
||||
//! any data you need to have associated with a struct. See its documentation for details.
|
||||
//!
|
||||
//! This [`CompositorToken`](::wayland::compositor::CompositorToken) also provides access to the metadata associated with the role of the
|
||||
//! surfaces. See the documentation of the [`roles`](::wayland::compositor::roles) submodule
|
||||
//! This [`CompositorToken`] also provides access to the metadata associated with the role of the
|
||||
//! surfaces. See the documentation of the [`roles`] submodule
|
||||
//! for a detailed explanation.
|
||||
|
||||
use std::{cell::RefCell, fmt, rc::Rc, sync::Mutex};
|
||||
|
@ -123,7 +123,7 @@ pub enum BufferAssignment {
|
|||
/// Data associated with a surface, aggregated by the handlers
|
||||
///
|
||||
/// Most of the fields of this struct represent a double-buffered state, which
|
||||
/// should only be applied once a [`commit`](::wayland::compositor::SurfaceEvent::Commit)
|
||||
/// should only be applied once a [`commit`](SurfaceEvent::Commit)
|
||||
/// request is received from the surface.
|
||||
///
|
||||
/// You are responsible for setting those values as you see fit to avoid
|
||||
|
|
|
@ -73,13 +73,13 @@
|
|||
//! as well as implement a few trait for it, allowing it to be used by
|
||||
//! all smithay handlers:
|
||||
//!
|
||||
//! - The trait [`RoleType`](::wayland::compositor::roles::RoleType),
|
||||
//! - The trait [`RoleType`](RoleType),
|
||||
//! which defines it as a type handling roles
|
||||
//! - For each of your roles, the trait [`Role<Token>`](::wayland::compositor::roles::Role)
|
||||
//! - For each of your roles, the trait [`Role<Token>`](Role)
|
||||
//! (where `Token` is your token type), marking its ability to handle this given role.
|
||||
//!
|
||||
//! All handlers that handle a specific role will require you to provide
|
||||
//! them with a [`CompositorToken<U, R, H>`](::wayland::compositor::CompositorToken)
|
||||
//! them with a [`CompositorToken<U, R, H>`](crate::wayland::compositor::CompositorToken)
|
||||
//! where `R: Role<TheToken>`.
|
||||
//!
|
||||
//! See the documentation of these traits for their specific definition and
|
||||
|
@ -115,7 +115,7 @@ pub trait RoleType {
|
|||
/// ```
|
||||
///
|
||||
/// The methods of this trait are mirrored on
|
||||
/// [`CompositorToken`](::wayland::compositor::CompositorToken) for easy
|
||||
/// [`CompositorToken`](crate::wayland::compositor::CompositorToken) for easy
|
||||
/// access to the role data of the surfaces.
|
||||
///
|
||||
/// Note that if a role is automatically handled for you by a Handler provided
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
//!
|
||||
//! This module provides 2 main freestanding functions:
|
||||
//!
|
||||
//! - [`init_data_device`](::wayland::data_device::init_data_device): this function must be called
|
||||
//! - [`init_data_device`]: this function must be called
|
||||
//! during the compositor startup to initialize the data device logic
|
||||
//! - [`set_data_device_focus`](::wayland::data_device::set_data_device_focus): this function sets
|
||||
//! - [`set_data_device_focus`]: this function sets
|
||||
//! the data device focus for a given seat; you'd typically call it whenever the keyboard focus
|
||||
//! changes, to follow it (for example in the focus hook of your keyboards)
|
||||
//!
|
||||
|
@ -18,11 +18,11 @@
|
|||
//! The module also provides additionnal mechanisms allowing your compositor to see and interact with
|
||||
//! the contents of the data device:
|
||||
//!
|
||||
//! - You can provide a callback closure to [`init_data_device`](::wayland::data_device::init_data_device)
|
||||
//! - You can provide a callback closure to [`init_data_device`]
|
||||
//! to peek into the the actions of your clients
|
||||
//! - the freestanding function [`set_data_device_selection`](::wayland::data_device::set_data_device_selection)
|
||||
//! - the freestanding function [`set_data_device_selection`]
|
||||
//! allows you to set the contents of the selection for your clients
|
||||
//! - the freestanding function [`start_dnd`](::wayland::data_device::start_dnd) allows you to initiate a drag'n'drop event from the compositor
|
||||
//! - the freestanding function [`start_dnd`] allows you to initiate a drag'n'drop event from the compositor
|
||||
//! itself and receive interactions of clients with it via an other dedicated callback.
|
||||
//!
|
||||
//! The module also defines the `DnDIconRole` that you need to insert into your compositor roles enum, to
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
//!
|
||||
//! # How to use it
|
||||
//!
|
||||
//! You need to instantiate an [`Output`](::wayland::output::Output)
|
||||
//! You need to instantiate an [`Output`]
|
||||
//! for each output global you want to advertise to clients.
|
||||
//!
|
||||
//! Just add it to your Display using the [`Output::new(..)`](::wayland::output::Output::new)
|
||||
//! method. You can use the returned [`Output`](::wayland::output::Output) to change
|
||||
//! Just add it to your Display using the [`Output::new(..)`](Output::new)
|
||||
//! method. You can use the returned [`Output`] to change
|
||||
//! the properties of your output (if the current resolution mode changes for example),
|
||||
//! it'll automatically forward any changes to the clients.
|
||||
//!
|
||||
|
|
|
@ -319,7 +319,7 @@ impl KeyboardHandle {
|
|||
/// returns false, the input will not be sent to the client. This mechanism can be used to
|
||||
/// implement compositor-level key bindings for example.
|
||||
///
|
||||
/// The module [`wayland::seat::keysyms`](::wayland::seat::keysyms) exposes definitions of all possible keysyms
|
||||
/// The module [`crate::wayland::seat::keysyms`] exposes definitions of all possible keysyms
|
||||
/// to be compared against. This includes non-character keysyms, such as XF86 special keys.
|
||||
pub fn input<F>(&self, keycode: u32, state: KeyState, serial: Serial, time: u32, filter: F)
|
||||
where
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
//! Currently, only pointer and keyboard capabilities are supported by
|
||||
//! smithay.
|
||||
//!
|
||||
//! You can add these capabilities via methods of the [`Seat`](::wayland::seat::Seat) struct:
|
||||
//! [`add_keyboard`](::wayland::seat::Seat::add_keyboard), [`add_pointer`](::wayland::seat::Seat::add_pointer).
|
||||
//! You can add these capabilities via methods of the [`Seat`] struct:
|
||||
//! [`add_keyboard`](Seat::add_keyboard), [`add_pointer`](Seat::add_pointer).
|
||||
//! These methods return handles that can be cloned and sent across thread, so you can keep one around
|
||||
//! in your event-handling code to forward inputs to your clients.
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
//!
|
||||
//! ### Initialization
|
||||
//!
|
||||
//! To initialize this handler, simple use the [`wl_shell_init`](::wayland::shell::legacy::wl_shell_init)
|
||||
//! function provided in this module. You will need to provide it the [`CompositorToken`](::wayland::compositor::CompositorToken)
|
||||
//! To initialize this handler, simple use the [`wl_shell_init`]
|
||||
//! function provided in this module. You will need to provide it the [`CompositorToken`](crate::wayland::compositor::CompositorToken)
|
||||
//! you retrieved from an instantiation of the compositor handler provided by smithay.
|
||||
//!
|
||||
//! ```no_run
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
//!
|
||||
//! ### Initialization
|
||||
//!
|
||||
//! To initialize this handler, simple use the [`xdg_shell_init`](::wayland::shell::xdg::xdg_shell_init) function provided in this
|
||||
//! module. You will need to provide it the [`CompositorToken`](::wayland::compositor::CompositorToken)
|
||||
//! To initialize this handler, simple use the [`xdg_shell_init`] function provided in this
|
||||
//! module. You will need to provide it the [`CompositorToken`](crate::wayland::compositor::CompositorToken)
|
||||
//! you retrieved from an instantiation of the compositor global provided by smithay.
|
||||
//!
|
||||
//! ```no_run
|
||||
|
@ -69,21 +69,21 @@
|
|||
//!
|
||||
//! There are mainly 3 kind of objects that you'll manipulate from this implementation:
|
||||
//!
|
||||
//! - [`ShellClient`](::wayland::shell::xdg::ShellClient):
|
||||
//! - [`ShellClient`]:
|
||||
//! This is a handle representing an instantiation of a shell global
|
||||
//! you can associate client-wise metadata to it (this is the `MyShellData` type in
|
||||
//! the example above).
|
||||
//! - [`ToplevelSurface`](::wayland::shell::xdg::ToplevelSurface):
|
||||
//! - [`ToplevelSurface`]:
|
||||
//! This is a handle representing a toplevel surface, you can
|
||||
//! retrieve a list of all currently alive toplevel surface from the
|
||||
//! [`ShellState`](::wayland::shell::xdg::ShellState).
|
||||
//! - [`PopupSurface`](::wayland::shell::xdg::PopupSurface):
|
||||
//! [`ShellState`].
|
||||
//! - [`PopupSurface`]:
|
||||
//! This is a handle representing a popup/tooltip surface. Similarly,
|
||||
//! you can get a list of all currently alive popup surface from the
|
||||
//! [`ShellState`](::wayland::shell::xdg::ShellState).
|
||||
//! [`ShellState`].
|
||||
//!
|
||||
//! You'll obtain these objects though two means: either via the callback methods of
|
||||
//! the subhandler you provided, or via methods on the [`ShellState`](::wayland::shell::xdg::ShellState)
|
||||
//! the subhandler you provided, or via methods on the [`ShellState`]
|
||||
//! that you are given (in an `Arc<Mutex<_>>`) as return value of the `init` function.
|
||||
|
||||
use crate::utils::Rectangle;
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
//!
|
||||
//! Then, when you have a [`WlBuffer`](wayland_server::protocol::wl_buffer::WlBuffer)
|
||||
//! and need to retrieve its contents, use the
|
||||
//! [`with_buffer_contents`](::wayland::shm::with_buffer_contents) function to do it:
|
||||
//! [`with_buffer_contents`] function to do it:
|
||||
//!
|
||||
//! ```
|
||||
//! # extern crate wayland_server;
|
||||
|
|
Loading…
Reference in New Issue