summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorAkemi <der.richter@gmx.de>2016-10-25 15:59:13 +0200
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2016-11-11 21:37:04 +0100
commitaceeeaf9bb7d3549c22557b8afe50838119f0b89 (patch)
tree612cf321968d79d0cae33c166bfe5626eb6a70c8 /video
parent98e7b4e538d42b6df1aa3c5f4a4c6c162a06b737 (diff)
downloadmpv-aceeeaf9bb7d3549c22557b8afe50838119f0b89.tar.bz2
mpv-aceeeaf9bb7d3549c22557b8afe50838119f0b89.tar.xz
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
Diffstat (limited to 'video')
-rw-r--r--video/out/cocoa_common.m11
1 files changed, 9 insertions, 2 deletions
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<MpvSizing> win = (id<MpvSizing>) 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];
}