From 5c91a432f542ad9e80ddf1e9ee35a89a17c450f2 Mon Sep 17 00:00:00 2001 From: Nova Date: Fri, 2 Sep 2022 10:09:36 -0400 Subject: [PATCH] feat(wayland): update smithay --- src/wayland/compositor.rs | 13 ++++++++----- src/wayland/xdg_decoration.rs | 14 ++------------ src/wayland/xdg_shell.rs | 28 +++++++--------------------- 3 files changed, 17 insertions(+), 38 deletions(-) diff --git a/src/wayland/compositor.rs b/src/wayland/compositor.rs index 4b85cea..24ab1d0 100644 --- a/src/wayland/compositor.rs +++ b/src/wayland/compositor.rs @@ -9,8 +9,11 @@ use smithay::{ import_surface_tree, on_commit_buffer_handler, RendererSurfaceStateUserData, }, delegate_compositor, - reexports::wayland_server::{protocol::wl_surface::WlSurface, DisplayHandle}, - wayland::compositor::{self, CompositorHandler, CompositorState}, + reexports::wayland_server::protocol::wl_surface::WlSurface, + wayland::{ + compositor::{self, CompositorHandler, CompositorState}, + shell::xdg::XdgToplevelSurfaceData, + }, }; impl CompositorHandler for WaylandState { @@ -18,7 +21,7 @@ impl CompositorHandler for WaylandState { &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 on_commit_buffer_handler(surface); @@ -32,13 +35,13 @@ impl CompositorHandler for WaylandState { .map(|surface_states| surface_states.borrow().wl_buffer().is_some()) .unwrap_or(false); - if !mapped { + if !mapped || data.data_map.get::().is_none() { return; } data.data_map.insert_if_missing_threadsafe(CoreSurface::new); 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::().unwrap(); diff --git a/src/wayland/xdg_decoration.rs b/src/wayland/xdg_decoration.rs index 32fb7ce..cfe594c 100644 --- a/src/wayland/xdg_decoration.rs +++ b/src/wayland/xdg_decoration.rs @@ -7,11 +7,7 @@ use smithay::{ use super::WaylandState; impl XdgDecorationHandler for WaylandState { - fn new_decoration( - &mut self, - _dh: &smithay::reexports::wayland_server::DisplayHandle, - toplevel: smithay::wayland::shell::xdg::ToplevelSurface, - ) { + fn new_decoration(&mut self, toplevel: smithay::wayland::shell::xdg::ToplevelSurface) { toplevel.with_pending_state(|state| { state.decoration_mode = Some(Mode::ServerSide); }); @@ -20,17 +16,11 @@ impl XdgDecorationHandler for WaylandState { fn request_mode( &mut self, - _dh: &smithay::reexports::wayland_server::DisplayHandle, _toplevel: smithay::wayland::shell::xdg::ToplevelSurface, _mode: smithay::reexports::wayland_protocols::xdg::decoration::zv1::server::zxdg_toplevel_decoration_v1::Mode, ) { } - fn unset_mode( - &mut self, - _dh: &smithay::reexports::wayland_server::DisplayHandle, - _toplevel: smithay::wayland::shell::xdg::ToplevelSurface, - ) { - } + fn unset_mode(&mut self, _toplevel: smithay::wayland::shell::xdg::ToplevelSurface) {} } delegate_xdg_decoration!(WaylandState); diff --git a/src/wayland/xdg_shell.rs b/src/wayland/xdg_shell.rs index 881f946..5b96ba3 100644 --- a/src/wayland/xdg_shell.rs +++ b/src/wayland/xdg_shell.rs @@ -6,13 +6,11 @@ use smithay::{ decoration::zv1::server::zxdg_toplevel_decoration_v1::Mode, shell::server::xdg_toplevel::State, }, - wayland_server::{protocol::wl_seat::WlSeat, DisplayHandle}, + wayland_server::protocol::wl_seat::WlSeat, }, - wayland::{ - shell::xdg::{ - PopupSurface, PositionerState, ToplevelSurface, XdgShellHandler, XdgShellState, - }, - Serial, + utils::Serial, + wayland::shell::xdg::{ + PopupSurface, PositionerState, ToplevelSurface, XdgShellHandler, XdgShellState, }, }; @@ -21,7 +19,7 @@ impl XdgShellHandler for WaylandState { &mut self.xdg_shell_state } - fn new_toplevel(&mut self, _dh: &DisplayHandle, surface: ToplevelSurface) { + fn new_toplevel(&mut self, surface: ToplevelSurface) { self.output .enter(&self.display_handle, surface.wl_surface()); surface.with_pending_state(|state| { @@ -31,21 +29,9 @@ impl XdgShellHandler for WaylandState { surface.send_configure(); } - fn new_popup( - &mut self, - _dh: &DisplayHandle, - _surface: PopupSurface, - _positioner: PositionerState, - ) { - } + fn new_popup(&mut self, _surface: PopupSurface, _positioner: PositionerState) {} - fn grab( - &mut self, - _dh: &DisplayHandle, - _surface: PopupSurface, - _seat: WlSeat, - _serial: Serial, - ) { + fn grab(&mut self, _surface: PopupSurface, _seat: WlSeat, _serial: Serial) { todo!() } }