Skip to content

Commit

Permalink
Merge pull request #1796 from gtk-rs/dependabot/cargo/windows-0.58.0
Browse files Browse the repository at this point in the history
build(deps): bump windows from 0.56.0 to 0.58.0
  • Loading branch information
sdroege authored Aug 27, 2024
2 parents 6869305 + 3ad93c6 commit 3b1387a
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 32 deletions.
33 changes: 22 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion gdk4-win32/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ version = "4"

[features]
v4_4 = ["gdk4-win32-sys/v4_4", "gdk/v4_4"]
v4_8 = ["v4_4", "gdk4-win32-sys/v4_8", "gdk/v4_8"]
egl = ["khronos-egl"]
win32 = ["windows"]

Expand All @@ -29,7 +30,7 @@ gio.workspace = true
glib.workspace = true
libc.workspace = true
khronos-egl = {version = "6.0", optional = true}
windows = { version = "0.56", features = [
windows = { version = "0.58", features = [
"Win32_Foundation",
"Win32_UI_WindowsAndMessaging",
], optional = true }
Expand Down
30 changes: 16 additions & 14 deletions gdk4-win32/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#![allow(deprecated)]
#![cfg_attr(docsrs, feature(doc_cfg))]

use std::ffi::c_void;

Check warning on line 7 in gdk4-win32/src/lib.rs

View workflow job for this annotation

GitHub Actions / Windows MSVC

unused import: `std::ffi::c_void`

Check warning on line 7 in gdk4-win32/src/lib.rs

View workflow job for this annotation

GitHub Actions / Windows MSVC

unused import: `std::ffi::c_void`

Check warning on line 7 in gdk4-win32/src/lib.rs

View workflow job for this annotation

GitHub Actions / Windows MSVC

unused import: `std::ffi::c_void`

pub use gdk;
pub use gdk4_win32_sys as ffi;
pub use gio;
Expand All @@ -29,31 +31,31 @@ pub use win32_display::Win32DisplayFilterHandle;
mod win32_hcursor;
mod win32_surface;

#[cfg(not(feature = "win32"))]
pub struct HANDLE(pub isize);
#[cfg(not(feature = "win32"))]
pub struct HCURSOR(pub isize);
#[cfg(not(feature = "win32"))]
pub struct HICON(pub isize);
#[cfg(not(feature = "win32"))]
pub struct HWND(pub isize);
#[cfg(not(all(feature = "win32", windows)))]
pub struct HANDLE(pub *mut c_void);
#[cfg(not(all(feature = "win32", windows)))]
pub struct HCURSOR(pub *mut c_void);
#[cfg(not(all(feature = "win32", windows)))]
pub struct HICON(pub *mut c_void);
#[cfg(not(all(feature = "win32", windows)))]
pub struct HWND(pub *mut c_void);

#[cfg(not(feature = "win32"))]
#[cfg(not(all(feature = "win32", windows)))]
#[repr(transparent)]
pub struct WPARAM(pub usize);
#[cfg(not(feature = "win32"))]
#[cfg(not(all(feature = "win32", windows)))]
#[repr(transparent)]
pub struct LPARAM(pub isize);

#[cfg(not(feature = "win32"))]
#[cfg(not(all(feature = "win32", windows)))]
#[repr(C)]
pub struct POINT {
pub x: i32,
pub y: i32,
}

#[allow(non_snake_case)]
#[cfg(not(feature = "win32"))]
#[cfg(not(all(feature = "win32", windows)))]
#[repr(C)]
pub struct MSG {
pub hwnd: HWND,
Expand All @@ -64,7 +66,7 @@ pub struct MSG {
pub pt: POINT,
}

#[cfg(feature = "win32")]
#[cfg(all(feature = "win32", windows))]
pub use windows::Win32::Foundation::{HANDLE, HWND};
#[cfg(feature = "win32")]
#[cfg(all(feature = "win32", windows))]
pub use windows::Win32::UI::WindowsAndMessaging::{HCURSOR, HICON, MSG};
6 changes: 3 additions & 3 deletions gdk4-win32/src/win32_hcursor.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use std::ptr::NonNull;
use std::{ffi::c_void, ptr::NonNull};

use glib::{translate::*, types::Pointee};

Expand All @@ -17,14 +17,14 @@ impl Win32HCursor {
unsafe {
from_glib_full(ffi::gdk_win32_hcursor_new(
display.as_ref().to_glib_none().0,
handle.0,
handle.0 as isize,
destroyable.into_glib(),
))
}
}

pub fn handle(&self) -> HCURSOR {
let ptr: NonNull<Pointee> = ObjectExt::property(self, "handle");
HCURSOR(ptr.as_ptr() as _)
HCURSOR(ptr.as_ptr() as *mut c_void)

Check warning on line 28 in gdk4-win32/src/win32_hcursor.rs

View workflow job for this annotation

GitHub Actions / Windows MSVC

casting raw pointers to the same type and constness is unnecessary (`*mut libc::c_void` -> `*mut libc::c_void`)
}
}
11 changes: 8 additions & 3 deletions gdk4-win32/src/win32_surface.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use std::ffi::c_void;

use glib::translate::*;

use crate::{ffi, prelude::*, Win32Surface, HWND};
Expand All @@ -14,22 +16,25 @@ impl Win32Surface {
unsafe {
from_glib_none(ffi::gdk_win32_surface_lookup_for_display(
display.as_ref().to_glib_none().0,
anid.0,
anid.0 as isize,
))
}
}

#[doc(alias = "gdk_win32_surface_get_handle")]
#[doc(alias = "get_handle")]
pub fn handle(&self) -> HWND {
HWND(unsafe { ffi::gdk_win32_surface_get_handle(self.to_glib_none().0) })
HWND(unsafe { ffi::gdk_win32_surface_get_handle(self.to_glib_none().0) } as *mut c_void)
}

#[cfg_attr(feature = "v4_8", deprecated = "Since 4.8")]
#[doc(alias = "gdk_win32_surface_get_impl_hwnd")]
#[doc(alias = "get_impl_hwnd")]
pub fn impl_hwnd(surface: &impl IsA<gdk::Surface>) -> HWND {
assert_initialized_main_thread!();
HWND(unsafe { ffi::gdk_win32_surface_get_impl_hwnd(surface.as_ref().to_glib_none().0) })
HWND(
unsafe { ffi::gdk_win32_surface_get_impl_hwnd(surface.as_ref().to_glib_none().0) }
as *mut c_void,
)
}
}

0 comments on commit 3b1387a

Please sign in to comment.