mirror of
https://github.com/mpv-player/mpv
synced 2025-04-10 03:31:32 +00:00
parent
a05c5b4ec6
commit
46b74a38f1
video/out
@ -27,4 +27,5 @@
|
|||||||
- (BOOL)canBecomeKeyWindow;
|
- (BOOL)canBecomeKeyWindow;
|
||||||
- (BOOL)canBecomeMainWindow;
|
- (BOOL)canBecomeMainWindow;
|
||||||
- (void)mulSize:(float)multiplier;
|
- (void)mulSize:(float)multiplier;
|
||||||
|
- (void)updateBorder:(int)border;
|
||||||
@end
|
@end
|
||||||
|
@ -212,6 +212,34 @@
|
|||||||
[self.adapter putCommand:cmd];
|
[self.adapter putCommand:cmd];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)updateBorder:(int)border
|
||||||
|
{
|
||||||
|
int borderStyle = NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|
|
||||||
|
NSWindowStyleMaskMiniaturizable;
|
||||||
|
if (border) {
|
||||||
|
int window_mask = [self styleMask] & ~NSWindowStyleMaskBorderless;
|
||||||
|
window_mask |= borderStyle;
|
||||||
|
[self setStyleMask:window_mask];
|
||||||
|
} else {
|
||||||
|
int window_mask = [self styleMask] & ~borderStyle;
|
||||||
|
window_mask |= NSWindowStyleMaskBorderless;
|
||||||
|
[self setStyleMask:window_mask];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (![self.adapter isInFullScreenMode]) {
|
||||||
|
// XXX: workaround to force redrawing of window decoration
|
||||||
|
if (border) {
|
||||||
|
NSRect frame = [self frame];
|
||||||
|
frame.size.width += 1;
|
||||||
|
[self setFrame:frame display:YES];
|
||||||
|
frame.size.width -= 1;
|
||||||
|
[self setFrame:frame display:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
[self setContentAspectRatio:_unfs_content_frame.size];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (NSRect)frameRect:(NSRect)f forCenteredContentSize:(NSSize)ns
|
- (NSRect)frameRect:(NSRect)f forCenteredContentSize:(NSSize)ns
|
||||||
{
|
{
|
||||||
NSRect cr = [self contentRectForFrameRect:f];
|
NSRect cr = [self contentRectForFrameRect:f];
|
||||||
|
@ -552,6 +552,20 @@ static int cocoa_set_window_title(struct vo *vo)
|
|||||||
return VO_TRUE;
|
return VO_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int vo_cocoa_window_border(struct vo *vo)
|
||||||
|
{
|
||||||
|
struct vo_cocoa_state *s = vo->cocoa;
|
||||||
|
if (s->embedded)
|
||||||
|
return VO_NOTIMPL;
|
||||||
|
|
||||||
|
struct mp_vo_opts *opts = vo->opts;
|
||||||
|
[s->window updateBorder:opts->border];
|
||||||
|
if (opts->border)
|
||||||
|
cocoa_set_window_title(vo);
|
||||||
|
|
||||||
|
return VO_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static void cocoa_screen_reconfiguration_observer(
|
static void cocoa_screen_reconfiguration_observer(
|
||||||
CGDirectDisplayID display, CGDisplayChangeSummaryFlags flags, void *ctx)
|
CGDirectDisplayID display, CGDisplayChangeSummaryFlags flags, void *ctx)
|
||||||
{
|
{
|
||||||
@ -747,6 +761,8 @@ static int vo_cocoa_control_on_main_thread(struct vo *vo, int request, void *arg
|
|||||||
return VO_TRUE;
|
return VO_TRUE;
|
||||||
case VOCTRL_ONTOP:
|
case VOCTRL_ONTOP:
|
||||||
return vo_cocoa_ontop(vo);
|
return vo_cocoa_ontop(vo);
|
||||||
|
case VOCTRL_BORDER:
|
||||||
|
return vo_cocoa_window_border(vo);
|
||||||
case VOCTRL_GET_UNFS_WINDOW_SIZE: {
|
case VOCTRL_GET_UNFS_WINDOW_SIZE: {
|
||||||
int *sz = arg;
|
int *sz = arg;
|
||||||
NSSize size = [s->view frame].size;
|
NSSize size = [s->view frame].size;
|
||||||
|
Loading…
Reference in New Issue
Block a user