Skip to content

Commit

Permalink
Make winapi crate optional
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd authored and complexspaces committed Nov 22, 2023
1 parent 11e395c commit 8c475cf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ thiserror = "1.0"
env_logger = "0.9.0"

[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.9", features = [
winapi = { version = "0.3.9", optional = true, features = [
"basetsd",
"winuser",
"winbase",
Expand Down
5 changes: 2 additions & 3 deletions src/platform/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ the Apache 2.0 or the MIT license at the licensee's choice. The terms
and conditions of the chosen license apply to this file.
*/

use std::{borrow::Cow, marker::PhantomData};
use std::{borrow::Cow, marker::PhantomData, thread, time::Duration};
#[cfg(feature = "image-data")]
use std::{convert::TryInto, mem::size_of};

Expand Down Expand Up @@ -400,8 +400,7 @@ impl Clipboard {
}

// The default value matches Chromium's implementation, but could be tweaked later.
// Safety: This is safe to call with any integer.
unsafe { winapi::um::synchapi::Sleep(5) };
thread::sleep(Duration::from_millis(5));
}
.map_err(|_| Error::ClipboardOccupied)?;

Expand Down

0 comments on commit 8c475cf

Please sign in to comment.