From 3ab859dbdf2dd21d6cc28571319e587d8bc6ad04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= Date: Sun, 12 Oct 2014 18:29:35 +0300 Subject: [PATCH] vout: remove is_forced parameter in display size change control --- modules/video_output/gl.c | 8 ------ modules/video_output/kva.c | 18 +++---------- modules/video_output/macosx.m | 9 ------- modules/video_output/msw/common.c | 42 ++++++++++++++---------------- modules/video_output/wayland/shm.c | 7 ----- modules/video_output/xcb/glx.c | 8 ------ modules/video_output/xcb/x11.c | 15 +---------- modules/video_output/xcb/xvideo.c | 7 ----- src/video_output/display.c | 2 +- 9 files changed, 24 insertions(+), 92 deletions(-) diff --git a/modules/video_output/gl.c b/modules/video_output/gl.c index a2f4aa3994..74290b898c 100644 --- a/modules/video_output/gl.c +++ b/modules/video_output/gl.c @@ -264,14 +264,6 @@ static int Control (vout_display_t *vd, int query, va_list ap) { const vout_display_cfg_t *c = va_arg (ap, const vout_display_cfg_t *); const video_format_t *src = &vd->source; - - if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE && va_arg (ap, int)) - { - vout_window_SetSize (sys->gl->surface, - c->display.width, c->display.height); - return VLC_EGENERIC; - } - vout_display_place_t place; vout_display_PlacePicture (&place, src, c, false); diff --git a/modules/video_output/kva.c b/modules/video_output/kva.c index 96f0a63b16..4803088807 100644 --- a/modules/video_output/kva.c +++ b/modules/video_output/kva.c @@ -480,22 +480,10 @@ static int Control( vout_display_t *vd, int query, va_list args ) case VOUT_DISPLAY_CHANGE_ZOOM: { const vout_display_cfg_t *cfg = va_arg(args, const vout_display_cfg_t *); - bool is_forced = query == VOUT_DISPLAY_CHANGE_ZOOM || - va_arg(args, int); - - if( is_forced ) - { - if( sys->parent_window ) - { - vout_window_SetSize(sys->parent_window, - cfg->display.width, cfg->display.height); - } - else - WinPostMsg( sys->client, WM_VLC_SIZE_CHANGE, - MPFROMLONG( cfg->display.width ), - MPFROMLONG( cfg->display.height )); - } + WinPostMsg( sys->client, WM_VLC_SIZE_CHANGE, + MPFROMLONG( cfg->display.width ), + MPFROMLONG( cfg->display.height )); return VLC_SUCCESS; } diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m index 3cc66b2b60..a4b5f2fae3 100644 --- a/modules/video_output/macosx.m +++ b/modules/video_output/macosx.m @@ -353,7 +353,6 @@ static int Control (vout_display_t *vd, int query, va_list ap) const vout_display_cfg_t *cfg; const video_format_t *source; - bool is_forced = false; if (query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT || query == VOUT_DISPLAY_CHANGE_SOURCE_CROP) { source = (const video_format_t *)va_arg (ap, const video_format_t *); @@ -361,14 +360,6 @@ static int Control (vout_display_t *vd, int query, va_list ap) } else { source = &vd->source; cfg = (const vout_display_cfg_t*)va_arg (ap, const vout_display_cfg_t *); - if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE) - is_forced = (bool)va_arg (ap, int); - } - - if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE && is_forced - && vout_window_SetSize (sys->embed, cfg->display.width, cfg->display.height)) { - [o_pool release]; - return VLC_EGENERIC; } /* we always use our current frame here, because we have some size constraints diff --git a/modules/video_output/msw/common.c b/modules/video_output/msw/common.c index f8c1ceb615..5d22689aae 100644 --- a/modules/video_output/msw/common.c +++ b/modules/video_output/msw/common.c @@ -553,14 +553,30 @@ int CommonControl(vout_display_t *vd, int query, va_list args) vout_display_sys_t *sys = vd->sys; switch (query) { - case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE: /* const vout_display_cfg_t *p_cfg, int is_forced */ + case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE: /* const vout_display_cfg_t *p_cfg */ + { /* Update dimensions */ + const vout_display_cfg_t *cfg = va_arg(args, const vout_display_cfg_t *); + RECT rect_window = { + .top = 0, + .left = 0, + .right = cfg->display.width, + .bottom = cfg->display.height, + }; + + AdjustWindowRect(&rect_window, EventThreadGetWindowStyle(sys->event), 0); + SetWindowPos(sys->hwnd, 0, 0, 0, + rect_window.right - rect_window.left, + rect_window.bottom - rect_window.top, SWP_NOMOVE); + UpdateRects(vd, cfg, &vd->source, false); + return VLC_SUCCESS; + } case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED: /* const vout_display_cfg_t *p_cfg */ case VOUT_DISPLAY_CHANGE_ZOOM: /* const vout_display_cfg_t *p_cfg */ case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT: /* const video_format_t *p_source */ case VOUT_DISPLAY_CHANGE_SOURCE_CROP: { /* const video_format_t *p_source */ const vout_display_cfg_t *cfg; const video_format_t *source; - bool is_forced = true; + if (query == VOUT_DISPLAY_CHANGE_SOURCE_CROP || query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT) { cfg = vd->cfg; @@ -568,28 +584,8 @@ int CommonControl(vout_display_t *vd, int query, va_list args) } else { cfg = va_arg(args, const vout_display_cfg_t *); source = &vd->source; - if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE) - is_forced = va_arg(args, int); - } - if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE && is_forced) { - /* Update dimensions */ - if (sys->parent_window) { - vout_window_SetSize(sys->parent_window, cfg->display.width, cfg->display.height); - } else { - RECT rect_window; - rect_window.top = 0; - rect_window.left = 0; - rect_window.right = cfg->display.width; - rect_window.bottom = cfg->display.height; - AdjustWindowRect(&rect_window, EventThreadGetWindowStyle(sys->event), 0); - - SetWindowPos(sys->hwnd, 0, 0, 0, - rect_window.right - rect_window.left, - rect_window.bottom - rect_window.top, SWP_NOMOVE); - } - return VLC_EGENERIC; } - UpdateRects(vd, cfg, source, is_forced); + UpdateRects(vd, cfg, source, false); return VLC_SUCCESS; } case VOUT_DISPLAY_CHANGE_WINDOW_STATE: { /* unsigned state */ diff --git a/modules/video_output/wayland/shm.c b/modules/video_output/wayland/shm.c index 889f12a75f..380a881937 100644 --- a/modules/video_output/wayland/shm.c +++ b/modules/video_output/wayland/shm.c @@ -305,13 +305,6 @@ static int Control(vout_display_t *vd, int query, va_list ap) cfg = va_arg(ap, const vout_display_cfg_t *); } - if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE && va_arg(ap, int)) - { - vout_window_SetSize(sys->embed, - cfg->display.width, cfg->display.height); - return VLC_EGENERIC; - } - vout_display_place_t place; vout_display_PlacePicture(&place, &vd->source, vd->cfg, false); diff --git a/modules/video_output/xcb/glx.c b/modules/video_output/xcb/glx.c index 785a5bccfe..7a3c5116eb 100644 --- a/modules/video_output/xcb/glx.c +++ b/modules/video_output/xcb/glx.c @@ -248,14 +248,6 @@ static int Control (vout_display_t *vd, int query, va_list ap) cfg = (const vout_display_cfg_t*)va_arg (ap, const vout_display_cfg_t *); } - /* */ - if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE && va_arg (ap, int)) - { - vout_window_SetSize (sys->gl->surface, - cfg->display.width, cfg->display.height); - return VLC_EGENERIC; /* Always fail. See x11.c for rationale. */ - } - vout_display_place_t place; vout_display_PlacePicture (&place, source, cfg, false); diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c index 74928fc10e..4316980ec3 100644 --- a/modules/video_output/xcb/x11.c +++ b/modules/video_output/xcb/x11.c @@ -477,21 +477,8 @@ static int Control (vout_display_t *vd, int query, va_list ap) { const vout_display_cfg_t *p_cfg = (const vout_display_cfg_t*)va_arg (ap, const vout_display_cfg_t *); - const bool is_forced = (bool)va_arg (ap, int); - - if (is_forced) - { /* Changing the dimensions of the parent window takes place - * asynchronously (in the X server). Also it might fail or result - * in different dimensions than requested. Request the size change - * and return a failure since the size is not (yet) changed. - * If the change eventually succeeds, HandleParentStructure() - * will trigger a non-forced display size change later. */ - vout_window_SetSize (sys->embed, p_cfg->display.width, - p_cfg->display.height); - return VLC_EGENERIC; - } - vout_display_place_t place; + vout_display_PlacePicture (&place, &vd->source, p_cfg, false); if (place.width != vd->fmt.i_visible_width || diff --git a/modules/video_output/xcb/xvideo.c b/modules/video_output/xcb/xvideo.c index 5a69f7c0ff..325e22432d 100644 --- a/modules/video_output/xcb/xvideo.c +++ b/modules/video_output/xcb/xvideo.c @@ -773,13 +773,6 @@ static int Control (vout_display_t *vd, int query, va_list ap) cfg = (const vout_display_cfg_t*)va_arg (ap, const vout_display_cfg_t *); } - if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE && va_arg (ap, int)) - { - vout_window_SetSize (p_sys->embed, - cfg->display.width, cfg->display.height); - return VLC_EGENERIC; /* Always fail. See x11.c for rationale. */ - } - vout_display_place_t place; vout_display_PlacePicture (&place, source, cfg, false); p_sys->width = place.width; diff --git a/src/video_output/display.c b/src/video_output/display.c index d548cbbc00..3f42d0f0e0 100644 --- a/src/video_output/display.c +++ b/src/video_output/display.c @@ -926,7 +926,7 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures) osys->height_saved = osys->cfg.display.height; if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_DISPLAY_SIZE, - &cfg, false)) { + &cfg)) { msg_Err(vd, "Failed to resize display"); /* We ignore the resized */ -- GitLab