Remove symlinking between winit-appkit and winit-uikit (#4530)

This commit is contained in:
Mads Marquart
2026-03-26 05:49:12 +01:00
committed by GitHub
parent ba856e127a
commit 557d285170
11 changed files with 21 additions and 10 deletions

View File

@@ -107,7 +107,7 @@ objc2-foundation = { workspace = true, features = [
"NSThread", "NSThread",
"NSValue", "NSValue",
] } ] }
winit-common = { workspace = true, features = ["core-foundation", "event-handler"] } winit-common = { workspace = true, features = ["core-foundation", "event-handler", "foundation"] }
[dev-dependencies] [dev-dependencies]
winit.workspace = true winit.workspace = true

View File

@@ -14,6 +14,7 @@ use objc2_foundation::{NSNotificationCenter, NSObjectProtocol};
use rwh_06::HasDisplayHandle; use rwh_06::HasDisplayHandle;
use tracing::debug_span; use tracing::debug_span;
use winit_common::core_foundation::{MainRunLoop, MainRunLoopObserver, tracing_observers}; use winit_common::core_foundation::{MainRunLoop, MainRunLoopObserver, tracing_observers};
use winit_common::foundation::create_observer;
use winit_core::application::ApplicationHandler; use winit_core::application::ApplicationHandler;
use winit_core::cursor::{CustomCursor as CoreCustomCursor, CustomCursorSource}; use winit_core::cursor::{CustomCursor as CoreCustomCursor, CustomCursorSource};
use winit_core::error::{EventLoopError, RequestError}; use winit_core::error::{EventLoopError, RequestError};
@@ -30,7 +31,6 @@ use super::app_state::AppState;
use super::cursor::CustomCursor; use super::cursor::CustomCursor;
use super::event::dummy_event; use super::event::dummy_event;
use super::monitor; use super::monitor;
use super::notification_center::create_observer;
use crate::ActivationPolicy; use crate::ActivationPolicy;
use crate::window::Window; use crate::window::Window;

View File

@@ -76,7 +76,6 @@ mod event_loop;
mod ffi; mod ffi;
mod menu; mod menu;
mod monitor; mod monitor;
mod notification_center;
mod observer; mod observer;
mod view; mod view;
mod window; mod window;

View File

@@ -20,6 +20,9 @@ xkb = ["dep:xkbcommon-dl", "dep:smol_str"]
# CoreFoundation # CoreFoundation
core-foundation = ["dep:block2", "dep:objc2", "dep:objc2-core-foundation"] core-foundation = ["dep:block2", "dep:objc2", "dep:objc2-core-foundation"]
# Foundation
foundation = ["dep:block2", "dep:objc2", "dep:objc2-foundation"]
[dependencies] [dependencies]
smol_str = { workspace = true, optional = true } smol_str = { workspace = true, optional = true }
tracing.workspace = true tracing.workspace = true
@@ -30,7 +33,7 @@ memmap2 = { workspace = true, optional = true }
x11-dl = { workspace = true, optional = true } x11-dl = { workspace = true, optional = true }
xkbcommon-dl = { workspace = true, optional = true } xkbcommon-dl = { workspace = true, optional = true }
# CoreFoundation # Foundation / CoreFoundation
block2 = { workspace = true, optional = true } block2 = { workspace = true, optional = true }
objc2 = { workspace = true, optional = true } objc2 = { workspace = true, optional = true }
objc2-core-foundation = { workspace = true, optional = true, features = [ objc2-core-foundation = { workspace = true, optional = true, features = [
@@ -40,6 +43,13 @@ objc2-core-foundation = { workspace = true, optional = true, features = [
"CFRunLoop", "CFRunLoop",
"CFString", "CFString",
] } ] }
objc2-foundation = { workspace = true, optional = true, features = [
"std",
"block2",
"NSNotification",
"NSString",
"NSOperation",
] }
[package.metadata.docs.rs] [package.metadata.docs.rs]
all-features = true all-features = true

View File

@@ -0,0 +1,3 @@
mod notification_center;
pub use self::notification_center::*;

View File

@@ -1,4 +1,3 @@
// NOTE: This is symlinked to be contained in both the AppKit and UIKit implementations.
use std::ptr::NonNull; use std::ptr::NonNull;
use block2::RcBlock; use block2::RcBlock;
@@ -12,7 +11,7 @@ use objc2_foundation::{
/// ///
/// This is used in Winit as an alternative to declaring an application delegate, as we want to /// This is used in Winit as an alternative to declaring an application delegate, as we want to
/// give the user full control over those. /// give the user full control over those.
pub(crate) fn create_observer( pub fn create_observer(
center: &NSNotificationCenter, center: &NSNotificationCenter,
name: &NSNotificationName, name: &NSNotificationName,
handler: impl Fn(&NSNotification) + 'static, handler: impl Fn(&NSNotification) + 'static,

View File

@@ -4,5 +4,7 @@
pub mod core_foundation; pub mod core_foundation;
#[cfg(feature = "event-handler")] #[cfg(feature = "event-handler")]
pub mod event_handler; pub mod event_handler;
#[cfg(feature = "foundation")]
pub mod foundation;
#[cfg(feature = "xkb")] #[cfg(feature = "xkb")]
pub mod xkb; pub mod xkb;

View File

@@ -69,7 +69,7 @@ objc2-ui-kit = { workspace = true, features = [
"UIViewController", "UIViewController",
"UIWindow", "UIWindow",
] } ] }
winit-common = { workspace = true, features = ["core-foundation", "event-handler"] } winit-common = { workspace = true, features = ["core-foundation", "event-handler", "foundation"] }
[package.metadata.docs.rs] [package.metadata.docs.rs]
all-features = true all-features = true

View File

@@ -14,6 +14,7 @@ use objc2_ui_kit::{
use rwh_06::HasDisplayHandle; use rwh_06::HasDisplayHandle;
use tracing::debug_span; use tracing::debug_span;
use winit_common::core_foundation::{MainRunLoop, MainRunLoopObserver, tracing_observers}; use winit_common::core_foundation::{MainRunLoop, MainRunLoopObserver, tracing_observers};
use winit_common::foundation::create_observer;
use winit_core::application::ApplicationHandler; use winit_core::application::ApplicationHandler;
use winit_core::cursor::{CustomCursor, CustomCursorSource}; use winit_core::cursor::{CustomCursor, CustomCursorSource};
use winit_core::error::{EventLoopError, NotSupportedError, RequestError}; use winit_core::error::{EventLoopError, NotSupportedError, RequestError};
@@ -25,7 +26,6 @@ use winit_core::monitor::MonitorHandle as CoreMonitorHandle;
use winit_core::window::{Theme, Window as CoreWindow}; use winit_core::window::{Theme, Window as CoreWindow};
use super::app_state::{AppState, send_occluded_event_for_all_windows}; use super::app_state::{AppState, send_occluded_event_for_all_windows};
use super::notification_center::create_observer;
use crate::monitor::MonitorHandle; use crate::monitor::MonitorHandle;
use crate::window::Window; use crate::window::Window;
use crate::{app_state, monitor}; use crate::{app_state, monitor};

View File

@@ -103,7 +103,6 @@
mod app_state; mod app_state;
mod event_loop; mod event_loop;
mod monitor; mod monitor;
mod notification_center;
mod view; mod view;
mod view_controller; mod view_controller;
mod window; mod window;

View File

@@ -1 +0,0 @@
../../winit-appkit/src/notification_center.rs