diff --git a/src/platform_impl/ios/app_state.rs b/src/platform_impl/ios/app_state.rs index 2e88f12c97..ed8fc36e48 100644 --- a/src/platform_impl/ios/app_state.rs +++ b/src/platform_impl/ios/app_state.rs @@ -9,6 +9,7 @@ use std::{ time::Instant, }; +use objc::foundation::{NSInteger, NSUInteger}; use objc::runtime::Object; use once_cell::sync::Lazy; @@ -21,8 +22,8 @@ use crate::{ ffi::{ id, kCFRunLoopCommonModes, CFAbsoluteTimeGetCurrent, CFRelease, CFRunLoopAddTimer, CFRunLoopGetMain, CFRunLoopRef, CFRunLoopTimerCreate, CFRunLoopTimerInvalidate, - CFRunLoopTimerRef, CFRunLoopTimerSetNextFireDate, CGRect, CGSize, NSInteger, - NSOperatingSystemVersion, NSUInteger, + CFRunLoopTimerRef, CFRunLoopTimerSetNextFireDate, CGRect, CGSize, + NSOperatingSystemVersion, }, }, window::WindowId as RootWindowId, diff --git a/src/platform_impl/ios/ffi.rs b/src/platform_impl/ios/ffi.rs index 515e32dcf0..7de3dce089 100644 --- a/src/platform_impl/ios/ffi.rs +++ b/src/platform_impl/ios/ffi.rs @@ -2,6 +2,7 @@ use std::{convert::TryInto, ffi::CString, ops::BitOr, os::raw::*}; +use objc::foundation::{NSInteger, NSUInteger}; use objc::{runtime::Object, Encode, Encoding}; use crate::{ @@ -17,9 +18,6 @@ pub type CGFloat = f32; #[cfg(target_pointer_width = "64")] pub type CGFloat = f64; -pub type NSInteger = isize; -pub type NSUInteger = usize; - #[repr(C)] #[derive(Clone, Debug)] pub struct NSOperatingSystemVersion { diff --git a/src/platform_impl/ios/monitor.rs b/src/platform_impl/ios/monitor.rs index edccd692b0..b309fe6231 100644 --- a/src/platform_impl/ios/monitor.rs +++ b/src/platform_impl/ios/monitor.rs @@ -4,12 +4,14 @@ use std::{ ops::{Deref, DerefMut}, }; +use objc::foundation::{NSInteger, NSUInteger}; + use crate::{ dpi::{PhysicalPosition, PhysicalSize}, monitor::{MonitorHandle as RootMonitorHandle, VideoMode as RootVideoMode}, platform_impl::platform::{ app_state, - ffi::{id, nil, CGFloat, CGRect, CGSize, NSInteger, NSUInteger}, + ffi::{id, nil, CGFloat, CGRect, CGSize}, }, }; diff --git a/src/platform_impl/macos/event_loop.rs b/src/platform_impl/macos/event_loop.rs index fdbf6efd9b..2f445b6f73 100644 --- a/src/platform_impl/macos/event_loop.rs +++ b/src/platform_impl/macos/event_loop.rs @@ -14,9 +14,10 @@ use std::{ use cocoa::{ appkit::{NSApp, NSEventModifierFlags, NSEventSubtype, NSEventType::NSApplicationDefined}, base::{id, nil}, - foundation::{NSInteger, NSPoint, NSTimeInterval}, + foundation::{NSPoint, NSTimeInterval}, }; -use objc::{foundation::is_main_thread, rc::autoreleasepool}; +use objc::foundation::is_main_thread; +use objc::rc::autoreleasepool; use raw_window_handle::{AppKitDisplayHandle, RawDisplayHandle}; use crate::{ @@ -245,11 +246,11 @@ pub unsafe fn post_dummy_event(target: id) { location: NSPoint::new(0.0, 0.0) modifierFlags: NSEventModifierFlags::empty() timestamp: 0 as NSTimeInterval - windowNumber: 0 as NSInteger + windowNumber: 0isize context: nil subtype: NSEventSubtype::NSWindowExposedEventType - data1: 0 as NSInteger - data2: 0 as NSInteger + data1: 0isize + data2: 0isize ]; let _: () = msg_send![target, postEvent: dummy_event, atStart: true]; } diff --git a/src/platform_impl/macos/ffi.rs b/src/platform_impl/macos/ffi.rs index 5c6fbc797c..b5bb6f5ebd 100644 --- a/src/platform_impl/macos/ffi.rs +++ b/src/platform_impl/macos/ffi.rs @@ -4,10 +4,7 @@ use std::ffi::c_void; -use cocoa::{ - base::id, - foundation::{NSInteger, NSUInteger}, -}; +use cocoa::base::id; use core_foundation::{ array::CFArrayRef, dictionary::CFDictionaryRef, string::CFStringRef, uuid::CFUUIDRef, }; @@ -15,6 +12,7 @@ use core_graphics::{ base::CGError, display::{CGDirectDisplayID, CGDisplayConfigRef}, }; +use objc::foundation::{NSInteger, NSUInteger}; pub const NSNotFound: NSInteger = NSInteger::max_value(); diff --git a/src/platform_impl/macos/monitor.rs b/src/platform_impl/macos/monitor.rs index 2b93be6a5a..00a4d69d16 100644 --- a/src/platform_impl/macos/monitor.rs +++ b/src/platform_impl/macos/monitor.rs @@ -8,7 +8,6 @@ use crate::{ use cocoa::{ appkit::NSScreen, base::{id, nil}, - foundation::NSUInteger, }; use core_foundation::{ array::{CFArrayGetCount, CFArrayGetValueAtIndex}, @@ -16,6 +15,7 @@ use core_foundation::{ string::CFString, }; use core_graphics::display::{CGDirectDisplayID, CGDisplay, CGDisplayBounds}; +use objc::foundation::NSUInteger; #[derive(Clone)] pub struct VideoMode { diff --git a/src/platform_impl/macos/util/mod.rs b/src/platform_impl/macos/util/mod.rs index be97acb5d7..f37bafc5ec 100644 --- a/src/platform_impl/macos/util/mod.rs +++ b/src/platform_impl/macos/util/mod.rs @@ -9,9 +9,10 @@ use std::os::raw::c_uchar; use cocoa::{ appkit::{CGFloat, NSApp, NSWindowStyleMask}, base::{id, nil}, - foundation::{NSPoint, NSRange, NSRect, NSString, NSUInteger}, + foundation::{NSPoint, NSRect, NSString}, }; use core_graphics::display::CGDisplay; +use objc::foundation::{NSRange, NSUInteger}; use objc::runtime::{Class, Object}; use crate::dpi::LogicalPosition; diff --git a/src/platform_impl/macos/view.rs b/src/platform_impl/macos/view.rs index 4055e2d97a..df7d50dfed 100644 --- a/src/platform_impl/macos/view.rs +++ b/src/platform_impl/macos/view.rs @@ -12,10 +12,11 @@ use std::{ use cocoa::{ appkit::{NSApp, NSEvent, NSEventModifierFlags, NSEventPhase, NSView, NSWindow}, base::{id, nil}, - foundation::{NSInteger, NSPoint, NSRange, NSRect, NSSize, NSString, NSUInteger}, + foundation::{NSPoint, NSRect, NSSize, NSString}, }; use objc::{ declare::ClassBuilder, + foundation::{NSInteger, NSRange, NSUInteger}, runtime::{Bool, Class, Object, Protocol, Sel}, }; use once_cell::sync::Lazy; diff --git a/src/platform_impl/macos/window.rs b/src/platform_impl/macos/window.rs index bd2a4f45cf..459ee05822 100644 --- a/src/platform_impl/macos/window.rs +++ b/src/platform_impl/macos/window.rs @@ -42,12 +42,12 @@ use cocoa::{ NSRequestUserAttentionType, NSScreen, NSView, NSWindow, NSWindowButton, NSWindowStyleMask, }, base::{id, nil}, - foundation::{NSDictionary, NSPoint, NSRect, NSSize, NSUInteger}, + foundation::{NSDictionary, NSPoint, NSRect, NSSize}, }; use core_graphics::display::{CGDisplay, CGDisplayMode}; use objc::{ declare::ClassBuilder, - foundation::is_main_thread, + foundation::{is_main_thread, NSUInteger}, rc::autoreleasepool, runtime::{Bool, Class, Object, Sel}, }; diff --git a/src/platform_impl/macos/window_delegate.rs b/src/platform_impl/macos/window_delegate.rs index ba3636dad8..5c4449bbbc 100644 --- a/src/platform_impl/macos/window_delegate.rs +++ b/src/platform_impl/macos/window_delegate.rs @@ -7,10 +7,10 @@ use std::{ use cocoa::{ appkit::{self, NSApplicationPresentationOptions, NSView, NSWindow, NSWindowOcclusionState}, base::{id, nil}, - foundation::NSUInteger, }; use objc::{ declare::ClassBuilder, + foundation::NSUInteger, rc::autoreleasepool, runtime::{Bool, Class, Object, Sel}, }; @@ -477,7 +477,7 @@ extern "C" fn window_will_use_fullscreen_presentation_options( options = (NSApplicationPresentationOptions::NSApplicationPresentationFullScreen | NSApplicationPresentationOptions::NSApplicationPresentationHideDock | NSApplicationPresentationOptions::NSApplicationPresentationHideMenuBar) - .bits(); + .bits() as NSUInteger; } }) });