mirror of
https://github.com/mpv-player/mpv
synced 2025-01-03 05:22:23 +00:00
video: rename VOCTRL_GET_WINDOW_SIZE
Make it clear that this accesses the un-fullscreened window size.
This commit is contained in:
parent
c15957b43a
commit
e267ff93f3
@ -2169,13 +2169,15 @@ static int mp_property_window_scale(void *ctx, struct m_property *prop,
|
||||
case M_PROPERTY_SET: {
|
||||
double scale = *(double *)arg;
|
||||
int s[2] = {vid_w * scale, vid_h * scale};
|
||||
if (s[0] > 0 && s[1] > 0 && vo_control(vo, VOCTRL_SET_WINDOW_SIZE, s) > 0)
|
||||
if (s[0] > 0 && s[1] > 0 &&
|
||||
vo_control(vo, VOCTRL_SET_UNFS_WINDOW_SIZE, s) > 0)
|
||||
return M_PROPERTY_OK;
|
||||
return M_PROPERTY_UNAVAILABLE;
|
||||
}
|
||||
case M_PROPERTY_GET: {
|
||||
int s[2];
|
||||
if (vo_control(vo, VOCTRL_GET_WINDOW_SIZE, s) <= 0 || s[0] < 1 || s[1] < 1)
|
||||
if (vo_control(vo, VOCTRL_GET_UNFS_WINDOW_SIZE, s) <= 0 ||
|
||||
s[0] < 1 || s[1] < 1)
|
||||
return M_PROPERTY_UNAVAILABLE;
|
||||
double xs = (double)s[0] / vid_w;
|
||||
double ys = (double)s[1] / vid_h;
|
||||
|
@ -656,7 +656,7 @@ int vo_cocoa_control(struct vo *vo, int *events, int request, void *arg)
|
||||
case VOCTRL_ONTOP:
|
||||
vo_cocoa_ontop(vo);
|
||||
return VO_TRUE;
|
||||
case VOCTRL_GET_WINDOW_SIZE: {
|
||||
case VOCTRL_GET_UNFS_WINDOW_SIZE: {
|
||||
int *s = arg;
|
||||
dispatch_on_main_thread(vo, ^{
|
||||
NSSize size = [vo->cocoa->view frame].size;
|
||||
@ -665,7 +665,7 @@ int vo_cocoa_control(struct vo *vo, int *events, int request, void *arg)
|
||||
});
|
||||
return VO_TRUE;
|
||||
}
|
||||
case VOCTRL_SET_WINDOW_SIZE: {
|
||||
case VOCTRL_SET_UNFS_WINDOW_SIZE: {
|
||||
dispatch_on_main_thread(vo, ^{
|
||||
int *s = arg;
|
||||
[vo->cocoa->window queueNewVideoSize:NSMakeSize(s[0], s[1])];
|
||||
|
@ -72,8 +72,10 @@ enum mp_voctrl {
|
||||
VOCTRL_SET_DEINTERLACE,
|
||||
VOCTRL_GET_DEINTERLACE,
|
||||
|
||||
VOCTRL_GET_WINDOW_SIZE, // int[2] (w/h)
|
||||
VOCTRL_SET_WINDOW_SIZE, // int[2] (w/h)
|
||||
// Return or set window size (not-fullscreen mode only - if fullscreened,
|
||||
// these must access the not-fullscreened window size only).
|
||||
VOCTRL_GET_UNFS_WINDOW_SIZE, // int[2] (w/h)
|
||||
VOCTRL_SET_UNFS_WINDOW_SIZE, // int[2] (w/h)
|
||||
|
||||
// The VO is supposed to set "known" fields, and leave the others
|
||||
// untouched or set to 0.
|
||||
|
@ -1100,7 +1100,7 @@ static int gui_thread_control(struct vo_w32_state *w32, int *events,
|
||||
reinit_window_state(w32);
|
||||
*events |= VO_EVENT_RESIZE;
|
||||
return VO_TRUE;
|
||||
case VOCTRL_GET_WINDOW_SIZE: {
|
||||
case VOCTRL_GET_UNFS_WINDOW_SIZE: {
|
||||
int *s = arg;
|
||||
|
||||
if (!w32->window_bounds_initialized)
|
||||
@ -1110,7 +1110,7 @@ static int gui_thread_control(struct vo_w32_state *w32, int *events,
|
||||
s[1] = w32->current_fs ? w32->prev_height : w32->dh;
|
||||
return VO_TRUE;
|
||||
}
|
||||
case VOCTRL_SET_WINDOW_SIZE: {
|
||||
case VOCTRL_SET_UNFS_WINDOW_SIZE: {
|
||||
int *s = arg;
|
||||
|
||||
if (!w32->window_bounds_initialized)
|
||||
|
@ -1146,13 +1146,13 @@ int vo_wayland_control (struct vo *vo, int *events, int request, void *arg)
|
||||
case VOCTRL_ONTOP:
|
||||
vo_wayland_ontop(vo);
|
||||
return VO_TRUE;
|
||||
case VOCTRL_GET_WINDOW_SIZE: {
|
||||
case VOCTRL_GET_UNFS_WINDOW_SIZE: {
|
||||
int *s = arg;
|
||||
s[0] = wl->window.width;
|
||||
s[1] = wl->window.height;
|
||||
return VO_TRUE;
|
||||
}
|
||||
case VOCTRL_SET_WINDOW_SIZE: {
|
||||
case VOCTRL_SET_UNFS_WINDOW_SIZE: {
|
||||
int *s = arg;
|
||||
if (!wl->window.is_fullscreen)
|
||||
schedule_resize(wl, 0, s[0], s[1]);
|
||||
|
@ -1547,7 +1547,7 @@ int vo_x11_control(struct vo *vo, int *events, int request, void *arg)
|
||||
vo_x11_border(vo);
|
||||
*events |= VO_EVENT_RESIZE;
|
||||
return VO_TRUE;
|
||||
case VOCTRL_GET_WINDOW_SIZE: {
|
||||
case VOCTRL_GET_UNFS_WINDOW_SIZE: {
|
||||
int *s = arg;
|
||||
if (!x11->window)
|
||||
return VO_FALSE;
|
||||
@ -1555,7 +1555,7 @@ int vo_x11_control(struct vo *vo, int *events, int request, void *arg)
|
||||
s[1] = x11->fs ? RC_H(x11->nofsrc) : RC_H(x11->winrc);
|
||||
return VO_TRUE;
|
||||
}
|
||||
case VOCTRL_SET_WINDOW_SIZE: {
|
||||
case VOCTRL_SET_UNFS_WINDOW_SIZE: {
|
||||
int *s = arg;
|
||||
if (!x11->window)
|
||||
return VO_FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user