mac: optimise and shorten some code

This commit is contained in:
der richter 2024-03-19 23:29:04 +01:00
parent 9e03ab5e1e
commit 12782aad6c
3 changed files with 6 additions and 15 deletions

View File

@ -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()

View File

@ -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)

View File

@ -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))
}