Skip to repository content39 lines · 1.8 KB · rust
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T04:01:05.837Z Public web read
NIP-34 coordinate
30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omegaMaintainersHidden in public view
References2 branches · 1 tag
Read-only clone
git clone https://openagents.com/git/tenant.openagents/omega.gitBrowse files
popup.rs
1pub use gpui::popup::*;
2
3use wayland_protocols::xdg::shell::client::xdg_positioner;
4
5pub(crate) fn wayland_anchor(anchor: PopupAnchor) -> xdg_positioner::Anchor {
6 match anchor {
7 PopupAnchor::Center => xdg_positioner::Anchor::None,
8 PopupAnchor::Top => xdg_positioner::Anchor::Top,
9 PopupAnchor::Bottom => xdg_positioner::Anchor::Bottom,
10 PopupAnchor::Left => xdg_positioner::Anchor::Left,
11 PopupAnchor::Right => xdg_positioner::Anchor::Right,
12 PopupAnchor::TopLeft => xdg_positioner::Anchor::TopLeft,
13 PopupAnchor::BottomLeft => xdg_positioner::Anchor::BottomLeft,
14 PopupAnchor::TopRight => xdg_positioner::Anchor::TopRight,
15 PopupAnchor::BottomRight => xdg_positioner::Anchor::BottomRight,
16 }
17}
18
19pub(crate) fn wayland_gravity(gravity: PopupGravity) -> xdg_positioner::Gravity {
20 match gravity {
21 PopupGravity::Center => xdg_positioner::Gravity::None,
22 PopupGravity::Top => xdg_positioner::Gravity::Top,
23 PopupGravity::Bottom => xdg_positioner::Gravity::Bottom,
24 PopupGravity::Left => xdg_positioner::Gravity::Left,
25 PopupGravity::Right => xdg_positioner::Gravity::Right,
26 PopupGravity::TopLeft => xdg_positioner::Gravity::TopLeft,
27 PopupGravity::BottomLeft => xdg_positioner::Gravity::BottomLeft,
28 PopupGravity::TopRight => xdg_positioner::Gravity::TopRight,
29 PopupGravity::BottomRight => xdg_positioner::Gravity::BottomRight,
30 }
31}
32
33pub(crate) fn wayland_constraint_adjustment(
34 adjustment: PopupConstraintAdjustment,
35) -> xdg_positioner::ConstraintAdjustment {
36 // The flag values match the protocol bitfield, so the bits map across directly.
37 xdg_positioner::ConstraintAdjustment::from_bits_truncate(adjustment.bits())
38}
39