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 )
ADD_COMMAND( audio_filter_changed )
ADD_COMMAND( intf_show_changed )
#undef ADD_COMMAND
#endif
......@@ -38,6 +38,7 @@
#include "../src/popup.hpp"
#include "../src/theme.hpp"
#include "../src/window_manager.hpp"
#include "../src/vout_manager.hpp"
#include "../commands/cmd_generic.hpp"
#include "../controls/ctrl_button.hpp"
#include "../controls/ctrl_checkbox.hpp"
......@@ -351,6 +352,9 @@ void Builder::addWindow( const BuilderData::Window &rData )
rData.m_visible );
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 ),
// so they must put commands in the queue and NOT do anything else
// (X11 calls are not reentrant)
// Called when volume sound changes
#define ADD_CALLBACK( p_object, var ) \
var_AddCallback( p_object, var, onGenericCallback, this );
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, "random" )
......@@ -168,9 +168,6 @@ VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ),
// TODO: properly handle item-deleted
var_AddCallback( pIntf->p_sys->p_playlist, "playlist-item-deleted",
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
var_AddCallback( pIntf->p_sys->p_playlist, "input-current",
onInputNew, this );
......@@ -210,6 +207,8 @@ VlcProc::~VlcProc()
var_DelCallback( getIntf()->p_libvlc, "volume-change",
onGenericCallback, this );
var_DelCallback( getIntf()->p_libvlc, "intf-show",
onGenericCallback, this );
var_DelCallback( getIntf()->p_sys->p_playlist, "item-current",
onGenericCallback, this );
......@@ -219,14 +218,13 @@ VlcProc::~VlcProc()
onGenericCallback, this );
var_DelCallback( getIntf()->p_sys->p_playlist, "repeat",
onGenericCallback, this );
var_DelCallback( getIntf()->p_sys->p_playlist, "intf-change",
onIntfChange, this );
var_DelCallback( getIntf()->p_sys->p_playlist, "playlist-item-append",
onItemAppend, this );
var_DelCallback( getIntf()->p_sys->p_playlist, "playlist-item-deleted",
onItemDelete, this );
var_DelCallback( getIntf()->p_libvlc, "intf-show",
onIntfShow, this );
var_DelCallback( getIntf()->p_sys->p_playlist, "input-current",
onInputNew, this );
var_DelCallback( getIntf()->p_sys->p_playlist, "item-change",
......@@ -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,
vlc_value_t oldval, vlc_value_t newval, void *pParam )
......@@ -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( "intf-show", intf_show_changed )
#undef ADD_CALLBACK_ENTRY
if( pCmd )
......@@ -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()
{
SET_BOOL( m_cVarSeekable, false );
......
......@@ -107,6 +107,8 @@ public:
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_intf_show_changed( vlc_object_t* p_obj, vlc_value_t newVal );
protected:
// Protected because it is a singleton
VlcProc( intf_thread_t *pIntf );
......
......@@ -56,7 +56,7 @@ void VoutManager::destroy( intf_thread_t *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_pVoutMainWindow = new VoutMainWindow( getIntf() );
......@@ -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( )
{
// Save width/height to be consistent across themes
......
......@@ -104,6 +104,9 @@ public:
// Register Video Controls (when building theme)
void registerCtrlVideo( CtrlVideo* p_CtrlVideo );
// Register Video Controls (when building theme)
void registerFSC( TopWindow* p_Win );
// save and restore vouts (when changing theme)
void saveVoutConfig( );
void restoreVoutConfig( bool b_success );
......@@ -133,6 +136,8 @@ private:
vector<SavedWnd> m_SavedWndVec;
VoutMainWindow* m_pVoutMainWindow;
TopWindow* m_pFscWindow;
};
......
......@@ -39,7 +39,7 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
X11Display &rDisplay, bool dragDrop, bool playOnDrop,
X11Window *pParentWindow, GenericWindow::WindowType_t type ):
OSWindow( pIntf ), m_rDisplay( rDisplay ), m_pParent( pParentWindow ),
m_dragDrop( dragDrop )
m_dragDrop( dragDrop ), m_type ( type )
{
XSetWindowAttributes attr;
unsigned long valuemask;
......@@ -188,7 +188,15 @@ void X11Window::reparent( void* OSHandle, int x, int y, int w, int h )
void X11Window::show() const
{
// Map the window
if( m_type == GenericWindow::VoutWindow )
{
XLowerWindow( XDISPLAY, m_wnd );
XMapWindow( XDISPLAY, m_wnd );
}
else
{
XMapRaised( XDISPLAY, m_wnd );
}
}
......
......@@ -88,6 +88,8 @@ private:
bool m_dragDrop;
/// Drop target
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