Commit 954d2d2c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

window: separate set-fullscreen and unset-fullscreen controls

parent 94adaa95
......@@ -62,7 +62,8 @@ enum vout_window_type {
enum vout_window_control {
VOUT_WINDOW_SET_STATE, /* unsigned state */
VOUT_WINDOW_SET_SIZE, /* unsigned i_width, unsigned i_height */
VOUT_WINDOW_SET_FULLSCREEN, /* int b_fullscreen */
VOUT_WINDOW_SET_FULLSCREEN, /* void */
VOUT_WINDOW_UNSET_FULLSCREEN, /* void */
VOUT_WINDOW_HIDE_MOUSE VLC_DEPRECATED_ENUM,
};
......@@ -282,7 +283,9 @@ static inline int vout_window_SetSize(vout_window_t *window,
*/
static inline int vout_window_SetFullScreen(vout_window_t *window, bool full)
{
return vout_window_Control(window, VOUT_WINDOW_SET_FULLSCREEN, full);
return vout_window_Control(window,
full ? VOUT_WINDOW_SET_FULLSCREEN
: VOUT_WINDOW_UNSET_FULLSCREEN);
}
/**
......
......@@ -122,13 +122,14 @@ static int WindowControl(vout_window_t *p_wnd, int i_query, va_list args)
break;
}
case VOUT_WINDOW_SET_FULLSCREEN:
case VOUT_WINDOW_UNSET_FULLSCREEN:
{
if (var_InheritBool(getIntf(), "video-wallpaper")) {
msg_Dbg(p_wnd, "Ignore fullscreen event as video-wallpaper is on");
goto out;
}
int i_full = va_arg(args, int);
int i_full = i_query == VOUT_WINDOW_SET_FULLSCREEN;
BOOL b_animation = YES;
dispatch_async(dispatch_get_main_queue(), ^{
......
......@@ -158,8 +158,9 @@ static int WindowControl(vout_window_t *p_wnd, int i_query, va_list args)
return VLC_SUCCESS;
}
case VOUT_WINDOW_SET_FULLSCREEN:
case VOUT_WINDOW_UNSET_FULLSCREEN:
{
int i_full = va_arg(args, int);
int i_full = i_query == VOUT_WINDOW_SET_FULLSCREEN;
@autoreleasepool {
dispatch_sync(dispatch_get_main_queue(), ^{
if (i_full)
......
......@@ -987,12 +987,11 @@ int MainInterface::controlVideo( int i_query, va_list args )
return VLC_SUCCESS;
}
case VOUT_WINDOW_SET_FULLSCREEN:
{
bool b_fs = va_arg( args, int );
emit askVideoSetFullScreen( b_fs );
emit askVideoSetFullScreen( true );
return VLC_SUCCESS;
case VOUT_WINDOW_UNSET_FULLSCREEN:
emit askVideoSetFullScreen( false );
return VLC_SUCCESS;
}
default:
msg_Warn( p_intf, "unsupported control query" );
return VLC_EGENERIC;
......
......@@ -443,12 +443,11 @@ static int WindowControl( vout_window_t *pWnd, int query, va_list args )
}
case VOUT_WINDOW_SET_FULLSCREEN:
case VOUT_WINDOW_UNSET_FULLSCREEN:
{
bool b_fullscreen = va_arg( args, int );
// Post a set fullscreen command
CmdSetFullscreen* pCmd =
new CmdSetFullscreen( pIntf, pWnd, b_fullscreen );
CmdSetFullscreen* pCmd = new CmdSetFullscreen( pIntf, pWnd,
query == VOUT_WINDOW_SET_FULLSCREEN );
pQueue->push( CmdGenericPtr( pCmd ) );
return VLC_SUCCESS;
}
......
......@@ -116,29 +116,22 @@ static int Control(vout_window_t *wnd, int cmd, va_list ap)
break;
}
case VOUT_WINDOW_SET_FULLSCREEN:
{
bool fs = va_arg(ap, int);
if (fs)
{
wl_shell_surface_set_fullscreen(sys->shell_surface, 1, 0,
NULL);
vlc_mutex_lock(&sys->lock);
sys->fullscreen = true;
vout_window_ReportSize(wnd, sys->fs_width, sys->fs_height);
vlc_mutex_unlock(&sys->lock);
}
else
{
wl_shell_surface_set_toplevel(sys->shell_surface);
vlc_mutex_lock(&sys->lock);
sys->fullscreen = false;
vout_window_ReportSize(wnd, sys->top_width, sys->top_height);
vlc_mutex_unlock(&sys->lock);
}
wl_shell_surface_set_fullscreen(sys->shell_surface, 1, 0, NULL);
vlc_mutex_lock(&sys->lock);
sys->fullscreen = true;
vout_window_ReportSize(wnd, sys->fs_width, sys->fs_height);
vlc_mutex_unlock(&sys->lock);
break;
case VOUT_WINDOW_UNSET_FULLSCREEN:
wl_shell_surface_set_toplevel(sys->shell_surface);
vlc_mutex_lock(&sys->lock);
sys->fullscreen = false;
vout_window_ReportSize(wnd, sys->top_width, sys->top_height);
vlc_mutex_unlock(&sys->lock);
break;
}
default:
msg_Err(wnd, "request %d not implemented", cmd);
......
......@@ -148,15 +148,12 @@ static int Control(vout_window_t *wnd, int cmd, va_list ap)
}
case VOUT_WINDOW_SET_FULLSCREEN:
{
bool fs = va_arg(ap, int);
xdg_toplevel_set_fullscreen(sys->toplevel, NULL);
break;
if (fs)
xdg_toplevel_set_fullscreen(sys->toplevel, NULL);
else
xdg_toplevel_unset_fullscreen(sys->toplevel);
case VOUT_WINDOW_UNSET_FULLSCREEN:
xdg_toplevel_unset_fullscreen(sys->toplevel);
break;
}
default:
msg_Err(wnd, "request %d not implemented", cmd);
......
......@@ -45,6 +45,7 @@ static int Control(vout_window_t *wnd, int query, va_list ap)
case VOUT_WINDOW_SET_STATE:
case VOUT_WINDOW_SET_FULLSCREEN:
case VOUT_WINDOW_UNSET_FULLSCREEN:
/* These controls deserve a proper window provider. Move along. */
return VLC_EGENERIC;
......
......@@ -272,11 +272,10 @@ static int Control (vout_window_t *wnd, int cmd, va_list ap)
}
case VOUT_WINDOW_SET_FULLSCREEN:
{
bool fs = va_arg (ap, int);
change_wm_state (wnd, fs, p_sys->wm_state_fullscreen);
case VOUT_WINDOW_UNSET_FULLSCREEN:
change_wm_state (wnd, cmd == VOUT_WINDOW_SET_FULLSCREEN,
p_sys->wm_state_fullscreen);
break;
}
default:
msg_Err (wnd, "request %d not implemented", cmd);
......
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