Jack Mac 3eaee3359d imstr and imstring have been removed.
fixed some instability and added a hacky shim to input_text functions.
We're looking okay so far, but more testing will be needed
2021-09-13 17:12:00 -04:00

19 lines
490 B
Rust

use clipboard::{ClipboardContext, ClipboardProvider};
use imgui::ClipboardBackend;
pub struct ClipboardSupport(pub ClipboardContext);
pub fn init() -> Option<ClipboardSupport> {
ClipboardContext::new().ok().map(ClipboardSupport)
}
impl ClipboardBackend for ClipboardSupport {
fn get(&mut self) -> Option<String> {
self.0.get_contents().ok()
}
fn set(&mut self, text: &str) {
// ignore errors?
let _ = self.0.set_contents(text.to_owned());
}
}