layer_shell: Fix popup positioning

This commit is contained in:
Victoria Brekenfeld 2022-07-07 19:45:55 +02:00
parent 1fb49824f9
commit 1a3e779eb9
3 changed files with 88 additions and 24 deletions

View file

@ -3,12 +3,15 @@
use crate::utils::prelude::*;
use smithay::{
delegate_layer_shell,
desktop::LayerSurface,
desktop::{LayerSurface, PopupKind},
reexports::wayland_server::{protocol::wl_output::WlOutput, DisplayHandle},
wayland::{
output::Output,
shell::wlr_layer::{
Layer, LayerSurface as WlrLayerSurface, WlrLayerShellHandler, WlrLayerShellState,
shell::{
wlr_layer::{
Layer, LayerSurface as WlrLayerSurface, WlrLayerShellHandler, WlrLayerShellState,
},
xdg::PopupSurface,
},
},
};
@ -38,6 +41,19 @@ impl WlrLayerShellHandler for State {
seat,
));
}
fn new_popup(&mut self, _dh: &DisplayHandle, _parent: WlrLayerSurface, popup: PopupSurface) {
let positioner = popup.with_pending_state(|state| state.positioner);
self.common.shell.unconstrain_popup(&popup, &positioner);
if popup.send_configure().is_ok() {
self.common
.shell
.popups
.track_popup(PopupKind::from(popup))
.unwrap();
}
}
}
delegate_layer_shell!(State);