2022-07-04 15:26:26 +02:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
|
|
2022-07-04 16:00:29 +02:00
|
|
|
use crate::utils::prelude::*;
|
2022-07-04 15:26:26 +02:00
|
|
|
use smithay::{
|
2022-07-04 16:00:29 +02:00
|
|
|
delegate_layer_shell,
|
2022-07-04 15:26:26 +02:00
|
|
|
desktop::LayerSurface,
|
2022-07-04 16:00:29 +02:00
|
|
|
reexports::wayland_server::{protocol::wl_output::WlOutput, DisplayHandle},
|
2022-07-04 15:26:26 +02:00
|
|
|
wayland::{
|
|
|
|
|
output::Output,
|
|
|
|
|
shell::wlr_layer::{
|
2022-07-04 16:00:29 +02:00
|
|
|
Layer, LayerSurface as WlrLayerSurface, WlrLayerShellHandler, WlrLayerShellState,
|
2022-07-04 15:26:26 +02:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
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,
|
2022-07-04 15:26:26 +02:00
|
|
|
) {
|
|
|
|
|
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);
|