Files
server/src/wayland/xdg_shell.rs
2022-09-18 19:26:59 -04:00

38 lines
1.0 KiB
Rust

use super::state::WaylandState;
use smithay::{
delegate_xdg_shell,
reexports::{
wayland_protocols::xdg::{
decoration::zv1::server::zxdg_toplevel_decoration_v1::Mode,
shell::server::xdg_toplevel::State,
},
wayland_server::protocol::wl_seat::WlSeat,
},
utils::Serial,
wayland::shell::xdg::{
PopupSurface, PositionerState, ToplevelSurface, XdgShellHandler, XdgShellState,
},
};
impl XdgShellHandler for WaylandState {
fn xdg_shell_state(&mut self) -> &mut XdgShellState {
&mut self.xdg_shell_state
}
fn new_toplevel(&mut self, surface: ToplevelSurface) {
self.output
.enter(&self.display_handle, surface.wl_surface());
surface.with_pending_state(|state| {
state.states.set(State::Fullscreen);
state.states.set(State::Activated);
state.decoration_mode = Some(Mode::ServerSide);
});
surface.send_configure();
}
fn new_popup(&mut self, _surface: PopupSurface, _positioner: PositionerState) {}
fn grab(&mut self, _surface: PopupSurface, _seat: WlSeat, _serial: Serial) {}
}
delegate_xdg_shell!(WaylandState);