diff options
author | der richter <der.richter@gmx.de> | 2024-03-19 23:29:04 +0100 |
---|---|---|
committer | der richter <der.richter@gmx.de> | 2024-03-21 18:33:15 +0100 |
commit | 12782aad6c10426b677695d4d221431ee230b683 (patch) | |
tree | d6d56e1577e0b163f07df9d81ca0a5b46935bd57 | |
parent | 9e03ab5e1e3ecdfaf96a8d3b9b9860ab1c9ebfed (diff) | |
download | mpv-12782aad6c10426b677695d4d221431ee230b683.tar.bz2 mpv-12782aad6c10426b677695d4d221431ee230b683.tar.xz |
mac: optimise and shorten some code
-rw-r--r-- | video/out/cocoa_cb_common.swift | 5 | ||||
-rw-r--r-- | video/out/mac/common.swift | 12 | ||||
-rw-r--r-- | video/out/mac/view.swift | 4 |
3 files changed, 6 insertions, 15 deletions
diff --git a/video/out/cocoa_cb_common.swift b/video/out/cocoa_cb_common.swift index 175053d7f0..bd4ac44727 100644 --- a/video/out/cocoa_cb_common.swift +++ b/video/out/cocoa_cb_common.swift @@ -94,10 +94,7 @@ class CocoaCB: Common { } let wr = getWindowGeometry(forScreen: targetScreen, videoOut: vo) - if !(window?.isVisible ?? false) && - !(window?.isMiniaturized ?? false) && - !NSApp.isHidden - { + if !(window?.isVisible ?? false) && !(window?.isMiniaturized ?? false) && !NSApp.isHidden { window?.makeKeyAndOrderFront(nil) } layer?.atomicDrawingStart() diff --git a/video/out/mac/common.swift b/video/out/mac/common.swift index 16489aa344..45628782e9 100644 --- a/video/out/mac/common.swift +++ b/video/out/mac/common.swift @@ -64,14 +64,10 @@ class Common: NSObject { func initApp() { var policy: NSApplication.ActivationPolicy = .regular switch option.mac.macos_app_activation_policy { - case 0: - policy = .regular - case 1: - policy = .accessory - case 2: - policy = .prohibited - default: - break + case 0: policy = .regular + case 1: policy = .accessory + case 2: policy = .prohibited + default: break } NSApp.setActivationPolicy(policy) diff --git a/video/out/mac/view.swift b/video/out/mac/view.swift index 58657170a2..0c6dbcd847 100644 --- a/video/out/mac/view.swift +++ b/video/out/mac/view.swift @@ -165,9 +165,7 @@ class View: NSView, CALayerDelegate { } override func magnify(with event: NSEvent) { - event.phase == .ended ? - common.windowDidEndLiveResize() : common.windowWillStartLiveResize() - + event.phase == .ended ? common.windowDidEndLiveResize() : common.windowWillStartLiveResize() common.window?.addWindowScale(Double(event.magnification)) } |