Commit 7b489339 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Add Fullscreen toggle to the MprisVersion 2.0 implementation.

parent 46fb5ca4
......@@ -739,8 +739,9 @@ enum output_query_e
{
VOUT_SET_SIZE, /* arg1= unsigned int, arg2= unsigned int, res= */
VOUT_SET_STAY_ON_TOP, /* arg1= bool res= */
VOUT_SET_VIEWPORT, /* arg1= view rect, arg2=clip rect, res= */
VOUT_REDRAW_RECT, /* arg1= area rect, res= */
VOUT_SET_VIEWPORT, /* arg1= view rect, arg2=clip rect, res= */
VOUT_REDRAW_RECT, /* arg1= area rect, res= */
VOUT_SET_POSITION, /* arg1= unsigned int, arg2= unsigned int, res= */
};
/**@}*/
......
......@@ -1158,7 +1158,7 @@ DBUS_METHOD( TransparentTeletext )
i_ret = var_SetInteger( p_vbi, "vbi-page",
var_GetInteger( p_vbi, "vbi-page" ) );
if( i_ret < 0 )
b_transparent = false;
b_transparent = FALSE;
}
else
{
......@@ -1166,7 +1166,7 @@ DBUS_METHOD( TransparentTeletext )
i_ret = var_SetBool( p_vbi, "vbi-opaque",
!var_GetBool( p_vbi, "vbi-opaque" ) );
if( i_ret < 0 )
b_transparent = false;
b_transparent = FALSE;
}
vlc_object_release( p_vbi );
}
......@@ -1257,9 +1257,9 @@ DBUS_METHOD( GetVideoPosition )
i_x = var_GetInteger( p_vout, "video-x");
i_y = var_GetInteger( p_vout, "video-y" );
i_width = var_GetInteger( p_vout, "width" );
i_width = (i_width == -1) ? p_vout->i_window_width: i_width;
if (i_width == -1) i_width = p_vout->i_window_width;
i_height = var_GetInteger( p_vout, "height" );
i_height = (i_height == -1) ? p_vout->i_window_height: i_height;
if (i_height == -1) i_height = p_vout->i_window_height;
vlc_object_release( p_vout );
}
vlc_object_release( p_input );
......@@ -1310,15 +1310,21 @@ DBUS_METHOD( SetVideoPosition )
p_vout = input_GetVout( p_input );
if( p_vout )
{
int i_ret;
var_SetInteger( p_vout, "video-x", i_x );
var_SetInteger( p_vout, "video-y", i_y );
var_SetInteger( p_vout, "width", i_width );
var_SetInteger( p_vout, "height", i_height );
int i_ret = vout_Control( p_vout, VOUT_SET_SIZE, i_width, i_height);
i_ret = vout_Control( p_vout, VOUT_SET_POSITION, i_x, i_y);
if( i_ret >= 0 )
{
i_success = 0;
var_SetInteger( p_vout, "width", i_width );
var_SetInteger( p_vout, "height", i_height );
i_ret = vout_Control( p_vout, VOUT_SET_SIZE, i_width, i_height);
if( i_ret >= 0 )
{
i_success = 0;
}
}
vlc_object_release( p_vout );
}
......@@ -1330,6 +1336,31 @@ DBUS_METHOD( SetVideoPosition )
REPLY_SEND;
}
DBUS_METHOD( Fullscreen )
{
REPLY_INIT;
DBusError error;
playlist_t *p_playlist = pl_Hold( (vlc_object_t*) p_this );
input_thread_t *p_input = playlist_CurrentInput( p_playlist );
if( p_input )
{
vout_thread_t *p_vout;
p_vout = input_GetVout( p_input );
if( p_vout )
{
bool b_fullscreen = var_GetBool( p_vout, "fullscreen" );
var_SetBool( p_vout, "fullscreen", !b_fullscreen );
vlc_object_release( p_vout );
}
vlc_object_release( p_input );
}
pl_Release( (vlc_object_t*) p_this );
REPLY_SEND;
}
/*****************************************************************************
* Introspection method
*****************************************************************************/
......@@ -1488,6 +1519,7 @@ DBUS_METHOD( handle_display )
METHOD_FUNC( "GetVideoPosition", GetVideoPosition );
METHOD_FUNC( "SetVideoPosition", SetVideoPosition );
METHOD_FUNC( "Fullscreen", Fullscreen );
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
......
......@@ -289,13 +289,15 @@ const char* psz_introspection_xml_data_display =
" </method>\n"
" </interface>\n"
" <interface name=\"org.freedesktop.MediaPlayer\">\n"
" <method name=\"GetVideoPosition\">\n"
" <arg type=\"(iiii)\" direction=\"out\" />\n"
" </method>\n"
" <method name=\"SetVideoPosition\">\n"
" <arg type=\"(iiii)\" direction=\"in\" />\n"
" <arg type=\"i\" direction=\"out\" />\n"
" </method>\n"
" <method name=\"GetVideoPosition\">\n"
" <arg type=\"(iiii)\" direction=\"out\" />\n"
" </method>\n"
" <method name=\"SetVideoPosition\">\n"
" <arg type=\"(iiii)\" direction=\"in\" />\n"
" <arg type=\"i\" direction=\"out\" />\n"
" </method>\n"
" <method name=\"Fullscreen\">\n"
" </method>\n"
" </interface>\n"
"</node>\n"
;
......
......@@ -170,8 +170,6 @@ static void DisablePixelDoubling( vout_thread_t *p_vout );
static const int i_backlight_on_interval = 300;
#endif
/*****************************************************************************
* Activate: allocate X11 video thread output method
*****************************************************************************
......@@ -185,12 +183,12 @@ int Activate ( vlc_object_t *p_this )
char * psz_display;
vlc_value_t val;
#if defined(MODULE_NAME_IS_xvmc)
char *psz_value;
char * psz_value;
#endif
#if defined(MODULE_NAME_IS_xvideo) || defined(MODULE_NAME_IS_xvmc)
char * psz_chroma;
vlc_fourcc_t i_chroma = 0;
bool b_chroma = 0;
char * psz_chroma;
vlc_fourcc_t i_chroma = 0;
bool b_chroma = 0;
#endif
p_vout->pf_init = InitVideo;
......@@ -1598,7 +1596,7 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win )
XGCValues xgcvalues;
XEvent xevent;
bool b_map_notify = false;
bool b_map_notify = false;
vlc_value_t val;
/* Prepare window manager hints and properties */
......@@ -3130,7 +3128,7 @@ static void SetPalette( vout_thread_t *p_vout,
static int Control( vout_thread_t *p_vout, int i_query, va_list args )
{
bool b_arg;
unsigned int i_width, i_height;
unsigned int i_x, i_y, i_width, i_height;
switch( i_query )
{
......@@ -3171,6 +3169,28 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
#endif
return VLC_SUCCESS;
case VOUT_SET_POSITION:
if( p_vout->p_sys->p_win->owner_window )
return vout_ControlWindow( p_vout->p_sys->p_win->owner_window,
i_query, args);
i_x = va_arg( args, unsigned int );
i_y = va_arg( args, unsigned int );
if( !i_x ) i_x = p_vout->p_sys->p_win->i_x;
if( !i_y ) i_y = p_vout->p_sys->p_win->i_x;
#ifdef MODULE_NAME_IS_xvmc
xvmc_context_reader_lock( &p_vout->p_sys->xvmc_lock );
#endif
/* Update dimensions */
XMoveWindow( p_vout->p_sys->p_display,
p_vout->p_sys->p_win->base_window,
i_x, i_y );
#ifdef MODULE_NAME_IS_xvmc
xvmc_context_reader_unlock( &p_vout->p_sys->xvmc_lock );
#endif
return VLC_SUCCESS;
default:
return VLC_EGENERIC;
}
......
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