Commit 6d62ce57 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vout: request resize directly from the window rather than display

parent 07ed042d
......@@ -411,7 +411,6 @@ struct vout_display_owner_sys_t {
bool ch_display_size;
int display_width;
int display_height;
bool display_is_forced;
int fit_window;
......@@ -708,7 +707,6 @@ static void VoutDisplayEvent(vout_display_t *vd, int event, va_list args)
osys->ch_display_size = true;
osys->display_width = width;
osys->display_height = height;
osys->display_is_forced = false;
vlc_mutex_unlock(&osys->lock);
break;
......@@ -793,14 +791,12 @@ static void VoutDisplayFitWindow(vout_display_t *vd, bool default_size)
vout_display_GetDefaultDisplaySize(&display_width, &display_height,
&vd->source, &cfg);
vlc_mutex_lock(&osys->lock);
osys->ch_display_size = true;
osys->display_width = display_width;
osys->display_height = display_height;
osys->display_is_forced = true;
vlc_mutex_unlock(&osys->lock);
#ifdef ALLOW_DUMMY_VOUT
if (!osys->vout->p)
vout_display_SendEventDisplaySize(vd, display_width, display_height);
else
#endif
vout_SetDisplayWindowSize(osys->vout, display_width, display_height);
}
static void VoutDisplayCropRatio(int *left, int *top, int *right, int *bottom,
......@@ -868,7 +864,6 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
bool ch_display_size = osys->ch_display_size;
int display_width = osys->display_width;
int display_height = osys->display_height;
bool display_is_forced = osys->display_is_forced;
osys->ch_display_size = false;
bool reset_pictures;
......@@ -906,15 +901,18 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
cfg.display.width = cfg.is_fullscreen ? 0 : osys->width_saved;
cfg.display.height = cfg.is_fullscreen ? 0 : osys->height_saved;
if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_FULLSCREEN, &cfg)) {
msg_Err(vd, "Failed to set fullscreen");
if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_FULLSCREEN, &cfg) == VLC_SUCCESS) {
osys->cfg.is_fullscreen = is_fullscreen;
if (!is_fullscreen)
vout_SetDisplayWindowSize(osys->vout, osys->width_saved,
osys->height_saved);
} else {
is_fullscreen = osys->cfg.is_fullscreen;
} else if (!is_fullscreen) {
vout_display_Control(vd, VOUT_DISPLAY_CHANGE_DISPLAY_SIZE, &cfg, true);
msg_Err(vd, "Failed to set fullscreen");
}
osys->cfg.is_fullscreen = is_fullscreen;
/* */
vout_SendEventFullscreen(osys->vout, osys->cfg.is_fullscreen);
}
......@@ -928,9 +926,8 @@ 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, display_is_forced)) {
if (!display_is_forced)
msg_Err(vd, "Failed to resize display");
&cfg, false)) {
msg_Err(vd, "Failed to resize display");
/* We ignore the resized */
display_width = osys->cfg.display.width;
......
......@@ -33,7 +33,9 @@ vout_display_t *vout_NewSplitter(vout_thread_t *vout,
/* FIXME should not be there */
void vout_SendDisplayEventMouse(vout_thread_t *, const vlc_mouse_t *);
vout_window_t *vout_NewDisplayWindow(vout_thread_t *, const vout_window_cfg_t *);
void vout_DeleteDisplayWindow(vout_thread_t *, vout_window_t *);
void vout_UpdateDisplaySourceProperties(vout_display_t *vd, const video_format_t *);
void vout_SetDisplayWindowSize(vout_thread_t *, unsigned, unsigned);
void vout_UpdateDisplaySourceProperties(vout_display_t *vd, const video_format_t *);
......@@ -648,6 +648,23 @@ void vout_DeleteDisplayWindow(vout_thread_t *vout, vout_window_t *window)
assert(vout->p->window == window);
}
void vout_SetDisplayWindowSize(vout_thread_t *vout,
unsigned width, unsigned height)
{
vout_window_t *window = vout->p->window;
if (window != NULL)
/* Request a resize of the window. If it fails, there is nothing to do.
* If it succeeds, the window will emit a resize event later. */
vout_window_SetSize(window, width, height);
else
if (vout->p->display.vd != NULL)
/* Force a resize of window-less display. This is not allowed to fail,
* although the display is allowed to ignore the size anyway. */
/* FIXME: remove this, fix MSW and OS/2 window providers */
vout_display_SendEventDisplaySize(vout->p->display.vd, width, height);
}
/* */
static picture_t *VoutVideoFilterInteractiveNewPicture(filter_t *filter)
{
......
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