Skip to content

Commit

Permalink
build(deps): Decrease windows-sys to version 0.52
Browse files Browse the repository at this point in the history
`winit` depends on `windows-sys 0.52`. We should follow that to prevent a duplicate dependency.
  • Loading branch information
caspermeijn committed Aug 30, 2024
1 parent db92440 commit 13986b4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
11 changes: 1 addition & 10 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,7 @@ dependencies = [
"web-sys",
"web-time",
"wgpu",
"windows-sys 0.59.0",
"windows-sys 0.52.0",
"winit",
]

Expand Down Expand Up @@ -4678,15 +4678,6 @@ dependencies = [
"windows-targets 0.52.6",
]

[[package]]
name = "windows-sys"
version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
dependencies = [
"windows-targets 0.52.6",
]

[[package]]
name = "windows-targets"
version = "0.42.2"
Expand Down
2 changes: 1 addition & 1 deletion crates/eframe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ objc2-app-kit = { version = "0.2.0", features = [

# windows:
[target.'cfg(any(target_os = "windows"))'.dependencies]
windows-sys = { version = "0.59", features = [
windows-sys = { version = "0.52", features = [
"Win32_UI_WindowsAndMessaging",
"Win32_UI_Input_KeyboardAndMouse",
] }
Expand Down
12 changes: 6 additions & 6 deletions crates/eframe/src/native/app_icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fn set_app_icon_windows(icon_data: &IconData) -> AppIconStatus {

// SAFETY: Windows API function without side-effects.
let window_handle = unsafe { KeyboardAndMouse::GetActiveWindow() };
if window_handle.is_null() {
if window_handle == 0 {
// The Window isn't available yet. Try again later!
return AppIconStatus::NotSetTryAgain;
}
Expand Down Expand Up @@ -123,7 +123,7 @@ fn set_app_icon_windows(icon_data: &IconData) -> AppIconStatus {
)
.is_err()
{
return std::ptr::null_mut();
return 0;
}

// SAFETY: Creating an HICON which should be readonly on our data.
Expand Down Expand Up @@ -159,7 +159,7 @@ fn set_app_icon_windows(icon_data: &IconData) -> AppIconStatus {
let icon_size_big =
unsafe { WindowsAndMessaging::GetSystemMetrics(WindowsAndMessaging::SM_CXICON) };
let icon_big = create_hicon_with_scale(&unscaled_image, icon_size_big);
if icon_big.is_null() {
if icon_big == 0 {
log::warn!("Failed to create HICON (for big icon) from embedded png data.");
return AppIconStatus::NotSetIgnored; // We could try independently with the small icon but what's the point, it would look bad!
} else {
Expand All @@ -169,7 +169,7 @@ fn set_app_icon_windows(icon_data: &IconData) -> AppIconStatus {
window_handle,
WindowsAndMessaging::WM_SETICON,
WindowsAndMessaging::ICON_BIG as usize,
icon_big as isize,
icon_big,
);
}
}
Expand All @@ -179,7 +179,7 @@ fn set_app_icon_windows(icon_data: &IconData) -> AppIconStatus {
let icon_size_small =
unsafe { WindowsAndMessaging::GetSystemMetrics(WindowsAndMessaging::SM_CXSMICON) };
let icon_small = create_hicon_with_scale(&unscaled_image, icon_size_small);
if icon_small.is_null() {
if icon_small == 0 {
log::warn!("Failed to create HICON (for small icon) from embedded png data.");
return AppIconStatus::NotSetIgnored;
} else {
Expand All @@ -189,7 +189,7 @@ fn set_app_icon_windows(icon_data: &IconData) -> AppIconStatus {
window_handle,
WindowsAndMessaging::WM_SETICON,
WindowsAndMessaging::ICON_SMALL as usize,
icon_small as isize,
icon_small,
);
}
}
Expand Down

0 comments on commit 13986b4

Please sign in to comment.