Prevent winit from overriding LSUIElement in package manifests (#3920)

This commit is contained in:
purajit 2024-09-16 06:49:18 -07:00 committed by GitHub
parent dfea49f488
commit 7e819bb2ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 15 deletions

View file

@ -384,9 +384,12 @@ impl WindowAttributesExtMacOS for WindowAttributes {
}
pub trait EventLoopBuilderExtMacOS {
/// Sets the activation policy for the application.
/// Sets the activation policy for the application. If used, this will override
/// any relevant settings provided in the package manifest.
/// For instance, `with_activation_policy(ActivationPolicy::Regular)` will prevent
/// the application from running as an "agent", even if LSUIElement is set to true.
///
/// It is set to [`ActivationPolicy::Regular`] by default.
/// If unused, the Winit will honor the package manifest.
///
/// # Example
///
@ -438,7 +441,7 @@ pub trait EventLoopBuilderExtMacOS {
impl EventLoopBuilderExtMacOS for EventLoopBuilder {
#[inline]
fn with_activation_policy(&mut self, activation_policy: ActivationPolicy) -> &mut Self {
self.platform_specific.activation_policy = activation_policy;
self.platform_specific.activation_policy = Some(activation_policy);
self
}