fix: upgrade smithay

This commit is contained in:
Nova
2023-05-10 16:51:39 -04:00
parent fa6ea5adc5
commit 54ad2667c3
5 changed files with 71 additions and 94 deletions

View File

@@ -1,11 +1,11 @@
use crate::wayland::surface::CoreSurface;
use super::state::WaylandState;
use super::state::{ClientState, WaylandState};
use portable_atomic::{AtomicU32, Ordering};
use smithay::{
delegate_compositor,
reexports::wayland_server::protocol::wl_surface::WlSurface,
wayland::compositor::{self, CompositorHandler, CompositorState},
reexports::wayland_server::{protocol::wl_surface::WlSurface, Client},
wayland::compositor::{self, CompositorClientState, CompositorHandler, CompositorState},
};
use std::sync::Arc;
use tracing::debug;
@@ -36,6 +36,10 @@ impl CompositorHandler for WaylandState {
core_surface.commit(count);
}
}
fn client_compositor_state<'a>(&self, client: &'a Client) -> &'a CompositorClientState {
&client.get_data::<ClientState>().unwrap().compositor_state
}
}
delegate_compositor!(WaylandState);

View File

@@ -129,7 +129,7 @@ impl Wayland {
}
acc = listen_async.accept() => { // New client connected
let (stream, _) = acc?;
let client = dh2.insert_client(stream.into_std()?, Arc::new(ClientState))?;
let client = dh2.insert_client(stream.into_std()?, Arc::new(ClientState::default()))?;
state.lock().new_client(client.id(), &dh2);
}

View File

@@ -23,7 +23,7 @@ use smithay::{
utils::{Size, Transform},
wayland::{
buffer::BufferHandler,
compositor::CompositorState,
compositor::{CompositorClientState, CompositorState},
dmabuf::{self, DmabufGlobal, DmabufHandler, DmabufState},
shell::kde::decoration::KdeDecorationState,
shm::{ShmHandler, ShmState},
@@ -32,7 +32,10 @@ use smithay::{
use std::sync::{Arc, Weak};
use tracing::info;
pub struct ClientState;
#[derive(Default)]
pub struct ClientState {
pub compositor_state: CompositorClientState,
}
impl ClientData for ClientState {
fn initialized(&self, client_id: ClientId) {
info!("Wayland client {:?} connected", client_id);

View File

@@ -103,7 +103,7 @@ impl CoreSurface {
});
// Let smithay handle buffer management (has to be done here as RendererSurfaceStates is not thread safe)
on_commit_buffer_handler(&wl_surface);
on_commit_buffer_handler::<()>(&wl_surface);
// Import all surface buffers into textures
if import_surface_tree(renderer, &wl_surface).is_err() {
return;