Skip to main content

CursorSource

Struct CursorSource 

Source
pub struct CursorSource { /* private fields */ }
Expand description

A cursor presented as a scene layer.

Static cursors are painted once. An animated one repaints when the frame under the clock changes, and says so as full-frame damage.

Implementations§

Source§

impl CursorSource

Source

pub fn new(device: &Device, cursor: Cursor) -> Result<Self, DumbError>

Wrap a cursor that is already loaded.

The buffer is sized to the largest frame, so an animation whose frames differ in size still has room for all of them, and the first frame is painted immediately.

§Errors

DumbError if the buffer cannot be allocated or mapped.

Source

pub fn from_argb( device: &Device, pixels: &[u32], width: u32, height: u32, xhot: u32, yhot: u32, ) -> Result<Self, SourceError>

Build a static cursor from raw premultiplied 0xAARRGGBB pixels.

The themeless fallback: what a caller uses when there is no cursor theme on the system, which is most embedded images.

§Errors

SourceError::Failed with EINVAL if a dimension is zero or oversize or the pixel count does not match the dimensions, or whatever the allocation failed with.

Source

pub const fn hotspot(&self) -> (u32, u32)

Where the pointer actually points, in buffer pixels.

The caller puts the layer’s destination at pointer - hotspot so the active point tracks the pointer rather than the sprite’s corner.

Source

pub const fn size(&self) -> (u32, u32)

The buffer’s size, which is the largest frame’s.

Source

pub const fn cursor(&self) -> &Cursor

The cursor being shown.

Trait Implementations§

Source§

impl Debug for CursorSource

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl LayerBufferSource for CursorSource

Source§

fn acquire(&mut self) -> Result<AcquiredBuffer, SourceError>

Produce this frame’s buffer. Read more
Source§

fn release(&mut self, _acquired: AcquiredBuffer)

Return a buffer to the free pool. Read more
Source§

fn binding_model(&self) -> BindingModel

Which binding contract this source participates in.
Source§

fn format(&self) -> SourceFormat

The buffer’s shape, read during layer lowering to populate the properties the allocator consults.
Source§

fn map(&mut self, access: MapAccess) -> Result<Mapping<'_>, SourceError>

Acquire a CPU view of the pixel storage. Read more
Source§

fn on_session_paused(&mut self)

The session is losing DRM master; issue no ioctls until resumed.
Source§

fn on_session_resumed(&mut self, device: &Device) -> Result<(), SourceError>

The session is back with a fresh device. Read more
Source§

fn release_with_fence( &mut self, acquired: AcquiredBuffer, release_fence: Option<SyncFence>, )

Release carrying the OUT_FENCE of the commit that displaced this buffer. Read more
Source§

fn wants_release_fence(&self) -> bool

Whether this source wants the per-buffer release fence. Read more
Source§

fn has_fresh_content(&self) -> bool

Whether a producer submitted something new since the last commit. Read more
Source§

fn on_retired(&mut self)

The scene acquires from this source no more: its layer was removed. Read more
Source§

fn with_mapping( &mut self, access: MapAccess, f: &mut dyn FnMut(&mut Mapping<'_>), ) -> Result<(), SourceError>

Run f over a CPU view of the pixel storage, writable when access allows it. Read more
Source§

fn export_dma_buf(&mut self) -> Result<DmaBufDesc<'_>, SourceError>

Export the currently-acquired buffer’s DMA-BUF planes. Read more
Source§

fn bind_to_plane(&mut self, plane_id: u32) -> Result<(), SourceError>

Bind a driver-owned producer to a plane. Read more
Source§

fn unbind_from_plane(&mut self, plane_id: u32)

Unbind from a plane, when the layer is reassigned or retired. Dormant, as bind_to_plane is.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.