mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
5e066670d0
commit
c083a7f53e
|
@ -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: {
|
||||
|
|
Loading…
Reference in New Issue