Commit 1cf7350b authored by Olivier Teulière's avatar Olivier Teulière

* skins2: new skins2-taskbar configuration option, to allow removing VLC from...

 * skins2: new skins2-taskbar configuration option, to allow removing VLC from the task bar on Windows (changing this option takes effect on the fly)
parent a05b23aa
......@@ -56,3 +56,19 @@ void CmdRemoveFromTray::execute()
pOsFactory->removeFromTray();
}
void CmdAddInTaskBar::execute()
{
// Get the instance of OSFactory
OSFactory *pOsFactory = OSFactory::instance( getIntf() );
pOsFactory->addInTaskBar();
}
void CmdRemoveFromTaskBar::execute()
{
// Get the instance of OSFactory
OSFactory *pOsFactory = OSFactory::instance( getIntf() );
pOsFactory->removeFromTaskBar();
}
......@@ -27,10 +27,11 @@
#include "cmd_generic.hpp"
/// Command to minimize VLC
DEFINE_COMMAND(Minimize, "minimize" )
DEFINE_COMMAND(Restore, "restore" )
DEFINE_COMMAND(AddInTray, "add in tray" )
DEFINE_COMMAND(RemoveFromTray, "remove from tray" )
DEFINE_COMMAND(AddInTaskBar, "add in taskbar" )
DEFINE_COMMAND(RemoveFromTaskBar, "remove from taskbar" )
#endif
......@@ -89,6 +89,16 @@ void MacOSXFactory::removeFromTray()
// TODO
}
void MacOSXFactory::addInTaskBar()
{
// TODO
}
void MacOSXFactory::removeFromTaskBar()
{
// TODO
}
OSTimer *MacOSXFactory::createOSTimer( const Callback &rCallback )
{
return new MacOSXTimer( getIntf(), rCallback );
......
......@@ -61,6 +61,12 @@ class MacOSXFactory: public OSFactory
/// Remove the icon from the system tray
virtual void removeFromTray();
/// Show the task in the task bar
virtual void addInTaskBar();
/// Remove the task from the task bar
virtual void removeFromTaskBar();
/// Instantiate an OSWindow object
virtual OSWindow *createOSWindow( GenericWindow &rWindow,
bool dragDrop, bool playOnDrop,
......
......@@ -90,6 +90,12 @@ class OSFactory: public SkinObject
/// Remove the icon from the system tray
virtual void removeFromTray() = 0;
/// Show the task in the task bar
virtual void addInTaskBar() = 0;
/// Remove the task from the task bar
virtual void removeFromTaskBar() = 0;
/// Instantiate an OSTimer with the given command
virtual OSTimer *createOSTimer( CmdGeneric &rCmd ) = 0;
......
......@@ -65,6 +65,9 @@ static int DemuxControl( demux_t *, int, va_list );
static int onSystrayChange( vlc_object_t *pObj, const char *pVariable,
vlc_value_t oldVal, vlc_value_t newVal,
void *pParam );
static int onTaskBarChange( vlc_object_t *pObj, const char *pVariable,
vlc_value_t oldVal, vlc_value_t newVal,
void *pParam );
//---------------------------------------------------------------------------
......@@ -378,6 +381,35 @@ static int onSystrayChange( vlc_object_t *pObj, const char *pVariable,
}
/// Callback for the systray configuration option
static int onTaskBarChange( vlc_object_t *pObj, const char *pVariable,
vlc_value_t oldVal, vlc_value_t newVal,
void *pParam )
{
intf_thread_t *pIntf =
(intf_thread_t*)vlc_object_find( pObj, VLC_OBJECT_INTF, FIND_ANYWHERE );
if( pIntf == NULL )
{
return VLC_EGENERIC;
}
AsyncQueue *pQueue = AsyncQueue::instance( pIntf );
if( newVal.b_bool )
{
CmdAddInTaskBar *pCmd = new CmdAddInTaskBar( pIntf );
pQueue->push( CmdGenericPtr( pCmd ) );
}
else
{
CmdRemoveFromTaskBar *pCmd = new CmdRemoveFromTaskBar( pIntf );
pQueue->push( CmdGenericPtr( pCmd ) );
}
vlc_object_release( pIntf );
}
//---------------------------------------------------------------------------
// Module descriptor
//---------------------------------------------------------------------------
......@@ -388,6 +420,8 @@ static int onSystrayChange( vlc_object_t *pObj, const char *pVariable,
"This option is updated automatically, do not touch it." )
#define SKINS2_SYSTRAY N_("Systray icon")
#define SKINS2_SYSTRAY_LONG N_("Show a systray icon for VLC")
#define SKINS2_TASKBAR N_("Show VLC on the taskbar")
#define SKINS2_TASKBAR_LONG N_("Show VLC on the taskbar")
#define SKINS2_TRANSPARENCY N_("Enable transparency effects")
#define SKINS2_TRANSPARENCY_LONG N_("You can disable all transparency effects"\
" if you want. This is mainly useful when moving windows does not behave" \
......@@ -405,6 +439,8 @@ vlc_module_begin();
#ifdef WIN32
add_bool( "skins2-systray", VLC_FALSE, onSystrayChange, SKINS2_SYSTRAY,
SKINS2_SYSTRAY_LONG, VLC_FALSE );
add_bool( "skins2-taskbar", VLC_TRUE, onTaskBarChange, SKINS2_TASKBAR,
SKINS2_TASKBAR_LONG, VLC_FALSE );
add_bool( "skins2-transparency", VLC_FALSE, NULL, SKINS2_TRANSPARENCY,
SKINS2_TRANSPARENCY_LONG, VLC_FALSE );
#endif
......
......@@ -150,7 +150,7 @@ bool Win32Factory::init()
}
// Create Window
m_hParentWindow = CreateWindowEx( WS_EX_APPWINDOW, _T("SkinWindowClass"),
m_hParentWindow = CreateWindowEx( WS_EX_TOOLWINDOW, _T("SkinWindowClass"),
_T("VLC media player"), WS_SYSMENU|WS_POPUP,
-200, -200, 0, 0, 0, 0, m_hInst, 0 );
if( m_hParentWindow == NULL )
......@@ -162,6 +162,14 @@ bool Win32Factory::init()
// Store with it a pointer to the interface thread
SetWindowLongPtr( m_hParentWindow, GWLP_USERDATA, (LONG_PTR)getIntf() );
// We do it this way otherwise CreateWindowEx will fail
// if WS_EX_LAYERED is not supported
SetWindowLongPtr( m_hParentWindow, GWL_EXSTYLE,
GetWindowLong( m_hParentWindow, GWL_EXSTYLE ) |
WS_EX_LAYERED );
ShowWindow( m_hParentWindow, SW_SHOW );
// Initialize the systray icon
m_trayIcon.cbSize = sizeof( NOTIFYICONDATA );
m_trayIcon.hWnd = m_hParentWindow;
......@@ -177,13 +185,11 @@ bool Win32Factory::init()
addInTray();
}
// We do it this way otherwise CreateWindowEx will fail
// if WS_EX_LAYERED is not supported
SetWindowLongPtr( m_hParentWindow, GWL_EXSTYLE,
GetWindowLong( m_hParentWindow, GWL_EXSTYLE ) |
WS_EX_LAYERED );
ShowWindow( m_hParentWindow, SW_SHOW );
// Show the task in the task bar if needed
if( config_GetInt( getIntf(), "skins2-taskbar" ) )
{
addInTaskBar();
}
// Initialize the OLE library (for drag & drop)
OleInitialize( NULL );
......@@ -296,6 +302,22 @@ void Win32Factory::removeFromTray()
Shell_NotifyIcon( NIM_DELETE, &m_trayIcon );
}
void Win32Factory::addInTaskBar()
{
ShowWindow( m_hParentWindow, SW_HIDE );
SetWindowLongPtr( m_hParentWindow, GWL_EXSTYLE,
WS_EX_LAYERED|WS_EX_APPWINDOW );
ShowWindow( m_hParentWindow, SW_SHOW );
}
void Win32Factory::removeFromTaskBar()
{
ShowWindow( m_hParentWindow, SW_HIDE );
SetWindowLongPtr( m_hParentWindow, GWL_EXSTYLE,
WS_EX_LAYERED|WS_EX_TOOLWINDOW );
ShowWindow( m_hParentWindow, SW_SHOW );
}
OSTimer *Win32Factory::createOSTimer( CmdGeneric &rCmd )
{
return new Win32Timer( getIntf(), rCmd, m_hParentWindow );
......
......@@ -66,6 +66,12 @@ class Win32Factory: public OSFactory
/// Remove the icon from the system tray
virtual void removeFromTray();
/// Show the task in the task bar
virtual void addInTaskBar();
/// Remove the task from the task bar
virtual void removeFromTaskBar();
/// Instantiate an OSTimer with the given command
virtual OSTimer *createOSTimer( CmdGeneric &rCmd );
......
......@@ -118,6 +118,16 @@ void X11Factory::removeFromTray()
// TODO
}
void X11Factory::addInTaskBar()
{
// TODO
}
void X11Factory::removeFromTaskBar()
{
// TODO
}
OSTimer *X11Factory::createOSTimer( CmdGeneric &rCmd )
{
return new X11Timer( getIntf(), rCmd );
......
......@@ -74,6 +74,12 @@ class X11Factory: public OSFactory
/// Remove the icon from the system tray
virtual void removeFromTray();
/// Show the task in the task bar
virtual void addInTaskBar();
/// Remove the task from the task bar
virtual void removeFromTaskBar();
/// Instantiate an OSWindow object
virtual OSWindow *createOSWindow( GenericWindow &rWindow,
bool dragDrop, bool playOnDrop,
......
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