window: fix build and clipboard on Windows

This commit is contained in:
Wez Furlong committed 2019-11-29 12:32:30 -08:00
1 parent 478d1f53bc
commit 2b795aa08d
4 files changed
+17

No files matched your search

+1
View File
@@ -40,6 +40,7 @@ winapi = { version = "0.3", features = [
"winerror",
"winuser",
]}
clipboard-win = "2.2"
[target.'cfg(all(unix, not(target_os = "macos")))'.dependencies]
filedescriptor = "0.5"
+1
View File
@@ -8,6 +8,7 @@ pub mod x11;
pub mod x_and_wayland;
pub mod xkeysyms;
#[cfg(all(unix, not(target_os = "macos")))]
pub use x_and_wayland::*;
#[cfg(target_os = "macos")]
+14
View File
@@ -422,6 +422,20 @@ impl WindowOps for Window {
func(inner.callbacks.borrow_mut().as_any(), &window, gl_state)
})
}
fn get_clipboard(&self) -> Future<String> {
Future::result(
clipboard_win::get_clipboard_string()
.map_err(|e| failure::format_err!("Error getting clipboard: {}", e)),
)
}
fn set_clipboard(&self, text: String) -> Future<()> {
Future::result(
clipboard_win::set_clipboard_string(&text)
.map_err(|e| failure::format_err!("Error setting clipboard: {}", e)),
)
}
}
/// Set up bidirectional pointers:
+1
View File
@@ -1,3 +1,4 @@
#![cfg(all(unix, not(target_os = "macos")))]
use std::cmp::Ordering;
use std::collections::VecDeque;
use std::time::{Duration, Instant};