1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 13:52:55 +03:00

window: fix build and clipboard on Windows

This commit is contained in:
Wez Furlong 2019-11-29 12:32:30 -08:00
parent 478d1f53bc
commit 2b795aa08d
4 changed files with 17 additions and 0 deletions

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"

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")]

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:

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};