Skip to content

Commit

Permalink
Update windows_win lib
Browse files Browse the repository at this point in the history
  • Loading branch information
DoumanAsh committed Jan 13, 2024
1 parent f4400b1 commit cb147f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
9 changes: 1 addition & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,7 @@ readme = "README.md"
edition = "2018"

[target.'cfg(windows)'.dependencies]
windows-win = "2"

[target.'cfg(windows)'.dependencies.winapi]
version = "0.3"
default-features = false
features = [
"winuser"
]
windows-win = "3"

[target.'cfg(all(unix, not(any(target_os="macos", target_os="ios", target_os="android", target_os="emscripten"))))'.dependencies]
x11-clipboard = "0.8"
Expand Down
12 changes: 7 additions & 5 deletions src/master/win32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ use windows_win::{
Messages
};

use winapi::shared::windef::HWND;

use winapi::um::winuser::{
use windows_win::sys::{
HWND,
AddClipboardFormatListener,
RemoveClipboardFormatListener,
PostMessageW,
Expand Down Expand Up @@ -81,7 +80,10 @@ impl<H: ClipboardHandler> Master<H> {
#[inline(always)]
///Creates new instance.
pub fn new(handler: H) -> io::Result<Self> {
let window = Window::from_builder(raw::window::Builder::new().class_name("STATIC").parent_message())?;
let window = match Window::from_builder(raw::window::Builder::new().class_name("STATIC").parent_message()) {
Ok(window) => window,
Err(error) => return Err(io::Error::from_raw_os_error(error.raw_code())),
};

Ok(Self {
handler,
Expand Down Expand Up @@ -126,7 +128,7 @@ impl<H: ClipboardHandler> Master<H> {
_ => panic!("Unexpected message"),
},
Err(error) => {
match self.handler.on_clipboard_error(error) {
match self.handler.on_clipboard_error(io::Error::from_raw_os_error(error.raw_code())) {
CallbackResult::Next => (),
CallbackResult::Stop => break,
CallbackResult::StopWithError(error) => {
Expand Down

0 comments on commit cb147f7

Please sign in to comment.