wayland.shell: implement Clone for toplevels

This commit is contained in:
Ivan Molodetskikh 2020-02-08 08:38:52 +03:00
parent ca7e91a98c
commit 33a9e242ed
No known key found for this signature in database
GPG Key ID: 02CE38DA47E9D691
2 changed files with 23 additions and 0 deletions

View File

@ -92,6 +92,17 @@ pub struct ShellSurface<R> {
token: CompositorToken<R>, token: CompositorToken<R>,
} }
// We implement Clone manually because #[derive(..)] would require R: Clone.
impl<R> Clone for ShellSurface<R> {
fn clone(&self) -> Self {
Self {
wl_surface: self.wl_surface.clone(),
shell_surface: self.shell_surface.clone(),
token: self.token.clone(),
}
}
}
impl<R> ShellSurface<R> impl<R> ShellSurface<R>
where where
R: Role<ShellSurfaceRole> + 'static, R: Role<ShellSurfaceRole> + 'static,

View File

@ -472,6 +472,7 @@ where
} }
} }
#[derive(Clone)]
pub(crate) enum ToplevelKind { pub(crate) enum ToplevelKind {
Xdg(xdg_toplevel::XdgToplevel), Xdg(xdg_toplevel::XdgToplevel),
ZxdgV6(zxdg_toplevel_v6::ZxdgToplevelV6), ZxdgV6(zxdg_toplevel_v6::ZxdgToplevelV6),
@ -484,6 +485,17 @@ pub struct ToplevelSurface<R> {
token: CompositorToken<R>, token: CompositorToken<R>,
} }
// We implement Clone manually because #[derive(..)] would require R: Clone.
impl<R> Clone for ToplevelSurface<R> {
fn clone(&self) -> Self {
Self {
wl_surface: self.wl_surface.clone(),
shell_surface: self.shell_surface.clone(),
token: self.token.clone(),
}
}
}
impl<R> ToplevelSurface<R> impl<R> ToplevelSurface<R>
where where
R: Role<XdgSurfaceRole> + 'static, R: Role<XdgSurfaceRole> + 'static,