Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eframe/egui-winit: Fix copy-paste on Windows #2120

Merged
merged 1 commit into from
Oct 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions crates/egui-winit/src/clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ use std::os::raw::c_void;
/// If the "clipboard" feature is off, or we cannot connect to the OS clipboard,
/// then a fallback clipboard that just works works within the same app is used instead.
pub struct Clipboard {
#[cfg(all(feature = "arboard", not(target_os = "android")))]
arboard: Option<arboard::Clipboard>,

#[cfg(all(
any(
target_os = "linux",
Expand All @@ -28,8 +25,6 @@ impl Clipboard {
#[allow(unused_variables)]
pub fn new(#[allow(unused_variables)] wayland_display: Option<*mut c_void>) -> Self {
Self {
#[cfg(all(feature = "arboard", not(target_os = "android")))]
arboard: init_arboard(),
#[cfg(all(
any(
target_os = "linux",
Expand Down Expand Up @@ -67,7 +62,7 @@ impl Clipboard {
}

#[cfg(all(feature = "arboard", not(target_os = "android")))]
if let Some(clipboard) = &mut self.arboard {
if let Some(mut clipboard) = init_arboard() {
return match clipboard.get_text() {
Ok(text) => Some(text),
Err(err) => {
Expand Down Expand Up @@ -97,7 +92,7 @@ impl Clipboard {
}

#[cfg(all(feature = "arboard", not(target_os = "android")))]
if let Some(clipboard) = &mut self.arboard {
if let Some(mut clipboard) = init_arboard() {
if let Err(err) = clipboard.set_text(text) {
tracing::error!("Copy/Cut error: {}", err);
}
Expand Down