From 7cf04d290a30fa46de5eb98fa870684cb27b4d87 Mon Sep 17 00:00:00 2001 From: Sophie Herold Date: Tue, 24 Jan 2023 01:51:59 +0100 Subject: [PATCH] clipboard: Use same ContentProvider as for D+D FileList is working in more cases than PNGs and has fewer drawbacks. Also, it's the same that has been used elsewhere for a long time. Closes #50 --- src/widgets/image_view.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/widgets/image_view.rs b/src/widgets/image_view.rs index 44327ec..cb2bafe 100644 --- a/src/widgets/image_view.rs +++ b/src/widgets/image_view.rs @@ -582,11 +582,11 @@ impl LpImageView { pub fn copy(&self) -> anyhow::Result<()> { let clipboard = self.clipboard(); - if let Some(texture) = self.current_page().context("No current page")?.texture() { - clipboard.set_texture(&texture); - } else { - anyhow::bail!("No Image displayed."); - } + let content_provider = self + .current_page() + .context("No current page")? + .content_provider(); + clipboard.set_content(content_provider.as_ref())?; Ok(()) }