diff --git a/Cargo.toml b/Cargo.toml index 549fa55623..b52a436dce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -179,7 +179,7 @@ features = [ unicode-segmentation = "1.7.1" [target.'cfg(target_os = "windows")'.dependencies.windows-sys] -version = "0.48" +version = "0.52.0" features = [ "Win32_Devices_HumanInterfaceDevice", "Win32_Foundation", diff --git a/src/platform_impl/windows/dpi.rs b/src/platform_impl/windows/dpi.rs index c4ed08a6db..5db2e8ee87 100644 --- a/src/platform_impl/windows/dpi.rs +++ b/src/platform_impl/windows/dpi.rs @@ -105,7 +105,7 @@ pub unsafe fn hwnd_dpi(hwnd: HWND) -> u32 { if unsafe { IsProcessDPIAware() } != false.into() { // If the process is DPI aware, then scaling must be handled by the application using // this DPI value. - unsafe { GetDeviceCaps(hdc, LOGPIXELSX) as u32 } + unsafe { GetDeviceCaps(hdc, LOGPIXELSX as i32) as u32 } } else { // If the process is DPI unaware, then scaling is performed by the OS; we thus return // 96 (scale factor 1.0) to prevent the window from being re-scaled by both the diff --git a/src/platform_impl/windows/drop_handler.rs b/src/platform_impl/windows/drop_handler.rs index 6911c5b82c..ff56b98e36 100644 --- a/src/platform_impl/windows/drop_handler.rs +++ b/src/platform_impl/windows/drop_handler.rs @@ -187,7 +187,7 @@ impl FileDropHandler { let get_data_fn = unsafe { (*(*data_obj).cast::()).GetData }; let get_data_result = unsafe { get_data_fn(data_obj as *mut _, &drop_format, &mut medium) }; if get_data_result >= 0 { - let hdrop = unsafe { medium.Anonymous.hGlobal }; + let hdrop = unsafe { medium.u.hGlobal as HDROP }; // The second parameter (0xFFFFFFFF) instructs the function to return the item count let item_count = unsafe { DragQueryFileW(hdrop, 0xFFFFFFFF, ptr::null_mut(), 0) }; diff --git a/src/platform_impl/windows/icon.rs b/src/platform_impl/windows/icon.rs index c885efab63..55a56a9f14 100644 --- a/src/platform_impl/windows/icon.rs +++ b/src/platform_impl/windows/icon.rs @@ -35,7 +35,7 @@ impl RgbaIcon { let pixels = unsafe { std::slice::from_raw_parts_mut(rgba.as_ptr() as *mut Pixel, pixel_count) }; for pixel in pixels { - and_mask.push(pixel.a.wrapping_sub(std::u8::MAX)); // invert alpha channel + and_mask.push(pixel.a.wrapping_sub(u8::MAX)); // invert alpha channel pixel.convert_to_bgra(); } assert_eq!(and_mask.len(), pixel_count); diff --git a/src/platform_impl/windows/util.rs b/src/platform_impl/windows/util.rs index ae36bdaec6..165242c11c 100644 --- a/src/platform_impl/windows/util.rs +++ b/src/platform_impl/windows/util.rs @@ -99,7 +99,7 @@ pub fn is_maximized(window: HWND) -> bool { let mut placement: WINDOWPLACEMENT = mem::zeroed(); placement.length = mem::size_of::() as u32; GetWindowPlacement(window, &mut placement); - placement.showCmd == SW_MAXIMIZE + placement.showCmd == SW_MAXIMIZE as u32 } } diff --git a/src/platform_impl/windows/window.rs b/src/platform_impl/windows/window.rs index 9c0001f55d..f0cbdf84b6 100644 --- a/src/platform_impl/windows/window.rs +++ b/src/platform_impl/windows/window.rs @@ -1030,7 +1030,7 @@ impl Window { unsafe { DwmSetWindowAttribute( self.hwnd(), - DWMWA_SYSTEMBACKDROP_TYPE, + DWMWA_SYSTEMBACKDROP_TYPE as u32, &(backdrop_type as i32) as *const _ as _, mem::size_of::() as _, ); @@ -1089,7 +1089,7 @@ impl Window { unsafe { DwmSetWindowAttribute( self.hwnd(), - DWMWA_BORDER_COLOR, + DWMWA_BORDER_COLOR as u32, &color as *const _ as _, mem::size_of::() as _, ); @@ -1101,7 +1101,7 @@ impl Window { unsafe { DwmSetWindowAttribute( self.hwnd(), - DWMWA_CAPTION_COLOR, + DWMWA_CAPTION_COLOR as u32, &color as *const _ as _, mem::size_of::() as _, ); @@ -1113,7 +1113,7 @@ impl Window { unsafe { DwmSetWindowAttribute( self.hwnd(), - DWMWA_TEXT_COLOR, + DWMWA_TEXT_COLOR as u32, &color as *const _ as _, mem::size_of::() as _, ); @@ -1125,7 +1125,7 @@ impl Window { unsafe { DwmSetWindowAttribute( self.hwnd(), - DWMWA_WINDOW_CORNER_PREFERENCE, + DWMWA_WINDOW_CORNER_PREFERENCE as u32, &(preference as DWM_WINDOW_CORNER_PREFERENCE) as *const _ as _, mem::size_of::() as _, ); @@ -1494,7 +1494,7 @@ impl Drop for ComInitialized { thread_local! { static COM_INITIALIZED: ComInitialized = { unsafe { - CoInitializeEx(ptr::null(), COINIT_APARTMENTTHREADED); + CoInitializeEx(ptr::null(), COINIT_APARTMENTTHREADED as u32); ComInitialized(ptr::null_mut()) } };