diff options
Diffstat (limited to 'video/out/cocoa_common.m')
-rw-r--r-- | video/out/cocoa_common.m | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index bd841d3a88..21e1246b1c 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -374,13 +374,16 @@ static void vo_cocoa_update_screen_fps(struct vo *vo) { struct vo_cocoa_state *s = vo->cocoa; + NSScreen *screen = vo->opts->fullscreen ? s->fs_screen : s->current_screen; + NSDictionary* sinfo = [screen deviceDescription]; + NSNumber* sid = [sinfo objectForKey:@"NSScreenNumber"]; + CGDirectDisplayID did = [sid longValue]; + CVDisplayLinkRef link; - CVDisplayLinkCreateWithActiveCGDisplays(&link); + CVDisplayLinkCreateWithCGDisplay(did, &link); CVDisplayLinkSetOutputCallback(link, &displayLinkCallback, NULL); CVDisplayLinkStart(link); - - CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext( - link, s->cgl_ctx, CGLGetPixelFormat(s->cgl_ctx)); + CVDisplayLinkSetCurrentCGDisplay(link, did); double display_period = CVDisplayLinkGetActualOutputVideoRefreshPeriod(link); @@ -947,6 +950,11 @@ int vo_cocoa_control(struct vo *vo, int *events, int request, void *arg) [[EventsResponder sharedInstance] handleFilesArray:files]; } +- (void)windowDidChangeScreen:(NSNotification *)notification +{ + vo_cocoa_update_screen_info(self.vout, NULL); +} + - (void)didChangeWindowedScreenProfile:(NSScreen *)screen { flag_events(self.vout, VO_EVENT_ICC_PROFILE_CHANGED); |