mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 13:51:30 +11:00
Update icrate to v0.0.4 (#2992)
This commit is contained in:
parent
19e3906369
commit
b5aa96bea4
|
@ -74,14 +74,14 @@ ndk-sys = "0.4.0"
|
||||||
|
|
||||||
[target.'cfg(any(target_os = "ios", target_os = "macos"))'.dependencies]
|
[target.'cfg(any(target_os = "ios", target_os = "macos"))'.dependencies]
|
||||||
core-foundation = "0.9.3"
|
core-foundation = "0.9.3"
|
||||||
objc2 = "0.4.0"
|
objc2 = "0.4.1"
|
||||||
|
|
||||||
[target.'cfg(target_os = "macos")'.dependencies]
|
[target.'cfg(target_os = "macos")'.dependencies]
|
||||||
core-graphics = "0.22.3"
|
core-graphics = "0.22.3"
|
||||||
dispatch = "0.2.0"
|
dispatch = "0.2.0"
|
||||||
|
|
||||||
[target.'cfg(target_os = "macos")'.dependencies.icrate]
|
[target.'cfg(target_os = "macos")'.dependencies.icrate]
|
||||||
version = "0.0.3"
|
version = "0.0.4"
|
||||||
features = [
|
features = [
|
||||||
"Foundation",
|
"Foundation",
|
||||||
"Foundation_NSArray",
|
"Foundation_NSArray",
|
||||||
|
@ -96,7 +96,7 @@ features = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[target.'cfg(target_os = "ios")'.dependencies.icrate]
|
[target.'cfg(target_os = "ios")'.dependencies.icrate]
|
||||||
version = "0.0.3"
|
version = "0.0.4"
|
||||||
features = [
|
features = [
|
||||||
"Foundation",
|
"Foundation",
|
||||||
"Foundation_NSArray",
|
"Foundation_NSArray",
|
||||||
|
|
|
@ -18,7 +18,7 @@ use core_foundation::runloop::{
|
||||||
};
|
};
|
||||||
use icrate::Foundation::{CGRect, CGSize, NSInteger, NSProcessInfo};
|
use icrate::Foundation::{CGRect, CGSize, NSInteger, NSProcessInfo};
|
||||||
use objc2::rc::Id;
|
use objc2::rc::Id;
|
||||||
use objc2::runtime::Object;
|
use objc2::runtime::AnyObject;
|
||||||
use objc2::{msg_send, sel};
|
use objc2::{msg_send, sel};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
|
@ -538,7 +538,7 @@ pub unsafe fn did_finish_launching() {
|
||||||
// completed. This may result in incorrect visual appearance.
|
// completed. This may result in incorrect visual appearance.
|
||||||
// ```
|
// ```
|
||||||
let screen = window.screen();
|
let screen = window.screen();
|
||||||
let _: () = msg_send![&window, setScreen: ptr::null::<Object>()];
|
let _: () = msg_send![&window, setScreen: ptr::null::<AnyObject>()];
|
||||||
window.setScreen(&screen);
|
window.setScreen(&screen);
|
||||||
|
|
||||||
let controller = window.rootViewController();
|
let controller = window.rootViewController();
|
||||||
|
|
|
@ -5,7 +5,7 @@ use std::ptr::NonNull;
|
||||||
use icrate::Foundation::{CGFloat, CGRect, MainThreadMarker, NSObject, NSObjectProtocol, NSSet};
|
use icrate::Foundation::{CGFloat, CGRect, MainThreadMarker, NSObject, NSObjectProtocol, NSSet};
|
||||||
use objc2::declare::{Ivar, IvarDrop};
|
use objc2::declare::{Ivar, IvarDrop};
|
||||||
use objc2::rc::Id;
|
use objc2::rc::Id;
|
||||||
use objc2::runtime::Class;
|
use objc2::runtime::AnyClass;
|
||||||
use objc2::{declare_class, extern_methods, msg_send, msg_send_id, mutability, ClassType};
|
use objc2::{declare_class, extern_methods, msg_send, msg_send_id, mutability, ClassType};
|
||||||
|
|
||||||
use super::uikit::{
|
use super::uikit::{
|
||||||
|
@ -167,7 +167,7 @@ extern_methods!(
|
||||||
|
|
||||||
// TODO: Allow the user to customize this
|
// TODO: Allow the user to customize this
|
||||||
#[method(layerClass)]
|
#[method(layerClass)]
|
||||||
pub(crate) fn layerClass() -> &'static Class;
|
pub(crate) fn layerClass() -> &'static AnyClass;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ use std::{
|
||||||
|
|
||||||
use icrate::Foundation::{CGFloat, CGPoint, CGRect, CGSize, MainThreadMarker};
|
use icrate::Foundation::{CGFloat, CGPoint, CGRect, CGSize, MainThreadMarker};
|
||||||
use objc2::rc::Id;
|
use objc2::rc::Id;
|
||||||
use objc2::runtime::Object;
|
use objc2::runtime::AnyObject;
|
||||||
use objc2::{class, msg_send};
|
use objc2::{class, msg_send};
|
||||||
use raw_window_handle::{RawDisplayHandle, RawWindowHandle, UiKitDisplayHandle, UiKitWindowHandle};
|
use raw_window_handle::{RawDisplayHandle, RawWindowHandle, UiKitDisplayHandle, UiKitWindowHandle};
|
||||||
|
|
||||||
|
@ -646,8 +646,8 @@ impl From<u64> for WindowId {
|
||||||
unsafe impl Send for WindowId {}
|
unsafe impl Send for WindowId {}
|
||||||
unsafe impl Sync for WindowId {}
|
unsafe impl Sync for WindowId {}
|
||||||
|
|
||||||
impl From<&Object> for WindowId {
|
impl From<&AnyObject> for WindowId {
|
||||||
fn from(window: &Object) -> WindowId {
|
fn from(window: &AnyObject) -> WindowId {
|
||||||
WindowId {
|
WindowId {
|
||||||
window: window as *const _ as _,
|
window: window as *const _ as _,
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ use std::ptr::NonNull;
|
||||||
use icrate::Foundation::NSObject;
|
use icrate::Foundation::NSObject;
|
||||||
use objc2::declare::{IvarBool, IvarEncode};
|
use objc2::declare::{IvarBool, IvarEncode};
|
||||||
use objc2::rc::Id;
|
use objc2::rc::Id;
|
||||||
use objc2::runtime::Object;
|
use objc2::runtime::AnyObject;
|
||||||
use objc2::{declare_class, msg_send, msg_send_id, mutability, ClassType};
|
use objc2::{declare_class, msg_send, msg_send_id, mutability, ClassType};
|
||||||
|
|
||||||
use super::app_state::AppState;
|
use super::app_state::AppState;
|
||||||
|
@ -43,7 +43,7 @@ declare_class!(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[method(applicationDidFinishLaunching:)]
|
#[method(applicationDidFinishLaunching:)]
|
||||||
fn did_finish_launching(&self, _sender: Option<&Object>) {
|
fn did_finish_launching(&self, _sender: Option<&AnyObject>) {
|
||||||
trace_scope!("applicationDidFinishLaunching:");
|
trace_scope!("applicationDidFinishLaunching:");
|
||||||
AppState::launched(
|
AppState::launched(
|
||||||
*self.activation_policy,
|
*self.activation_policy,
|
||||||
|
@ -53,7 +53,7 @@ declare_class!(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[method(applicationWillTerminate:)]
|
#[method(applicationWillTerminate:)]
|
||||||
fn will_terminate(&self, _sender: Option<&Object>) {
|
fn will_terminate(&self, _sender: Option<&AnyObject>) {
|
||||||
trace_scope!("applicationWillTerminate:");
|
trace_scope!("applicationWillTerminate:");
|
||||||
// TODO: Notify every window that it will be destroyed, like done in iOS?
|
// TODO: Notify every window that it will be destroyed, like done in iOS?
|
||||||
AppState::exit();
|
AppState::exit();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use icrate::Foundation::{MainThreadMarker, NSArray, NSInteger, NSObject, NSUInteger};
|
use icrate::Foundation::{MainThreadMarker, NSArray, NSInteger, NSObject, NSUInteger};
|
||||||
use objc2::rc::Id;
|
use objc2::rc::Id;
|
||||||
use objc2::runtime::Object;
|
use objc2::runtime::AnyObject;
|
||||||
use objc2::{extern_class, extern_methods, msg_send_id, mutability, ClassType};
|
use objc2::{extern_class, extern_methods, msg_send_id, mutability, ClassType};
|
||||||
use objc2::{Encode, Encoding};
|
use objc2::{Encode, Encoding};
|
||||||
|
|
||||||
|
@ -50,23 +50,23 @@ extern_methods!(
|
||||||
|
|
||||||
// TODO: NSApplicationDelegate
|
// TODO: NSApplicationDelegate
|
||||||
#[method(setDelegate:)]
|
#[method(setDelegate:)]
|
||||||
pub fn setDelegate(&self, delegate: &Object);
|
pub fn setDelegate(&self, delegate: &AnyObject);
|
||||||
|
|
||||||
#[method(setPresentationOptions:)]
|
#[method(setPresentationOptions:)]
|
||||||
pub fn setPresentationOptions(&self, options: NSApplicationPresentationOptions);
|
pub fn setPresentationOptions(&self, options: NSApplicationPresentationOptions);
|
||||||
|
|
||||||
#[method(hide:)]
|
#[method(hide:)]
|
||||||
pub fn hide(&self, sender: Option<&Object>);
|
pub fn hide(&self, sender: Option<&AnyObject>);
|
||||||
|
|
||||||
#[method(orderFrontCharacterPalette:)]
|
#[method(orderFrontCharacterPalette:)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn orderFrontCharacterPalette(&self, sender: Option<&Object>);
|
pub fn orderFrontCharacterPalette(&self, sender: Option<&AnyObject>);
|
||||||
|
|
||||||
#[method(hideOtherApplications:)]
|
#[method(hideOtherApplications:)]
|
||||||
pub fn hideOtherApplications(&self, sender: Option<&Object>);
|
pub fn hideOtherApplications(&self, sender: Option<&AnyObject>);
|
||||||
|
|
||||||
#[method(stop:)]
|
#[method(stop:)]
|
||||||
pub fn stop(&self, sender: Option<&Object>);
|
pub fn stop(&self, sender: Option<&AnyObject>);
|
||||||
|
|
||||||
#[method(activateIgnoringOtherApps:)]
|
#[method(activateIgnoringOtherApps:)]
|
||||||
pub fn activateIgnoringOtherApps(&self, ignore: bool);
|
pub fn activateIgnoringOtherApps(&self, ignore: bool);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use icrate::ns_string;
|
use icrate::ns_string;
|
||||||
use icrate::Foundation::{CGFloat, NSArray, NSDictionary, NSNumber, NSObject, NSRect, NSString};
|
use icrate::Foundation::{CGFloat, NSArray, NSDictionary, NSNumber, NSObject, NSRect, NSString};
|
||||||
use objc2::rc::Id;
|
use objc2::rc::Id;
|
||||||
use objc2::runtime::Object;
|
use objc2::runtime::AnyObject;
|
||||||
use objc2::{extern_class, extern_methods, mutability, ClassType};
|
use objc2::{extern_class, extern_methods, mutability, ClassType};
|
||||||
|
|
||||||
extern_class!(
|
extern_class!(
|
||||||
|
@ -33,7 +33,7 @@ extern_methods!(
|
||||||
pub fn visibleFrame(&self) -> NSRect;
|
pub fn visibleFrame(&self) -> NSRect;
|
||||||
|
|
||||||
#[method_id(deviceDescription)]
|
#[method_id(deviceDescription)]
|
||||||
pub fn deviceDescription(&self) -> Id<NSDictionary<NSDeviceDescriptionKey, Object>>;
|
pub fn deviceDescription(&self) -> Id<NSDictionary<NSDeviceDescriptionKey, AnyObject>>;
|
||||||
|
|
||||||
pub fn display_id(&self) -> u32 {
|
pub fn display_id(&self) -> u32 {
|
||||||
let key = ns_string!("NSScreenNumber");
|
let key = ns_string!("NSScreenNumber");
|
||||||
|
@ -49,7 +49,7 @@ extern_methods!(
|
||||||
let obj = device_description
|
let obj = device_description
|
||||||
.get(key)
|
.get(key)
|
||||||
.expect("failed getting screen display id from device description");
|
.expect("failed getting screen display id from device description");
|
||||||
let obj: *const Object = obj;
|
let obj: *const AnyObject = obj;
|
||||||
let obj: *const NSNumber = obj.cast();
|
let obj: *const NSNumber = obj.cast();
|
||||||
let obj: &NSNumber = unsafe { &*obj };
|
let obj: &NSNumber = unsafe { &*obj };
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ use std::ptr;
|
||||||
|
|
||||||
use icrate::Foundation::{NSObject, NSPoint, NSRect};
|
use icrate::Foundation::{NSObject, NSPoint, NSRect};
|
||||||
use objc2::rc::Id;
|
use objc2::rc::Id;
|
||||||
use objc2::runtime::Object;
|
use objc2::runtime::AnyObject;
|
||||||
use objc2::{extern_class, extern_methods, mutability, ClassType};
|
use objc2::{extern_class, extern_methods, mutability, ClassType};
|
||||||
|
|
||||||
use super::{NSCursor, NSResponder, NSTextInputContext, NSWindow};
|
use super::{NSCursor, NSResponder, NSTextInputContext, NSWindow};
|
||||||
|
@ -74,7 +74,7 @@ extern_methods!(
|
||||||
unsafe fn inner_addTrackingRect(
|
unsafe fn inner_addTrackingRect(
|
||||||
&self,
|
&self,
|
||||||
rect: NSRect,
|
rect: NSRect,
|
||||||
owner: &Object,
|
owner: &AnyObject,
|
||||||
user_data: *mut c_void,
|
user_data: *mut c_void,
|
||||||
assume_inside: bool,
|
assume_inside: bool,
|
||||||
) -> Option<NSTrackingRectTag>;
|
) -> Option<NSTrackingRectTag>;
|
||||||
|
|
|
@ -3,7 +3,7 @@ use icrate::Foundation::{
|
||||||
};
|
};
|
||||||
use objc2::encode::{Encode, Encoding};
|
use objc2::encode::{Encode, Encoding};
|
||||||
use objc2::rc::Id;
|
use objc2::rc::Id;
|
||||||
use objc2::runtime::Object;
|
use objc2::runtime::AnyObject;
|
||||||
use objc2::{extern_class, extern_methods, mutability, ClassType};
|
use objc2::{extern_class, extern_methods, mutability, ClassType};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
|
@ -116,31 +116,31 @@ extern_methods!(
|
||||||
pub(crate) fn registerForDraggedTypes(&self, types: &NSArray<NSPasteboardType>);
|
pub(crate) fn registerForDraggedTypes(&self, types: &NSArray<NSPasteboardType>);
|
||||||
|
|
||||||
#[method(makeKeyAndOrderFront:)]
|
#[method(makeKeyAndOrderFront:)]
|
||||||
pub(crate) fn makeKeyAndOrderFront(&self, sender: Option<&Object>);
|
pub(crate) fn makeKeyAndOrderFront(&self, sender: Option<&AnyObject>);
|
||||||
|
|
||||||
#[method(orderFront:)]
|
#[method(orderFront:)]
|
||||||
pub(crate) fn orderFront(&self, sender: Option<&Object>);
|
pub(crate) fn orderFront(&self, sender: Option<&AnyObject>);
|
||||||
|
|
||||||
#[method(miniaturize:)]
|
#[method(miniaturize:)]
|
||||||
pub(crate) fn miniaturize(&self, sender: Option<&Object>);
|
pub(crate) fn miniaturize(&self, sender: Option<&AnyObject>);
|
||||||
|
|
||||||
#[method(sender:)]
|
#[method(sender:)]
|
||||||
pub(crate) fn deminiaturize(&self, sender: Option<&Object>);
|
pub(crate) fn deminiaturize(&self, sender: Option<&AnyObject>);
|
||||||
|
|
||||||
#[method(toggleFullScreen:)]
|
#[method(toggleFullScreen:)]
|
||||||
pub(crate) fn toggleFullScreen(&self, sender: Option<&Object>);
|
pub(crate) fn toggleFullScreen(&self, sender: Option<&AnyObject>);
|
||||||
|
|
||||||
#[method(orderOut:)]
|
#[method(orderOut:)]
|
||||||
pub(crate) fn orderOut(&self, sender: Option<&Object>);
|
pub(crate) fn orderOut(&self, sender: Option<&AnyObject>);
|
||||||
|
|
||||||
#[method(zoom:)]
|
#[method(zoom:)]
|
||||||
pub(crate) fn zoom(&self, sender: Option<&Object>);
|
pub(crate) fn zoom(&self, sender: Option<&AnyObject>);
|
||||||
|
|
||||||
#[method(selectNextKeyView:)]
|
#[method(selectNextKeyView:)]
|
||||||
pub(crate) fn selectNextKeyView(&self, sender: Option<&Object>);
|
pub(crate) fn selectNextKeyView(&self, sender: Option<&AnyObject>);
|
||||||
|
|
||||||
#[method(selectPreviousKeyView:)]
|
#[method(selectPreviousKeyView:)]
|
||||||
pub(crate) fn selectPreviousKeyView(&self, sender: Option<&Object>);
|
pub(crate) fn selectPreviousKeyView(&self, sender: Option<&AnyObject>);
|
||||||
|
|
||||||
#[method_id(firstResponder)]
|
#[method_id(firstResponder)]
|
||||||
pub(crate) fn firstResponder(&self) -> Option<Id<NSResponder>>;
|
pub(crate) fn firstResponder(&self) -> Option<Id<NSResponder>>;
|
||||||
|
|
|
@ -10,7 +10,7 @@ use icrate::Foundation::{
|
||||||
};
|
};
|
||||||
use objc2::declare::{Ivar, IvarDrop};
|
use objc2::declare::{Ivar, IvarDrop};
|
||||||
use objc2::rc::{Id, WeakId};
|
use objc2::rc::{Id, WeakId};
|
||||||
use objc2::runtime::{Object, Sel};
|
use objc2::runtime::{AnyObject, Sel};
|
||||||
use objc2::{class, declare_class, msg_send, msg_send_id, mutability, sel, ClassType};
|
use objc2::{class, declare_class, msg_send, msg_send_id, mutability, sel, ClassType};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
|
@ -182,7 +182,7 @@ declare_class!(
|
||||||
|
|
||||||
this.setPostsFrameChangedNotifications(true);
|
this.setPostsFrameChangedNotifications(true);
|
||||||
|
|
||||||
let notification_center: &Object =
|
let notification_center: &AnyObject =
|
||||||
unsafe { msg_send![class!(NSNotificationCenter), defaultCenter] };
|
unsafe { msg_send![class!(NSNotificationCenter), defaultCenter] };
|
||||||
// About frame change
|
// About frame change
|
||||||
let frame_did_change_notification_name =
|
let frame_did_change_notification_name =
|
||||||
|
@ -550,7 +550,7 @@ declare_class!(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[method(insertTab:)]
|
#[method(insertTab:)]
|
||||||
fn insert_tab(&self, _sender: Option<&Object>) {
|
fn insert_tab(&self, _sender: Option<&AnyObject>) {
|
||||||
trace_scope!("insertTab:");
|
trace_scope!("insertTab:");
|
||||||
let window = self.window();
|
let window = self.window();
|
||||||
if let Some(first_responder) = window.firstResponder() {
|
if let Some(first_responder) = window.firstResponder() {
|
||||||
|
@ -561,7 +561,7 @@ declare_class!(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[method(insertBackTab:)]
|
#[method(insertBackTab:)]
|
||||||
fn insert_back_tab(&self, _sender: Option<&Object>) {
|
fn insert_back_tab(&self, _sender: Option<&AnyObject>) {
|
||||||
trace_scope!("insertBackTab:");
|
trace_scope!("insertBackTab:");
|
||||||
let window = self.window();
|
let window = self.window();
|
||||||
if let Some(first_responder) = window.firstResponder() {
|
if let Some(first_responder) = window.firstResponder() {
|
||||||
|
@ -574,7 +574,7 @@ declare_class!(
|
||||||
// Allows us to receive Cmd-. (the shortcut for closing a dialog)
|
// Allows us to receive Cmd-. (the shortcut for closing a dialog)
|
||||||
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=300620#c6
|
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=300620#c6
|
||||||
#[method(cancelOperation:)]
|
#[method(cancelOperation:)]
|
||||||
fn cancel_operation(&self, _sender: Option<&Object>) {
|
fn cancel_operation(&self, _sender: Option<&AnyObject>) {
|
||||||
trace_scope!("cancelOperation:");
|
trace_scope!("cancelOperation:");
|
||||||
|
|
||||||
let event = NSApp()
|
let event = NSApp()
|
||||||
|
|
|
@ -5,7 +5,7 @@ use std::ptr::{self, NonNull};
|
||||||
use icrate::Foundation::{NSArray, NSObject, NSSize, NSString};
|
use icrate::Foundation::{NSArray, NSObject, NSSize, NSString};
|
||||||
use objc2::declare::{Ivar, IvarDrop};
|
use objc2::declare::{Ivar, IvarDrop};
|
||||||
use objc2::rc::{autoreleasepool, Id};
|
use objc2::rc::{autoreleasepool, Id};
|
||||||
use objc2::runtime::Object;
|
use objc2::runtime::AnyObject;
|
||||||
use objc2::{class, declare_class, msg_send, msg_send_id, mutability, sel, ClassType};
|
use objc2::{class, declare_class, msg_send, msg_send_id, mutability, sel, ClassType};
|
||||||
|
|
||||||
use super::appkit::{
|
use super::appkit::{
|
||||||
|
@ -83,7 +83,7 @@ declare_class!(
|
||||||
this.window.setDelegate(Some(this));
|
this.window.setDelegate(Some(this));
|
||||||
|
|
||||||
// Enable theme change event
|
// Enable theme change event
|
||||||
let notification_center: Id<Object> =
|
let notification_center: Id<AnyObject> =
|
||||||
unsafe { msg_send_id![class!(NSDistributedNotificationCenter), defaultCenter] };
|
unsafe { msg_send_id![class!(NSDistributedNotificationCenter), defaultCenter] };
|
||||||
let notification_name =
|
let notification_name =
|
||||||
NSString::from_str("AppleInterfaceThemeChangedNotification");
|
NSString::from_str("AppleInterfaceThemeChangedNotification");
|
||||||
|
@ -93,7 +93,7 @@ declare_class!(
|
||||||
addObserver: &*this
|
addObserver: &*this
|
||||||
selector: sel!(effectiveAppearanceDidChange:)
|
selector: sel!(effectiveAppearanceDidChange:)
|
||||||
name: &*notification_name
|
name: &*notification_name
|
||||||
object: ptr::null::<Object>()
|
object: ptr::null::<AnyObject>()
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -105,14 +105,14 @@ declare_class!(
|
||||||
// NSWindowDelegate + NSDraggingDestination protocols
|
// NSWindowDelegate + NSDraggingDestination protocols
|
||||||
unsafe impl WinitWindowDelegate {
|
unsafe impl WinitWindowDelegate {
|
||||||
#[method(windowShouldClose:)]
|
#[method(windowShouldClose:)]
|
||||||
fn window_should_close(&self, _: Option<&Object>) -> bool {
|
fn window_should_close(&self, _: Option<&AnyObject>) -> bool {
|
||||||
trace_scope!("windowShouldClose:");
|
trace_scope!("windowShouldClose:");
|
||||||
self.queue_event(WindowEvent::CloseRequested);
|
self.queue_event(WindowEvent::CloseRequested);
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
#[method(windowWillClose:)]
|
#[method(windowWillClose:)]
|
||||||
fn window_will_close(&self, _: Option<&Object>) {
|
fn window_will_close(&self, _: Option<&AnyObject>) {
|
||||||
trace_scope!("windowWillClose:");
|
trace_scope!("windowWillClose:");
|
||||||
// `setDelegate:` retains the previous value and then autoreleases it
|
// `setDelegate:` retains the previous value and then autoreleases it
|
||||||
autoreleasepool(|_| {
|
autoreleasepool(|_| {
|
||||||
|
@ -124,14 +124,14 @@ declare_class!(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[method(windowDidResize:)]
|
#[method(windowDidResize:)]
|
||||||
fn window_did_resize(&self, _: Option<&Object>) {
|
fn window_did_resize(&self, _: Option<&AnyObject>) {
|
||||||
trace_scope!("windowDidResize:");
|
trace_scope!("windowDidResize:");
|
||||||
// NOTE: WindowEvent::Resized is reported in frameDidChange.
|
// NOTE: WindowEvent::Resized is reported in frameDidChange.
|
||||||
self.emit_move_event();
|
self.emit_move_event();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[method(windowWillStartLiveResize:)]
|
#[method(windowWillStartLiveResize:)]
|
||||||
fn window_will_start_live_resize(&self, _: Option<&Object>) {
|
fn window_will_start_live_resize(&self, _: Option<&AnyObject>) {
|
||||||
trace_scope!("windowWillStartLiveResize:");
|
trace_scope!("windowWillStartLiveResize:");
|
||||||
|
|
||||||
let increments = self
|
let increments = self
|
||||||
|
@ -142,26 +142,26 @@ declare_class!(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[method(windowDidEndLiveResize:)]
|
#[method(windowDidEndLiveResize:)]
|
||||||
fn window_did_end_live_resize(&self, _: Option<&Object>) {
|
fn window_did_end_live_resize(&self, _: Option<&AnyObject>) {
|
||||||
trace_scope!("windowDidEndLiveResize:");
|
trace_scope!("windowDidEndLiveResize:");
|
||||||
self.window.set_resize_increments_inner(NSSize::new(1., 1.));
|
self.window.set_resize_increments_inner(NSSize::new(1., 1.));
|
||||||
}
|
}
|
||||||
|
|
||||||
// This won't be triggered if the move was part of a resize.
|
// This won't be triggered if the move was part of a resize.
|
||||||
#[method(windowDidMove:)]
|
#[method(windowDidMove:)]
|
||||||
fn window_did_move(&self, _: Option<&Object>) {
|
fn window_did_move(&self, _: Option<&AnyObject>) {
|
||||||
trace_scope!("windowDidMove:");
|
trace_scope!("windowDidMove:");
|
||||||
self.emit_move_event();
|
self.emit_move_event();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[method(windowDidChangeBackingProperties:)]
|
#[method(windowDidChangeBackingProperties:)]
|
||||||
fn window_did_change_backing_properties(&self, _: Option<&Object>) {
|
fn window_did_change_backing_properties(&self, _: Option<&AnyObject>) {
|
||||||
trace_scope!("windowDidChangeBackingProperties:");
|
trace_scope!("windowDidChangeBackingProperties:");
|
||||||
self.queue_static_scale_factor_changed_event();
|
self.queue_static_scale_factor_changed_event();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[method(windowDidBecomeKey:)]
|
#[method(windowDidBecomeKey:)]
|
||||||
fn window_did_become_key(&self, _: Option<&Object>) {
|
fn window_did_become_key(&self, _: Option<&AnyObject>) {
|
||||||
trace_scope!("windowDidBecomeKey:");
|
trace_scope!("windowDidBecomeKey:");
|
||||||
// TODO: center the cursor if the window had mouse grab when it
|
// TODO: center the cursor if the window had mouse grab when it
|
||||||
// lost focus
|
// lost focus
|
||||||
|
@ -169,7 +169,7 @@ declare_class!(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[method(windowDidResignKey:)]
|
#[method(windowDidResignKey:)]
|
||||||
fn window_did_resign_key(&self, _: Option<&Object>) {
|
fn window_did_resign_key(&self, _: Option<&AnyObject>) {
|
||||||
trace_scope!("windowDidResignKey:");
|
trace_scope!("windowDidResignKey:");
|
||||||
// It happens rather often, e.g. when the user is Cmd+Tabbing, that the
|
// It happens rather often, e.g. when the user is Cmd+Tabbing, that the
|
||||||
// NSWindowDelegate will receive a didResignKey event despite no event
|
// NSWindowDelegate will receive a didResignKey event despite no event
|
||||||
|
@ -243,7 +243,7 @@ declare_class!(
|
||||||
|
|
||||||
/// Invoked when before enter fullscreen
|
/// Invoked when before enter fullscreen
|
||||||
#[method(windowWillEnterFullScreen:)]
|
#[method(windowWillEnterFullScreen:)]
|
||||||
fn window_will_enter_fullscreen(&self, _: Option<&Object>) {
|
fn window_will_enter_fullscreen(&self, _: Option<&AnyObject>) {
|
||||||
trace_scope!("windowWillEnterFullScreen:");
|
trace_scope!("windowWillEnterFullScreen:");
|
||||||
|
|
||||||
let mut shared_state = self
|
let mut shared_state = self
|
||||||
|
@ -272,7 +272,7 @@ declare_class!(
|
||||||
|
|
||||||
/// Invoked when before exit fullscreen
|
/// Invoked when before exit fullscreen
|
||||||
#[method(windowWillExitFullScreen:)]
|
#[method(windowWillExitFullScreen:)]
|
||||||
fn window_will_exit_fullscreen(&self, _: Option<&Object>) {
|
fn window_will_exit_fullscreen(&self, _: Option<&AnyObject>) {
|
||||||
trace_scope!("windowWillExitFullScreen:");
|
trace_scope!("windowWillExitFullScreen:");
|
||||||
|
|
||||||
let mut shared_state = self.window.lock_shared_state("window_will_exit_fullscreen");
|
let mut shared_state = self.window.lock_shared_state("window_will_exit_fullscreen");
|
||||||
|
@ -282,7 +282,7 @@ declare_class!(
|
||||||
#[method(window:willUseFullScreenPresentationOptions:)]
|
#[method(window:willUseFullScreenPresentationOptions:)]
|
||||||
fn window_will_use_fullscreen_presentation_options(
|
fn window_will_use_fullscreen_presentation_options(
|
||||||
&self,
|
&self,
|
||||||
_: Option<&Object>,
|
_: Option<&AnyObject>,
|
||||||
proposed_options: NSApplicationPresentationOptions,
|
proposed_options: NSApplicationPresentationOptions,
|
||||||
) -> NSApplicationPresentationOptions {
|
) -> NSApplicationPresentationOptions {
|
||||||
trace_scope!("window:willUseFullScreenPresentationOptions:");
|
trace_scope!("window:willUseFullScreenPresentationOptions:");
|
||||||
|
@ -309,7 +309,7 @@ declare_class!(
|
||||||
|
|
||||||
/// Invoked when entered fullscreen
|
/// Invoked when entered fullscreen
|
||||||
#[method(windowDidEnterFullScreen:)]
|
#[method(windowDidEnterFullScreen:)]
|
||||||
fn window_did_enter_fullscreen(&self, _: Option<&Object>) {
|
fn window_did_enter_fullscreen(&self, _: Option<&AnyObject>) {
|
||||||
trace_scope!("windowDidEnterFullScreen:");
|
trace_scope!("windowDidEnterFullScreen:");
|
||||||
self.state.initial_fullscreen.set(false);
|
self.state.initial_fullscreen.set(false);
|
||||||
let mut shared_state = self.window.lock_shared_state("window_did_enter_fullscreen");
|
let mut shared_state = self.window.lock_shared_state("window_did_enter_fullscreen");
|
||||||
|
@ -323,7 +323,7 @@ declare_class!(
|
||||||
|
|
||||||
/// Invoked when exited fullscreen
|
/// Invoked when exited fullscreen
|
||||||
#[method(windowDidExitFullScreen:)]
|
#[method(windowDidExitFullScreen:)]
|
||||||
fn window_did_exit_fullscreen(&self, _: Option<&Object>) {
|
fn window_did_exit_fullscreen(&self, _: Option<&AnyObject>) {
|
||||||
trace_scope!("windowDidExitFullScreen:");
|
trace_scope!("windowDidExitFullScreen:");
|
||||||
|
|
||||||
self.window.restore_state_from_fullscreen();
|
self.window.restore_state_from_fullscreen();
|
||||||
|
@ -353,7 +353,7 @@ declare_class!(
|
||||||
/// This method indicates that there was an error, and you should clean up any
|
/// This method indicates that there was an error, and you should clean up any
|
||||||
/// work you may have done to prepare to enter full-screen mode.
|
/// work you may have done to prepare to enter full-screen mode.
|
||||||
#[method(windowDidFailToEnterFullScreen:)]
|
#[method(windowDidFailToEnterFullScreen:)]
|
||||||
fn window_did_fail_to_enter_fullscreen(&self, _: Option<&Object>) {
|
fn window_did_fail_to_enter_fullscreen(&self, _: Option<&AnyObject>) {
|
||||||
trace_scope!("windowDidFailToEnterFullScreen:");
|
trace_scope!("windowDidFailToEnterFullScreen:");
|
||||||
let mut shared_state = self
|
let mut shared_state = self
|
||||||
.window
|
.window
|
||||||
|
@ -366,7 +366,7 @@ declare_class!(
|
||||||
let _: () = msg_send![
|
let _: () = msg_send![
|
||||||
&*self.window,
|
&*self.window,
|
||||||
performSelector: sel!(toggleFullScreen:),
|
performSelector: sel!(toggleFullScreen:),
|
||||||
withObject: ptr::null::<Object>(),
|
withObject: ptr::null::<AnyObject>(),
|
||||||
afterDelay: 0.5,
|
afterDelay: 0.5,
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -377,7 +377,7 @@ declare_class!(
|
||||||
|
|
||||||
// Invoked when the occlusion state of the window changes
|
// Invoked when the occlusion state of the window changes
|
||||||
#[method(windowDidChangeOcclusionState:)]
|
#[method(windowDidChangeOcclusionState:)]
|
||||||
fn window_did_change_occlusion_state(&self, _: Option<&Object>) {
|
fn window_did_change_occlusion_state(&self, _: Option<&AnyObject>) {
|
||||||
trace_scope!("windowDidChangeOcclusionState:");
|
trace_scope!("windowDidChangeOcclusionState:");
|
||||||
self.queue_event(WindowEvent::Occluded(
|
self.queue_event(WindowEvent::Occluded(
|
||||||
!self
|
!self
|
||||||
|
@ -389,7 +389,7 @@ declare_class!(
|
||||||
|
|
||||||
// Observe theme change
|
// Observe theme change
|
||||||
#[method(effectiveAppearanceDidChange:)]
|
#[method(effectiveAppearanceDidChange:)]
|
||||||
fn effective_appearance_did_change(&self, sender: Option<&Object>) {
|
fn effective_appearance_did_change(&self, sender: Option<&AnyObject>) {
|
||||||
trace_scope!("Triggered `effectiveAppearanceDidChange:`");
|
trace_scope!("Triggered `effectiveAppearanceDidChange:`");
|
||||||
unsafe {
|
unsafe {
|
||||||
msg_send![
|
msg_send![
|
||||||
|
@ -402,7 +402,7 @@ declare_class!(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[method(effectiveAppearanceDidChangedOnMainThread:)]
|
#[method(effectiveAppearanceDidChangedOnMainThread:)]
|
||||||
fn effective_appearance_did_changed_on_main_thread(&self, _: Option<&Object>) {
|
fn effective_appearance_did_changed_on_main_thread(&self, _: Option<&AnyObject>) {
|
||||||
let theme = get_ns_theme();
|
let theme = get_ns_theme();
|
||||||
let mut shared_state = self
|
let mut shared_state = self
|
||||||
.window
|
.window
|
||||||
|
@ -416,7 +416,7 @@ declare_class!(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[method(windowDidChangeScreen:)]
|
#[method(windowDidChangeScreen:)]
|
||||||
fn window_did_change_screen(&self, _: Option<&Object>) {
|
fn window_did_change_screen(&self, _: Option<&AnyObject>) {
|
||||||
trace_scope!("windowDidChangeScreen:");
|
trace_scope!("windowDidChangeScreen:");
|
||||||
let is_simple_fullscreen = self
|
let is_simple_fullscreen = self
|
||||||
.window
|
.window
|
||||||
|
|
Loading…
Reference in a new issue