feat(wayland): update smithay

This commit is contained in:
Nova
2022-09-02 10:09:36 -04:00
parent 28338cd2e5
commit 5c91a432f5
3 changed files with 17 additions and 38 deletions

View File

@@ -9,8 +9,11 @@ use smithay::{
import_surface_tree, on_commit_buffer_handler, RendererSurfaceStateUserData, import_surface_tree, on_commit_buffer_handler, RendererSurfaceStateUserData,
}, },
delegate_compositor, delegate_compositor,
reexports::wayland_server::{protocol::wl_surface::WlSurface, DisplayHandle}, reexports::wayland_server::protocol::wl_surface::WlSurface,
wayland::compositor::{self, CompositorHandler, CompositorState}, wayland::{
compositor::{self, CompositorHandler, CompositorState},
shell::xdg::XdgToplevelSurfaceData,
},
}; };
impl CompositorHandler for WaylandState { impl CompositorHandler for WaylandState {
@@ -18,7 +21,7 @@ impl CompositorHandler for WaylandState {
&mut self.compositor_state &mut self.compositor_state
} }
fn commit(&mut self, dh: &DisplayHandle, surface: &WlSurface) { fn commit(&mut self, surface: &WlSurface) {
// Let Smithay handle all the buffer maintenance // Let Smithay handle all the buffer maintenance
on_commit_buffer_handler(surface); on_commit_buffer_handler(surface);
@@ -32,13 +35,13 @@ impl CompositorHandler for WaylandState {
.map(|surface_states| surface_states.borrow().wl_buffer().is_some()) .map(|surface_states| surface_states.borrow().wl_buffer().is_some())
.unwrap_or(false); .unwrap_or(false);
if !mapped { if !mapped || data.data_map.get::<XdgToplevelSurfaceData>().is_none() {
return; return;
} }
data.data_map.insert_if_missing_threadsafe(CoreSurface::new); data.data_map.insert_if_missing_threadsafe(CoreSurface::new);
data.data_map.insert_if_missing_threadsafe(|| { data.data_map.insert_if_missing_threadsafe(|| {
PanelItem::create(dh, &data.data_map, surface.clone()) PanelItem::create(&self.display_handle, &data.data_map, surface.clone())
}); });
let surface_states = data.data_map.get::<RendererSurfaceStateUserData>().unwrap(); let surface_states = data.data_map.get::<RendererSurfaceStateUserData>().unwrap();

View File

@@ -7,11 +7,7 @@ use smithay::{
use super::WaylandState; use super::WaylandState;
impl XdgDecorationHandler for WaylandState { impl XdgDecorationHandler for WaylandState {
fn new_decoration( fn new_decoration(&mut self, toplevel: smithay::wayland::shell::xdg::ToplevelSurface) {
&mut self,
_dh: &smithay::reexports::wayland_server::DisplayHandle,
toplevel: smithay::wayland::shell::xdg::ToplevelSurface,
) {
toplevel.with_pending_state(|state| { toplevel.with_pending_state(|state| {
state.decoration_mode = Some(Mode::ServerSide); state.decoration_mode = Some(Mode::ServerSide);
}); });
@@ -20,17 +16,11 @@ impl XdgDecorationHandler for WaylandState {
fn request_mode( fn request_mode(
&mut self, &mut self,
_dh: &smithay::reexports::wayland_server::DisplayHandle,
_toplevel: smithay::wayland::shell::xdg::ToplevelSurface, _toplevel: smithay::wayland::shell::xdg::ToplevelSurface,
_mode: smithay::reexports::wayland_protocols::xdg::decoration::zv1::server::zxdg_toplevel_decoration_v1::Mode, _mode: smithay::reexports::wayland_protocols::xdg::decoration::zv1::server::zxdg_toplevel_decoration_v1::Mode,
) { ) {
} }
fn unset_mode( fn unset_mode(&mut self, _toplevel: smithay::wayland::shell::xdg::ToplevelSurface) {}
&mut self,
_dh: &smithay::reexports::wayland_server::DisplayHandle,
_toplevel: smithay::wayland::shell::xdg::ToplevelSurface,
) {
}
} }
delegate_xdg_decoration!(WaylandState); delegate_xdg_decoration!(WaylandState);

View File

@@ -6,13 +6,11 @@ use smithay::{
decoration::zv1::server::zxdg_toplevel_decoration_v1::Mode, decoration::zv1::server::zxdg_toplevel_decoration_v1::Mode,
shell::server::xdg_toplevel::State, shell::server::xdg_toplevel::State,
}, },
wayland_server::{protocol::wl_seat::WlSeat, DisplayHandle}, wayland_server::protocol::wl_seat::WlSeat,
}, },
wayland::{ utils::Serial,
shell::xdg::{ wayland::shell::xdg::{
PopupSurface, PositionerState, ToplevelSurface, XdgShellHandler, XdgShellState, PopupSurface, PositionerState, ToplevelSurface, XdgShellHandler, XdgShellState,
},
Serial,
}, },
}; };
@@ -21,7 +19,7 @@ impl XdgShellHandler for WaylandState {
&mut self.xdg_shell_state &mut self.xdg_shell_state
} }
fn new_toplevel(&mut self, _dh: &DisplayHandle, surface: ToplevelSurface) { fn new_toplevel(&mut self, surface: ToplevelSurface) {
self.output self.output
.enter(&self.display_handle, surface.wl_surface()); .enter(&self.display_handle, surface.wl_surface());
surface.with_pending_state(|state| { surface.with_pending_state(|state| {
@@ -31,21 +29,9 @@ impl XdgShellHandler for WaylandState {
surface.send_configure(); surface.send_configure();
} }
fn new_popup( fn new_popup(&mut self, _surface: PopupSurface, _positioner: PositionerState) {}
&mut self,
_dh: &DisplayHandle,
_surface: PopupSurface,
_positioner: PositionerState,
) {
}
fn grab( fn grab(&mut self, _surface: PopupSurface, _seat: WlSeat, _serial: Serial) {
&mut self,
_dh: &DisplayHandle,
_surface: PopupSurface,
_seat: WlSeat,
_serial: Serial,
) {
todo!() todo!()
} }
} }