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: {