From 0165987fef47c5cbc7014b1f98efd50d6bfadcf1 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Tue, 1 Aug 2023 01:56:53 +0200 Subject: [PATCH] Fix `add_method` calls --- ARCHITECTURE.md | 6 +- src/appkit/app/delegate.rs | 81 +++++++++++------------- src/appkit/menu/item.rs | 4 +- src/appkit/toolbar/class.rs | 8 +-- src/appkit/window/class.rs | 78 +++++++++-------------- src/color/appkit_dynamic_color.rs | 89 ++++++++++----------------- src/image/appkit.rs | 2 +- src/input/appkit.rs | 13 ++-- src/input/uikit.rs | 10 +-- src/invoker.rs | 2 +- src/listview/appkit.rs | 33 ++++------ src/listview/row/appkit.rs | 24 +++----- src/scrollview/appkit.rs | 17 ++--- src/scrollview/uikit.rs | 12 ++-- src/uikit/app/delegate.rs | 6 +- src/uikit/scene/delegate.rs | 4 +- src/view/appkit.rs | 28 ++++----- src/view/controller/appkit.rs | 8 +-- src/view/controller/uikit.rs | 14 ++--- src/view/splitviewcontroller/ios.rs | 8 +-- src/view/splitviewcontroller/macos.rs | 8 +-- src/webview/class.rs | 21 +++---- src/webview/process_pool.rs | 2 +- 23 files changed, 192 insertions(+), 286 deletions(-) diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index ee3b68af..522399f6 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -360,7 +360,7 @@ pub(crate) fn register_view_class() -> *const Class { let superclass = class!(NSView); let mut decl = ClassDecl::new("RSTView", superclass).unwrap(); - decl.add_method(sel!(isFlipped), enforce_normalcy as extern "C" fn(&Object, _) -> BOOL); + decl.add_method(sel!(isFlipped), enforce_normalcy as extern "C" fn(_, _) -> _); decl.add_ivar::(BACKGROUND_COLOR); @@ -384,12 +384,12 @@ pub(crate) fn register_view_class_with_delegate(instance: &T) - decl.add_method( sel!(isFlipped), - enforce_normalcy as extern "C" fn(&Object, _) -> BOOL + enforce_normalcy as extern "C" fn(_, _) -> _, ); decl.add_method( sel!(draggingEntered:), - dragging_entered:: as extern "C" fn (&mut Object, _, _) -> NSUInteger + dragging_entered:: as extern "C" fn (_, _, _) -> _, ); }) } diff --git a/src/appkit/app/delegate.rs b/src/appkit/app/delegate.rs index 4296fbdd..f34c32b2 100644 --- a/src/appkit/app/delegate.rs +++ b/src/appkit/app/delegate.rs @@ -298,150 +298,141 @@ pub(crate) fn register_app_delegate_class() -> *co // Launching Applications decl.add_method( sel!(applicationWillFinishLaunching:), - will_finish_launching:: as extern "C" fn(&Object, _, _) + will_finish_launching:: as extern "C" fn(_, _, _) ); decl.add_method( sel!(applicationDidFinishLaunching:), - did_finish_launching:: as extern "C" fn(&Object, _, _) + did_finish_launching:: as extern "C" fn(_, _, _) ); // Managing Active Status decl.add_method( sel!(applicationWillBecomeActive:), - will_become_active:: as extern "C" fn(&Object, _, _) + will_become_active:: as extern "C" fn(_, _, _) ); decl.add_method( sel!(applicationDidBecomeActive:), - did_become_active:: as extern "C" fn(&Object, _, _) + did_become_active:: as extern "C" fn(_, _, _) ); decl.add_method( sel!(applicationWillResignActive:), - will_resign_active:: as extern "C" fn(&Object, _, _) + will_resign_active:: as extern "C" fn(_, _, _) ); decl.add_method( sel!(applicationDidResignActive:), - did_resign_active:: as extern "C" fn(&Object, _, _) + did_resign_active:: as extern "C" fn(_, _, _) ); // Terminating Applications decl.add_method( sel!(applicationShouldTerminate:), - should_terminate:: as extern "C" fn(&Object, _, _) -> NSUInteger - ); - decl.add_method( - sel!(applicationWillTerminate:), - will_terminate:: as extern "C" fn(&Object, _, _) + should_terminate:: as extern "C" fn(_, _, _) -> _ ); + decl.add_method(sel!(applicationWillTerminate:), will_terminate:: as extern "C" fn(_, _, _)); decl.add_method( sel!(applicationShouldTerminateAfterLastWindowClosed:), - should_terminate_after_last_window_closed:: as extern "C" fn(&Object, _, _) -> BOOL + should_terminate_after_last_window_closed:: as extern "C" fn(_, _, _) -> _ ); // Hiding Applications - decl.add_method(sel!(applicationWillHide:), will_hide:: as extern "C" fn(&Object, _, _)); - decl.add_method(sel!(applicationDidHide:), did_hide:: as extern "C" fn(&Object, _, _)); - decl.add_method(sel!(applicationWillUnhide:), will_unhide:: as extern "C" fn(&Object, _, _)); - decl.add_method(sel!(applicationDidUnhide:), did_unhide:: as extern "C" fn(&Object, _, _)); + decl.add_method(sel!(applicationWillHide:), will_hide:: as extern "C" fn(_, _, _)); + decl.add_method(sel!(applicationDidHide:), did_hide:: as extern "C" fn(_, _, _)); + decl.add_method(sel!(applicationWillUnhide:), will_unhide:: as extern "C" fn(_, _, _)); + decl.add_method(sel!(applicationDidUnhide:), did_unhide:: as extern "C" fn(_, _, _)); // Managing Windows - decl.add_method(sel!(applicationWillUpdate:), will_update:: as extern "C" fn(&Object, _, _)); - decl.add_method(sel!(applicationDidUpdate:), did_update:: as extern "C" fn(&Object, _, _)); + decl.add_method(sel!(applicationWillUpdate:), will_update:: as extern "C" fn(_, _, _)); + decl.add_method(sel!(applicationDidUpdate:), did_update:: as extern "C" fn(_, _, _)); decl.add_method( sel!(applicationShouldHandleReopen:hasVisibleWindows:), - should_handle_reopen:: as extern "C" fn(&Object, _, _, BOOL) -> BOOL + should_handle_reopen:: as extern "C" fn(_, _, _, _) -> _ ); // Dock Menu - decl.add_method( - sel!(applicationDockMenu:), - dock_menu:: as extern "C" fn(&Object, _, _) -> id - ); + decl.add_method(sel!(applicationDockMenu:), dock_menu:: as extern "C" fn(_, _, _) -> _); // Displaying Errors decl.add_method( sel!(application:willPresentError:), - will_present_error:: as extern "C" fn(&Object, _, _, id) -> id + will_present_error:: as extern "C" fn(_, _, _, _) -> _ ); // Managing the Screen decl.add_method( sel!(applicationDidChangeScreenParameters:), - did_change_screen_parameters:: as extern "C" fn(&Object, _, _) + did_change_screen_parameters:: as extern "C" fn(_, _, _) ); decl.add_method( sel!(applicationDidChangeOcclusionState:), - did_change_occlusion_state:: as extern "C" fn(&Object, _, _) + did_change_occlusion_state:: as extern "C" fn(_, _, _) ); // User Activities decl.add_method( sel!(application:willContinueUserActivityWithType:), - will_continue_user_activity_with_type:: as extern "C" fn(&Object, _, _, id) -> BOOL + will_continue_user_activity_with_type:: as extern "C" fn(_, _, _, _) -> _ ); decl.add_method( sel!(application:continueUserActivity:restorationHandler:), - continue_user_activity:: as extern "C" fn(&Object, _, _, id, id) -> BOOL + continue_user_activity:: as extern "C" fn(_, _, _, _, _) -> _ ); decl.add_method( sel!(application:didFailToContinueUserActivityWithType:error:), - failed_to_continue_user_activity:: as extern "C" fn(&Object, _, _, id, id) + failed_to_continue_user_activity:: as extern "C" fn(_, _, _, _, _) ); decl.add_method( sel!(application:didUpdateUserActivity:), - did_update_user_activity:: as extern "C" fn(&Object, _, _, id) + did_update_user_activity:: as extern "C" fn(_, _, _, _) ); // Handling push notifications decl.add_method( sel!(application:didRegisterForRemoteNotificationsWithDeviceToken:), - registered_for_remote_notifications:: as extern "C" fn(&Object, _, _, id) + registered_for_remote_notifications:: as extern "C" fn(_, _, _, _) ); decl.add_method( sel!(application:didFailToRegisterForRemoteNotificationsWithError:), - failed_to_register_for_remote_notifications:: as extern "C" fn(&Object, _, _, id) + failed_to_register_for_remote_notifications:: as extern "C" fn(_, _, _, _) ); decl.add_method( sel!(application:didReceiveRemoteNotification:), - did_receive_remote_notification:: as extern "C" fn(&Object, _, _, id) + did_receive_remote_notification:: as extern "C" fn(_, _, _, _) ); // CloudKit #[cfg(feature = "cloudkit")] decl.add_method( sel!(application:userDidAcceptCloudKitShareWithMetadata:), - accepted_cloudkit_share:: as extern "C" fn(&Object, _, _, id) + accepted_cloudkit_share:: as extern "C" fn(_, _, _, _) ); // Opening Files - decl.add_method( - sel!(application:openURLs:), - open_urls:: as extern "C" fn(&Object, _, _, id) - ); + decl.add_method(sel!(application:openURLs:), open_urls:: as extern "C" fn(_, _, _, _)); decl.add_method( sel!(application:openFileWithoutUI:), - open_file_without_ui:: as extern "C" fn(&Object, _, _, id) -> BOOL + open_file_without_ui:: as extern "C" fn(_, _, _, _) -> _ ); decl.add_method( sel!(applicationShouldOpenUntitledFile:), - should_open_untitled_file:: as extern "C" fn(&Object, _, _) -> BOOL + should_open_untitled_file:: as extern "C" fn(_, _, _) -> _ ); decl.add_method( sel!(applicationOpenUntitledFile:), - open_untitled_file:: as extern "C" fn(&Object, _, _) -> BOOL + open_untitled_file:: as extern "C" fn(_, _, _) -> _ ); decl.add_method( sel!(application:openTempFile:), - open_temp_file:: as extern "C" fn(&Object, _, _, id) -> BOOL + open_temp_file:: as extern "C" fn(_, _, _, _) -> _ ); // Printing decl.add_method( sel!(application:printFile:), - print_file:: as extern "C" fn(&Object, _, _, id) -> BOOL + print_file:: as extern "C" fn(_, _, _, _) -> _ ); decl.add_method( sel!(application:printFiles:withSettings:showPrintPanels:), - print_files:: as extern "C" fn(&Object, _, id, id, id, BOOL) -> NSUInteger + print_files:: as extern "C" fn(_, _, _, _, _, _) -> _ ); // @TODO: Restoring Application State @@ -450,7 +441,7 @@ pub(crate) fn register_app_delegate_class() -> *co // Scripting decl.add_method( sel!(application:delegateHandlesKey:), - delegate_handles_key:: as extern "C" fn(&Object, _, _, id) -> BOOL + delegate_handles_key:: as extern "C" fn(_, _, _, _) -> _ ); }) } diff --git a/src/appkit/menu/item.rs b/src/appkit/menu/item.rs index 69c0b91b..57f21f3a 100644 --- a/src/appkit/menu/item.rs +++ b/src/appkit/menu/item.rs @@ -318,7 +318,7 @@ pub(crate) fn register_menu_item_class() -> *const Class { load_or_register_class("NSMenuItem", "CacaoMenuItem", |decl| unsafe { decl.add_ivar::(BLOCK_PTR); - decl.add_method(sel!(dealloc), dealloc_cacao_menuitem as extern "C" fn(&Object, _)); - decl.add_method(sel!(fireBlockAction:), fire_block_action as extern "C" fn(&Object, _, id)); + decl.add_method(sel!(dealloc), dealloc_cacao_menuitem as extern "C" fn(_, _)); + decl.add_method(sel!(fireBlockAction:), fire_block_action as extern "C" fn(_, _, _)); }) } diff --git a/src/appkit/toolbar/class.rs b/src/appkit/toolbar/class.rs index 8e190972..29139fcb 100644 --- a/src/appkit/toolbar/class.rs +++ b/src/appkit/toolbar/class.rs @@ -73,19 +73,19 @@ pub(crate) fn register_toolbar_class(instance: &T) -> *const // Add callback methods decl.add_method( sel!(toolbarAllowedItemIdentifiers:), - allowed_item_identifiers:: as extern "C" fn(&Object, _, _) -> id + allowed_item_identifiers:: as extern "C" fn(_, _, _) -> _ ); decl.add_method( sel!(toolbarDefaultItemIdentifiers:), - default_item_identifiers:: as extern "C" fn(&Object, _, _) -> id + default_item_identifiers:: as extern "C" fn(_, _, _) -> _ ); decl.add_method( sel!(toolbarSelectableItemIdentifiers:), - selectable_item_identifiers:: as extern "C" fn(&Object, _, _) -> id + selectable_item_identifiers:: as extern "C" fn(_, _, _) -> _ ); decl.add_method( sel!(toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar:), - item_for_identifier:: as extern "C" fn(&Object, _, _, _, _) -> id + item_for_identifier:: as extern "C" fn(_, _, _, _, _) -> _ ); }) } diff --git a/src/appkit/window/class.rs b/src/appkit/window/class.rs index 9cf662b8..19dca2a6 100644 --- a/src/appkit/window/class.rs +++ b/src/appkit/window/class.rs @@ -232,112 +232,94 @@ pub(crate) fn register_window_class_with_delegate(instance: & decl.add_ivar::(WINDOW_DELEGATE_PTR); // NSWindowDelegate methods - decl.add_method( - sel!(windowShouldClose:), - should_close:: as extern "C" fn(&Object, _, _) -> BOOL - ); - decl.add_method(sel!(windowWillClose:), will_close:: as extern "C" fn(&Object, _, _)); + decl.add_method(sel!(windowShouldClose:), should_close:: as extern "C" fn(_, _, _) -> _); + decl.add_method(sel!(windowWillClose:), will_close:: as extern "C" fn(_, _, _)); // Sizing decl.add_method( sel!(windowWillResize:toSize:), - will_resize:: as extern "C" fn(&Object, _, _, CGSize) -> CGSize + will_resize:: as extern "C" fn(_, _, _, _) -> _ ); - decl.add_method(sel!(windowDidResize:), did_resize:: as extern "C" fn(&Object, _, _)); + decl.add_method(sel!(windowDidResize:), did_resize:: as extern "C" fn(_, _, _)); decl.add_method( sel!(windowWillStartLiveResize:), - will_start_live_resize:: as extern "C" fn(&Object, _, _) + will_start_live_resize:: as extern "C" fn(_, _, _) ); decl.add_method( sel!(windowDidEndLiveResize:), - did_end_live_resize:: as extern "C" fn(&Object, _, _) + did_end_live_resize:: as extern "C" fn(_, _, _) ); // Minimizing - decl.add_method( - sel!(windowWillMiniaturize:), - will_miniaturize:: as extern "C" fn(&Object, _, _) - ); - decl.add_method( - sel!(windowDidMiniaturize:), - did_miniaturize:: as extern "C" fn(&Object, _, _) - ); + decl.add_method(sel!(windowWillMiniaturize:), will_miniaturize:: as extern "C" fn(_, _, _)); + decl.add_method(sel!(windowDidMiniaturize:), did_miniaturize:: as extern "C" fn(_, _, _)); decl.add_method( sel!(windowDidDeminiaturize:), - did_deminiaturize:: as extern "C" fn(&Object, _, _) + did_deminiaturize:: as extern "C" fn(_, _, _) ); // Full Screen decl.add_method( sel!(window:willUseFullScreenContentSize:), - content_size_for_full_screen:: as extern "C" fn(&Object, _, _, CGSize) -> CGSize + content_size_for_full_screen:: as extern "C" fn(_, _, _, _) -> _ ); decl.add_method( sel!(window:willUseFullScreenPresentationOptions:), - options_for_full_screen:: as extern "C" fn(&Object, _, _, NSUInteger) -> NSUInteger + options_for_full_screen:: as extern "C" fn(_, _, _, _) -> _ ); decl.add_method( sel!(windowWillEnterFullScreen:), - will_enter_full_screen:: as extern "C" fn(&Object, _, _) + will_enter_full_screen:: as extern "C" fn(_, _, _) ); decl.add_method( sel!(windowDidEnterFullScreen:), - did_enter_full_screen:: as extern "C" fn(&Object, _, _) + did_enter_full_screen:: as extern "C" fn(_, _, _) ); decl.add_method( sel!(windowWillExitFullScreen:), - will_exit_full_screen:: as extern "C" fn(&Object, _, _) + will_exit_full_screen:: as extern "C" fn(_, _, _) ); decl.add_method( sel!(windowDidExitFullScreen:), - did_exit_full_screen:: as extern "C" fn(&Object, _, _) + did_exit_full_screen:: as extern "C" fn(_, _, _) ); decl.add_method( sel!(windowDidFailToEnterFullScreen:), - did_fail_to_enter_full_screen:: as extern "C" fn(&Object, _, _) + did_fail_to_enter_full_screen:: as extern "C" fn(_, _, _) ); decl.add_method( sel!(windowDidFailToExitFullScreen:), - did_fail_to_exit_full_screen:: as extern "C" fn(&Object, _, _) + did_fail_to_exit_full_screen:: as extern "C" fn(_, _, _) ); // Key status - decl.add_method(sel!(windowDidBecomeKey:), did_become_key:: as extern "C" fn(&Object, _, _)); - decl.add_method(sel!(windowDidResignKey:), did_resign_key:: as extern "C" fn(&Object, _, _)); + decl.add_method(sel!(windowDidBecomeKey:), did_become_key:: as extern "C" fn(_, _, _)); + decl.add_method(sel!(windowDidResignKey:), did_resign_key:: as extern "C" fn(_, _, _)); // Main status - decl.add_method( - sel!(windowDidBecomeMain:), - did_become_main:: as extern "C" fn(&Object, _, _) - ); - decl.add_method( - sel!(windowDidResignMain:), - did_resign_main:: as extern "C" fn(&Object, _, _) - ); + decl.add_method(sel!(windowDidBecomeMain:), did_become_main:: as extern "C" fn(_, _, _)); + decl.add_method(sel!(windowDidResignMain:), did_resign_main:: as extern "C" fn(_, _, _)); // Moving Windows - decl.add_method(sel!(windowWillMove:), will_move:: as extern "C" fn(&Object, _, _)); - decl.add_method(sel!(windowDidMove:), did_move:: as extern "C" fn(&Object, _, _)); - decl.add_method( - sel!(windowDidChangeScreen:), - did_change_screen:: as extern "C" fn(&Object, _, _) - ); + decl.add_method(sel!(windowWillMove:), will_move:: as extern "C" fn(_, _, _)); + decl.add_method(sel!(windowDidMove:), did_move:: as extern "C" fn(_, _, _)); + decl.add_method(sel!(windowDidChangeScreen:), did_change_screen:: as extern "C" fn(_, _, _)); decl.add_method( sel!(windowDidChangeScreenProfile:), - did_change_screen_profile:: as extern "C" fn(&Object, _, _) + did_change_screen_profile:: as extern "C" fn(_, _, _) ); decl.add_method( sel!(windowDidChangeBackingProperties:), - did_change_backing_properties:: as extern "C" fn(&Object, _, _) + did_change_backing_properties:: as extern "C" fn(_, _, _) ); // Random decl.add_method( sel!(windowDidChangeOcclusionState:), - did_change_occlusion_state:: as extern "C" fn(&Object, _, _) + did_change_occlusion_state:: as extern "C" fn(_, _, _) ); - decl.add_method(sel!(windowDidExpose:), did_expose:: as extern "C" fn(&Object, _, _)); - decl.add_method(sel!(windowDidUpdate:), did_update:: as extern "C" fn(&Object, _, _)); - decl.add_method(sel!(cancelOperation:), cancel:: as extern "C" fn(&Object, _, _)); + decl.add_method(sel!(windowDidExpose:), did_expose:: as extern "C" fn(_, _, _)); + decl.add_method(sel!(windowDidUpdate:), did_update:: as extern "C" fn(_, _, _)); + decl.add_method(sel!(cancelOperation:), cancel:: as extern "C" fn(_, _, _)); }) } diff --git a/src/color/appkit_dynamic_color.rs b/src/color/appkit_dynamic_color.rs index 3f4664be..d0cd0946 100644 --- a/src/color/appkit_dynamic_color.rs +++ b/src/color/appkit_dynamic_color.rs @@ -256,92 +256,65 @@ extern "C" fn color_with_system_effect(this: &Object, _: Sel, effect: NSInteger) pub(crate) fn register_class() -> *const Class { load_or_register_class("NSColor", "CacaoDynamicColor", |decl| unsafe { // These methods all need to be forwarded, so let's hook them up. - decl.add_method(sel!(colorSpace), color_space as extern "C" fn(&Object, _) -> id); + decl.add_method(sel!(colorSpace), color_space as extern "C" fn(_, _) -> _); decl.add_method( sel!(colorUsingColorSpace:), - color_using_color_space as extern "C" fn(&Object, _, id) -> id + color_using_color_space as extern "C" fn(_, _, _) -> _ ); - decl.add_method(sel!(colorSpaceName), color_space_name as extern "C" fn(&Object, _) -> id); + decl.add_method(sel!(colorSpaceName), color_space_name as extern "C" fn(_, _) -> _); decl.add_method( sel!(colorUsingColorSpaceName:), - color_using_color_space_name as extern "C" fn(&Object, _, id) -> id - ); - decl.add_method( - sel!(numberOfComponents), - number_of_components as extern "C" fn(&Object, _) -> NSInteger + color_using_color_space_name as extern "C" fn(_, _, _) -> _ ); + decl.add_method(sel!(numberOfComponents), number_of_components as extern "C" fn(_, _) -> _); - decl.add_method(sel!(getComponents:), get_components as extern "C" fn(&Object, _, CGFloat)); - decl.add_method( - sel!(getRed:green:blue:alpha:), - get_rgba as extern "C" fn(&Object, _, CGFloat, CGFloat, CGFloat, CGFloat) - ); - decl.add_method(sel!(redComponent), red_component as extern "C" fn(&Object, _) -> CGFloat); - decl.add_method(sel!(greenComponent), green_component as extern "C" fn(&Object, _) -> CGFloat); - decl.add_method(sel!(blueComponent), blue_component as extern "C" fn(&Object, _) -> CGFloat); + decl.add_method(sel!(getComponents:), get_components as extern "C" fn(_, _, _)); + decl.add_method(sel!(getRed:green:blue:alpha:), get_rgba as extern "C" fn(_, _, _, _, _, _)); + decl.add_method(sel!(redComponent), red_component as extern "C" fn(_, _) -> _); + decl.add_method(sel!(greenComponent), green_component as extern "C" fn(_, _) -> _); + decl.add_method(sel!(blueComponent), blue_component as extern "C" fn(_, _) -> _); - decl.add_method(sel!(hueComponent), hue_component as extern "C" fn(&Object, _) -> CGFloat); - decl.add_method( - sel!(saturationComponent), - saturation_component as extern "C" fn(&Object, _) -> CGFloat - ); - decl.add_method( - sel!(brightnessComponent), - brightness_component as extern "C" fn(&Object, _) -> CGFloat - ); + decl.add_method(sel!(hueComponent), hue_component as extern "C" fn(_, _) -> _); + decl.add_method(sel!(saturationComponent), saturation_component as extern "C" fn(_, _) -> _); + decl.add_method(sel!(brightnessComponent), brightness_component as extern "C" fn(_, _) -> _); decl.add_method( sel!(getHue:saturation:brightness:alpha:), - get_hsba as extern "C" fn(&Object, _, CGFloat, CGFloat, CGFloat, CGFloat) + get_hsba as extern "C" fn(_, _, _, _, _, _) ); - decl.add_method(sel!(whiteComponent), white_component as extern "C" fn(&Object, _) -> CGFloat); - decl.add_method( - sel!(getWhite:alpha:), - get_white as extern "C" fn(&Object, _, CGFloat, CGFloat) - ); + decl.add_method(sel!(whiteComponent), white_component as extern "C" fn(_, _) -> _); + decl.add_method(sel!(getWhite:alpha:), get_white as extern "C" fn(_, _, _, _)); - decl.add_method(sel!(cyanComponent), cyan_component as extern "C" fn(&Object, _) -> CGFloat); - decl.add_method( - sel!(magentaComponent), - magenta_component as extern "C" fn(&Object, _) -> CGFloat - ); - decl.add_method( - sel!(yellowComponent), - yellow_component as extern "C" fn(&Object, _) -> CGFloat - ); - decl.add_method(sel!(blackComponent), black_component as extern "C" fn(&Object, _) -> CGFloat); + decl.add_method(sel!(cyanComponent), cyan_component as extern "C" fn(_, _) -> _); + decl.add_method(sel!(magentaComponent), magenta_component as extern "C" fn(_, _) -> _); + decl.add_method(sel!(yellowComponent), yellow_component as extern "C" fn(_, _) -> _); + decl.add_method(sel!(blackComponent), black_component as extern "C" fn(_, _) -> _); decl.add_method( sel!(getCyan:magenta:yellow:black:alpha:), - get_cmyk as extern "C" fn(&Object, _, CGFloat, CGFloat, CGFloat, CGFloat, CGFloat) + get_cmyk as extern "C" fn(_, _, _, _, _, _, _) ); - decl.add_method(sel!(alphaComponent), alpha_component as extern "C" fn(&Object, _) -> CGFloat); + decl.add_method(sel!(alphaComponent), alpha_component as extern "C" fn(_, _) -> _); - decl.add_method(sel!(CGColor), cg_color as extern "C" fn(&Object, _) -> id); - decl.add_method(sel!(setStroke), set_stroke as extern "C" fn(&Object, _)); - decl.add_method(sel!(setFill), set_fill as extern "C" fn(&Object, _)); - decl.add_method(sel!(set), call_set as extern "C" fn(&Object, _)); + decl.add_method(sel!(CGColor), cg_color as extern "C" fn(_, _) -> _); + decl.add_method(sel!(setStroke), set_stroke as extern "C" fn(_, _)); + decl.add_method(sel!(setFill), set_fill as extern "C" fn(_, _)); + decl.add_method(sel!(set), call_set as extern "C" fn(_, _)); - decl.add_method( - sel!(highlightWithLevel:), - highlight_with_level as extern "C" fn(&Object, _, CGFloat) -> id - ); - decl.add_method( - sel!(shadowWithLevel:), - shadow_with_level as extern "C" fn(&Object, _, CGFloat) -> id - ); + decl.add_method(sel!(highlightWithLevel:), highlight_with_level as extern "C" fn(_, _, _) -> _); + decl.add_method(sel!(shadowWithLevel:), shadow_with_level as extern "C" fn(_, _, _) -> _); decl.add_method( sel!(colorWithAlphaComponent:), - color_with_alpha_component as extern "C" fn(&Object, _, CGFloat) -> id + color_with_alpha_component as extern "C" fn(_, _, _) -> _ ); decl.add_method( sel!(blendedColorWithFraction:ofColor:), - blended_color as extern "C" fn(&Object, _, CGFloat, id) -> id + blended_color as extern "C" fn(_, _, _, _) -> _ ); decl.add_method( sel!(colorWithSystemEffect:), - color_with_system_effect as extern "C" fn(&Object, _, NSInteger) -> id + color_with_system_effect as extern "C" fn(_, _, _) -> _ ); decl.add_ivar::(AQUA_LIGHT_COLOR_NORMAL_CONTRAST); diff --git a/src/image/appkit.rs b/src/image/appkit.rs index 2af6d950..e558b0df 100644 --- a/src/image/appkit.rs +++ b/src/image/appkit.rs @@ -16,6 +16,6 @@ use crate::foundation::load_or_register_class; /// used if there's no delegates. pub(crate) fn register_image_view_class() -> *const Class { load_or_register_class("NSImageView", "RSTImageView", |decl| unsafe { - //decl.add_method(sel!(isFlipped), enforce_normalcy as extern "C" fn(&Object, _) -> BOOL); + //decl.add_method(sel!(isFlipped), enforce_normalcy as extern "C" fn(_, _) -> _); }) } diff --git a/src/input/appkit.rs b/src/input/appkit.rs index b6aa2107..4c8495c9 100644 --- a/src/input/appkit.rs +++ b/src/input/appkit.rs @@ -58,22 +58,19 @@ pub(crate) fn register_view_class_with_delegate(instance: // move. decl.add_ivar::(TEXTFIELD_DELEGATE_PTR); - decl.add_method( - sel!(textDidEndEditing:), - text_did_end_editing:: as extern "C" fn(&mut Object, _, _) - ); + decl.add_method(sel!(textDidEndEditing:), text_did_end_editing:: as extern "C" fn(_, _, _)); decl.add_method( sel!(textDidBeginEditing:), - text_did_begin_editing:: as extern "C" fn(&mut Object, _, _) + text_did_begin_editing:: as extern "C" fn(_, _, _) ); - decl.add_method(sel!(textDidChange:), text_did_change:: as extern "C" fn(&mut Object, _, _)); + decl.add_method(sel!(textDidChange:), text_did_change:: as extern "C" fn(_, _, _)); decl.add_method( sel!(textShouldBeginEditing:), - text_should_begin_editing:: as extern "C" fn(&mut Object, Sel, id) -> BOOL + text_should_begin_editing:: as extern "C" fn(_, _, _) -> _ ); decl.add_method( sel!(textShouldEndEditing:), - text_should_end_editing:: as extern "C" fn(&mut Object, Sel, id) -> BOOL + text_should_end_editing:: as extern "C" fn(_, _, _) -> _ ); }) } diff --git a/src/input/uikit.rs b/src/input/uikit.rs index 1c92f81c..66a9366f 100644 --- a/src/input/uikit.rs +++ b/src/input/uikit.rs @@ -73,23 +73,23 @@ pub(crate) fn register_view_class_with_delegate(instance: decl.add_method( sel!(textFieldDidEndEditing:), - text_did_end_editing:: as extern "C" fn(&mut Object, _, _) + text_did_end_editing:: as extern "C" fn(_, _, _) ); decl.add_method( sel!(textFieldDidBeginEditing:), - text_did_begin_editing:: as extern "C" fn(&mut Object, _, _) + text_did_begin_editing:: as extern "C" fn(_, _, _) ); decl.add_method( sel!(textFieldDidChangeSelection:), - text_did_change:: as extern "C" fn(&mut Object, _, _) + text_did_change:: as extern "C" fn(_, _, _) ); decl.add_method( sel!(textFieldShouldBeginEditing:), - text_should_begin_editing:: as extern "C" fn(&mut Object, Sel, id) -> BOOL + text_should_begin_editing:: as extern "C" fn(_, _, _) -> _ ); decl.add_method( sel!(textFieldShouldEndEditing:), - text_should_end_editing:: as extern "C" fn(&mut Object, Sel, id) -> BOOL + text_should_end_editing:: as extern "C" fn(_, _, _) -> _ ); }) } diff --git a/src/invoker.rs b/src/invoker.rs index e0aa4e09..28c0edf2 100644 --- a/src/invoker.rs +++ b/src/invoker.rs @@ -94,6 +94,6 @@ extern "C" fn perform(this: &mut Object, _: Sel, pub(crate) fn register_invoker_class() -> *const Class { load_or_register_class("NSObject", "RSTTargetActionHandler", |decl| unsafe { decl.add_ivar::(ACTION_CALLBACK_PTR); - decl.add_method(sel!(perform:), perform:: as extern "C" fn(&mut Object, _, id)); + decl.add_method(sel!(perform:), perform:: as extern "C" fn(_, _, _)); }) } diff --git a/src/listview/appkit.rs b/src/listview/appkit.rs index 728bb57d..5a66f388 100644 --- a/src/listview/appkit.rs +++ b/src/listview/appkit.rs @@ -193,58 +193,49 @@ pub(crate) fn register_listview_class_with_delegate(instanc load_or_register_class("NSTableView", instance.subclass_name(), |decl| unsafe { decl.add_ivar::(LISTVIEW_DELEGATE_PTR); - decl.add_method(sel!(isFlipped), enforce_normalcy as extern "C" fn(&Object, _) -> BOOL); + decl.add_method(sel!(isFlipped), enforce_normalcy as extern "C" fn(_, _) -> _); // Tableview-specific decl.add_method( sel!(numberOfRowsInTableView:), - number_of_items:: as extern "C" fn(&Object, _, id) -> NSInteger + number_of_items:: as extern "C" fn(_, _, _) -> _ ); decl.add_method( sel!(tableView:willDisplayCell:forTableColumn:row:), - will_display_cell:: as extern "C" fn(&Object, _, id, id, id, NSInteger) + will_display_cell:: as extern "C" fn(_, _, _, _, _, _) ); decl.add_method( sel!(tableView:viewForTableColumn:row:), - view_for_column:: as extern "C" fn(&Object, _, id, id, NSInteger) -> id + view_for_column:: as extern "C" fn(_, _, _, _, _) -> _ ); decl.add_method( sel!(tableViewSelectionDidChange:), - selection_did_change:: as extern "C" fn(&Object, _, id) + selection_did_change:: as extern "C" fn(_, _, _) ); decl.add_method( sel!(tableView:rowActionsForRow:edge:), - row_actions_for_row:: as extern "C" fn(&Object, _, id, NSInteger, NSInteger) -> id + row_actions_for_row:: as extern "C" fn(_, _, _, _, _) -> _ ); // A slot for some menu handling; we just let it be done here for now rather than do the // whole delegate run, since things are fast enough nowadays to just replace the entire // menu. - decl.add_method( - sel!(menuNeedsUpdate:), - menu_needs_update:: as extern "C" fn(&Object, _, id) - ); + decl.add_method(sel!(menuNeedsUpdate:), menu_needs_update:: as extern "C" fn(_, _, _)); // Drag and drop operations (e.g, accepting files) - decl.add_method( - sel!(draggingEntered:), - dragging_entered:: as extern "C" fn(&mut Object, _, _) -> NSUInteger - ); + decl.add_method(sel!(draggingEntered:), dragging_entered:: as extern "C" fn(_, _, _) -> _); decl.add_method( sel!(prepareForDragOperation:), - prepare_for_drag_operation:: as extern "C" fn(&mut Object, _, _) -> BOOL + prepare_for_drag_operation:: as extern "C" fn(_, _, _) -> _ ); decl.add_method( sel!(performDragOperation:), - perform_drag_operation:: as extern "C" fn(&mut Object, _, _) -> BOOL + perform_drag_operation:: as extern "C" fn(_, _, _) -> _ ); decl.add_method( sel!(concludeDragOperation:), - conclude_drag_operation:: as extern "C" fn(&mut Object, _, _) - ); - decl.add_method( - sel!(draggingExited:), - dragging_exited:: as extern "C" fn(&mut Object, _, _) + conclude_drag_operation:: as extern "C" fn(_, _, _) ); + decl.add_method(sel!(draggingExited:), dragging_exited:: as extern "C" fn(_, _, _)); }) } diff --git a/src/listview/row/appkit.rs b/src/listview/row/appkit.rs index fd2131f9..253cc899 100644 --- a/src/listview/row/appkit.rs +++ b/src/listview/row/appkit.rs @@ -105,7 +105,7 @@ extern "C" fn dealloc(this: &Object, _: Sel) { /// used if there's no delegates. pub(crate) fn register_listview_row_class() -> *const Class { load_or_register_class("NSView", "RSTTableViewRow", |decl| unsafe { - decl.add_method(sel!(isFlipped), enforce_normalcy as extern "C" fn(&Object, _) -> BOOL); + decl.add_method(sel!(isFlipped), enforce_normalcy as extern "C" fn(_, _) -> _); }) } @@ -118,32 +118,26 @@ pub(crate) fn register_listview_row_class_with_delegate() -> *c decl.add_ivar::(LISTVIEW_ROW_DELEGATE_PTR); decl.add_ivar::(BACKGROUND_COLOR); - decl.add_method(sel!(isFlipped), enforce_normalcy as extern "C" fn(&Object, _) -> BOOL); - decl.add_method(sel!(updateLayer), update_layer as extern "C" fn(&Object, _)); + decl.add_method(sel!(isFlipped), enforce_normalcy as extern "C" fn(_, _) -> _); + decl.add_method(sel!(updateLayer), update_layer as extern "C" fn(_, _)); // Drag and drop operations (e.g, accepting files) - decl.add_method( - sel!(draggingEntered:), - dragging_entered:: as extern "C" fn(&mut Object, _, _) -> NSUInteger - ); + decl.add_method(sel!(draggingEntered:), dragging_entered:: as extern "C" fn(_, _, _) -> _); decl.add_method( sel!(prepareForDragOperation:), - prepare_for_drag_operation:: as extern "C" fn(&mut Object, _, _) -> BOOL + prepare_for_drag_operation:: as extern "C" fn(_, _, _) -> _ ); decl.add_method( sel!(performDragOperation:), - perform_drag_operation:: as extern "C" fn(&mut Object, _, _) -> BOOL + perform_drag_operation:: as extern "C" fn(_, _, _) -> _ ); decl.add_method( sel!(concludeDragOperation:), - conclude_drag_operation:: as extern "C" fn(&mut Object, _, _) - ); - decl.add_method( - sel!(draggingExited:), - dragging_exited:: as extern "C" fn(&mut Object, _, _) + conclude_drag_operation:: as extern "C" fn(_, _, _) ); + decl.add_method(sel!(draggingExited:), dragging_exited:: as extern "C" fn(_, _, _)); // Cleanup - decl.add_method(sel!(dealloc), dealloc:: as extern "C" fn(&Object, _)); + decl.add_method(sel!(dealloc), dealloc:: as extern "C" fn(_, _)); }) } diff --git a/src/scrollview/appkit.rs b/src/scrollview/appkit.rs index 87acd178..fc1de0ff 100644 --- a/src/scrollview/appkit.rs +++ b/src/scrollview/appkit.rs @@ -85,28 +85,21 @@ pub(crate) fn register_scrollview_class_with_delegate() - // move. decl.add_ivar::(SCROLLVIEW_DELEGATE_PTR); - decl.add_method(sel!(isFlipped), enforce_normalcy as extern "C" fn(&Object, _) -> BOOL); + decl.add_method(sel!(isFlipped), enforce_normalcy as extern "C" fn(_, _) -> _); // Drag and drop operations (e.g, accepting files) - decl.add_method( - sel!(draggingEntered:), - dragging_entered:: as extern "C" fn(&mut Object, _, _) -> NSUInteger - ); + decl.add_method(sel!(draggingEntered:), dragging_entered:: as extern "C" fn(_, _, _) -> _); decl.add_method( sel!(prepareForDragOperation:), - prepare_for_drag_operation:: as extern "C" fn(&mut Object, _, _) -> BOOL + prepare_for_drag_operation:: as extern "C" fn(_, _, _) -> _ ); decl.add_method( sel!(performDragOperation:), - perform_drag_operation:: as extern "C" fn(&mut Object, _, _) -> BOOL + perform_drag_operation:: as extern "C" fn(_, _, _) -> _ ); decl.add_method( sel!(concludeDragOperation:), - conclude_drag_operation:: as extern "C" fn(&mut Object, _, _) - ); - decl.add_method( - sel!(draggingExited:), - dragging_exited:: as extern "C" fn(&mut Object, _, _) + conclude_drag_operation:: as extern "C" fn(_, _, _) ); }) } diff --git a/src/scrollview/uikit.rs b/src/scrollview/uikit.rs index da42fdd1..c9ecbf9f 100644 --- a/src/scrollview/uikit.rs +++ b/src/scrollview/uikit.rs @@ -105,29 +105,29 @@ pub(crate) fn register_scrollview_class_with_delegate() - // move. decl.add_ivar::(SCROLLVIEW_DELEGATE_PTR); - decl.add_method(sel!(isFlipped), enforce_normalcy as extern "C" fn(&Object, _) -> BOOL); + decl.add_method(sel!(isFlipped), enforce_normalcy as extern "C" fn(_, _) -> _); /* // Drag and drop operations (e.g, accepting files) decl.add_method( sel!(draggingEntered:), - dragging_entered:: as extern "C" fn(&mut Object, _, _) -> NSUInteger + dragging_entered:: as extern "C" fn(_, _, _) -> _ ); decl.add_method( sel!(prepareForDragOperation:), - prepare_for_drag_operation:: as extern "C" fn(&mut Object, _, _) -> BOOL + prepare_for_drag_operation:: as extern "C" fn(_, _, _) -> _ ); decl.add_method( sel!(performDragOperation:), - perform_drag_operation:: as extern "C" fn(&mut Object, _, _) -> BOOL + perform_drag_operation:: as extern "C" fn(_, _, _) -> _ ); decl.add_method( sel!(concludeDragOperation:), - conclude_drag_operation:: as extern "C" fn(&mut Object, _, _) + conclude_drag_operation:: as extern "C" fn(_, _, _) ); decl.add_method( sel!(draggingExited:), - dragging_exited:: as extern "C" fn(&mut Object, _, _) + dragging_exited:: as extern "C" fn(_, _, _) ); */ diff --git a/src/uikit/app/delegate.rs b/src/uikit/app/delegate.rs index 2f8c4fbb..b9ed6a8a 100644 --- a/src/uikit/app/delegate.rs +++ b/src/uikit/app/delegate.rs @@ -47,17 +47,17 @@ pub(crate) fn register_app_delegate_class() -> *const Class { // Launching Applications decl.add_method( sel!(application:didFinishLaunchingWithOptions:), - did_finish_launching:: as extern "C" fn(&Object, _, _, id) -> BOOL + did_finish_launching:: as extern "C" fn(_, _, _, _) -> _ ); // Scenes decl.add_method( sel!(application:configurationForConnectingSceneSession:options:), - configuration_for_scene_session:: as extern "C" fn(&Object, _, _, id, id) -> id + configuration_for_scene_session:: as extern "C" fn(_, _, _, _, _) -> _ ); /*decl.add_method( sel!(application:didDiscardSceneSessions:), - did_discard_scene_sessions:: as extern "C" fn(&Object, _, _, id) + did_discard_scene_sessions:: as extern "C" fn(_, _, _, _) );*/ }) } diff --git a/src/uikit/scene/delegate.rs b/src/uikit/scene/delegate.rs index ac11c3f9..1b80b409 100644 --- a/src/uikit/scene/delegate.rs +++ b/src/uikit/scene/delegate.rs @@ -55,12 +55,12 @@ pub(crate) fn register_window_scene_delegate_class as extern "C" fn(&mut Object, _) -> id); + decl.add_method(sel!(init), init:: as extern "C" fn(_, _) -> _); // UIWindowSceneDelegate API decl.add_method( sel!(scene:willConnectToSession:options:), - scene_will_connect_to_session_with_options:: as extern "C" fn(&Object, _, _, _, _) + scene_will_connect_to_session_with_options:: as extern "C" fn(_, _, _, _, _) ); }) } diff --git a/src/view/appkit.rs b/src/view/appkit.rs index de7058a6..0aa92eb5 100644 --- a/src/view/appkit.rs +++ b/src/view/appkit.rs @@ -91,9 +91,9 @@ extern "C" fn update_layer(this: &Object, _: Sel) { /// used if there's no delegates. pub(crate) fn register_view_class() -> *const Class { load_or_register_class("NSView", "RSTView", |decl| unsafe { - decl.add_method(sel!(isFlipped), enforce_normalcy as extern "C" fn(&Object, _) -> BOOL); - decl.add_method(sel!(updateLayer), update_layer as extern "C" fn(&Object, _)); - decl.add_method(sel!(wantsUpdateLayer), enforce_normalcy as extern "C" fn(&Object, _) -> BOOL); + decl.add_method(sel!(isFlipped), enforce_normalcy as extern "C" fn(_, _) -> _); + decl.add_method(sel!(updateLayer), update_layer as extern "C" fn(_, _)); + decl.add_method(sel!(wantsUpdateLayer), enforce_normalcy as extern "C" fn(_, _) -> _); decl.add_ivar::(BACKGROUND_COLOR); }) @@ -108,36 +108,30 @@ pub(crate) fn register_view_class_with_delegate(instance: &T) - decl.add_ivar::(VIEW_DELEGATE_PTR); decl.add_ivar::(BACKGROUND_COLOR); - decl.add_method(sel!(updateLayer), update_layer as extern "C" fn(&Object, _)); + decl.add_method(sel!(updateLayer), update_layer as extern "C" fn(_, _)); - decl.add_method(sel!(wantsUpdateLayer), enforce_normalcy as extern "C" fn(&Object, _) -> BOOL); + decl.add_method(sel!(wantsUpdateLayer), enforce_normalcy as extern "C" fn(_, _) -> _); - decl.add_method(sel!(isFlipped), enforce_normalcy as extern "C" fn(&Object, _) -> BOOL); + decl.add_method(sel!(isFlipped), enforce_normalcy as extern "C" fn(_, _) -> _); // Drag and drop operations (e.g, accepting files) - decl.add_method( - sel!(draggingEntered:), - dragging_entered:: as extern "C" fn(&mut Object, _, _) -> NSUInteger - ); + decl.add_method(sel!(draggingEntered:), dragging_entered:: as extern "C" fn(_, _, _) -> _); decl.add_method( sel!(prepareForDragOperation:), - prepare_for_drag_operation:: as extern "C" fn(&mut Object, _, _) -> BOOL + prepare_for_drag_operation:: as extern "C" fn(_, _, _) -> _ ); decl.add_method( sel!(performDragOperation:), - perform_drag_operation:: as extern "C" fn(&mut Object, _, _) -> BOOL + perform_drag_operation:: as extern "C" fn(_, _, _) -> _ ); decl.add_method( sel!(concludeDragOperation:), - conclude_drag_operation:: as extern "C" fn(&mut Object, _, _) + conclude_drag_operation:: as extern "C" fn(_, _, _) ); - decl.add_method( - sel!(draggingExited:), - dragging_exited:: as extern "C" fn(&mut Object, _, _) - ); + decl.add_method(sel!(draggingExited:), dragging_exited:: as extern "C" fn(_, _, _)); }) } diff --git a/src/view/controller/appkit.rs b/src/view/controller/appkit.rs index 2bfe7ec9..45fb03a4 100644 --- a/src/view/controller/appkit.rs +++ b/src/view/controller/appkit.rs @@ -55,9 +55,9 @@ pub(crate) fn register_view_controller_class(instance load_or_register_class("NSViewController", instance.subclass_name(), |decl| unsafe { decl.add_ivar::(VIEW_DELEGATE_PTR); - decl.add_method(sel!(viewWillAppear), will_appear:: as extern "C" fn(&mut Object, _)); - decl.add_method(sel!(viewDidAppear), did_appear:: as extern "C" fn(&mut Object, _)); - decl.add_method(sel!(viewWillDisappear), will_disappear:: as extern "C" fn(&mut Object, _)); - decl.add_method(sel!(viewDidDisappear), did_disappear:: as extern "C" fn(&mut Object, _)); + decl.add_method(sel!(viewWillAppear), will_appear:: as extern "C" fn(_, _)); + decl.add_method(sel!(viewDidAppear), did_appear:: as extern "C" fn(_, _)); + decl.add_method(sel!(viewWillDisappear), will_disappear:: as extern "C" fn(_, _)); + decl.add_method(sel!(viewDidDisappear), did_disappear:: as extern "C" fn(_, _)); }) } diff --git a/src/view/controller/uikit.rs b/src/view/controller/uikit.rs index 4c59a86c..9598dd51 100644 --- a/src/view/controller/uikit.rs +++ b/src/view/controller/uikit.rs @@ -55,15 +55,9 @@ pub(crate) fn register_view_controller_class(instance load_or_register_class("UIViewController", instance.subclass_name(), |decl| unsafe { decl.add_ivar::(VIEW_DELEGATE_PTR); - decl.add_method(sel!(viewWillAppear:), will_appear:: as extern "C" fn(&mut Object, _, BOOL)); - decl.add_method(sel!(viewDidAppear:), did_appear:: as extern "C" fn(&mut Object, _, BOOL)); - decl.add_method( - sel!(viewWillDisappear:), - will_disappear:: as extern "C" fn(&mut Object, _, BOOL) - ); - decl.add_method( - sel!(viewDidDisappear:), - did_disappear:: as extern "C" fn(&mut Object, _, BOOL) - ); + decl.add_method(sel!(viewWillAppear:), will_appear:: as extern "C" fn(_, _, _)); + decl.add_method(sel!(viewDidAppear:), did_appear:: as extern "C" fn(_, _, _)); + decl.add_method(sel!(viewWillDisappear:), will_disappear:: as extern "C" fn(_, _, _)); + decl.add_method(sel!(viewDidDisappear:), did_disappear:: as extern "C" fn(_, _, _)); }) } diff --git a/src/view/splitviewcontroller/ios.rs b/src/view/splitviewcontroller/ios.rs index 77c4b8a4..5e25766e 100644 --- a/src/view/splitviewcontroller/ios.rs +++ b/src/view/splitviewcontroller/ios.rs @@ -51,15 +51,15 @@ pub(crate) fn register_view_controller_class() -> *co load_or_register_class("UIViewController", "RSTViewController", |decl| unsafe { decl.add_ivar::(VIEW_DELEGATE_PTR); - decl.add_method(sel!(viewWillAppear:), will_appear:: as extern "C" fn(&mut Object, _, BOOL)); - decl.add_method(sel!(viewDidAppear:), did_appear:: as extern "C" fn(&mut Object, _, BOOL)); + decl.add_method(sel!(viewWillAppear:), will_appear:: as extern "C" fn(_, _, _)); + decl.add_method(sel!(viewDidAppear:), did_appear:: as extern "C" fn(_, _, _)); decl.add_method( sel!(viewWillDisappear:), - will_disappear:: as extern "C" fn(&mut Object, _, BOOL) + will_disappear:: as extern "C" fn(_, _, _) ); decl.add_method( sel!(viewDidDisappear:), - did_disappear:: as extern "C" fn(&mut Object, _, BOOL) + did_disappear:: as extern "C" fn(_, _, _) ); }) } diff --git a/src/view/splitviewcontroller/macos.rs b/src/view/splitviewcontroller/macos.rs index 7e55421a..a31d966b 100644 --- a/src/view/splitviewcontroller/macos.rs +++ b/src/view/splitviewcontroller/macos.rs @@ -55,9 +55,9 @@ pub(crate) fn register_view_controller_class(instance load_or_register_class("NSViewController", instance.subclass_name(), |decl| unsafe { decl.add_ivar::(VIEW_DELEGATE_PTR); - decl.add_method(sel!(viewWillAppear), will_appear:: as extern "C" fn(&mut Object, _)); - decl.add_method(sel!(viewDidAppear), did_appear:: as extern "C" fn(&mut Object, _)); - decl.add_method(sel!(viewWillDisappear), will_disappear:: as extern "C" fn(&mut Object, _)); - decl.add_method(sel!(viewDidDisappear), did_disappear:: as extern "C" fn(&mut Object, _)); + decl.add_method(sel!(viewWillAppear), will_appear:: as extern "C" fn(_, _)); + decl.add_method(sel!(viewDidAppear), did_appear:: as extern "C" fn(_, _)); + decl.add_method(sel!(viewWillDisappear), will_disappear:: as extern "C" fn(_, _)); + decl.add_method(sel!(viewDidDisappear), did_disappear:: as extern "C" fn(_, _)); }) } diff --git a/src/webview/class.rs b/src/webview/class.rs index d35dfd7f..ee468ab5 100644 --- a/src/webview/class.rs +++ b/src/webview/class.rs @@ -176,10 +176,7 @@ extern "C" fn accepts_first_mouse(_: &mut Object, _: Sel, _: id) -> BOOL { /// varieties of delegates needed there). pub fn register_webview_class() -> *const Class { load_or_register_class("WKWebView", "CacaoWebView", |decl| unsafe { - decl.add_method( - sel!(acceptsFirstMouse:), - accepts_first_mouse as extern "C" fn(&mut Object, Sel, id) -> BOOL - ); + decl.add_method(sel!(acceptsFirstMouse:), accepts_first_mouse as extern "C" fn(_, _, _) -> _); }) } @@ -193,37 +190,37 @@ pub fn register_webview_delegate_class(instance: &T) -> *con // WKNavigationDelegate decl.add_method( sel!(webView:decidePolicyForNavigationAction:decisionHandler:), - decide_policy_for_action:: as extern "C" fn(&Object, _, _, id, usize) + decide_policy_for_action:: as extern "C" fn(_, _, _, _, _) ); decl.add_method( sel!(webView:decidePolicyForNavigationResponse:decisionHandler:), - decide_policy_for_response:: as extern "C" fn(&Object, _, _, id, usize) + decide_policy_for_response:: as extern "C" fn(_, _, _, _, _) ); // WKScriptMessageHandler decl.add_method( sel!(userContentController:didReceiveScriptMessage:), - on_message:: as extern "C" fn(&Object, _, _, id) + on_message:: as extern "C" fn(_, _, _, _) ); // Custom protocol handler decl.add_method( sel!(webView:startURLSchemeTask:), - start_url_scheme_task:: as extern "C" fn(&Object, Sel, id, id) + start_url_scheme_task:: as extern "C" fn(_, _, _, _) ); decl.add_method( sel!(webView:stopURLSchemeTask:), - stop_url_scheme_task:: as extern "C" fn(&Object, Sel, id, id) + stop_url_scheme_task:: as extern "C" fn(_, _, _, _) ); // WKUIDelegate decl.add_method( sel!(webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:), - alert:: as extern "C" fn(&Object, _, _, id, _, _) + alert:: as extern "C" fn(_, _, _, _, _, _) ); decl.add_method( sel!(webView:runOpenPanelWithParameters:initiatedByFrame:completionHandler:), - run_open_panel:: as extern "C" fn(&Object, _, _, id, _, usize) + run_open_panel:: as extern "C" fn(_, _, _, _, _, _) ); // WKDownloadDelegate is a private class on macOS that handles downloading (saving) files. @@ -232,7 +229,7 @@ pub fn register_webview_delegate_class(instance: &T) -> *con #[cfg(feature = "webview-downloading-macos")] decl.add_method( sel!(_download:decideDestinationWithSuggestedFilename:completionHandler:), - handle_download:: as extern "C" fn(&Object, _, id, id, usize) + handle_download:: as extern "C" fn(_, _, _, _, _) ); }) } diff --git a/src/webview/process_pool.rs b/src/webview/process_pool.rs index 726c67e5..84e5ac02 100644 --- a/src/webview/process_pool.rs +++ b/src/webview/process_pool.rs @@ -21,6 +21,6 @@ extern "C" fn download_delegate(this: &Object, _: Sel) -> id { pub fn register_process_pool() -> *const Object { load_or_register_class("WKProcessPool", "RSTWebViewProcessPool", |decl| unsafe { //decl.add_ivar::(DOWNLOAD_DELEGATE_PTR); - decl.add_method(sel!(_downloadDelegate), download_delegate as extern "C" fn(&Object, _) -> id); + decl.add_method(sel!(_downloadDelegate), download_delegate as extern "C" fn(_, _) -> _); }) }