stardust-xr-server: 0.44.1 -> 0.51.1

This commit is contained in:
Gavin John
2025-10-30 08:50:46 -07:00
parent 802b3a1e17
commit 0b9ef48cbd
2 changed files with 99 additions and 24 deletions

View File

@@ -0,0 +1,58 @@
diff --git a/src/wayland/xdg/backend.rs b/src/wayland/xdg/backend.rs
index e3860b8..9404a86 100644
--- a/src/wayland/xdg/backend.rs
+++ b/src/wayland/xdg/backend.rs
@@ -29,9 +29,9 @@ pub struct XdgBackend {
}
impl XdgBackend {
- pub fn new(seat: &Arc<Seat>, toplevel: &Arc<Toplevel>) -> Self {
+ pub fn new(seat: Weak<Seat>, toplevel: &Arc<Toplevel>) -> Self {
Self {
- seat: Arc::downgrade(seat),
+ seat,
toplevel: Arc::downgrade(toplevel),
children: DashMap::new(),
}
diff --git a/src/wayland/xdg/surface.rs b/src/wayland/xdg/surface.rs
index ddc3562..df733da 100644
--- a/src/wayland/xdg/surface.rs
+++ b/src/wayland/xdg/surface.rs
@@ -74,7 +74,6 @@ impl XdgSurface for Surface {
let toplevel_weak = Arc::downgrade(&toplevel);
let display = client.get::<Display>(ObjectId::DISPLAY).unwrap();
- let seat = Arc::downgrade(display.seat.get().unwrap());
let pid = display.pid;
let configured = self.configured.clone();
let mut first_commit = true;
@@ -94,7 +93,8 @@ impl XdgSurface for Surface {
&& configured.load(std::sync::atomic::Ordering::SeqCst)
&& surface.currently_has_valid_buffer()
{
- let mapped_inner = MappedInner::create(&seat.upgrade().unwrap(), &toplevel, pid);
+ let seat = display.seat.get().map(Arc::downgrade).unwrap_or_default();
+ let mapped_inner = MappedInner::create(seat, &toplevel, pid);
*surface.panel_item.lock() = Arc::downgrade(&mapped_inner.panel_item);
mapped_lock.replace(mapped_inner);
return false;
diff --git a/src/wayland/xdg/toplevel.rs b/src/wayland/xdg/toplevel.rs
index b10223e..a2e0f93 100644
--- a/src/wayland/xdg/toplevel.rs
+++ b/src/wayland/xdg/toplevel.rs
@@ -13,6 +13,7 @@ use crate::{
use mint::Vector2;
use parking_lot::Mutex;
use std::sync::Arc;
+use std::sync::Weak;
use waynest::ObjectId;
pub use waynest_protocols::server::stable::xdg_shell::xdg_toplevel::*;
use waynest_server::Client as _;
@@ -23,7 +24,7 @@ pub struct MappedInner {
pub panel_item: Arc<PanelItem<XdgBackend>>,
}
impl MappedInner {
- pub fn create(seat: &Arc<Seat>, toplevel: &Arc<Toplevel>, pid: Option<i32>) -> Self {
+ pub fn create(seat: Weak<Seat>, toplevel: &Arc<Toplevel>, pid: Option<i32>) -> Self {
let (panel_item_node, panel_item) =
PanelItem::create(Box::new(XdgBackend::new(seat, toplevel)), pid);

View File

@@ -1,53 +1,70 @@
{
lib,
fetchFromGitHub,
nix-update-script,
rustPlatform,
cmake,
cpm-cmake,
fontconfig,
alsa-lib,
libGL,
libx11,
libxcursor,
libxcb,
libxi,
libxkbcommon,
libgbm,
openxr-loader,
pkg-config,
libxfixes,
libx11,
vulkan-loader,
wayland,
nix-update-script,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "stardust-xr-server";
version = "0.44.1";
version = "0.51.1";
src = fetchFromGitHub {
owner = "stardustxr";
repo = "server";
tag = finalAttrs.version;
hash = "sha256-sCatpWDdy7NFWOWUARjN3fZMDVviX2iV79G0HTxfYZU=";
hash = "sha256-ntVc5fc1qMjR1FDqoNq35Y6PkG9VPNDVplyTpO6VhKA=";
};
cargoHash = "sha256-jCtMCZG3ku30tabTnVdGfgcLl5DoqhkJpLKPPliJgDU=";
patches = [
# nixosTests/flatland hits a bug:
# it is permissible for a client to create an xdg_toplevel
# before binding wl_seat; weston-presentation-shm never
# binds a wl_seat since it doesn't need to accept input
# TODO(@Pandapip1): upstream
./fix-seat-unwrap-panic.patch
];
cargoHash = "sha256-5HQkrkupBohmopGJh9t3JndVTU6cjbW0LgtBPb+YAr0=";
strictDeps = true;
nativeBuildInputs = [
cmake
pkg-config
rustPlatform.bindgenHook
];
buildInputs = [
fontconfig
libGL
libxkbcommon
libgbm
openxr-loader
libx11
libxfixes
alsa-lib
wayland
];
env.CPM_SOURCE_CACHE = "./build";
postPatch = ''
install -D ${cpm-cmake}/share/cpm/CPM.cmake $(echo $cargoDepsCopy/*/stereokit-sys-*/StereoKit)/build/cpm/CPM_0.32.2.cmake
postFixup = ''
patchelf $out/bin/stardust-xr-server --add-rpath ${
lib.makeLibraryPath [
# wgpu-hal hardcodes ash's runtime libvulkan dlopen() path (ash does expose an optional linked feature)
vulkan-loader
# Likewise, bevy_openxr doesn't use openxr's linked feature
openxr-loader
# x11-dl via winit x11
libx11
libxcursor
libxi
libxcb
# x11rb via winit and xkbcommon-dl
libxkbcommon
# wgpu-hal I think
libGL
]
}
'';
passthru.updateScript = nix-update-script { };