mirror of https://github.com/mpv-player/mpv
mac: optimise and shorten some code
This commit is contained in:
parent
9e03ab5e1e
commit
12782aad6c
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue