From 276c2c05d38d17c41f0f78353a456c45dab1f9d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 27 Aug 2024 12:49:44 +0300 Subject: [PATCH] gdk4-win32: Fix isize / *mut c_void mismatches --- gdk4-win32/src/win32_hcursor.rs | 6 +++--- gdk4-win32/src/win32_surface.rs | 11 ++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gdk4-win32/src/win32_hcursor.rs b/gdk4-win32/src/win32_hcursor.rs index 8c2f39b8c014..a93cc2d2e12f 100644 --- a/gdk4-win32/src/win32_hcursor.rs +++ b/gdk4-win32/src/win32_hcursor.rs @@ -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}; @@ -17,7 +17,7 @@ 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(), )) } @@ -25,6 +25,6 @@ impl Win32HCursor { pub fn handle(&self) -> HCURSOR { let ptr: NonNull = ObjectExt::property(self, "handle"); - HCURSOR(ptr.as_ptr() as _) + HCURSOR(ptr.as_ptr() as *mut c_void) } } diff --git a/gdk4-win32/src/win32_surface.rs b/gdk4-win32/src/win32_surface.rs index 37491d365524..3e98c6a91743 100644 --- a/gdk4-win32/src/win32_surface.rs +++ b/gdk4-win32/src/win32_surface.rs @@ -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}; @@ -14,7 +16,7 @@ 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, )) } } @@ -22,7 +24,7 @@ impl Win32Surface { #[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")] @@ -30,6 +32,9 @@ impl Win32Surface { #[doc(alias = "get_impl_hwnd")] pub fn impl_hwnd(surface: &impl IsA) -> 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, + ) } }