diff options
author | Akemi <der.richter@gmx.de> | 2018-06-06 17:04:40 +0200 |
---|---|---|
committer | Jan Ekström <jeebjp@gmail.com> | 2018-06-12 01:51:01 +0300 |
commit | 5865086aa84cae5e5505698ccf115a53a1b6b4fa (patch) | |
tree | 416b5ce30ae4c4d35af4130aa1956757fb6252ff /video/out/cocoa-cb/events_view.swift | |
parent | 20dffe0621b3e26674850ef0b46ba3e689931d87 (diff) | |
download | mpv-5865086aa84cae5e5505698ccf115a53a1b6b4fa.tar.bz2 mpv-5865086aa84cae5e5505698ccf115a53a1b6b4fa.tar.xz |
cocoa-cb: remove pre-allocation of window, view and layer
the pre-allocation was needed because the layer allocated a opengl
context async itself and we couldn't influence that. so we had to start
the core after the context was actually allocated. furthermore a window,
view and layer hierarchy had to be created so the layer would create
a context.
now, instead of relying on the layer to create a context we do this
manually and re-use that context later when the layer wants to create
one async itself.
Diffstat (limited to 'video/out/cocoa-cb/events_view.swift')
-rw-r--r-- | video/out/cocoa-cb/events_view.swift | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/video/out/cocoa-cb/events_view.swift b/video/out/cocoa-cb/events_view.swift index 7cc6a4022d..7cc295f362 100644 --- a/video/out/cocoa-cb/events_view.swift +++ b/video/out/cocoa-cb/events_view.swift @@ -31,9 +31,9 @@ class EventsView: NSView { override var acceptsFirstResponder: Bool { return true } - init(frame frameRect: NSRect, cocoaCB ccb: CocoaCB) { + init(cocoaCB ccb: CocoaCB) { cocoaCB = ccb - super.init(frame: frameRect) + super.init(frame: NSMakeRect(0, 0, 960, 480)) autoresizingMask = [.viewWidthSizable, .viewHeightSizable] wantsBestResolutionOpenGLSurface = true register(forDraggedTypes: [NSFilenamesPboardType, NSURLPboardType]) @@ -249,6 +249,7 @@ class EventsView: NSView { } func canHideCursor() -> Bool { + if cocoaCB.window == nil { return false } return !hasMouseDown && containsMouseLocation() && window!.isKeyWindow } |