diff options
author | Akemi <der.richter@gmx.de> | 2017-03-14 02:38:54 +0100 |
---|---|---|
committer | Akemi <der.richter@gmx.de> | 2017-03-26 20:41:20 +0200 |
commit | c083a7f53e21ee1d7c1260401de92b30f674e79b (patch) | |
tree | ddaa327fd2fff6216e921b0fef09072588a35b31 /video/out/cocoa_common.m | |
parent | 5e066670d0633f94e8e02b6e417e262b759863d9 (diff) | |
download | mpv-c083a7f53e21ee1d7c1260401de92b30f674e79b.tar.bz2 mpv-c083a7f53e21ee1d7c1260401de92b30f674e79b.tar.xz |
cocoa: fix retrieval of unfs window size
there are two minor bugs. mpv could try to retrieve the size when in
fullscreen and would get the fullscreen size. to fix that we keep track
of the window size before going into fullscreen.
the second small bug is when using HiDPI resolution and the
--hidpi-window-scale option. we actually want the OSD to show the proper
window scale depending on the hidpi settings. before when resizing the
window to double the size it could show "window-scale: 1.0" or
"window-scale: 0.5" when resizing to normal size. now it considers the
backing scale factor and the hidpi option to return a logical correct
window size.
Diffstat (limited to 'video/out/cocoa_common.m')
-rw-r--r-- | video/out/cocoa_common.m | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index 5e295ec8ef..4db1ac2371 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -73,6 +73,7 @@ struct vo_cocoa_state { NSInteger window_level; int fullscreen; + NSRect unfs_window; bool cursor_visibility; bool cursor_visibility_wanted; @@ -694,6 +695,8 @@ int vo_cocoa_config_window(struct vo *vo) create_ui(vo, &geo.win, geo.flags); } + s->unfs_window = NSMakeRect(0, 0, width, height); + if (!s->embedded && s->window) { if (reset_size) queue_new_video_size(vo, width, height); @@ -809,6 +812,9 @@ static int vo_cocoa_fullscreen(struct vo *vo) if (s->embedded) return VO_NOTIMPL; + if (!s->fullscreen) + s->unfs_window = [s->view frame]; + [s->window toggleFullScreen:nil]; return VO_TRUE; @@ -841,9 +847,11 @@ static int vo_cocoa_control_on_main_thread(struct vo *vo, int request, void *arg return vo_cocoa_window_border(vo); case VOCTRL_GET_UNFS_WINDOW_SIZE: { int *sz = arg; - NSSize size = [s->view frame].size; - sz[0] = size.width; - sz[1] = size.height; + NSRect rect = s->fullscreen ? s->unfs_window : [s->view frame]; + if(!vo->opts->hidpi_window_scale) + rect = [s->current_screen convertRectToBacking:rect]; + sz[0] = rect.size.width; + sz[1] = rect.size.height; return VO_TRUE; } case VOCTRL_SET_UNFS_WINDOW_SIZE: { |