Skip to main content

set_embed_anchor

Function set_embed_anchor 

Source
pub fn set_embed_anchor<T>(
    id: Id,
    embed_id: u64,
    anchor: u32,
    margin_top: i32,
    margin_right: i32,
    margin_bottom: i32,
    margin_left: i32,
    width: i32,
    height: i32,
) -> Task<T>
Expand description

Set anchor-based positioning for an embedded surface.

Instead of specifying absolute (x, y) coordinates, this allows positioning relative to the parent window edges. The geometry is automatically recalculated by the compositor when the parent window resizes.

§Arguments

  • id - The parent window ID
  • embed_id - The embedded surface ID
  • anchor - Bitflags indicating which edges to anchor to:
    • 0: none (use absolute positioning)
    • 1: top
    • 2: bottom
    • 4: left
    • 8: right
    • Combinations like 9 (top | right) are valid
  • margin_top - Margin from top edge (when anchored to top)
  • margin_right - Margin from right edge (when anchored to right)
  • margin_bottom - Margin from bottom edge (when anchored to bottom)
  • margin_left - Margin from left edge (when anchored to left)
  • width - Width of embed region (0 to stretch between left/right anchors)
  • height - Height of embed region (0 to stretch between top/bottom anchors)

§Platform-specific

  • COSMIC/Wayland: Uses zcosmic_surface_embed_manager_v1 protocol.
  • Other platforms: No-op.