Commit 3ab859db authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vout: remove is_forced parameter in display size change control

parent fa2a49e0
...@@ -264,14 +264,6 @@ static int Control (vout_display_t *vd, int query, va_list ap) ...@@ -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 vout_display_cfg_t *c = va_arg (ap, const vout_display_cfg_t *);
const video_format_t *src = &vd->source; 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_place_t place;
vout_display_PlacePicture (&place, src, c, false); vout_display_PlacePicture (&place, src, c, false);
......
...@@ -480,22 +480,10 @@ static int Control( vout_display_t *vd, int query, va_list args ) ...@@ -480,22 +480,10 @@ static int Control( vout_display_t *vd, int query, va_list args )
case VOUT_DISPLAY_CHANGE_ZOOM: case VOUT_DISPLAY_CHANGE_ZOOM:
{ {
const vout_display_cfg_t *cfg = va_arg(args, const vout_display_cfg_t *); 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; return VLC_SUCCESS;
} }
......
...@@ -353,7 +353,6 @@ static int Control (vout_display_t *vd, int query, va_list ap) ...@@ -353,7 +353,6 @@ static int Control (vout_display_t *vd, int query, va_list ap)
const vout_display_cfg_t *cfg; const vout_display_cfg_t *cfg;
const video_format_t *source; const video_format_t *source;
bool is_forced = false;
if (query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT || query == VOUT_DISPLAY_CHANGE_SOURCE_CROP) { 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 *); 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) ...@@ -361,14 +360,6 @@ static int Control (vout_display_t *vd, int query, va_list ap)
} else { } else {
source = &vd->source; source = &vd->source;
cfg = (const vout_display_cfg_t*)va_arg (ap, const vout_display_cfg_t *); 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 /* we always use our current frame here, because we have some size constraints
......
...@@ -553,14 +553,30 @@ int CommonControl(vout_display_t *vd, int query, va_list args) ...@@ -553,14 +553,30 @@ int CommonControl(vout_display_t *vd, int query, va_list args)
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
switch (query) { 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_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_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_ASPECT: /* const video_format_t *p_source */
case VOUT_DISPLAY_CHANGE_SOURCE_CROP: { /* 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 vout_display_cfg_t *cfg;
const video_format_t *source; const video_format_t *source;
bool is_forced = true;
if (query == VOUT_DISPLAY_CHANGE_SOURCE_CROP || if (query == VOUT_DISPLAY_CHANGE_SOURCE_CROP ||
query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT) { query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT) {
cfg = vd->cfg; cfg = vd->cfg;
...@@ -568,28 +584,8 @@ int CommonControl(vout_display_t *vd, int query, va_list args) ...@@ -568,28 +584,8 @@ int CommonControl(vout_display_t *vd, int query, va_list args)
} else { } else {
cfg = va_arg(args, const vout_display_cfg_t *); cfg = va_arg(args, const vout_display_cfg_t *);
source = &vd->source; 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; return VLC_SUCCESS;
} }
case VOUT_DISPLAY_CHANGE_WINDOW_STATE: { /* unsigned state */ case VOUT_DISPLAY_CHANGE_WINDOW_STATE: { /* unsigned state */
......
...@@ -305,13 +305,6 @@ static int Control(vout_display_t *vd, int query, va_list ap) ...@@ -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 *); 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_place_t place;
vout_display_PlacePicture(&place, &vd->source, vd->cfg, false); vout_display_PlacePicture(&place, &vd->source, vd->cfg, false);
......
...@@ -248,14 +248,6 @@ static int Control (vout_display_t *vd, int query, va_list ap) ...@@ -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 *); 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_place_t place;
vout_display_PlacePicture (&place, source, cfg, false); vout_display_PlacePicture (&place, source, cfg, false);
......
...@@ -477,21 +477,8 @@ static int Control (vout_display_t *vd, int query, va_list ap) ...@@ -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 *p_cfg =
(const vout_display_cfg_t*)va_arg (ap, const vout_display_cfg_t *); (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_place_t place;
vout_display_PlacePicture (&place, &vd->source, p_cfg, false); vout_display_PlacePicture (&place, &vd->source, p_cfg, false);
if (place.width != vd->fmt.i_visible_width || if (place.width != vd->fmt.i_visible_width ||
......
...@@ -773,13 +773,6 @@ static int Control (vout_display_t *vd, int query, va_list ap) ...@@ -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 *); 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_place_t place;
vout_display_PlacePicture (&place, source, cfg, false); vout_display_PlacePicture (&place, source, cfg, false);
p_sys->width = place.width; p_sys->width = place.width;
......
...@@ -926,7 +926,7 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures) ...@@ -926,7 +926,7 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
osys->height_saved = osys->cfg.display.height; osys->height_saved = osys->cfg.display.height;
if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_DISPLAY_SIZE, if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_DISPLAY_SIZE,
&cfg, false)) { &cfg)) {
msg_Err(vd, "Failed to resize display"); msg_Err(vd, "Failed to resize display");
/* We ignore the resized */ /* We ignore the resized */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment