From d595298d808105137eba3334773434576e3554ba Mon Sep 17 00:00:00 2001 From: tosti007 Date: Tue, 9 Jan 2024 10:22:25 +0100 Subject: [PATCH] Replace clipboard with clipboard_get and clipboard_set --- crates/egui-winit/src/lib.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/egui-winit/src/lib.rs b/crates/egui-winit/src/lib.rs index 65fc03127f97..ab6557141421 100644 --- a/crates/egui-winit/src/lib.rs +++ b/crates/egui-winit/src/lib.rs @@ -172,9 +172,14 @@ impl State { self.egui_input.max_texture_side = Some(max_texture_side); } - /// Returns the used clipboard. - pub fn clipboard(&mut self) -> &mut clipboard::Clipboard { - &mut self.clipboard + /// Fetches text from the clipboard and returns it. + pub fn clipboard(&mut self) -> Option { + self.clipboard.get() + } + + /// Places the text onto the clipboard. + pub fn set_clipboard(&mut self, text: String) { + self.clipboard.set(text) } /// Returns [`false`] or the last value that [`Window::set_ime_allowed()`] was called with, used for debouncing.