summaryrefslogtreecommitdiffstats
path: root/video/out/cocoa-cb/events_view.swift
diff options
context:
space:
mode:
authorAkemi <der.richter@gmx.de>2018-02-16 13:07:15 +0100
committerKevin Mitchell <kevmitch@gmail.com>2018-02-28 00:48:44 -0800
commit938ad6ebc037ebb32b41619a31b15f8ade712867 (patch)
treefc8c27e6c73f79a75de42032dabdd3650ef54601 /video/out/cocoa-cb/events_view.swift
parenta4c436bac26cc9a6f257764bbb268adde8ef8496 (diff)
downloadmpv-938ad6ebc037ebb32b41619a31b15f8ade712867.tar.bz2
mpv-938ad6ebc037ebb32b41619a31b15f8ade712867.tar.xz
cocoa-cb: change border and borderless window styling
the title bar is now within the window bounds instead of outside. same as QuickTime Player. it supports several standard styles, two dark and two light ones. additionally we have properly rounded corners now and the borderless window also has the proper window shadow. Also make the earliest supported macOS version 10.10. Fixes #4789, #3944
Diffstat (limited to 'video/out/cocoa-cb/events_view.swift')
-rw-r--r--video/out/cocoa-cb/events_view.swift11
1 files changed, 8 insertions, 3 deletions
diff --git a/video/out/cocoa-cb/events_view.swift b/video/out/cocoa-cb/events_view.swift
index 4cb154c64a..e2da8345f1 100644
--- a/video/out/cocoa-cb/events_view.swift
+++ b/video/out/cocoa-cb/events_view.swift
@@ -110,12 +110,14 @@ class EventsView: NSView {
if mpv.getBoolProperty("input-cursor") {
cocoa_put_key_with_modifiers(SWIFT_KEY_MOUSE_LEAVE, 0)
}
+ cocoaCB.window.hideTitleBar()
}
override func mouseMoved(with event: NSEvent) {
if mpv != nil && mpv.getBoolProperty("input-cursor") {
signalMouseMovement(event)
}
+ cocoaCB.window.showTitleBar()
}
override func mouseDragged(with event: NSEvent) {
@@ -233,8 +235,7 @@ class EventsView: NSView {
let menuBarHeight = NSApp.mainMenu!.menuBarHeight
if cocoaCB.window.isInFullscreen && (menuBarHeight > 0) {
- let titleBar = NSWindow.frameRect(forContentRect: CGRect.zero, styleMask: .titled)
- topMargin = titleBar.size.height + 1 + menuBarHeight
+ topMargin = cocoaCB.window.titleBarHeight + 1 + menuBarHeight
}
var vF = window!.screen!.frame
@@ -244,7 +245,11 @@ class EventsView: NSView {
let vFV = convert(vFW, from: nil)
let pt = convert(window!.mouseLocationOutsideOfEventStream, from: nil)
- let clippedBounds = bounds.intersection(vFV)
+ var clippedBounds = bounds.intersection(vFV)
+ if !cocoaCB.window.isInFullscreen {
+ clippedBounds.origin.y += cocoaCB.window.titleBarHeight
+ clippedBounds.size.height -= cocoaCB.window.titleBarHeight
+ }
return clippedBounds.contains(pt)
}