fix: polish stuff a bit

This commit is contained in:
Nova
2024-06-27 16:51:33 -04:00
parent d17841ec7a
commit f08f3e4e4b
11 changed files with 104 additions and 98 deletions

View File

@@ -150,7 +150,7 @@ impl SeatWrapper {
};
pointer.motion(
&mut state,
Some((surface, (0, 0).into())),
Some((surface, (0.0, 0.0).into())),
&MotionEvent {
location: (position.x as f64, position.y as f64).into(),
serial: SERIAL_COUNTER.next_serial(),
@@ -261,7 +261,7 @@ impl SeatWrapper {
};
touch.down(
&mut state.lock(),
Some((surface, (0, 0).into())),
Some((surface, (0.0, 0.0).into())),
&DownEvent {
slot: Some(id).into(),
location: (position.x as f64, position.y as f64).into(),
@@ -283,7 +283,7 @@ impl SeatWrapper {
};
touch.motion(
&mut state.lock(),
Some((surface, (0, 0).into())),
Some((surface, (0.0, 0.0).into())),
&touch::MotionEvent {
slot: Some(id).into(),
location: (position.x as f64, position.y as f64).into(),

View File

@@ -24,7 +24,7 @@ use smithay::{
reexports::wayland_server::{self, protocol::wl_surface::WlSurface, Resource},
wayland::compositor::{self, SurfaceData},
};
use std::{cell::RefCell, ffi::c_void, sync::Arc, time::Duration};
use std::{ffi::c_void, sync::Arc, time::Duration};
use stereokit_rust::{
material::{Material, Transparency},
shader::Shader,
@@ -121,7 +121,7 @@ impl CoreSurface {
let mapped = compositor::with_states(&wl_surface, |data| {
data.data_map
.get::<RendererSurfaceStateUserData>()
.map(|surface_states| surface_states.borrow().buffer().is_some())
.map(|surface_states| surface_states.lock().unwrap().buffer().is_some())
.unwrap_or(false)
});
@@ -135,7 +135,9 @@ impl CoreSurface {
let Some(renderer_surface_state) = data
.data_map
.get::<RendererSurfaceStateUserData>()
.map(RefCell::borrow)
.map(std::sync::Mutex::lock)
.map(Result::ok)
.flatten()
else {
return;
};

View File

@@ -427,7 +427,11 @@ impl Backend for XdgBackend {
.clone()
});
let toplevel_cached_state = compositor::with_states(toplevel.wl_surface(), |states| {
*states.cached_state.current::<SurfaceCachedState>()
states
.cached_state
.get::<SurfaceCachedState>()
.current()
.clone()
});
let toplevel_core_surface = CoreSurface::from_wl_surface(toplevel.wl_surface()).unwrap();