mirror of
https://github.com/mpv-player/mpv
synced 2025-01-01 12:22:22 +00:00
cocoa: use displaylink without manually tracking the display id
Maybe it partially helps with #2392 (on dual display setups). Either way, it makes the code simpler.
This commit is contained in:
parent
9cc5507079
commit
de4c74e5a4
@ -370,13 +370,14 @@ static void vo_cocoa_update_screens_pointers(struct vo *vo)
|
||||
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;
|
||||
CVDisplayLinkCreateWithCGDisplay(did, &link);
|
||||
CVDisplayLinkCreateWithActiveCGDisplays(&link);
|
||||
CVDisplayLinkStart(link);
|
||||
|
||||
CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(
|
||||
link, s->cgl_ctx, CGLGetPixelFormat(s->cgl_ctx));
|
||||
|
||||
s->screen_fps = CVDisplayLinkGetActualOutputVideoRefreshPeriod(link);
|
||||
|
||||
if (s->screen_fps == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user