From 33a9e242edaf5160f8e9ef1bb8d58d7ccfff44de Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sat, 8 Feb 2020 08:38:52 +0300 Subject: [PATCH] wayland.shell: implement Clone for toplevels --- src/wayland/shell/legacy/mod.rs | 11 +++++++++++ src/wayland/shell/xdg/mod.rs | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/wayland/shell/legacy/mod.rs b/src/wayland/shell/legacy/mod.rs index 4814738..575fd10 100644 --- a/src/wayland/shell/legacy/mod.rs +++ b/src/wayland/shell/legacy/mod.rs @@ -92,6 +92,17 @@ pub struct ShellSurface { token: CompositorToken, } +// We implement Clone manually because #[derive(..)] would require R: Clone. +impl Clone for ShellSurface { + fn clone(&self) -> Self { + Self { + wl_surface: self.wl_surface.clone(), + shell_surface: self.shell_surface.clone(), + token: self.token.clone(), + } + } +} + impl ShellSurface where R: Role + 'static, diff --git a/src/wayland/shell/xdg/mod.rs b/src/wayland/shell/xdg/mod.rs index cd20236..a3a20da 100644 --- a/src/wayland/shell/xdg/mod.rs +++ b/src/wayland/shell/xdg/mod.rs @@ -472,6 +472,7 @@ where } } +#[derive(Clone)] pub(crate) enum ToplevelKind { Xdg(xdg_toplevel::XdgToplevel), ZxdgV6(zxdg_toplevel_v6::ZxdgToplevelV6), @@ -484,6 +485,17 @@ pub struct ToplevelSurface { token: CompositorToken, } +// We implement Clone manually because #[derive(..)] would require R: Clone. +impl Clone for ToplevelSurface { + fn clone(&self) -> Self { + Self { + wl_surface: self.wl_surface.clone(), + shell_surface: self.shell_surface.clone(), + token: self.token.clone(), + } + } +} + impl ToplevelSurface where R: Role + 'static,