fix: clippy
This commit is contained in:
56
Cargo.lock
generated
56
Cargo.lock
generated
@@ -177,17 +177,6 @@ dependencies = [
|
||||
"syn 2.0.66",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
||||
dependencies = [
|
||||
"hermit-abi 0.1.19",
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.3.0"
|
||||
@@ -336,12 +325,6 @@ version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "cfg_aliases"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
|
||||
|
||||
[[package]]
|
||||
name = "cfg_aliases"
|
||||
version = "0.2.1"
|
||||
@@ -537,16 +520,6 @@ version = "0.8.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
|
||||
|
||||
[[package]]
|
||||
name = "ctrlc"
|
||||
version = "3.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "672465ae37dc1bc6380a6547a8883d5dd397b0f1faaad4f265726cc7042a5345"
|
||||
dependencies = [
|
||||
"nix 0.28.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cty"
|
||||
version = "0.2.2"
|
||||
@@ -906,15 +879,6 @@ version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.3.9"
|
||||
@@ -1350,18 +1314,6 @@ dependencies = [
|
||||
"memoffset",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.28.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
|
||||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"cfg-if",
|
||||
"cfg_aliases 0.1.1",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.29.0"
|
||||
@@ -1370,7 +1322,7 @@ checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
|
||||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"cfg-if",
|
||||
"cfg_aliases 0.2.1",
|
||||
"cfg_aliases",
|
||||
"libc",
|
||||
]
|
||||
|
||||
@@ -1409,7 +1361,7 @@ version = "1.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
|
||||
dependencies = [
|
||||
"hermit-abi 0.3.9",
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
]
|
||||
|
||||
@@ -1597,7 +1549,7 @@ checksum = "5e6a007746f34ed64099e88783b0ae369eaa3da6392868ba262e2af9b8fbaea1"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"concurrent-queue",
|
||||
"hermit-abi 0.3.9",
|
||||
"hermit-abi",
|
||||
"pin-project-lite",
|
||||
"rustix",
|
||||
"tracing",
|
||||
@@ -2111,11 +2063,9 @@ dependencies = [
|
||||
name = "stardust-xr-server"
|
||||
version = "0.44.1"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"clap",
|
||||
"color-eyre",
|
||||
"console-subscriber",
|
||||
"ctrlc",
|
||||
"directories",
|
||||
"glam",
|
||||
"global_counter",
|
||||
|
||||
@@ -61,9 +61,7 @@ serde_repr = "0.1.16"
|
||||
tracing = "0.1.37"
|
||||
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
|
||||
rand = "0.8.5"
|
||||
atty = "0.2.14"
|
||||
xkbcommon = { version = "0.7.0", default-features = false, optional = true }
|
||||
ctrlc = "3.4.1"
|
||||
libc = "0.2.148"
|
||||
input-event-codes = "6.2.0"
|
||||
nix = "0.29.0"
|
||||
|
||||
@@ -322,7 +322,7 @@ fn generate_member(member: &Member) -> TokenStream {
|
||||
let return_type = member
|
||||
.return_type
|
||||
.as_ref()
|
||||
.map(|r| generate_argument_type(&r, false, true))
|
||||
.map(|r| generate_argument_type(r, false, true))
|
||||
.unwrap_or_else(|| quote!(()));
|
||||
|
||||
match (side, _type) {
|
||||
@@ -496,8 +496,8 @@ fn argument_type_option_name(argument_type: &ArgumentType) -> String {
|
||||
ArgumentType::Color => "Color".to_string(),
|
||||
ArgumentType::String => "String".to_string(),
|
||||
ArgumentType::Bytes => "Bytes".to_string(),
|
||||
ArgumentType::Vec(v) => format!("{}Vector", argument_type_option_name(&v)),
|
||||
ArgumentType::Map(m) => format!("{}Map", argument_type_option_name(&m)),
|
||||
ArgumentType::Vec(v) => format!("{}Vector", argument_type_option_name(v)),
|
||||
ArgumentType::Map(m) => format!("{}Map", argument_type_option_name(m)),
|
||||
ArgumentType::NodeID => "Node ID".to_string(),
|
||||
ArgumentType::Datamap => "Datamap".to_string(),
|
||||
ArgumentType::ResourceID => "ResourceID".to_string(),
|
||||
@@ -519,11 +519,11 @@ fn generate_argument_type(
|
||||
ArgumentType::UInt => quote!(u32),
|
||||
ArgumentType::Float => quote!(f32),
|
||||
ArgumentType::Vec2(t) => {
|
||||
let t = generate_argument_type(&t, false, true);
|
||||
let t = generate_argument_type(t, false, true);
|
||||
quote!(stardust_xr::values::Vector2<#t>)
|
||||
}
|
||||
ArgumentType::Vec3(t) => {
|
||||
let t = generate_argument_type(&t, false, true);
|
||||
let t = generate_argument_type(t, false, true);
|
||||
quote!(stardust_xr::values::Vector3<#t>)
|
||||
}
|
||||
ArgumentType::Quat => quote!(stardust_xr::values::Quaternion),
|
||||
@@ -544,7 +544,7 @@ fn generate_argument_type(
|
||||
}
|
||||
}
|
||||
ArgumentType::Vec(t) => {
|
||||
let t = generate_argument_type(&t, false, true);
|
||||
let t = generate_argument_type(t, false, true);
|
||||
if !owned {
|
||||
quote!(&[#t])
|
||||
} else {
|
||||
@@ -552,7 +552,7 @@ fn generate_argument_type(
|
||||
}
|
||||
}
|
||||
ArgumentType::Map(t) => {
|
||||
let t = generate_argument_type(&t, false, true);
|
||||
let t = generate_argument_type(t, false, true);
|
||||
|
||||
if !owned {
|
||||
quote!(&stardust_xr::values::Map<String, #t>)
|
||||
|
||||
@@ -142,11 +142,8 @@ impl Client {
|
||||
let client = client.clone();
|
||||
async move {
|
||||
loop {
|
||||
match messenger_rx.dispatch(&*scenegraph).await {
|
||||
Err(e) => {
|
||||
client.disconnect(Err(e.into()));
|
||||
}
|
||||
_ => (),
|
||||
if let Err(e) = messenger_rx.dispatch(&*scenegraph).await {
|
||||
client.disconnect(Err(e.into()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,11 +157,8 @@ impl Client {
|
||||
let client = client.clone();
|
||||
async move {
|
||||
loop {
|
||||
match messenger_tx.flush().await {
|
||||
Err(e) => {
|
||||
client.disconnect(Err(e.into()));
|
||||
}
|
||||
_ => (),
|
||||
if let Err(e) = messenger_tx.flush().await {
|
||||
client.disconnect(Err(e.into()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,11 +65,11 @@ impl ClientStateParsed {
|
||||
let file_string = std::fs::read_to_string(file).ok()?;
|
||||
toml::from_str(&file_string).ok()
|
||||
}
|
||||
pub fn to_file(self, directory: &Path) {
|
||||
pub fn to_file(&self, directory: &Path) {
|
||||
let app_name = self
|
||||
.launch_info
|
||||
.as_ref()
|
||||
.map(|l| l.cmdline.get(0).unwrap().split('/').last().unwrap())
|
||||
.map(|l| l.cmdline.first().unwrap().split('/').last().unwrap())
|
||||
.unwrap_or("unknown");
|
||||
let state_file_path = directory
|
||||
.join(format!("{app_name}-{}", nanoid::nanoid!()))
|
||||
|
||||
@@ -3,9 +3,11 @@ use parking_lot::Mutex;
|
||||
use std::any::Any;
|
||||
use tokio::sync::mpsc::{self, unbounded_channel};
|
||||
|
||||
type Anything = Box<dyn Any + Send + Sync>;
|
||||
|
||||
static MAIN_DESTROY_QUEUE: Lazy<(
|
||||
mpsc::UnboundedSender<Box<dyn Any + Send + Sync>>,
|
||||
Mutex<mpsc::UnboundedReceiver<Box<dyn Any + Send + Sync>>>,
|
||||
mpsc::UnboundedSender<Anything>,
|
||||
Mutex<mpsc::UnboundedReceiver<Anything>>,
|
||||
)> = Lazy::new(|| {
|
||||
let (tx, rx) = unbounded_channel();
|
||||
(tx, Mutex::new(rx))
|
||||
|
||||
@@ -14,7 +14,7 @@ impl<T: Send + Sync + ?Sized> Registry<T> {
|
||||
}
|
||||
fn lock(&self) -> MappedMutexGuard<FxHashMap<usize, Weak<T>>> {
|
||||
MutexGuard::map(self.0.lock(), |r| {
|
||||
r.get_or_insert_with(|| FxHashMap::default())
|
||||
r.get_or_insert_with(FxHashMap::default)
|
||||
})
|
||||
}
|
||||
pub fn add(&self, t: T) -> Arc<T>
|
||||
@@ -63,7 +63,7 @@ impl<T: Send + Sync + ?Sized> Registry<T> {
|
||||
.collect()
|
||||
}
|
||||
pub fn set(&self, other: &Registry<T>) {
|
||||
*self.lock() = other.lock().clone();
|
||||
self.lock().clone_from(&other.lock());
|
||||
}
|
||||
pub fn take_valid_contents(&self) -> Vec<Arc<T>> {
|
||||
self.0
|
||||
@@ -119,7 +119,7 @@ impl<T: Send + Sync + ?Sized> OwnedRegistry<T> {
|
||||
}
|
||||
fn lock(&self) -> MappedMutexGuard<FxHashMap<usize, Arc<T>>> {
|
||||
MutexGuard::map(self.0.lock(), |r| {
|
||||
r.get_or_insert_with(|| FxHashMap::default())
|
||||
r.get_or_insert_with(FxHashMap::default)
|
||||
})
|
||||
}
|
||||
pub fn add(&self, t: T) -> Arc<T>
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
use stardust_xr::values::ResourceID;
|
||||
use std::{ffi::OsStr, path::PathBuf};
|
||||
use std::{
|
||||
ffi::OsStr,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use super::client::Client;
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static ref THEMES: Vec<PathBuf> = std::env::var("STARDUST_THEMES").map(|s| s.split(":").map(PathBuf::from).collect()).unwrap_or_default();
|
||||
static ref THEMES: Vec<PathBuf> = std::env::var("STARDUST_THEMES").map(|s| s.split(':').map(PathBuf::from).collect()).unwrap_or_default();
|
||||
}
|
||||
|
||||
fn has_extension(path: &PathBuf, extensions: &[&OsStr]) -> bool {
|
||||
fn has_extension(path: &Path, extensions: &[&OsStr]) -> bool {
|
||||
if let Some(path_extension) = path.extension() {
|
||||
extensions.contains(&path_extension)
|
||||
} else {
|
||||
|
||||
@@ -47,7 +47,8 @@ impl Scenegraph {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MethodResponseSender(oneshot::Sender<Result<(Vec<u8>, Vec<OwnedFd>), ScenegraphError>>);
|
||||
pub type MethodResponse = Result<(Vec<u8>, Vec<OwnedFd>), ScenegraphError>;
|
||||
pub struct MethodResponseSender(oneshot::Sender<MethodResponse>);
|
||||
impl MethodResponseSender {
|
||||
pub fn send(self, t: Result<Message, ScenegraphError>) {
|
||||
let _ = self.0.send(t.map(|m| (m.data, m.fds)));
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(clippy::empty_docs)]
|
||||
mod core;
|
||||
mod nodes;
|
||||
mod objects;
|
||||
@@ -399,7 +400,7 @@ fn run_client(
|
||||
#[cfg(feature = "wayland")]
|
||||
{
|
||||
if let Some(wayland_socket) = wayland.socket_name.as_ref() {
|
||||
command.env("WAYLAND_DISPLAY", &wayland_socket);
|
||||
command.env("WAYLAND_DISPLAY", wayland_socket);
|
||||
}
|
||||
command.env(
|
||||
"DISPLAY",
|
||||
@@ -429,7 +430,7 @@ async fn save_session(project_dirs: &ProjectDirs) {
|
||||
local_set.spawn_local(async move {
|
||||
tokio::select! {
|
||||
biased;
|
||||
s = client.save_state() => {s.map(|s| s.to_file(&session_dir));},
|
||||
s = client.save_state() => {if let Some(s) = s { s.to_file(&session_dir) }},
|
||||
_ = tokio::time::sleep(Duration::from_millis(100)) => (),
|
||||
}
|
||||
});
|
||||
|
||||
@@ -59,7 +59,7 @@ impl Alias {
|
||||
|
||||
fn add_to(new_node: &Arc<Node>, original: &Arc<Node>, info: AliasInfo) -> Result<()> {
|
||||
let alias = Alias {
|
||||
node: Arc::downgrade(&new_node),
|
||||
node: Arc::downgrade(new_node),
|
||||
original: Arc::downgrade(original),
|
||||
info,
|
||||
};
|
||||
|
||||
@@ -36,7 +36,7 @@ pub fn mask_matches(mask_map_lesser: &Datamap, mask_map_greater: &Datamap) -> bo
|
||||
let greater_key = get_mask(mask_map_greater)?.index(key)?;
|
||||
// otherwise zero-length vectors don't count the same as a single type vector
|
||||
if lesser_key.flexbuffer_type().is_heterogenous_vector()
|
||||
&& lesser_key.as_vector().len() == 0
|
||||
&& lesser_key.as_vector().is_empty()
|
||||
&& greater_key.flexbuffer_type().is_vector()
|
||||
{
|
||||
continue;
|
||||
|
||||
@@ -76,7 +76,7 @@ impl Lines {
|
||||
thickness: (first.thickness + last.thickness) * 0.5,
|
||||
color: color.into(),
|
||||
};
|
||||
points.push_front(connect_point.clone());
|
||||
points.push_front(connect_point);
|
||||
points.push_back(connect_point);
|
||||
}
|
||||
stereokit_rust::system::Lines::add_list(token, points.make_contiguous());
|
||||
|
||||
@@ -26,12 +26,12 @@ pub fn draw(token: &MainThreadToken) {
|
||||
text::draw_all(token);
|
||||
|
||||
if let Some(skytex) = QUEUED_SKYTEX.lock().take() {
|
||||
if let Ok(skytex) = SHCubemap::from_cubemap_equirectangular(&skytex, true, 100) {
|
||||
if let Ok(skytex) = SHCubemap::from_cubemap_equirectangular(skytex, true, 100) {
|
||||
Renderer::skytex(skytex.tex);
|
||||
}
|
||||
}
|
||||
if let Some(skylight) = QUEUED_SKYLIGHT.lock().take() {
|
||||
if let Ok(skylight) = SHCubemap::from_cubemap_equirectangular(&skylight, true, 100) {
|
||||
if let Ok(skylight) = SHCubemap::from_cubemap_equirectangular(skylight, true, 100) {
|
||||
Renderer::skylight(skylight.sh);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ impl MaterialParameter {
|
||||
}
|
||||
MaterialParameter::Texture(resource) => {
|
||||
let Some(texture_path) =
|
||||
get_resource_file(&resource, &client, &[OsStr::new("png"), OsStr::new("jpg")])
|
||||
get_resource_file(resource, client, &[OsStr::new("png"), OsStr::new("jpg")])
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
@@ -3,8 +3,7 @@ use smithay::backend::renderer::gles::{
|
||||
ffi::{self, Gles2, FRAGMENT_SHADER, VERTEX_SHADER},
|
||||
GlesError,
|
||||
};
|
||||
use std::mem::transmute;
|
||||
use stereokit_rust::shader::Shader;
|
||||
use stereokit_rust::shader::{Shader, _ShaderT};
|
||||
use tracing::error;
|
||||
|
||||
// Simula shader with fancy lanzcos sampling
|
||||
@@ -133,7 +132,7 @@ pub unsafe fn shader_inject(
|
||||
let gl_frag = compile_shader(c, FRAGMENT_SHADER, frag_str)?;
|
||||
let gl_prog = link_program(c, gl_vert, gl_frag)?;
|
||||
|
||||
let shader: *mut FfiShader = transmute(sk_shader.0.as_mut());
|
||||
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;
|
||||
|
||||
@@ -46,7 +46,7 @@ impl Text {
|
||||
let text = TEXT_REGISTRY.add(Text {
|
||||
space: node.get_aspect::<Spatial>().unwrap().clone(),
|
||||
font_path: style.font.as_ref().and_then(|res| {
|
||||
get_resource_file(&res, &client, &[OsStr::new("ttf"), OsStr::new("otf")])
|
||||
get_resource_file(res, &client, &[OsStr::new("ttf"), OsStr::new("otf")])
|
||||
}),
|
||||
style: OnceCell::new(),
|
||||
|
||||
@@ -93,7 +93,7 @@ impl Text {
|
||||
super::TextFit::Exact => TextFit::Exact,
|
||||
super::TextFit::Overflow => TextFit::Overflow,
|
||||
},
|
||||
Some(style.clone()),
|
||||
Some(*style),
|
||||
Some(Color128::new(
|
||||
data.color.c.r,
|
||||
data.color.c.g,
|
||||
|
||||
@@ -54,7 +54,7 @@ impl BoxFieldAspect for BoxField {
|
||||
let Field::Box(this_field) = &*this_field else {
|
||||
return Ok(());
|
||||
};
|
||||
this_field.set_size(size.into());
|
||||
this_field.set_size(size);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,9 +161,7 @@ pub fn process_input() {
|
||||
// Iterate over the distance links and send input to them
|
||||
for (i, input_link) in input_links.into_iter().enumerate() {
|
||||
let handler = input_link.handler.spatial.node().unwrap();
|
||||
if !handler_input.contains_key(&handler.id) {
|
||||
handler_input.insert(handler.id, (handler.clone(), Vec::new(), Vec::new()));
|
||||
}
|
||||
handler_input.entry(handler.id).or_insert_with(|| (handler.clone(), Vec::new(), Vec::new()));
|
||||
let (_, methods, datas) = handler_input.get_mut(&handler.id).unwrap();
|
||||
|
||||
let method_alias = input_link
|
||||
|
||||
@@ -140,7 +140,7 @@ impl CameraItem {
|
||||
let sk_mat = self
|
||||
.sk_mat
|
||||
.get_or_try_init(|| -> Result<Arc<MaterialWrapper>> {
|
||||
let shader = Shader::from_memory(&UNLIT_SHADER_BYTES)?;
|
||||
let shader = Shader::from_memory(UNLIT_SHADER_BYTES)?;
|
||||
let mut mat = Material::new(&shader, None);
|
||||
mat.get_all_param_info().set_texture("diffuse", &sk_tex.0);
|
||||
mat.transparency(Transparency::Blend);
|
||||
|
||||
@@ -35,7 +35,7 @@ fn release(item: &Item) {
|
||||
*captured_acceptor = Weak::default();
|
||||
acceptor.handle_release(item);
|
||||
if let Some(ui) = item.type_info.ui.lock().upgrade() {
|
||||
ui.handle_release_item(item, &acceptor);
|
||||
ui.handle_release_item(item, acceptor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ use stereokit_rust::maths::Bounds;
|
||||
|
||||
stardust_xr_server_codegen::codegen_spatial_protocol!();
|
||||
impl Transform {
|
||||
pub fn to_mat4(self, position: bool, rotation: bool, scale: bool) -> Mat4 {
|
||||
pub fn to_mat4(&self, position: bool, rotation: bool, scale: bool) -> Mat4 {
|
||||
let position = position
|
||||
.then_some(self.translation)
|
||||
.flatten()
|
||||
@@ -184,7 +184,7 @@ impl Spatial {
|
||||
}
|
||||
fn set_parent(self: &Arc<Self>, new_parent: Option<&Arc<Spatial>>) {
|
||||
if let Some(parent) = self.get_parent() {
|
||||
parent.children.remove(&self);
|
||||
parent.children.remove(self);
|
||||
}
|
||||
if let Some(new_parent) = &new_parent {
|
||||
new_parent.children.add_raw(self);
|
||||
@@ -218,7 +218,7 @@ impl Spatial {
|
||||
}
|
||||
|
||||
self.set_local_transform(Spatial::space_to_space_matrix(
|
||||
Some(&self),
|
||||
Some(self),
|
||||
parent.map(AsRef::as_ref),
|
||||
));
|
||||
self.set_parent(parent);
|
||||
|
||||
@@ -47,7 +47,7 @@ impl EyePointer {
|
||||
pub fn update(&self) {
|
||||
let ray = Input::get_eyes();
|
||||
self.spatial.set_local_transform(
|
||||
Mat4::from_rotation_translation(ray.orientation.into(), ray.position.into()).into(),
|
||||
Mat4::from_rotation_translation(ray.orientation.into(), ray.position.into()),
|
||||
);
|
||||
{
|
||||
// Set pointer input datamap
|
||||
|
||||
@@ -157,7 +157,7 @@ impl MousePointer {
|
||||
.pointer
|
||||
.capture_requests
|
||||
.get_valid_contents()
|
||||
.contains(&capture)
|
||||
.contains(capture)
|
||||
{
|
||||
self.capture.take();
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ impl SkController {
|
||||
.input
|
||||
.capture_requests
|
||||
.get_valid_contents()
|
||||
.contains(&capture)
|
||||
.contains(capture)
|
||||
{
|
||||
self.capture.take();
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ impl SkHand {
|
||||
.input
|
||||
.capture_requests
|
||||
.get_valid_contents()
|
||||
.contains(&capture)
|
||||
.contains(capture)
|
||||
{
|
||||
self.capture.take();
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ impl PlaySpace {
|
||||
pub fn update(&self) {
|
||||
let pose = World::get_bounds_pose();
|
||||
self.spatial.set_local_transform(
|
||||
Mat4::from_rotation_translation(pose.orientation.into(), pose.position.into()).into(),
|
||||
Mat4::from_rotation_translation(pose.orientation.into(), pose.position.into()),
|
||||
);
|
||||
let Field::Box(box_field) = self.field.as_ref() else {
|
||||
return;
|
||||
|
||||
@@ -165,7 +165,7 @@ impl Wayland {
|
||||
let dh1 = display.handle();
|
||||
let mut dh2 = dh1.clone();
|
||||
|
||||
Ok(task::new(|| "wayland loop", async move {
|
||||
task::new(|| "wayland loop", async move {
|
||||
let _socket = socket; // Keep the socket alive
|
||||
loop {
|
||||
tokio::select! {
|
||||
@@ -191,7 +191,7 @@ impl Wayland {
|
||||
}
|
||||
}
|
||||
}
|
||||
})?)
|
||||
})
|
||||
}
|
||||
|
||||
#[instrument(level = "debug", name = "Wayland frame", skip(self))]
|
||||
|
||||
@@ -239,7 +239,7 @@ impl SeatWrapper {
|
||||
for key in keys {
|
||||
keyboard.input(
|
||||
&mut state.lock(),
|
||||
key.abs() as u32,
|
||||
key.unsigned_abs(),
|
||||
if key > 0 {
|
||||
KeyState::Pressed
|
||||
} else {
|
||||
|
||||
@@ -107,7 +107,7 @@ impl CoreSurface {
|
||||
)))
|
||||
});
|
||||
self.sk_mat.get_or_init(|| {
|
||||
let shader = Shader::from_memory(&PANEL_SHADER_BYTES).unwrap();
|
||||
let shader = Shader::from_memory(PANEL_SHADER_BYTES).unwrap();
|
||||
// let _ = renderer.with_context(|c| unsafe {
|
||||
// shader_inject(c, &mut shader, SIMULA_VERT_STR, SIMULA_FRAG_STR)
|
||||
// });
|
||||
|
||||
@@ -100,7 +100,7 @@ impl XdgShellHandler for WaylandState {
|
||||
toplevel.clone(),
|
||||
client_state.seat.clone(),
|
||||
)),
|
||||
client_state.pid.clone(),
|
||||
client_state.pid,
|
||||
);
|
||||
handle_cursor(&panel_item, panel_item.backend.seat.cursor_info_rx.clone());
|
||||
utils::insert_data(toplevel.wl_surface(), Arc::downgrade(&panel_item));
|
||||
@@ -430,14 +430,13 @@ impl Backend for XdgBackend {
|
||||
.clone()
|
||||
});
|
||||
let toplevel_cached_state = compositor::with_states(toplevel.wl_surface(), |states| {
|
||||
states.cached_state.current::<SurfaceCachedState>().clone()
|
||||
*states.cached_state.current::<SurfaceCachedState>()
|
||||
});
|
||||
let toplevel_core_surface = CoreSurface::from_wl_surface(toplevel.wl_surface()).unwrap();
|
||||
|
||||
let size = toplevel
|
||||
.current_state()
|
||||
.size
|
||||
.clone()
|
||||
.map(|s| Vector2::from([s.w as u32, s.h as u32]))
|
||||
.or_else(|| toplevel_core_surface.size())
|
||||
.unwrap_or(Vector2::from([0; 2]));
|
||||
@@ -571,7 +570,7 @@ impl Backend for XdgBackend {
|
||||
}
|
||||
|
||||
fn pointer_motion(&self, surface: &SurfaceId, position: Vector2<f32>) {
|
||||
let Some(surface) = self.wl_surface_from_id(&surface) else {
|
||||
let Some(surface) = self.wl_surface_from_id(surface) else {
|
||||
return;
|
||||
};
|
||||
self.seat.pointer_motion(surface, position)
|
||||
@@ -589,14 +588,14 @@ impl Backend for XdgBackend {
|
||||
}
|
||||
|
||||
fn keyboard_keys(&self, surface: &SurfaceId, keymap_id: u64, keys: Vec<i32>) {
|
||||
let Some(surface) = self.wl_surface_from_id(&surface) else {
|
||||
let Some(surface) = self.wl_surface_from_id(surface) else {
|
||||
return;
|
||||
};
|
||||
self.seat.keyboard_keys(surface, keymap_id, keys)
|
||||
}
|
||||
|
||||
fn touch_down(&self, surface: &SurfaceId, id: u32, position: Vector2<f32>) {
|
||||
let Some(surface) = self.wl_surface_from_id(&surface) else {
|
||||
let Some(surface) = self.wl_surface_from_id(surface) else {
|
||||
return;
|
||||
};
|
||||
self.seat.touch_down(surface, id, position)
|
||||
|
||||
Reference in New Issue
Block a user