Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update windows crate to 0.58 #963

Merged
merged 3 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ softbuffer = "0.4"
parking_lot = "0.12"
unicode-segmentation = "1.11"
windows-version = "0.1"
windows-core = "0.57"
windows-core = "0.58"

[target."cfg(target_os = \"windows\")".dependencies.windows]
version = "0.57"
version = "0.58"
features = [
"implement",
"Win32_Devices_HumanInterfaceDevice",
Expand Down Expand Up @@ -106,9 +106,9 @@ tao-macros = { version = "0.1.0", path = "./tao-macros" }
objc = "0.2"

[target."cfg(target_os = \"macos\")".dependencies]
cocoa = "0.25"
core-foundation = "0.9"
core-graphics = "0.23"
cocoa = "0.26"
core-foundation = "0.10"
core-graphics = "0.24"
dispatch = "0.2"
scopeguard = "1.2"

Expand Down
6 changes: 3 additions & 3 deletions src/platform/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,12 @@ pub trait WindowExtWindows {
impl WindowExtWindows for Window {
#[inline]
fn hinstance(&self) -> isize {
self.window.hinstance().0
self.window.hinstance().0 as _
}

#[inline]
fn hwnd(&self) -> isize {
self.window.hwnd().0
self.window.hwnd().0 as _
}

#[inline]
Expand Down Expand Up @@ -380,7 +380,7 @@ impl MonitorHandleExtWindows for MonitorHandle {

#[inline]
fn hmonitor(&self) -> isize {
self.inner.hmonitor().0
self.inner.hmonitor().0 as _
}
}

Expand Down
24 changes: 12 additions & 12 deletions src/platform_impl/windows/dark_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use std::ffi::c_void;

use crate::window::Theme;

static HUXTHEME: Lazy<HMODULE> =
Lazy::new(|| unsafe { LoadLibraryA(s!("uxtheme.dll")).unwrap_or_default() });
static HUXTHEME: Lazy<isize> =
Lazy::new(|| unsafe { LoadLibraryA(s!("uxtheme.dll")).unwrap_or_default().0 as _ });

static WIN10_BUILD_VERSION: Lazy<Option<u32>> = Lazy::new(|| {
let version = windows_version::OsVersion::current();
Expand All @@ -44,12 +44,12 @@ pub fn allow_dark_mode_for_app(is_dark_mode: bool) {
const UXTHEME_ALLOWDARKMODEFORAPP_ORDINAL: u16 = 135;
type AllowDarkModeForApp = unsafe extern "system" fn(bool) -> bool;
static ALLOW_DARK_MODE_FOR_APP: Lazy<Option<AllowDarkModeForApp>> = Lazy::new(|| unsafe {
if HUXTHEME.is_invalid() {
if HMODULE(*HUXTHEME as _).is_invalid() {
return None;
}

GetProcAddress(
*HUXTHEME,
HMODULE(*HUXTHEME as _),
PCSTR::from_raw(UXTHEME_ALLOWDARKMODEFORAPP_ORDINAL as usize as *mut _),
)
.map(|handle| std::mem::transmute(handle))
Expand All @@ -66,12 +66,12 @@ pub fn allow_dark_mode_for_app(is_dark_mode: bool) {
const UXTHEME_SETPREFERREDAPPMODE_ORDINAL: u16 = 135;
type SetPreferredAppMode = unsafe extern "system" fn(PreferredAppMode) -> PreferredAppMode;
static SET_PREFERRED_APP_MODE: Lazy<Option<SetPreferredAppMode>> = Lazy::new(|| unsafe {
if HUXTHEME.is_invalid() {
if HMODULE(*HUXTHEME as _).is_invalid() {
return None;
}

GetProcAddress(
*HUXTHEME,
HMODULE(*HUXTHEME as _),
PCSTR::from_raw(UXTHEME_SETPREFERREDAPPMODE_ORDINAL as usize as *mut _),
)
.map(|handle| std::mem::transmute(handle))
Expand Down Expand Up @@ -100,12 +100,12 @@ fn refresh_immersive_color_policy_state() {
type RefreshImmersiveColorPolicyState = unsafe extern "system" fn();
static REFRESH_IMMERSIVE_COLOR_POLICY_STATE: Lazy<Option<RefreshImmersiveColorPolicyState>> =
Lazy::new(|| unsafe {
if HUXTHEME.is_invalid() {
if HMODULE(*HUXTHEME as _).is_invalid() {
return None;
}

GetProcAddress(
*HUXTHEME,
HMODULE(*HUXTHEME as _),
PCSTR::from_raw(UXTHEME_REFRESHIMMERSIVECOLORPOLICYSTATE_ORDINAL as usize as *mut _),
)
.map(|handle| std::mem::transmute(handle))
Expand Down Expand Up @@ -142,12 +142,12 @@ pub fn allow_dark_mode_for_window(hwnd: HWND, is_dark_mode: bool) {
const UXTHEME_ALLOWDARKMODEFORWINDOW_ORDINAL: u16 = 133;
type AllowDarkModeForWindow = unsafe extern "system" fn(HWND, bool) -> bool;
static ALLOW_DARK_MODE_FOR_WINDOW: Lazy<Option<AllowDarkModeForWindow>> = Lazy::new(|| unsafe {
if HUXTHEME.is_invalid() {
if HMODULE(*HUXTHEME as _).is_invalid() {
return None;
}

GetProcAddress(
*HUXTHEME,
HMODULE(*HUXTHEME as _),
PCSTR::from_raw(UXTHEME_ALLOWDARKMODEFORWINDOW_ORDINAL as usize as *mut _),
)
.map(|handle| std::mem::transmute(handle))
Expand Down Expand Up @@ -206,12 +206,12 @@ fn should_apps_use_dark_mode() -> bool {
const UXTHEME_SHOULDAPPSUSEDARKMODE_ORDINAL: u16 = 132;
type ShouldAppsUseDarkMode = unsafe extern "system" fn() -> bool;
static SHOULD_APPS_USE_DARK_MODE: Lazy<Option<ShouldAppsUseDarkMode>> = Lazy::new(|| unsafe {
if HUXTHEME.is_invalid() {
if HMODULE(*HUXTHEME as _).is_invalid() {
return None;
}

GetProcAddress(
*HUXTHEME,
HMODULE(*HUXTHEME as _),
PCSTR::from_raw(UXTHEME_SHOULDAPPSUSEDARKMODE_ORDINAL as usize as *mut _),
)
.map(|handle| std::mem::transmute(handle))
Expand Down
12 changes: 6 additions & 6 deletions src/platform_impl/windows/drop_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl FileDropHandler {
}

#[allow(non_snake_case)]
impl IDropTarget_Impl for FileDropHandler {
impl IDropTarget_Impl for FileDropHandler_Impl {
fn DragEnter(
&self,
pDataObj: Option<&IDataObject>,
Expand All @@ -112,9 +112,9 @@ impl IDropTarget_Impl for FileDropHandler {
) -> windows::core::Result<()> {
use crate::event::WindowEvent::HoveredFile;
unsafe {
let hdrop = Self::iterate_filenames(pDataObj, |filename| {
let hdrop = FileDropHandler::iterate_filenames(pDataObj, |filename| {
(self.send_event)(Event::WindowEvent {
window_id: SuperWindowId(WindowId(self.window.0)),
window_id: SuperWindowId(WindowId(self.window.0 as _)),
event: HoveredFile(filename),
});
});
Expand Down Expand Up @@ -147,7 +147,7 @@ impl IDropTarget_Impl for FileDropHandler {
use crate::event::WindowEvent::HoveredFileCancelled;
if unsafe { *self.hovered_is_valid.get() } {
(self.send_event)(Event::WindowEvent {
window_id: SuperWindowId(WindowId(self.window.0)),
window_id: SuperWindowId(WindowId(self.window.0 as _)),
event: HoveredFileCancelled,
});
}
Expand All @@ -163,9 +163,9 @@ impl IDropTarget_Impl for FileDropHandler {
) -> windows::core::Result<()> {
use crate::event::WindowEvent::DroppedFile;
unsafe {
let hdrop = Self::iterate_filenames(pDataObj, |filename| {
let hdrop = FileDropHandler::iterate_filenames(pDataObj, |filename| {
(self.send_event)(Event::WindowEvent {
window_id: SuperWindowId(WindowId(self.window.0)),
window_id: SuperWindowId(WindowId(self.window.0 as _)),
event: DroppedFile(filename),
});
});
Expand Down
Loading
Loading