refactor: upgrade to rust 2024
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
edition = "2021"
|
||||
rust-version = "1.75"
|
||||
edition = "2024"
|
||||
rust-version = "1.85"
|
||||
name = "stardust-xr-server"
|
||||
version = "0.45.0"
|
||||
authors = ["Nova King <technobaboo@proton.me>"]
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
use super::{
|
||||
client_state::{ClientStateParsed, CLIENT_STATES},
|
||||
client_state::{CLIENT_STATES, ClientStateParsed},
|
||||
destroy_queue,
|
||||
scenegraph::Scenegraph,
|
||||
};
|
||||
use crate::{
|
||||
core::{registry::OwnedRegistry, task},
|
||||
nodes::{
|
||||
audio, drawable, fields, input, items,
|
||||
Node, audio, drawable, fields, input, items,
|
||||
root::{ClientState, Root},
|
||||
spatial, Node,
|
||||
spatial,
|
||||
},
|
||||
};
|
||||
use color_eyre::eyre::{eyre, Result};
|
||||
use color_eyre::eyre::{Result, eyre};
|
||||
use global_counter::primitive::exact::CounterU32;
|
||||
use lazy_static::lazy_static;
|
||||
use once_cell::sync::OnceCell;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::client::{get_env, Client};
|
||||
use crate::nodes::{root::ClientState, spatial::Spatial, Node};
|
||||
use super::client::{Client, get_env};
|
||||
use crate::nodes::{Node, root::ClientState, spatial::Spatial};
|
||||
use glam::Mat4;
|
||||
use parking_lot::Mutex;
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
@@ -4,8 +4,8 @@ use color_eyre::eyre::Report;
|
||||
use stardust_xr::{
|
||||
messenger::MessengerError,
|
||||
schemas::flex::{
|
||||
flexbuffers::{DeserializationError, ReaderError},
|
||||
FlexSerializeError,
|
||||
flexbuffers::{DeserializationError, ReaderError},
|
||||
},
|
||||
};
|
||||
use stereokit_rust::StereoKitError;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use parking_lot::{const_mutex, MappedMutexGuard, Mutex, MutexGuard};
|
||||
use parking_lot::{MappedMutexGuard, Mutex, MutexGuard, const_mutex};
|
||||
use rustc_hash::FxHashMap;
|
||||
use std::ptr;
|
||||
use std::sync::{Arc, Weak};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::core::error::Result;
|
||||
use crate::nodes::alias::get_original;
|
||||
use crate::nodes::Node;
|
||||
use crate::nodes::alias::get_original;
|
||||
use crate::{core::client::Client, nodes::Message};
|
||||
use once_cell::sync::OnceCell;
|
||||
use parking_lot::Mutex;
|
||||
|
||||
14
src/main.rs
14
src/main.rs
@@ -25,7 +25,7 @@ use std::time::Duration;
|
||||
use stereokit_rust::material::Material;
|
||||
use stereokit_rust::shader::Shader;
|
||||
use stereokit_rust::sk::{
|
||||
sk_quit, AppMode, DepthMode, DisplayBlend, OriginMode, QuitReason, SkSettings,
|
||||
AppMode, DepthMode, DisplayBlend, OriginMode, QuitReason, SkSettings, sk_quit,
|
||||
};
|
||||
use stereokit_rust::system::{Handed, Input, LogLevel, Renderer};
|
||||
use stereokit_rust::tex::{SHCubemap, Tex, TexFormat, TexType};
|
||||
@@ -35,9 +35,9 @@ use tokio::net::UnixListener;
|
||||
use tokio::sync::Notify;
|
||||
use tracing::metadata::LevelFilter;
|
||||
use tracing::{debug_span, error, info};
|
||||
use tracing_subscriber::{fmt, prelude::*, EnvFilter};
|
||||
use zbus::fdo::ObjectManager;
|
||||
use tracing_subscriber::{EnvFilter, fmt, prelude::*};
|
||||
use zbus::Connection;
|
||||
use zbus::fdo::ObjectManager;
|
||||
|
||||
#[derive(Debug, Clone, Parser)]
|
||||
#[clap(author, version, about, long_about = None)]
|
||||
@@ -123,7 +123,9 @@ async fn main() {
|
||||
|
||||
let project_dirs = ProjectDirs::from("", "", "stardust");
|
||||
if project_dirs.is_none() {
|
||||
error!("Unable to get Stardust project directories, default skybox and startup script will not work.");
|
||||
error!(
|
||||
"Unable to get Stardust project directories, default skybox and startup script will not work."
|
||||
);
|
||||
}
|
||||
|
||||
let dbus_connection = Connection::session()
|
||||
@@ -132,7 +134,9 @@ async fn main() {
|
||||
dbus_connection
|
||||
.request_name("org.stardustxr.HMD")
|
||||
.await
|
||||
.expect("Another instance of the server is running. This is not supported currently (but is planned).");
|
||||
.expect(
|
||||
"Another instance of the server is running. This is not supported currently (but is planned).",
|
||||
);
|
||||
|
||||
dbus_connection
|
||||
.object_server()
|
||||
|
||||
@@ -4,9 +4,9 @@ use crate::core::destroy_queue;
|
||||
use crate::core::error::Result;
|
||||
use crate::core::registry::Registry;
|
||||
use crate::core::resource::get_resource_file;
|
||||
use crate::nodes::spatial::{Spatial, Transform, SPATIAL_ASPECT_ALIAS_INFO};
|
||||
use crate::nodes::spatial::{SPATIAL_ASPECT_ALIAS_INFO, Spatial, Transform};
|
||||
use color_eyre::eyre::eyre;
|
||||
use glam::{vec3, Vec4Swizzles};
|
||||
use glam::{Vec4Swizzles, vec3};
|
||||
use once_cell::sync::OnceCell;
|
||||
use parking_lot::Mutex;
|
||||
use stardust_xr::values::ResourceID;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::{Line, LinesAspect};
|
||||
use crate::{
|
||||
core::{client::Client, error::Result, registry::Registry},
|
||||
nodes::{spatial::Spatial, Node},
|
||||
nodes::{Node, spatial::Spatial},
|
||||
};
|
||||
use glam::Vec3;
|
||||
use parking_lot::Mutex;
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
pub mod lines;
|
||||
pub mod model;
|
||||
#[cfg(feature = "wayland")]
|
||||
pub mod shader_manipulation;
|
||||
pub mod shaders;
|
||||
pub mod text;
|
||||
|
||||
use self::{lines::Lines, model::Model, text::Text};
|
||||
use super::{
|
||||
spatial::{Spatial, Transform},
|
||||
Aspect, AspectIdentifier, Node,
|
||||
spatial::{Spatial, Transform},
|
||||
};
|
||||
use crate::core::{client::Client, error::Result, resource::get_resource_file};
|
||||
use crate::nodes::spatial::SPATIAL_ASPECT_ALIAS_INFO;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use super::{MaterialParameter, ModelAspect, ModelPartAspect, MODEL_PART_ASPECT_ALIAS_INFO};
|
||||
use super::{MODEL_PART_ASPECT_ALIAS_INFO, MaterialParameter, ModelAspect, ModelPartAspect};
|
||||
use crate::bail;
|
||||
use crate::core::client::Client;
|
||||
use crate::core::error::Result;
|
||||
use crate::core::registry::Registry;
|
||||
use crate::core::resource::get_resource_file;
|
||||
use crate::nodes::Node;
|
||||
use crate::nodes::alias::{Alias, AliasList};
|
||||
use crate::nodes::spatial::Spatial;
|
||||
use crate::nodes::Node;
|
||||
use color_eyre::eyre::eyre;
|
||||
use glam::{Mat4, Vec2, Vec3};
|
||||
use once_cell::sync::{Lazy, OnceCell};
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
#![allow(dead_code)]
|
||||
use smithay::backend::renderer::gles::{
|
||||
ffi::{self, Gles2, FRAGMENT_SHADER, VERTEX_SHADER},
|
||||
GlesError,
|
||||
};
|
||||
use stereokit_rust::shader::{Shader, _ShaderT};
|
||||
use tracing::error;
|
||||
|
||||
struct FfiAssetHeader {
|
||||
asset_type: i32,
|
||||
asset_state: i32,
|
||||
id: u64,
|
||||
index: u64,
|
||||
refs: i32,
|
||||
debug: *mut u8,
|
||||
}
|
||||
|
||||
struct FfiSkgShader {
|
||||
meta: *mut u8,
|
||||
vertex: u32,
|
||||
pixel: u32,
|
||||
program: u32,
|
||||
compute: u32,
|
||||
}
|
||||
|
||||
struct FfiShader {
|
||||
header: FfiAssetHeader,
|
||||
shader: FfiSkgShader,
|
||||
}
|
||||
|
||||
unsafe fn compile_shader(
|
||||
gl: &ffi::Gles2,
|
||||
variant: ffi::types::GLuint,
|
||||
src: &str,
|
||||
) -> Result<ffi::types::GLuint, GlesError> {
|
||||
let shader = gl.CreateShader(variant);
|
||||
if shader == 0 {
|
||||
return Err(GlesError::CreateShaderObject);
|
||||
}
|
||||
|
||||
gl.ShaderSource(
|
||||
shader,
|
||||
1,
|
||||
&src.as_ptr() as *const *const u8 as *const *const ffi::types::GLchar,
|
||||
&(src.len() as i32) as *const _,
|
||||
);
|
||||
gl.CompileShader(shader);
|
||||
|
||||
let mut status = ffi::FALSE as i32;
|
||||
gl.GetShaderiv(shader, ffi::COMPILE_STATUS, &mut status as *mut _);
|
||||
if status == ffi::FALSE as i32 {
|
||||
let mut max_len = 0;
|
||||
gl.GetShaderiv(shader, ffi::INFO_LOG_LENGTH, &mut max_len as *mut _);
|
||||
|
||||
let mut error = Vec::with_capacity(max_len as usize);
|
||||
let mut len = 0;
|
||||
gl.GetShaderInfoLog(
|
||||
shader,
|
||||
max_len as _,
|
||||
&mut len as *mut _,
|
||||
error.as_mut_ptr() as *mut _,
|
||||
);
|
||||
error.set_len(len as usize);
|
||||
|
||||
error!(
|
||||
"[GL] {}",
|
||||
std::str::from_utf8(&error).unwrap_or("<Error Message no utf8>")
|
||||
);
|
||||
|
||||
gl.DeleteShader(shader);
|
||||
return Err(GlesError::ShaderCompileError);
|
||||
}
|
||||
|
||||
Ok(shader)
|
||||
}
|
||||
|
||||
unsafe fn link_program(
|
||||
gl: &ffi::Gles2,
|
||||
vert: ffi::types::GLuint,
|
||||
frag: ffi::types::GLuint,
|
||||
) -> Result<ffi::types::GLuint, GlesError> {
|
||||
let program = gl.CreateProgram();
|
||||
gl.AttachShader(program, vert);
|
||||
gl.AttachShader(program, frag);
|
||||
gl.LinkProgram(program);
|
||||
// gl.DetachShader(program, vert);
|
||||
// gl.DetachShader(program, frag);
|
||||
// gl.DeleteShader(vert);
|
||||
// gl.DeleteShader(frag);
|
||||
|
||||
let mut status = ffi::FALSE as i32;
|
||||
gl.GetProgramiv(program, ffi::LINK_STATUS, &mut status as *mut _);
|
||||
if status == ffi::FALSE as i32 {
|
||||
let mut max_len = 0;
|
||||
gl.GetProgramiv(program, ffi::INFO_LOG_LENGTH, &mut max_len as *mut _);
|
||||
|
||||
let mut error = Vec::with_capacity(max_len as usize);
|
||||
let mut len = 0;
|
||||
gl.GetProgramInfoLog(
|
||||
program,
|
||||
max_len as _,
|
||||
&mut len as *mut _,
|
||||
error.as_mut_ptr() as *mut _,
|
||||
);
|
||||
error.set_len(len as usize);
|
||||
|
||||
error!(
|
||||
"[GL] {}",
|
||||
std::str::from_utf8(&error).unwrap_or("<Error Message no utf8>")
|
||||
);
|
||||
|
||||
gl.DeleteProgram(program);
|
||||
return Err(GlesError::ProgramLinkError);
|
||||
}
|
||||
|
||||
Ok(program)
|
||||
}
|
||||
|
||||
pub unsafe fn shader_inject(
|
||||
c: &Gles2,
|
||||
sk_shader: &mut Shader,
|
||||
vert_str: &str,
|
||||
frag_str: &str,
|
||||
) -> Result<(), GlesError> {
|
||||
let gl_vert = compile_shader(c, VERTEX_SHADER, vert_str)?;
|
||||
let gl_frag = compile_shader(c, FRAGMENT_SHADER, frag_str)?;
|
||||
let gl_prog = link_program(c, gl_vert, gl_frag)?;
|
||||
|
||||
let shader = sk_shader.0.as_mut() as *mut _ShaderT as *mut FfiShader;
|
||||
if let Some(shader) = shader.as_mut() {
|
||||
shader.shader.vertex = gl_vert;
|
||||
shader.shader.pixel = gl_frag;
|
||||
shader.shader.program = gl_prog;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -3,10 +3,10 @@ use crate::{
|
||||
client::Client, destroy_queue, error::Result, registry::Registry,
|
||||
resource::get_resource_file,
|
||||
},
|
||||
nodes::{spatial::Spatial, Node},
|
||||
nodes::{Node, spatial::Spatial},
|
||||
};
|
||||
use color_eyre::eyre::eyre;
|
||||
use glam::{vec3, Mat4, Vec2};
|
||||
use glam::{Mat4, Vec2, vec3};
|
||||
use once_cell::sync::OnceCell;
|
||||
use parking_lot::Mutex;
|
||||
use std::{ffi::OsStr, path::PathBuf, sync::Arc};
|
||||
@@ -14,7 +14,7 @@ use stereokit_rust::{
|
||||
font::Font,
|
||||
sk::MainThreadToken,
|
||||
system::{TextAlign, TextFit, TextStyle as SkTextStyle},
|
||||
util::{Color128, Color32},
|
||||
util::{Color32, Color128},
|
||||
};
|
||||
|
||||
use super::{TextAspect, TextStyle};
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
use super::alias::{Alias, AliasInfo};
|
||||
use super::spatial::{
|
||||
Spatial, SPATIAL_REF_GET_LOCAL_BOUNDING_BOX_SERVER_OPCODE,
|
||||
SPATIAL_REF_GET_LOCAL_BOUNDING_BOX_SERVER_OPCODE,
|
||||
SPATIAL_REF_GET_RELATIVE_BOUNDING_BOX_SERVER_OPCODE, SPATIAL_REF_GET_TRANSFORM_SERVER_OPCODE,
|
||||
Spatial,
|
||||
};
|
||||
use super::{Aspect, AspectIdentifier, Node};
|
||||
use crate::core::client::Client;
|
||||
use crate::core::error::Result;
|
||||
use crate::nodes::spatial::Transform;
|
||||
use crate::nodes::spatial::SPATIAL_ASPECT_ALIAS_INFO;
|
||||
use crate::nodes::spatial::SPATIAL_REF_ASPECT_ALIAS_INFO;
|
||||
use crate::nodes::spatial::Transform;
|
||||
use color_eyre::eyre::OptionExt;
|
||||
use glam::{vec2, vec3, vec3a, Vec3, Vec3A, Vec3Swizzles};
|
||||
use glam::{Vec3, Vec3A, Vec3Swizzles, vec2, vec3, vec3a};
|
||||
use once_cell::sync::Lazy;
|
||||
use parking_lot::Mutex;
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::{Finger, Hand, InputDataTrait, InputHandler, InputMethod, Joint, Thumb};
|
||||
use crate::nodes::fields::{Field, FieldTrait};
|
||||
use crate::nodes::spatial::Spatial;
|
||||
use glam::{vec3a, Mat4, Quat};
|
||||
use glam::{Mat4, Quat, vec3a};
|
||||
use std::sync::Arc;
|
||||
|
||||
impl Default for Joint {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::{InputHandlerAspect, INPUT_HANDLER_REGISTRY, INPUT_METHOD_REGISTRY};
|
||||
use crate::nodes::{alias::AliasList, fields::Field, spatial::Spatial, Node};
|
||||
use super::{INPUT_HANDLER_REGISTRY, INPUT_METHOD_REGISTRY, InputHandlerAspect};
|
||||
use crate::nodes::{Node, alias::AliasList, fields::Field, spatial::Spatial};
|
||||
use color_eyre::eyre::Result;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
use super::{
|
||||
input_method_client, InputData, InputDataTrait, InputDataType, InputHandler, InputMethodAspect,
|
||||
InputMethodRefAspect, INPUT_HANDLER_REGISTRY, INPUT_METHOD_REF_ASPECT_ALIAS_INFO,
|
||||
INPUT_METHOD_REGISTRY,
|
||||
INPUT_HANDLER_REGISTRY, INPUT_METHOD_REF_ASPECT_ALIAS_INFO, INPUT_METHOD_REGISTRY, InputData,
|
||||
InputDataTrait, InputDataType, InputHandler, InputMethodAspect, InputMethodRefAspect,
|
||||
input_method_client,
|
||||
};
|
||||
use crate::{
|
||||
core::{client::Client, error::Result, registry::Registry},
|
||||
nodes::{
|
||||
alias::{Alias, AliasList},
|
||||
fields::{Field, FIELD_ALIAS_INFO},
|
||||
spatial::Spatial,
|
||||
Node,
|
||||
alias::{Alias, AliasList},
|
||||
fields::{FIELD_ALIAS_INFO, Field},
|
||||
spatial::Spatial,
|
||||
},
|
||||
};
|
||||
use parking_lot::Mutex;
|
||||
|
||||
@@ -9,10 +9,10 @@ mod tip;
|
||||
pub use handler::*;
|
||||
pub use method::*;
|
||||
|
||||
use super::fields::Field;
|
||||
use super::spatial::Spatial;
|
||||
use super::Aspect;
|
||||
use super::AspectIdentifier;
|
||||
use super::fields::Field;
|
||||
use super::spatial::Spatial;
|
||||
use crate::core::error::Result;
|
||||
use crate::nodes::spatial::SPATIAL_ASPECT_ALIAS_INFO;
|
||||
use crate::nodes::spatial::SPATIAL_REF_ASPECT_ALIAS_INFO;
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::nodes::{
|
||||
fields::{Field, FieldTrait, Ray, RayMarchResult},
|
||||
spatial::Spatial,
|
||||
};
|
||||
use glam::{vec3, Mat4, Quat};
|
||||
use glam::{Mat4, Quat, vec3};
|
||||
use std::sync::{Arc, Weak};
|
||||
|
||||
impl Default for Pointer {
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
use super::{create_item_acceptor_flex, register_item_ui_flex, Item, ItemType};
|
||||
use super::{Item, ItemType, create_item_acceptor_flex, register_item_ui_flex};
|
||||
use crate::bail;
|
||||
use crate::core::error::Result;
|
||||
use crate::nodes::items::ITEM_ACCEPTOR_ASPECT_ALIAS_INFO;
|
||||
use crate::nodes::items::ITEM_ASPECT_ALIAS_INFO;
|
||||
use crate::nodes::Aspect;
|
||||
use crate::nodes::AspectIdentifier;
|
||||
use crate::nodes::items::ITEM_ACCEPTOR_ASPECT_ALIAS_INFO;
|
||||
use crate::nodes::items::ITEM_ASPECT_ALIAS_INFO;
|
||||
use crate::{
|
||||
core::{client::Client, registry::Registry, scenegraph::MethodResponseSender},
|
||||
nodes::{
|
||||
Message, Node,
|
||||
drawable::{
|
||||
model::{MaterialWrapper, ModelPart},
|
||||
shaders::UNLIT_SHADER_BYTES,
|
||||
},
|
||||
items::TypeInfo,
|
||||
spatial::{Spatial, Transform},
|
||||
Message, Node,
|
||||
},
|
||||
};
|
||||
use glam::Mat4;
|
||||
|
||||
@@ -4,7 +4,7 @@ pub mod panel;
|
||||
use self::camera::CameraItem;
|
||||
use self::panel::PanelItemTrait;
|
||||
use super::alias::AliasList;
|
||||
use super::fields::{Field, FIELD_ALIAS_INFO};
|
||||
use super::fields::{FIELD_ALIAS_INFO, Field};
|
||||
use super::spatial::Spatial;
|
||||
use super::{Alias, Aspect, AspectIdentifier, Node};
|
||||
use crate::core::client::Client;
|
||||
@@ -12,8 +12,8 @@ use crate::core::error::Result;
|
||||
use crate::core::registry::Registry;
|
||||
use crate::ensure;
|
||||
use crate::nodes::alias::AliasInfo;
|
||||
use crate::nodes::spatial::Transform;
|
||||
use crate::nodes::spatial::SPATIAL_ASPECT_ALIAS_INFO;
|
||||
use crate::nodes::spatial::Transform;
|
||||
use parking_lot::Mutex;
|
||||
use std::hash::Hash;
|
||||
use std::sync::{Arc, Weak};
|
||||
|
||||
@@ -7,14 +7,14 @@ use crate::nodes::items::ITEM_ASPECT_ALIAS_INFO;
|
||||
use crate::nodes::{Aspect, AspectIdentifier};
|
||||
use crate::{
|
||||
core::{
|
||||
client::{get_env, state, Client, INTERNAL_CLIENT},
|
||||
client::{Client, INTERNAL_CLIENT, get_env, state},
|
||||
registry::Registry,
|
||||
},
|
||||
nodes::{
|
||||
Node,
|
||||
drawable::model::ModelPart,
|
||||
items::{Item, ItemType, TypeInfo},
|
||||
spatial::{Spatial, Transform},
|
||||
Node,
|
||||
},
|
||||
};
|
||||
use glam::Mat4;
|
||||
|
||||
@@ -15,7 +15,7 @@ use crate::core::scenegraph::MethodResponseSender;
|
||||
use parking_lot::Mutex;
|
||||
use portable_atomic::{AtomicBool, Ordering};
|
||||
use rustc_hash::FxHashMap;
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use serde::{Serialize, de::DeserializeOwned};
|
||||
use spatial::Spatial;
|
||||
use stardust_xr::messenger::MessageSenderHandle;
|
||||
use stardust_xr::scenegraph::ScenegraphError;
|
||||
|
||||
@@ -10,7 +10,7 @@ use crate::core::error::Result;
|
||||
use crate::core::registry::Registry;
|
||||
use crate::nodes::{Node, OWNED_ASPECT_ALIAS_INFO};
|
||||
use color_eyre::eyre::OptionExt;
|
||||
use glam::{vec3a, Mat4, Quat, Vec3};
|
||||
use glam::{Mat4, Quat, Vec3, vec3a};
|
||||
use mint::Vector3;
|
||||
use once_cell::sync::OnceCell;
|
||||
use parking_lot::Mutex;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
use super::{
|
||||
Spatial, ZoneAspect, SPATIAL_ASPECT_ALIAS_INFO, SPATIAL_REF_ASPECT_ALIAS_INFO,
|
||||
ZONEABLE_REGISTRY,
|
||||
SPATIAL_ASPECT_ALIAS_INFO, SPATIAL_REF_ASPECT_ALIAS_INFO, Spatial, ZONEABLE_REGISTRY,
|
||||
ZoneAspect,
|
||||
};
|
||||
use crate::{
|
||||
core::{client::Client, error::Result, registry::Registry},
|
||||
nodes::{
|
||||
alias::{get_original, Alias, AliasList},
|
||||
fields::{Field, FieldTrait},
|
||||
Node,
|
||||
alias::{Alias, AliasList, get_original},
|
||||
fields::{Field, FieldTrait},
|
||||
},
|
||||
};
|
||||
use glam::vec3a;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
use crate::{
|
||||
core::client::INTERNAL_CLIENT,
|
||||
nodes::{
|
||||
fields::{FieldTrait, Ray},
|
||||
input::{InputDataType, InputMethod, Pointer, INPUT_HANDLER_REGISTRY},
|
||||
spatial::Spatial,
|
||||
Node, OwnedNode,
|
||||
fields::{FieldTrait, Ray},
|
||||
input::{INPUT_HANDLER_REGISTRY, InputDataType, InputMethod, Pointer},
|
||||
spatial::Spatial,
|
||||
},
|
||||
};
|
||||
use color_eyre::eyre::Result;
|
||||
use glam::{vec3, Mat4};
|
||||
use glam::{Mat4, vec3};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use stardust_xr::values::Datamap;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -5,7 +5,7 @@ pub mod sk_hand;
|
||||
|
||||
use crate::nodes::{
|
||||
fields::{Field, FieldTrait, Ray},
|
||||
input::{InputDataTrait, InputDataType, InputHandler, InputMethod, INPUT_HANDLER_REGISTRY},
|
||||
input::{INPUT_HANDLER_REGISTRY, InputDataTrait, InputDataType, InputHandler, InputMethod},
|
||||
spatial::Spatial,
|
||||
};
|
||||
use glam::vec3;
|
||||
@@ -70,13 +70,13 @@ pub fn get_sorted_handlers(
|
||||
INPUT_HANDLER_REGISTRY
|
||||
.get_valid_contents()
|
||||
.into_iter()
|
||||
.filter(|handler| handler.spatial.node().map_or(false, |node| node.enabled()))
|
||||
.filter(|handler| handler.spatial.node().is_some_and(|node| node.enabled()))
|
||||
.filter(|handler| {
|
||||
handler
|
||||
.field
|
||||
.spatial
|
||||
.node()
|
||||
.map_or(false, |node| node.enabled())
|
||||
.is_some_and(|node| node.enabled())
|
||||
})
|
||||
.filter_map(|handler| {
|
||||
distance_calculator(&method.spatial, &method.data.lock(), &handler.field)
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
use super::{get_sorted_handlers, CaptureManager, DistanceCalculator};
|
||||
use super::{CaptureManager, DistanceCalculator, get_sorted_handlers};
|
||||
use crate::{
|
||||
core::client::INTERNAL_CLIENT,
|
||||
nodes::{
|
||||
fields::{Field, FieldTrait, Ray, EXPORTED_FIELDS},
|
||||
Node, OwnedNode,
|
||||
fields::{EXPORTED_FIELDS, Field, FieldTrait, Ray},
|
||||
input::{InputDataType, InputMethod, Pointer},
|
||||
items::panel::KEYMAPS,
|
||||
spatial::Spatial,
|
||||
Node, OwnedNode,
|
||||
},
|
||||
};
|
||||
use color_eyre::eyre::Result;
|
||||
use glam::{vec3, Mat4, Vec3};
|
||||
use glam::{Mat4, Vec3, vec3};
|
||||
use mint::Vector2;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use slotmap::{DefaultKey, Key as SlotKey};
|
||||
@@ -21,9 +21,9 @@ use stardust_xr::{
|
||||
use std::sync::Arc;
|
||||
use stereokit_rust::system::{Input, Key};
|
||||
use tokio::task::JoinSet;
|
||||
use tokio::time::{timeout, Duration};
|
||||
use xkbcommon_rs::{xkb_keymap::CompileFlags, Context, Keymap, KeymapFormat};
|
||||
use zbus::{names::OwnedInterfaceName, Connection};
|
||||
use tokio::time::{Duration, timeout};
|
||||
use xkbcommon_rs::{Context, Keymap, KeymapFormat, xkb_keymap::CompileFlags};
|
||||
use zbus::{Connection, names::OwnedInterfaceName};
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
struct MouseEvent {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use super::{get_sorted_handlers, CaptureManager};
|
||||
use super::{CaptureManager, get_sorted_handlers};
|
||||
use crate::{
|
||||
core::client::INTERNAL_CLIENT,
|
||||
nodes::{
|
||||
fields::{Field, FieldTrait},
|
||||
input::{InputDataType, InputHandler, InputMethod, Tip, INPUT_HANDLER_REGISTRY},
|
||||
spatial::Spatial,
|
||||
Node, OwnedNode,
|
||||
fields::{Field, FieldTrait},
|
||||
input::{INPUT_HANDLER_REGISTRY, InputDataType, InputHandler, InputMethod, Tip},
|
||||
spatial::Spatial,
|
||||
},
|
||||
objects::{ObjectHandle, SpatialRef},
|
||||
};
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use crate::core::client::INTERNAL_CLIENT;
|
||||
use crate::nodes::fields::{Field, FieldTrait};
|
||||
use crate::nodes::input::{InputDataType, InputHandler, INPUT_HANDLER_REGISTRY};
|
||||
use crate::nodes::OwnedNode;
|
||||
use crate::nodes::fields::{Field, FieldTrait};
|
||||
use crate::nodes::input::{INPUT_HANDLER_REGISTRY, InputDataType, InputHandler};
|
||||
use crate::nodes::{
|
||||
Node,
|
||||
input::{Hand, InputMethod, Joint},
|
||||
spatial::Spatial,
|
||||
Node,
|
||||
};
|
||||
use crate::objects::{ObjectHandle, SpatialRef};
|
||||
use color_eyre::eyre::Result;
|
||||
@@ -19,7 +19,7 @@ use stereokit_rust::system::{HandJoint, HandSource, Handed, Input, LinePoint, Li
|
||||
use stereokit_rust::util::Color128;
|
||||
use zbus::Connection;
|
||||
|
||||
use super::{get_sorted_handlers, CaptureManager};
|
||||
use super::{CaptureManager, get_sorted_handlers};
|
||||
|
||||
fn convert_joint(joint: HandJoint) -> Joint {
|
||||
Joint {
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
use crate::{
|
||||
core::client::INTERNAL_CLIENT,
|
||||
nodes::{
|
||||
fields::{Field, Shape, EXPORTED_FIELDS},
|
||||
spatial::{Spatial, EXPORTED_SPATIALS},
|
||||
Node, OwnedNode,
|
||||
fields::{EXPORTED_FIELDS, Field, Shape},
|
||||
spatial::{EXPORTED_SPATIALS, Spatial},
|
||||
},
|
||||
};
|
||||
use glam::{vec3, Mat4};
|
||||
use glam::{Mat4, vec3};
|
||||
use input::{
|
||||
eye_pointer::EyePointer, mouse_pointer::MousePointer, sk_controller::SkController,
|
||||
sk_hand::SkHand,
|
||||
@@ -22,7 +22,7 @@ use stereokit_rust::{
|
||||
system::{Handed, Input, Key, World},
|
||||
util::Device,
|
||||
};
|
||||
use zbus::{interface, object_server::Interface, zvariant::OwnedObjectPath, Connection};
|
||||
use zbus::{Connection, interface, object_server::Interface, zvariant::OwnedObjectPath};
|
||||
|
||||
pub mod input;
|
||||
pub mod play_space;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use stereokit_rust::system::World;
|
||||
use zbus::{interface, Connection, ObjectServer};
|
||||
use zbus::{Connection, ObjectServer, interface};
|
||||
|
||||
pub struct PlaySpaceBounds;
|
||||
impl PlaySpaceBounds {
|
||||
|
||||
@@ -10,12 +10,12 @@ use crate::{
|
||||
use parking_lot::Mutex;
|
||||
use rand::Rng;
|
||||
use smithay::{
|
||||
backend::renderer::utils::{on_commit_buffer_handler, RendererSurfaceStateUserData},
|
||||
backend::renderer::utils::{RendererSurfaceStateUserData, on_commit_buffer_handler},
|
||||
delegate_compositor,
|
||||
desktop::PopupKind,
|
||||
reexports::wayland_server::{protocol::wl_surface::WlSurface, Client},
|
||||
reexports::wayland_server::{Client, protocol::wl_surface::WlSurface},
|
||||
wayland::compositor::{
|
||||
add_post_commit_hook, CompositorClientState, CompositorHandler, CompositorState,
|
||||
CompositorClientState, CompositorHandler, CompositorState, add_post_commit_hook,
|
||||
},
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use smithay::reexports::wayland_server::{
|
||||
Client, DataInit, Dispatch, DisplayHandle, GlobalDispatch, New, Resource,
|
||||
protocol::{
|
||||
wl_data_device::{
|
||||
Request::{Release, SetSelection, StartDrag},
|
||||
@@ -13,7 +14,6 @@ use smithay::reexports::wayland_server::{
|
||||
WlDataSource,
|
||||
},
|
||||
},
|
||||
Client, DataInit, Dispatch, DisplayHandle, GlobalDispatch, New, Resource,
|
||||
};
|
||||
|
||||
use super::state::WaylandState;
|
||||
|
||||
@@ -13,8 +13,8 @@ use smithay::{
|
||||
Mode as KdeMode, OrgKdeKwinServerDecoration,
|
||||
},
|
||||
wayland_server::{
|
||||
protocol::wl_surface::WlSurface, Client, DataInit, Dispatch, DisplayHandle,
|
||||
GlobalDispatch, New, Resource, WEnum, Weak,
|
||||
Client, DataInit, Dispatch, DisplayHandle, GlobalDispatch, New, Resource, WEnum, Weak,
|
||||
protocol::wl_surface::WlSurface,
|
||||
},
|
||||
},
|
||||
wayland::shell::{self, kde::decoration::KdeDecorationHandler},
|
||||
|
||||
@@ -23,8 +23,8 @@ mod generated {
|
||||
use super::state::WaylandState;
|
||||
use smithay::{
|
||||
backend::allocator::{
|
||||
dmabuf::{Dmabuf, DmabufFlags},
|
||||
Fourcc, Modifier,
|
||||
dmabuf::{Dmabuf, DmabufFlags},
|
||||
},
|
||||
reexports::wayland_server::{
|
||||
Client, DataInit, Dispatch, DisplayHandle, GlobalDispatch, New, Resource,
|
||||
|
||||
@@ -11,7 +11,7 @@ mod xdg_shell;
|
||||
|
||||
use self::{state::WaylandState, surface::CORE_SURFACES};
|
||||
use crate::{core::task, wayland::state::ClientState};
|
||||
use color_eyre::eyre::{ensure, Result};
|
||||
use color_eyre::eyre::{Result, ensure};
|
||||
use once_cell::sync::OnceCell;
|
||||
use parking_lot::Mutex;
|
||||
use smithay::backend::allocator::dmabuf::Dmabuf;
|
||||
@@ -19,8 +19,8 @@ use smithay::backend::egl::EGLContext;
|
||||
use smithay::backend::renderer::gles::GlesRenderer;
|
||||
use smithay::backend::renderer::{ImportDma, Renderer};
|
||||
use smithay::output::Output;
|
||||
use smithay::reexports::wayland_server::backend::ClientId;
|
||||
use smithay::reexports::wayland_server::DisplayHandle;
|
||||
use smithay::reexports::wayland_server::backend::ClientId;
|
||||
use smithay::reexports::wayland_server::{Display, ListeningSocket};
|
||||
use smithay::wayland::dmabuf;
|
||||
use std::ffi::OsStr;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::{state::WaylandState, surface::CoreSurface, utils::WlSurfaceExt};
|
||||
use crate::{
|
||||
core::task,
|
||||
nodes::items::panel::{Backend, Geometry, PanelItem, KEYMAPS},
|
||||
nodes::items::panel::{Backend, Geometry, KEYMAPS, PanelItem},
|
||||
};
|
||||
use mint::Vector2;
|
||||
use parking_lot::Mutex;
|
||||
@@ -11,12 +11,12 @@ use smithay::{
|
||||
backend::input::{AxisRelativeDirection, ButtonState, KeyState},
|
||||
delegate_seat,
|
||||
input::{
|
||||
Seat, SeatHandler,
|
||||
keyboard::{FilterResult, LedState},
|
||||
pointer::{AxisFrame, ButtonEvent, CursorImageStatus, MotionEvent},
|
||||
touch::{self, DownEvent, UpEvent},
|
||||
Seat, SeatHandler,
|
||||
},
|
||||
reexports::wayland_server::{protocol::wl_surface::WlSurface, Resource, Weak as WlWeak},
|
||||
reexports::wayland_server::{Resource, Weak as WlWeak, protocol::wl_surface::WlSurface},
|
||||
utils::SERIAL_COUNTER,
|
||||
wayland::compositor,
|
||||
};
|
||||
|
||||
@@ -4,13 +4,13 @@ use once_cell::sync::OnceCell;
|
||||
use parking_lot::Mutex;
|
||||
use smithay::{
|
||||
backend::{
|
||||
allocator::{dmabuf::Dmabuf, Fourcc},
|
||||
allocator::{Fourcc, dmabuf::Dmabuf},
|
||||
egl::EGLDevice,
|
||||
renderer::gles::GlesRenderer,
|
||||
},
|
||||
delegate_dmabuf, delegate_output, delegate_shm,
|
||||
desktop::PopupManager,
|
||||
input::{keyboard::XkbConfig, SeatState},
|
||||
input::{SeatState, keyboard::XkbConfig},
|
||||
output::{Mode, Output, Scale, Subpixel},
|
||||
reexports::{
|
||||
wayland_protocols::xdg::{
|
||||
@@ -19,12 +19,12 @@ use smithay::{
|
||||
},
|
||||
wayland_protocols_misc::server_decoration::server::org_kde_kwin_server_decoration_manager::Mode as DecorationMode,
|
||||
wayland_server::{
|
||||
DisplayHandle,
|
||||
backend::{ClientData, ClientId, DisconnectReason},
|
||||
protocol::{
|
||||
wl_buffer::WlBuffer, wl_data_device_manager::WlDataDeviceManager,
|
||||
wl_output::WlOutput,
|
||||
},
|
||||
DisplayHandle,
|
||||
},
|
||||
},
|
||||
utils::{Size, Transform},
|
||||
|
||||
@@ -14,13 +14,13 @@ use parking_lot::Mutex;
|
||||
use send_wrapper::SendWrapper;
|
||||
use smithay::{
|
||||
backend::renderer::{
|
||||
gles::{GlesRenderer, GlesTexture},
|
||||
utils::{import_surface_tree, RendererSurfaceStateUserData},
|
||||
Renderer, Texture,
|
||||
gles::{GlesRenderer, GlesTexture},
|
||||
utils::{RendererSurfaceStateUserData, import_surface_tree},
|
||||
},
|
||||
desktop::utils::send_frames_surface_tree,
|
||||
output::Output,
|
||||
reexports::wayland_server::{self, protocol::wl_surface::WlSurface, Resource},
|
||||
reexports::wayland_server::{self, Resource, protocol::wl_surface::WlSurface},
|
||||
};
|
||||
use std::{ffi::c_void, sync::Arc, time::Duration};
|
||||
use stereokit_rust::{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::{
|
||||
seat::{handle_cursor, SeatWrapper},
|
||||
seat::{SeatWrapper, handle_cursor},
|
||||
state::{ClientState, WaylandState},
|
||||
surface::CoreSurface,
|
||||
utils::*,
|
||||
@@ -27,8 +27,8 @@ use smithay::{
|
||||
shell::server::xdg_toplevel::{ResizeEdge, State},
|
||||
},
|
||||
wayland_server::{
|
||||
protocol::{wl_output::WlOutput, wl_seat::WlSeat, wl_surface::WlSurface},
|
||||
Resource,
|
||||
protocol::{wl_output::WlOutput, wl_seat::WlSeat, wl_surface::WlSurface},
|
||||
},
|
||||
},
|
||||
utils::{Logical, Rectangle, Serial},
|
||||
|
||||
Reference in New Issue
Block a user