From aceeeaf9bb7d3549c22557b8afe50838119f0b89 Mon Sep 17 00:00:00 2001 From: Akemi Date: Tue, 25 Oct 2016 15:59:13 +0200 Subject: cocoa: option to scale window by HiDPI scale factor Deactivating this options makes it possible to circumvent the default OS X behavior of using points. Windows on HiDPI resolutions won't open in double the size anymore and videos are display in their native resolution when windowed. Fixes #3716 --- video/out/cocoa_common.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'video') diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index ba241f42cc..719169df48 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -121,9 +121,14 @@ static void run_on_main_thread(struct vo *vo, void(^block)(void)) static void queue_new_video_size(struct vo *vo, int w, int h) { struct vo_cocoa_state *s = vo->cocoa; + struct mp_vo_opts *opts = vo->opts; if ([s->window conformsToProtocol: @protocol(MpvSizing)]) { id win = (id) s->window; - [win queueNewVideoSize:NSMakeSize(w, h)]; + NSRect r = NSMakeRect(0, 0, w, h); + if(!opts->hidpi_window_scale) { + r = [s->current_screen convertRectFromBacking:r]; + } + [win queueNewVideoSize:NSMakeSize(r.size.width, r.size.height)]; } } @@ -488,8 +493,10 @@ static void create_ui(struct vo *vo, struct mp_rect *win, int geo_flags) if (s->embedded) { parent = (NSView *) (intptr_t) opts->WinID; } else { - const NSRect wr = + NSRect wr = NSMakeRect(win->x0, win->y0, win->x1 - win->x0, win->y1 - win->y0); + if(!opts->hidpi_window_scale) + wr = [s->current_screen convertRectFromBacking:wr]; s->window = create_window(wr, s->current_screen, opts->border, adapter); parent = [s->window contentView]; } -- cgit v1.2.3