mirror of https://github.com/mpv-player/mpv
cocoa: remove --fs-missioncontrol
This is the first of a series of commits that will change the Cocoa way in a way that is easily embeddable inside parent views. To reach that point common code must avoid referencing the parent NSWindow since that could be the host application's window.
This commit is contained in:
parent
7968814470
commit
c6b68c28f4
|
@ -1618,13 +1618,6 @@ Window
|
|||
there is a change in video parameters, video stream or file. This used to
|
||||
be the default behavior. Currently only affects X11 VOs.
|
||||
|
||||
``--fs-missioncontrol``
|
||||
(OS X only)
|
||||
Use OS X Mission Control's fullscreen feature instead of the custom one
|
||||
provided by mpv. This can potentially break a lot of stuff like
|
||||
``--geometry`` and is disabled by default. On the other hand it provides
|
||||
a more 'OS X-like' user experience.
|
||||
|
||||
``--heartbeat-cmd=<command>``
|
||||
Command that is executed every 30 seconds during playback via *system()* -
|
||||
i.e. using the shell. The time between the commands can be customized with
|
||||
|
|
|
@ -975,7 +975,6 @@ static const char *const replaced_opts =
|
|||
"|right-alt-gr#--input-right-alt-gr"
|
||||
"|autosub#--sub-auto"
|
||||
"|autosub-match#--sub-auto"
|
||||
"|native-fs#--fs-missioncontrol"
|
||||
"|status-msg#--term-status-msg"
|
||||
"|idx#--index"
|
||||
"|forceidx#--index"
|
||||
|
|
|
@ -443,10 +443,6 @@ const m_option_t mp_opts[] = {
|
|||
OPT_CHOICE_OR_INT("fs-screen", vo.fsscreen_id, 0, 0, 32,
|
||||
({"all", -2}, {"current", -1})),
|
||||
|
||||
#if HAVE_COCOA
|
||||
OPT_FLAG("fs-missioncontrol", vo.fs_missioncontrol, 0),
|
||||
#endif
|
||||
|
||||
OPT_INTRANGE("brightness", gamma_brightness, 0, -100, 100),
|
||||
OPT_INTRANGE("saturation", gamma_saturation, 0, -100, 100),
|
||||
OPT_INTRANGE("contrast", gamma_contrast, 0, -100, 100),
|
||||
|
|
|
@ -36,8 +36,6 @@ typedef struct mp_vo_opts {
|
|||
float monitor_pixel_aspect;
|
||||
int force_window_position;
|
||||
|
||||
int fs_missioncontrol;
|
||||
|
||||
struct sws_opts *sws_opts;
|
||||
} mp_vo_opts;
|
||||
|
||||
|
|
|
@ -22,11 +22,7 @@
|
|||
- (void)queueNewVideoSize:(NSSize)newSize;
|
||||
@end
|
||||
|
||||
@protocol MpvFullscreen
|
||||
- (void)setFullScreen:(BOOL)willBeFullscreen;
|
||||
@end
|
||||
|
||||
@interface MpvVideoWindow : NSWindow <NSWindowDelegate, MpvSizing, MpvFullscreen>
|
||||
@interface MpvVideoWindow : NSWindow <NSWindowDelegate, MpvSizing>
|
||||
@property(nonatomic, retain) MpvCocoaAdapter *adapter;
|
||||
- (BOOL)canBecomeKeyWindow;
|
||||
- (BOOL)canBecomeMainWindow;
|
||||
|
|
|
@ -63,26 +63,6 @@
|
|||
[self.adapter didChangeWindowedScreenProfile:[self screen]];
|
||||
}
|
||||
|
||||
- (BOOL)isInFullScreenMode
|
||||
{
|
||||
return !!([self styleMask] & NSFullScreenWindowMask);
|
||||
}
|
||||
|
||||
- (void)setFullScreen:(BOOL)willBeFullscreen
|
||||
{
|
||||
if (willBeFullscreen != [self isInFullScreenMode]) {
|
||||
[super toggleFullScreen:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)toggleFullScreen:(id)sender {
|
||||
if ([self isInFullScreenMode]) {
|
||||
[self.adapter putCommand:"set fullscreen no"];
|
||||
} else {
|
||||
[self.adapter putCommand:"set fullscreen yes"];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)canBecomeMainWindow { return YES; }
|
||||
- (BOOL)canBecomeKeyWindow { return YES; }
|
||||
- (BOOL)windowShouldClose:(id)sender
|
||||
|
@ -124,9 +104,6 @@
|
|||
|
||||
- (NSRect)constrainFrameRect:(NSRect)nf toScreen:(NSScreen *)screen
|
||||
{
|
||||
if ([self isInFullScreenMode])
|
||||
return [super constrainFrameRect:nf toScreen:screen];
|
||||
|
||||
NSRect of = [self frame];
|
||||
NSRect vf = [screen ?: self.screen ?: [NSScreen mainScreen] visibleFrame];
|
||||
NSRect ncf = [self contentRectForFrameRect:nf];
|
||||
|
@ -167,6 +144,7 @@
|
|||
if (_queued_video_size.width <= 0.0 || _queued_video_size.height <= 0.0)
|
||||
return;
|
||||
|
||||
// XXX find a way to kill this state
|
||||
if (![self.adapter isInFullScreenMode]) {
|
||||
[self setContentAspectRatio:_queued_video_size];
|
||||
[self setCenteredContentSize:_queued_video_size];
|
||||
|
@ -185,20 +163,4 @@
|
|||
- (void)windowDidBecomeMain:(NSNotification *)notification {
|
||||
[self tryDequeueSize];
|
||||
}
|
||||
|
||||
- (NSSize)window:(NSWindow *)window willUseFullScreenContentSize:(NSSize)size {
|
||||
return window.screen.frame.size;
|
||||
}
|
||||
|
||||
- (NSApplicationPresentationOptions)window:(NSWindow *)window
|
||||
willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)opts {
|
||||
return NSApplicationPresentationFullScreen |
|
||||
NSApplicationPresentationAutoHideDock |
|
||||
NSApplicationPresentationAutoHideMenuBar |
|
||||
NSApplicationPresentationAutoHideToolbar;
|
||||
}
|
||||
|
||||
- (void)windowDidExitFullScreen:(NSNotification *)notification {
|
||||
[self tryDequeueSize];
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -331,11 +331,6 @@ static void create_ui(struct vo *vo, struct mp_rect *win, int geo_flags)
|
|||
}
|
||||
|
||||
vo_set_level(vo, opts->ontop);
|
||||
|
||||
if (opts->fs_missioncontrol) {
|
||||
[s->window setCollectionBehavior:
|
||||
NSWindowCollectionBehaviorFullScreenPrimary];
|
||||
}
|
||||
}
|
||||
|
||||
static void cocoa_set_window_title(struct vo *vo, const char *title)
|
||||
|
@ -498,20 +493,12 @@ static void vo_cocoa_fullscreen(struct vo *vo)
|
|||
|
||||
vo_cocoa_update_screen_info(vo, NULL);
|
||||
|
||||
if (opts->fs_missioncontrol) {
|
||||
if ([s->window conformsToProtocol:@protocol(MpvFullscreen)]) {
|
||||
id<MpvFullscreen> win = (id<MpvFullscreen>) s->window;
|
||||
[win setFullScreen:opts->fullscreen];
|
||||
}
|
||||
} else {
|
||||
draw_changes_after_next_frame(vo);
|
||||
[s->view setFullScreen:opts->fullscreen];
|
||||
}
|
||||
draw_changes_after_next_frame(vo);
|
||||
[s->view setFullScreen:opts->fullscreen];
|
||||
|
||||
if (s->icc_fs_profile_path != s->icc_wnd_profile_path)
|
||||
s->icc_profile_path_changed = true;
|
||||
|
||||
// Make the core aware of the view size change.
|
||||
resize_window(vo);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue