refactor(wayland): use latest smithay goods

This commit is contained in:
Nova
2024-07-07 20:05:57 -04:00
parent 7bedd2c27f
commit f5259f2977
3 changed files with 79 additions and 78 deletions

View File

@@ -3,6 +3,7 @@ use crate::wayland::surface::CoreSurface;
use super::state::{ClientState, WaylandState};
use portable_atomic::{AtomicU32, Ordering};
use smithay::{
backend::renderer::utils::on_commit_buffer_handler,
delegate_compositor,
reexports::wayland_server::{protocol::wl_surface::WlSurface, Client},
wayland::compositor::{self, CompositorClientState, CompositorHandler, CompositorState},
@@ -17,6 +18,8 @@ impl CompositorHandler for WaylandState {
fn commit(&mut self, surface: &WlSurface) {
debug!(?surface, "Surface commit");
// Let smithay handle buffer management (has to be done here as RendererSurfaceStates is not thread safe)
on_commit_buffer_handler::<WaylandState>(&surface);
let mut count = 0;
let core_surface = compositor::with_states(surface, |data| {
let count_new = data

View File

@@ -1,4 +1,4 @@
use super::{state::WaylandState, utils};
use super::utils;
use crate::{
core::{delta::Delta, destroy_queue, registry::Registry},
nodes::{
@@ -16,7 +16,7 @@ use send_wrapper::SendWrapper;
use smithay::{
backend::renderer::{
gles::{GlesRenderer, GlesTexture},
utils::{import_surface_tree, on_commit_buffer_handler, RendererSurfaceStateUserData},
utils::{import_surface_tree, RendererSurfaceStateUserData},
Renderer, Texture,
},
desktop::utils::send_frames_surface_tree,
@@ -111,8 +111,6 @@ impl CoreSurface {
Mutex::new(MaterialWrapper(mat))
});
// Let smithay handle buffer management (has to be done here as RendererSurfaceStates is not thread safe)
on_commit_buffer_handler::<WaylandState>(&wl_surface);
// Import all surface buffers into textures
if import_surface_tree(renderer, &wl_surface).is_err() {
return;