Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings about links in doc comments, and fix defintion of delegate_xdg_toplevel_icon #1606

Merged
merged 4 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/backend/drm/gbm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl Framebuffer for GbmFramebuffer {
/// Attach a framebuffer for a [`WlBuffer`]
///
/// This tries to import the buffer to gbm and attach a [`framebuffer::Handle`] for
/// the imported [`BufferObject`].
/// the imported [`BufferObject`][gbm::BufferObject].
///
/// Returns `Ok(None)` for unknown buffer types and buffer types that do not
/// support attaching a framebuffer (e.g. shm-buffers)
Expand Down Expand Up @@ -136,7 +136,7 @@ pub enum Error {
/// Attach a framebuffer for a [`Dmabuf`]
///
/// This tries to import the [`Dmabuf`] using gbm and attach
/// a [`framebuffer::Handle`] for the imported [`BufferObject`]
/// a [`framebuffer::Handle`] for the imported [`BufferObject`][gbm::BufferObject]
#[profiling::function]
pub fn framebuffer_from_dmabuf<A: AsFd + 'static>(
drm: &DrmDeviceFd,
Expand Down Expand Up @@ -181,7 +181,7 @@ pub fn framebuffer_from_dmabuf<A: AsFd + 'static>(
})
}

/// Attach a [`framebuffer::Handle`] to an [`BufferObject`]
/// Attach a [`framebuffer::Handle`] to an [`BufferObject`][gbm::BufferObject]
#[profiling::function]
pub fn framebuffer_from_bo(
drm: &DrmDeviceFd,
Expand Down
2 changes: 1 addition & 1 deletion src/backend/renderer/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::ops::Mul;
pub struct Color32F([f32; 4]);

impl Color32F {
/// Initialize a new [`Color`]
/// Initialize a new [`Color32F`]
#[inline]
pub const fn new(r: f32, g: f32, b: f32, a: f32) -> Self {
Self([r, g, b, a])
Expand Down
2 changes: 1 addition & 1 deletion src/backend/renderer/multigpu/gbm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl<R, A: AsFd + Clone + Send + 'static> GbmGlesBackend<R, A> {
/// Sets the default flags to use for allocating buffers via the [`GbmAllocator`]
/// provided by these backends devices.
///
/// Only affects nodes added via [`add_node`] *after* calling this method.
/// Only affects nodes added via [`add_node`][Self::add_node] *after* calling this method.
pub fn set_allocator_flags(&mut self, flags: GbmBufferFlags) {
self.allocator_flags = flags;
}
Expand Down
2 changes: 1 addition & 1 deletion src/backend/renderer/multigpu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! [`GraphicsApi`] implementation will allow you to create [`MultiRenderer`]s.
//!
//! smithay provides the following graphics apis:
//! - [`egl::EglGlesBackend`]
//! - [`gbm::GbmGlesBackend`]
//!
//! A [`MultiRenderer`] gets created using two [`DrmNode`]s to identify gpus.
//! One gpu will be referred to as the render-gpu, the other as the target-gpu.
Expand Down
2 changes: 1 addition & 1 deletion src/desktop/space/element/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ macro_rules! space_elements_internal {
}

/// Aggregate multiple types implementing [`SpaceElement`] into a single enum type to be used
/// with a [`Space`].
/// with a [`Space`][super::Space].
///
/// # Example
///
Expand Down
4 changes: 2 additions & 2 deletions src/utils/clock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl Time<Monotonic> {
/// Returns the time in milliseconds
///
/// This should match timestamps from libinput:
/// https://wayland.freedesktop.org/libinput/doc/latest/timestamps.html
/// <https://wayland.freedesktop.org/libinput/doc/latest/timestamps.html>
pub fn as_millis(&self) -> u32 {
// Assume monotonic clock (but not realitime) fits as milliseconds in 32-bit
debug_assert!(self.tp.tv_sec >= 0);
Expand All @@ -80,7 +80,7 @@ impl Time<Monotonic> {
/// Returns the time in microseconds
///
/// This should match timestamps from libinput:
/// https://wayland.freedesktop.org/libinput/doc/latest/timestamps.html
/// <https://wayland.freedesktop.org/libinput/doc/latest/timestamps.html>
pub fn as_micros(&self) -> u64 {
// Assume monotonic clock (but not realitime) fits as microseconds in 64-bit
debug_assert!(self.tp.tv_sec >= 0);
Expand Down
8 changes: 4 additions & 4 deletions src/wayland/commit_timing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub struct CommitTimingManagerState {
impl CommitTimingManagerState {
/// Create a new [`WpCommitTimingManagerV1`] global
//
/// The id provided by [`FifoManagerState::global`] may be used to
/// The id provided by [`CommitTimingManagerState::global`] may be used to
/// remove or disable this global in the future.
pub fn new<D>(display: &DisplayHandle) -> Self
where
Expand All @@ -121,7 +121,7 @@ impl CommitTimingManagerState {

/// Create a new unmanaged [`WpCommitTimingManagerV1`] global
//
/// The id provided by [`FifoManagerState::global`] may be used to
/// The id provided by [`CommitTimingManagerState::global`] may be used to
/// remove or disable this global in the future.
pub fn unmanaged<D>(display: &DisplayHandle) -> Self
where
Expand All @@ -143,12 +143,12 @@ impl CommitTimingManagerState {
Self { global, is_managed }
}

/// Returns the id of the [`WpFifoManagerV1`] global.
/// Returns the id of the [`WpCommitTimingManagerV1`] global.
pub fn global(&self) -> GlobalId {
self.global.clone()
}

/// Returns if this [`FifoManagerState`] operates in managed mode.
/// Returns if this [`CommitTimingManagerState`] operates in managed mode.
pub fn is_managed(&self) -> bool {
self.is_managed
}
Expand Down
14 changes: 8 additions & 6 deletions src/wayland/compositor/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,21 +132,23 @@ impl<T: Cacheable + 'static> Cache for Mutex<CachedState<T>> {
/// A typemap-like container for double-buffered values
///
/// All values inserted into this container must implement the [`Cacheable`] trait,
/// which defines their buffering semantics. They furthermore must be `Send` as the surface state
/// can be accessed from multiple threads (but `Sync` is not required, the surface internally synchronizes
/// which defines their buffering semantics. They furthermore must be [`Send`] as the surface state
/// can be accessed from multiple threads (but [`Sync`] is not required, the surface internally synchronizes
/// access to its state).
///
/// [`MultiCache::get`] provides access to the [`CachedState`] associated with a particular type.
///
/// Consumers of surface state (like compositor applications using Smithay) will mostly be concerned
/// with the [`MultiCache::current`] method, which gives access to the current state of the surface for
/// with the [`CachedState::current`] method, which gives access to the current state of the surface for
/// a particular type.
///
/// Writers of protocol extensions logic will mostly be concerned with the [`MultiCache::pending`] method,
/// Writers of protocol extensions logic will mostly be concerned with the [`CachedState::pending`] method,
/// which provides access to the pending state of the surface, in which new state from clients will be
/// stored.
///
/// This contained has [`Mutex`]-like semantics: values of multiple stored types can be accessed at the
/// same time, but accessing the same value multiple times will cause a deadlock.
/// The stored values are initialized lazily the first time `get()` is invoked with this type as argument.
/// The stored values are initialized lazily the first time [`get`][Self::get] is invoked with this type as argument.
pub struct MultiCache {
caches: appendlist::AppendList<Box<dyn Cache + Send>>,
}
Expand Down Expand Up @@ -179,7 +181,7 @@ impl MultiCache {
.unwrap()
}

/// Access the state associated with type `T`
/// Access the [`CachedState`] associated with type `T`
pub fn get<T: Cacheable + Send + 'static>(&self) -> MutexGuard<'_, CachedState<T>> {
self.find_or_insert::<T>().lock().unwrap()
}
Expand Down
2 changes: 1 addition & 1 deletion src/wayland/compositor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ use std::sync::atomic::{AtomicU32, Ordering};
use std::sync::Arc;
use std::{any::Any, sync::Mutex};

pub use self::cache::{Cacheable, MultiCache};
pub use self::cache::{Cacheable, CachedState, MultiCache};
pub use self::handlers::{RegionUserData, SubsurfaceCachedState, SubsurfaceUserData, SurfaceUserData};
use self::transaction::TransactionQueue;
pub use self::transaction::{Barrier, Blocker, BlockerState};
Expand Down
10 changes: 5 additions & 5 deletions src/wayland/foreign_toplevel_list/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ impl ForeignToplevelHandle {
resource.data::<Self>().cloned()
}

/// Retrieve [`ExtForeignToplevelHandleV1`](wayland_protocols::ext::foreign_toplevel_list::v1::server::ext_foreign_toplevel_handle_v1::ExtForeignToplevelHandleV1)
/// Retrieve [`ExtForeignToplevelHandleV1`]
/// instances for this handle.
pub fn resources(&self) -> Vec<ExtForeignToplevelHandleV1> {
let inner = self.inner.0.lock().unwrap();
Expand All @@ -173,8 +173,8 @@ impl ForeignToplevelHandle {
.collect()
}

/// Retrieve [`ExtForeignToplevelHandleV1`](wayland_protocols::ext::foreign_toplevel_list::v1::server::ext_foreign_toplevel_handle_v1::ExtForeignToplevelHandleV1)
/// instances for this handle of a given [`Client`](wayland_server::Client).
/// Retrieve [`ExtForeignToplevelHandleV1`]
/// instances for this handle of a given [`Client`].
pub fn resources_for_client(&self, client: &Client) -> Vec<ExtForeignToplevelHandleV1> {
self.resources()
.into_iter()
Expand All @@ -189,7 +189,7 @@ impl ForeignToplevelHandle {

/// The title of the toplevel has changed.
///
/// [Self::done] has to be called to finalize the update
/// [Self::send_done] has to be called to finalize the update
pub fn send_title(&self, title: &str) {
let mut inner = self.inner.0.lock().unwrap();
if inner.title == title {
Expand All @@ -207,7 +207,7 @@ impl ForeignToplevelHandle {

/// The app_id of the toplevel has changed.
///
/// [Self::done] has to be called to finalize the update
/// [Self::send_done] has to be called to finalize the update
pub fn send_app_id(&self, app_id: &str) {
let mut inner = self.inner.0.lock().unwrap();
if inner.app_id == app_id {
Expand Down
4 changes: 2 additions & 2 deletions src/wayland/xdg_system_bell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
//!
//! This protocol enables clients to ring the system bell.
//!
//! In order to advertise system bell global call [XdgSystemBellState::new] and delegate
//! events to it with [delegate_xdg_system_bell].
//! In order to advertise system bell global call [`XdgSystemBellState::new`] and delegate
//! events to it with [`delegate_xdg_system_bell`][crate::delegate_xdg_system_bell].
//!
//! ```
//! use smithay::wayland::xdg_system_bell::{XdgSystemBellState, XdgSystemBellHandler};
Expand Down
14 changes: 7 additions & 7 deletions src/wayland/xdg_toplevel_icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! This protocol allows clients to set icons for their toplevel surfaces either via the XDG icon stock (using an icon name), or from pixel data.
//!
//! In order to advertise toplevel icon global call [XdgToplevelIconManager::new] and delegate
//! events to it with [delegate_xdg_toplevel_icon].
//! events to it with [`delegate_xdg_toplevel_icon`][crate::delegate_xdg_toplevel_icon].
//! Currently attached icon is available in double-buffered [ToplevelIconCachedState]

use std::{
Expand Down Expand Up @@ -382,21 +382,21 @@ impl<D: XdgToplevelIconHandler> Dispatch<XdgToplevelIconV1, XdgToplevelIconUserD
}
}

/// Macro to delegate implementation of the xdg toplevel icon to [`XdgToplevelIconState`].
/// Macro to delegate implementation of the xdg toplevel icon to [`XdgToplevelIconManager`].
///
/// You must also implement [`XdgToplevelIconHandler`] to use this.
#[macro_export]
macro_rules! delegate_xdg_toplevel_icon {
($(@<$( $lt:tt $( : $clt:tt $(+ $dlt:tt )* )? ),+>)? $ty: ty) => {
$crate::reexports::wayland_server::delegate_global_dispatch!($(@< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)? $ty: [
$crate::reexports::wayland_protocols::xdg::toplevel_icon::v1::server::xdg_toplevel_icon_manager_v1::XdgToplevelIconManagerV1: XdgToplevelIconManagerUserData
] => $crate::wayland::xdg_toplevel_icon::XdgToplevelIconState);
$crate::reexports::wayland_protocols::xdg::toplevel_icon::v1::server::xdg_toplevel_icon_manager_v1::XdgToplevelIconManagerV1: $crate::wayland::xdg_toplevel_icon::XdgToplevelIconManagerUserData
] => $crate::wayland::xdg_toplevel_icon::XdgToplevelIconManager);

$crate::reexports::wayland_server::delegate_dispatch!($(@< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)? $ty: [
$crate::reexports::wayland_protocols::xdg::toplevel_icon::v1::server::xdg_toplevel_icon_manager_v1::XdgToplevelIconManagerV1: ()
] => $crate::wayland::xdg_toplevel_icon::XdgToplevelIconState);
] => $crate::wayland::xdg_toplevel_icon::XdgToplevelIconManager);
$crate::reexports::wayland_server::delegate_dispatch!($(@< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)? $ty: [
$crate::reexports::wayland_protocols::xdg::toplevel_icon::v1::server::xdg_toplevel_icon_v1::XdgToplevelIconV1: XdgToplevelIconUserData
] => $crate::wayland::xdg_toplevel_icon::XdgToplevelIconState);
$crate::reexports::wayland_protocols::xdg::toplevel_icon::v1::server::xdg_toplevel_icon_v1::XdgToplevelIconV1: $crate::wayland::xdg_toplevel_icon::XdgToplevelIconUserData
] => $crate::wayland::xdg_toplevel_icon::XdgToplevelIconManager);
};
}
4 changes: 2 additions & 2 deletions src/xwayland/xwm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
//! To use this functionality you must first spawn an
//! [`XWayland`](super::XWayland) instance to attach a [`X11Wm`] to.
//!
//! # Associating an [X11Surface] with a [WlSurface]
//! # Associating an [`X11Surface`] with a [`WlSurface`][wayland_server::protocol::wl_surface::WlSurface]
//!
//! When an X11 window is created, XWayland will associate it with a
//! `wl_surface` that it creates via the wayland connection. This happens in two
//! steps:
//!
//! - Via the [xwayland shell](crate::wayland::xwayland::shell) protocol, a
//! - Via the [xwayland shell](crate::wayland::xwayland_shell) protocol, a
//! serial number is set on the surface, and it is given the
//! "xwayland_shell" role.
//! - Via the X11 connection, a matching `WL_SURFACE_SERIAL` atom is set on the
Expand Down
2 changes: 1 addition & 1 deletion src/xwayland/xwm/settings.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Types related to XSETTINGS handling
//!
//! See https://specifications.freedesktop.org/xsettings-spec/0.5/
//! See <https://specifications.freedesktop.org/xsettings-spec/0.5/>

use std::{borrow::Borrow, collections::HashMap, hash::Hash};

Expand Down
2 changes: 1 addition & 1 deletion src/xwayland/xwm/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ impl X11Surface {
///
/// XWayland will set this if it has bound the [xwayland
/// shell](crate::wayland::xwayland_shell) protocol on the wayland side.
/// Otherwise, it will set [wl_surface_id] instead.
/// Otherwise, it will set [`wl_surface_id`][Self::wl_surface_id] instead.
pub fn wl_surface_serial(&self) -> Option<u64> {
self.state.lock().unwrap().wl_surface_serial
}
Expand Down
Loading