aboutsummaryrefslogtreecommitdiffhomepage
path: root/video/out/cocoa
diff options
context:
space:
mode:
authorGravatar Stefano Pigozzi <stefano.pigozzi@gmail.com>2014-10-05 14:28:33 +0200
committerGravatar Stefano Pigozzi <stefano.pigozzi@gmail.com>2014-10-05 14:28:33 +0200
commitc8ed4736ef6ffd58d2cf8b10317ff26d7424dfa2 (patch)
tree7b4a964c9ead2e7403baba6639911f2b56e0bc38 /video/out/cocoa
parent3137b7ac5f98ac062c4a7df351f0836e52994b18 (diff)
cocoa/libmpv: allow to embed mpv GL view in another window
This is just temporary code but is a good base for future work (and baby steps are required for these changes). The 'final destination' is embedding the video view into any NSView but that requires some more work (the mechanism will be the same: pass the view's pointer casted to int64_t through -wid). For instance we will need to remove as much usage of the window instance as possible, and use nil guards where not possible. For this reason I will remove stuff like the mission control fullscreen feature (it's a cute feature but annoying to support and quite limited, go make your GUIs), and a way to lookup the current screen directly from the NSView absolute coordinates (this is needed for ICC detection mostly, and reporting back the screen to mpv's core). Moreover the current view.m will need to be separated into 2 views: the actual video view that will be embedded, and a parent view that will not be embedded and will be responsibile for tracking events.
Diffstat (limited to 'video/out/cocoa')
-rw-r--r--video/out/cocoa/window.h14
-rw-r--r--video/out/cocoa/window.m5
2 files changed, 14 insertions, 5 deletions
diff --git a/video/out/cocoa/window.h b/video/out/cocoa/window.h
index 88c054ac8d..e325be343e 100644
--- a/video/out/cocoa/window.h
+++ b/video/out/cocoa/window.h
@@ -18,13 +18,17 @@
#import <Cocoa/Cocoa.h>
#import "video/out/cocoa/mpvadapter.h"
-@interface MpvVideoWindow : NSWindow <NSWindowDelegate>
-@property(nonatomic, retain) MpvCocoaAdapter *adapter;
+@protocol MpvSizing
+- (void)queueNewVideoSize:(NSSize)newSize;
+@end
+
+@protocol MpvFullscreen
- (void)setFullScreen:(BOOL)willBeFullscreen;
+@end
+
+@interface MpvVideoWindow : NSWindow <NSWindowDelegate, MpvSizing, MpvFullscreen>
+@property(nonatomic, retain) MpvCocoaAdapter *adapter;
- (BOOL)canBecomeKeyWindow;
- (BOOL)canBecomeMainWindow;
- (void)mulSize:(float)multiplier;
-- (NSRect)frameRect:(NSRect)frameRect forCenteredContentSize:(NSSize)newSize;
-- (void)setCenteredContentSize:(NSSize)newSize;
-- (void)queueNewVideoSize:(NSSize)newSize;
@end
diff --git a/video/out/cocoa/window.m b/video/out/cocoa/window.m
index ebd3eaf957..597fa35d58 100644
--- a/video/out/cocoa/window.m
+++ b/video/out/cocoa/window.m
@@ -27,6 +27,11 @@
#include "window.h"
+@interface MpvVideoWindow()
+- (NSRect)frameRect:(NSRect)frameRect forCenteredContentSize:(NSSize)newSize;
+- (void)setCenteredContentSize:(NSSize)newSize;
+@end
+
@implementation MpvVideoWindow {
NSSize _queued_video_size;
}