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,
},
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::<XdgToplevelSurfaceData>().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::<RendererSurfaceStateUserData>().unwrap();

View File

@@ -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);

View File

@@ -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!()
}
}