Commit 9ba50800 authored by Erwan Tulou's avatar Erwan Tulou

skins2: first proposal for a skinnable fullscreen controller (fsc)

This patch proposes a fullscreen controller for the skins2 interface.
it features the following :
- skinable fsc (desciption in theme.xml with the Window tag)
- only restriction : no spawning of subwindows or dialogs
- window is considered a fsc when id="fullscreenController"
- (de)activation by clicking on the middle button of the mouse (intf-show)

This fsc currently only works for Linux (new vout design).
For Windows, it is a noop as long as the old vout design is still valid.
parent 300ed5ab
...@@ -80,6 +80,8 @@ ADD_COMMAND( volume_changed ) ...@@ -80,6 +80,8 @@ ADD_COMMAND( volume_changed )
ADD_COMMAND( audio_filter_changed ) ADD_COMMAND( audio_filter_changed )
ADD_COMMAND( intf_show_changed )
#undef ADD_COMMAND #undef ADD_COMMAND
#endif #endif
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "../src/popup.hpp" #include "../src/popup.hpp"
#include "../src/theme.hpp" #include "../src/theme.hpp"
#include "../src/window_manager.hpp" #include "../src/window_manager.hpp"
#include "../src/vout_manager.hpp"
#include "../commands/cmd_generic.hpp" #include "../commands/cmd_generic.hpp"
#include "../controls/ctrl_button.hpp" #include "../controls/ctrl_button.hpp"
#include "../controls/ctrl_checkbox.hpp" #include "../controls/ctrl_checkbox.hpp"
...@@ -351,6 +352,9 @@ void Builder::addWindow( const BuilderData::Window &rData ) ...@@ -351,6 +352,9 @@ void Builder::addWindow( const BuilderData::Window &rData )
rData.m_visible ); rData.m_visible );
m_pTheme->m_windows[rData.m_id] = TopWindowPtr( pWin ); m_pTheme->m_windows[rData.m_id] = TopWindowPtr( pWin );
if( rData.m_id == "fullscreenController" )
VoutManager::instance( getIntf())->registerFSC( pWin );
} }
......
...@@ -145,11 +145,11 @@ VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ), ...@@ -145,11 +145,11 @@ VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ),
// so they must put commands in the queue and NOT do anything else // so they must put commands in the queue and NOT do anything else
// (X11 calls are not reentrant) // (X11 calls are not reentrant)
// Called when volume sound changes
#define ADD_CALLBACK( p_object, var ) \ #define ADD_CALLBACK( p_object, var ) \
var_AddCallback( p_object, var, onGenericCallback, this ); var_AddCallback( p_object, var, onGenericCallback, this );
ADD_CALLBACK( pIntf->p_libvlc, "volume-change" ) ADD_CALLBACK( pIntf->p_libvlc, "volume-change" )
ADD_CALLBACK( pIntf->p_libvlc, "intf-show" )
ADD_CALLBACK( pIntf->p_sys->p_playlist, "item-current" ) ADD_CALLBACK( pIntf->p_sys->p_playlist, "item-current" )
ADD_CALLBACK( pIntf->p_sys->p_playlist, "random" ) ADD_CALLBACK( pIntf->p_sys->p_playlist, "random" )
...@@ -168,9 +168,6 @@ VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ), ...@@ -168,9 +168,6 @@ VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ),
// TODO: properly handle item-deleted // TODO: properly handle item-deleted
var_AddCallback( pIntf->p_sys->p_playlist, "playlist-item-deleted", var_AddCallback( pIntf->p_sys->p_playlist, "playlist-item-deleted",
onItemDelete, this ); onItemDelete, this );
// Called when the "interface shower" wants us to show the skin
var_AddCallback( pIntf->p_libvlc, "intf-show",
onIntfShow, this );
// Called when the current input changes // Called when the current input changes
var_AddCallback( pIntf->p_sys->p_playlist, "input-current", var_AddCallback( pIntf->p_sys->p_playlist, "input-current",
onInputNew, this ); onInputNew, this );
...@@ -210,6 +207,8 @@ VlcProc::~VlcProc() ...@@ -210,6 +207,8 @@ VlcProc::~VlcProc()
var_DelCallback( getIntf()->p_libvlc, "volume-change", var_DelCallback( getIntf()->p_libvlc, "volume-change",
onGenericCallback, this ); onGenericCallback, this );
var_DelCallback( getIntf()->p_libvlc, "intf-show",
onGenericCallback, this );
var_DelCallback( getIntf()->p_sys->p_playlist, "item-current", var_DelCallback( getIntf()->p_sys->p_playlist, "item-current",
onGenericCallback, this ); onGenericCallback, this );
...@@ -219,14 +218,13 @@ VlcProc::~VlcProc() ...@@ -219,14 +218,13 @@ VlcProc::~VlcProc()
onGenericCallback, this ); onGenericCallback, this );
var_DelCallback( getIntf()->p_sys->p_playlist, "repeat", var_DelCallback( getIntf()->p_sys->p_playlist, "repeat",
onGenericCallback, this ); onGenericCallback, this );
var_DelCallback( getIntf()->p_sys->p_playlist, "intf-change", var_DelCallback( getIntf()->p_sys->p_playlist, "intf-change",
onIntfChange, this ); onIntfChange, this );
var_DelCallback( getIntf()->p_sys->p_playlist, "playlist-item-append", var_DelCallback( getIntf()->p_sys->p_playlist, "playlist-item-append",
onItemAppend, this ); onItemAppend, this );
var_DelCallback( getIntf()->p_sys->p_playlist, "playlist-item-deleted", var_DelCallback( getIntf()->p_sys->p_playlist, "playlist-item-deleted",
onItemDelete, this ); onItemDelete, this );
var_DelCallback( getIntf()->p_libvlc, "intf-show",
onIntfShow, this );
var_DelCallback( getIntf()->p_sys->p_playlist, "input-current", var_DelCallback( getIntf()->p_sys->p_playlist, "input-current",
onInputNew, this ); onInputNew, this );
var_DelCallback( getIntf()->p_sys->p_playlist, "item-change", var_DelCallback( getIntf()->p_sys->p_playlist, "item-change",
...@@ -277,25 +275,6 @@ int VlcProc::onIntfChange( vlc_object_t *pObj, const char *pVariable, ...@@ -277,25 +275,6 @@ int VlcProc::onIntfChange( vlc_object_t *pObj, const char *pVariable,
} }
int VlcProc::onIntfShow( vlc_object_t *pObj, const char *pVariable,
vlc_value_t oldVal, vlc_value_t newVal,
void *pParam )
{
if (newVal.b_bool)
{
VlcProc *pThis = (VlcProc*)pParam;
// Create a raise all command
CmdRaiseAll *pCmd = new CmdRaiseAll( pThis->getIntf(),
pThis->getIntf()->p_sys->p_theme->getWindowManager() );
// Push the command in the asynchronous command queue
AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
pQueue->push( CmdGenericPtr( pCmd ) );
}
return VLC_SUCCESS;
}
int VlcProc::onInputNew( vlc_object_t *pObj, const char *pVariable, int VlcProc::onInputNew( vlc_object_t *pObj, const char *pVariable,
vlc_value_t oldval, vlc_value_t newval, void *pParam ) vlc_value_t oldval, vlc_value_t newval, void *pParam )
...@@ -481,6 +460,8 @@ int VlcProc::onGenericCallback( vlc_object_t *pObj, const char *pVariable, ...@@ -481,6 +460,8 @@ int VlcProc::onGenericCallback( vlc_object_t *pObj, const char *pVariable,
ADD_CALLBACK_ENTRY( "audio-filter", audio_filter_changed ) ADD_CALLBACK_ENTRY( "audio-filter", audio_filter_changed )
ADD_CALLBACK_ENTRY( "intf-show", intf_show_changed )
#undef ADD_CALLBACK_ENTRY #undef ADD_CALLBACK_ENTRY
if( pCmd ) if( pCmd )
...@@ -721,6 +702,51 @@ void VlcProc::on_audio_filter_changed( vlc_object_t* p_obj, vlc_value_t newVal ) ...@@ -721,6 +702,51 @@ void VlcProc::on_audio_filter_changed( vlc_object_t* p_obj, vlc_value_t newVal )
} }
} }
void VlcProc::on_intf_show_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
(void)p_obj;
bool b_fullscreen = getFullscreenVar().get();
if( !b_fullscreen )
{
if( newVal.b_bool )
{
// Create a raise all command
CmdRaiseAll *pCmd = new CmdRaiseAll( getIntf(),
getIntf()->p_sys->p_theme->getWindowManager() );
// Push the command in the asynchronous command queue
AsyncQueue *pQueue = AsyncQueue::instance( getIntf() );
pQueue->push( CmdGenericPtr( pCmd ) );
}
}
else
{
Theme* pTheme = getIntf()->p_sys->p_theme;
TopWindow *pWin = pTheme->getWindowById( "fullscreenController" );
if( pWin )
{
bool b_visible = pWin->getVisibleVar().get();
AsyncQueue *pQueue = AsyncQueue::instance( getIntf() );
if( !b_visible )
{
CmdShowWindow* pCmd = new CmdShowWindow( getIntf(),
getIntf()->p_sys->p_theme->getWindowManager(),
*pWin );
pQueue->push( CmdGenericPtr( pCmd ) );
}
else
{
CmdHideWindow* pCmd = new CmdHideWindow( getIntf(),
getIntf()->p_sys->p_theme->getWindowManager(),
*pWin );
pQueue->push( CmdGenericPtr( pCmd ) );
}
}
}
}
void VlcProc::reset_input() void VlcProc::reset_input()
{ {
SET_BOOL( m_cVarSeekable, false ); SET_BOOL( m_cVarSeekable, false );
......
...@@ -107,6 +107,8 @@ public: ...@@ -107,6 +107,8 @@ public:
void on_volume_changed( vlc_object_t* p_obj, vlc_value_t newVal ); void on_volume_changed( vlc_object_t* p_obj, vlc_value_t newVal );
void on_audio_filter_changed( vlc_object_t* p_obj, vlc_value_t newVal ); void on_audio_filter_changed( vlc_object_t* p_obj, vlc_value_t newVal );
void on_intf_show_changed( vlc_object_t* p_obj, vlc_value_t newVal );
protected: protected:
// Protected because it is a singleton // Protected because it is a singleton
VlcProc( intf_thread_t *pIntf ); VlcProc( intf_thread_t *pIntf );
......
...@@ -56,7 +56,7 @@ void VoutManager::destroy( intf_thread_t *pIntf ) ...@@ -56,7 +56,7 @@ void VoutManager::destroy( intf_thread_t *pIntf )
VoutManager::VoutManager( intf_thread_t *pIntf ): SkinObject( pIntf ), VoutManager::VoutManager( intf_thread_t *pIntf ): SkinObject( pIntf ),
m_pVoutMainWindow( NULL ), m_pCtrlVideoVec(), m_pVoutMainWindow( NULL ), m_pFscWindow( NULL ), m_pCtrlVideoVec(),
m_pCtrlVideoVecBackup(), m_SavedWndVec() m_pCtrlVideoVecBackup(), m_SavedWndVec()
{ {
m_pVoutMainWindow = new VoutMainWindow( getIntf() ); m_pVoutMainWindow = new VoutMainWindow( getIntf() );
...@@ -82,6 +82,16 @@ void VoutManager::registerCtrlVideo( CtrlVideo* p_CtrlVideo ) ...@@ -82,6 +82,16 @@ void VoutManager::registerCtrlVideo( CtrlVideo* p_CtrlVideo )
} }
void VoutManager::registerFSC( TopWindow* p_Win )
{
m_pFscWindow = p_Win;
int x = p_Win->getLeft();
int y = p_Win->getTop();
p_Win->setParent( m_pVoutMainWindow, x , y, 0, 0 );
}
void VoutManager::saveVoutConfig( ) void VoutManager::saveVoutConfig( )
{ {
// Save width/height to be consistent across themes // Save width/height to be consistent across themes
......
...@@ -104,6 +104,9 @@ public: ...@@ -104,6 +104,9 @@ public:
// Register Video Controls (when building theme) // Register Video Controls (when building theme)
void registerCtrlVideo( CtrlVideo* p_CtrlVideo ); void registerCtrlVideo( CtrlVideo* p_CtrlVideo );
// Register Video Controls (when building theme)
void registerFSC( TopWindow* p_Win );
// save and restore vouts (when changing theme) // save and restore vouts (when changing theme)
void saveVoutConfig( ); void saveVoutConfig( );
void restoreVoutConfig( bool b_success ); void restoreVoutConfig( bool b_success );
...@@ -133,6 +136,8 @@ private: ...@@ -133,6 +136,8 @@ private:
vector<SavedWnd> m_SavedWndVec; vector<SavedWnd> m_SavedWndVec;
VoutMainWindow* m_pVoutMainWindow; VoutMainWindow* m_pVoutMainWindow;
TopWindow* m_pFscWindow;
}; };
......
...@@ -39,7 +39,7 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow, ...@@ -39,7 +39,7 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
X11Display &rDisplay, bool dragDrop, bool playOnDrop, X11Display &rDisplay, bool dragDrop, bool playOnDrop,
X11Window *pParentWindow, GenericWindow::WindowType_t type ): X11Window *pParentWindow, GenericWindow::WindowType_t type ):
OSWindow( pIntf ), m_rDisplay( rDisplay ), m_pParent( pParentWindow ), OSWindow( pIntf ), m_rDisplay( rDisplay ), m_pParent( pParentWindow ),
m_dragDrop( dragDrop ) m_dragDrop( dragDrop ), m_type ( type )
{ {
XSetWindowAttributes attr; XSetWindowAttributes attr;
unsigned long valuemask; unsigned long valuemask;
...@@ -188,7 +188,15 @@ void X11Window::reparent( void* OSHandle, int x, int y, int w, int h ) ...@@ -188,7 +188,15 @@ void X11Window::reparent( void* OSHandle, int x, int y, int w, int h )
void X11Window::show() const void X11Window::show() const
{ {
// Map the window // Map the window
XMapRaised( XDISPLAY, m_wnd ); if( m_type == GenericWindow::VoutWindow )
{
XLowerWindow( XDISPLAY, m_wnd );
XMapWindow( XDISPLAY, m_wnd );
}
else
{
XMapRaised( XDISPLAY, m_wnd );
}
} }
......
...@@ -88,6 +88,8 @@ private: ...@@ -88,6 +88,8 @@ private:
bool m_dragDrop; bool m_dragDrop;
/// Drop target /// Drop target
X11DragDrop *m_pDropTarget; X11DragDrop *m_pDropTarget;
/// window type
GenericWindow::WindowType_t m_type;
}; };
......
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