Skip to main content

FloatingPlacement

Struct FloatingPlacement 

pub struct FloatingPlacement { /* private fields */ }
Expand description

Placement + drag state shared by call, navigation, browser PiP and arbitrary captured regions.

Implementations§

§

impl FloatingPlacement

pub fn is_beyond_detach_boundary(pointer: Point, app: Rect) -> bool

Whether an attached surface has crossed the shared detach boundary.

Hosts can use this before constructing a retained surface so the pre-creation gesture follows the same threshold as Self::update_drag.

pub fn attached(preferred_size: Size) -> FloatingPlacement

pub fn attachment(&self) -> Attachment

pub fn is_dragging(&self) -> bool

pub fn is_desktop_adopted(&self) -> bool

pub fn is_desktop_covered(&self) -> bool

pub fn is_return_pending(&self) -> bool

pub fn request_app_return(&mut self)

Ask the host to return an adopted surface without painting a second source copy before its Suspended acknowledgement.

pub fn set_preferred_size(&mut self, size: Size)

pub fn settle_detached_to_preferred_size(&mut self, size: Size)

Opt this placement into source-sized transfer followed by a compact desktop settle. The transfer stays full-sized through Prepare and the first adopted frame; only a released, adopted surface may resize.

pub fn set_attached_region(&mut self, region: Option<Rect>)

Bind placement to the exact current app-local region of an inline element. This is lifecycle geometry, not an independent layout system.

pub fn set_attached_chrome(&mut self, chrome: [f64; 4])

Declare app-owned decoration around the placement’s content rect as [left, top, right, bottom] logical pixels.

pub fn set_safe_insets(&mut self, insets: [f64; 4])

Keep the attached surface clear of bands of the app as [left, top, right, bottom] logical pixels: its home sits inside them and a drag inside the app does not slide it under them. A host with a header row passes [0.0, header_height, 0.0, 0.0]. Separate from Self::set_attached_chrome, which is the surface’s own decoration.

pub fn restore_local_offset(&mut self, offset: Vec2)

Restore only app-local presentation; never restore desktop surface authority.

pub fn reset_attached(&mut self)

pub fn reattach_to_app(&mut self, app: Rect, desktop: Rect)

Host-declined/programmatic shell → app return. The surface keeps its current desktop rect on the first frame and eases back to the app home, so an unavailable native-surface path never makes it vanish or jump.

pub fn detach_to_desktop(&mut self, rect: Rect)

Programmatic counterpart to crossing the app edge (for a “Float” menu action). The supplied rect is already in desktop coordinates.

pub fn prepare_desktop_rect(&mut self, rect: Rect)

Apply the compositor’s clamped transfer geometry before the native surface’s first draw, without claiming that pixels are visible yet.

pub fn prepare_desktop_rect_with_offset( &mut self, rect: Rect, coordinate_offset: Vec2, )

Prepare desktop geometry while rebasing a still-held pointer grab from app-local into desktop coordinates. The correction term keeps the prepared (possibly compositor-clamped) rect exact on this frame and on the first native pointer event.

pub fn set_desktop_transfer_covered(&mut self, covered: bool)

Tell placement whether the shell can already cover the old app-local pixels during native-surface startup.

pub fn confirm_desktop_adoption(&mut self)

Confirm that the native surface has committed a visible buffer. This deliberately does not replay the acknowledgement’s geometry: while the surface was preparing, pointer motion may already have advanced beyond that earlier rectangle.

pub fn confirm_desktop_adoption_within(&mut self, desktop: Rect)

Confirm adoption and, for an opted-in released surface, begin its compact desktop settle inside desktop.

pub fn confirm_app_adoption(&mut self, app: Rect)

Complete the shell → app half of the ownership handshake. The shell has hidden the native/proxy surface, so the attached copy may now be included in the next primary frame.

pub fn is_handoff_animating(&self) -> bool

pub fn presentation_transform( &self, transform: Affine, rect: Rect, reduce_motion: bool, ) -> Affine

A tiny, render-only stretch along the drag direction when ownership changes. Geometry and hit testing stay on the exact drag rect, so the handoff cannot jump; reduced-motion disables the flourish entirely.

pub fn rect(&self, app: Rect, desktop: Rect) -> Rect

Resolve the live rect. Attached overlays follow app; detached ones retain screen coordinates and only clamp to the desktop.

pub fn begin_drag(&mut self, pointer: Point, app: Rect, desktop: Rect)

pub fn update_drag( &mut self, pointer: Point, app: Rect, desktop: Rect, ) -> Handoff

Detaches after crossing the app by a deliberate 28px, and reattaches when the pointer returns well inside it. The asymmetric thresholds stop the surface flickering between owners along the border.

pub fn end_drag(&mut self, desktop: Rect)

Trait Implementations§

§

impl Clone for FloatingPlacement

§

fn clone(&self) -> FloatingPlacement

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for FloatingPlacement

§

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

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Fruit for T
where T: Send + Downcast,

§

impl<T> WasmNotSend for T
where T: Send,