cosmic-comp/src/wayland/handlers/layer_shell.rs

44 lines
1.2 KiB
Rust
Raw Normal View History

// SPDX-License-Identifier: GPL-3.0-only
2022-07-04 16:00:29 +02:00
use crate::utils::prelude::*;
use smithay::{
2022-07-04 16:00:29 +02:00
delegate_layer_shell,
desktop::LayerSurface,
2022-07-04 16:00:29 +02:00
reexports::wayland_server::{protocol::wl_output::WlOutput, DisplayHandle},
wayland::{
output::Output,
shell::wlr_layer::{
2022-07-04 16:00:29 +02:00
Layer, LayerSurface as WlrLayerSurface, WlrLayerShellHandler, WlrLayerShellState,
},
},
};
impl WlrLayerShellHandler for State {
fn shell_state(&mut self) -> &mut WlrLayerShellState {
&mut self.common.shell.layer_shell_state
}
fn new_layer_surface(
2022-07-04 16:00:29 +02:00
&mut self,
_dh: &DisplayHandle,
surface: WlrLayerSurface,
wl_output: Option<WlOutput>,
_layer: Layer,
namespace: String,
) {
super::mark_dirty_on_drop(&self.common, surface.wl_surface());
let seat = self.common.last_active_seat.clone();
let output = wl_output
.as_ref()
.and_then(Output::from_resource)
.unwrap_or_else(|| active_output(&seat, &self.common));
self.common.shell.pending_layers.push((
LayerSurface::new(surface, namespace),
output,
seat,
));
}
}
delegate_layer_shell!(State);