From 75162e93c71cf897a0457bec6e1a987782087441 Mon Sep 17 00:00:00 2001 From: Christian Meissl Date: Sat, 15 Jan 2022 20:23:08 +0100 Subject: [PATCH] fix setting the parent of a ToplevelSurface --- src/wayland/shell/xdg/mod.rs | 7 +++---- src/wayland/xdg_foreign/mod.rs | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/wayland/shell/xdg/mod.rs b/src/wayland/shell/xdg/mod.rs index cc6f4a3..ed7029c 100644 --- a/src/wayland/shell/xdg/mod.rs +++ b/src/wayland/shell/xdg/mod.rs @@ -1169,15 +1169,14 @@ impl ToplevelSurface { /// The parent must be another toplevel equivalent surface. /// /// If the parent is `None`, the parent-child relationship is removed. - pub fn set_parent(&self, parent: Option) -> bool { + pub fn set_parent(&self, parent: Option<&wl_surface::WlSurface>) -> bool { if let Some(parent) = parent { - if !is_toplevel_equivalent(&parent) { + if !is_toplevel_equivalent(parent) { return false; } } - // Unset the parent - xdg_handlers::set_parent(&self.shell_surface, None); + xdg_handlers::set_parent(&self.shell_surface, parent.cloned()); true } diff --git a/src/wayland/xdg_foreign/mod.rs b/src/wayland/xdg_foreign/mod.rs index 0e18289..9a83f6d 100644 --- a/src/wayland/xdg_foreign/mod.rs +++ b/src/wayland/xdg_foreign/mod.rs @@ -447,7 +447,7 @@ fn imported_implementation( .map(|export| export.surface.clone()) .unwrap(); - toplevel_surface.set_parent(Some(imported_parent)); + toplevel_surface.set_parent(Some(&imported_parent)); } _ => unreachable!(),