diff --git a/CHANGELOG.md b/CHANGELOG.md index a10bcf72..0e28f803 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ - Add `PartialEq`, `Eq`, and `Hash` implementations on public types that could have them but were missing them. - On X11, drag-and-drop receiving an unsupported drop type can no longer cause the WM to freeze. - Fix issue whereby the OpenGL context would not appear at startup on macOS Mojave (#1069). +- **Breaking:** Removed `From` impl from `ActivationPolicy` on macOS. # Version 0.17.2 (2018-08-19) diff --git a/src/os/macos.rs b/src/os/macos.rs index 776c10ff..a0470ede 100644 --- a/src/os/macos.rs +++ b/src/os/macos.rs @@ -1,8 +1,6 @@ #![cfg(target_os = "macos")] -use std::convert::From; use std::os::raw::c_void; -use cocoa::appkit::NSApplicationActivationPolicy; use {LogicalSize, MonitorId, Window, WindowBuilder}; /// Additional methods on `Window` that are specific to MacOS. @@ -47,19 +45,6 @@ impl Default for ActivationPolicy { } } -impl From for NSApplicationActivationPolicy { - fn from(activation_policy: ActivationPolicy) -> Self { - match activation_policy { - ActivationPolicy::Regular => - NSApplicationActivationPolicy::NSApplicationActivationPolicyRegular, - ActivationPolicy::Accessory => - NSApplicationActivationPolicy::NSApplicationActivationPolicyAccessory, - ActivationPolicy::Prohibited => - NSApplicationActivationPolicy::NSApplicationActivationPolicyProhibited, - } - } -} - /// Additional methods on `WindowBuilder` that are specific to MacOS. /// /// **Note:** Properties dealing with the titlebar will be overwritten by the `with_decorations` method diff --git a/src/platform/macos/window.rs b/src/platform/macos/window.rs index 10939f73..c982e94a 100644 --- a/src/platform/macos/window.rs +++ b/src/platform/macos/window.rs @@ -16,6 +16,7 @@ use cocoa::appkit::{ NSWindow, NSWindowButton, NSWindowStyleMask, + NSApplicationActivationPolicy, }; use cocoa::base::{id, nil}; use cocoa::foundation::{NSAutoreleasePool, NSDictionary, NSPoint, NSRect, NSSize, NSString}; @@ -718,7 +719,15 @@ impl Window2 { if app == nil { None } else { - app.setActivationPolicy_(activation_policy.into()); + let ns_activation_policy = match activation_policy { + ActivationPolicy::Regular => + NSApplicationActivationPolicy::NSApplicationActivationPolicyRegular, + ActivationPolicy::Accessory => + NSApplicationActivationPolicy::NSApplicationActivationPolicyAccessory, + ActivationPolicy::Prohibited => + NSApplicationActivationPolicy::NSApplicationActivationPolicyProhibited, + }; + app.setActivationPolicy_(ns_activation_policy); app.finishLaunching(); Some(app) }