#include "cmd_minimize.hpp"
#include "../src/os_factory.hpp"
+
void CmdMinimize::execute()
{
// Get the instance of OSFactory
pOsFactory->minimize();
}
+
+void CmdRestore::execute()
+{
+ // Get the instance of OSFactory
+ OSFactory *pOsFactory = OSFactory::instance( getIntf() );
+ pOsFactory->restore();
+}
+
+
+void CmdAddInTray::execute()
+{
+ // Get the instance of OSFactory
+ OSFactory *pOsFactory = OSFactory::instance( getIntf() );
+ pOsFactory->addInTray();
+}
+
+
+void CmdRemoveFromTray::execute()
+{
+ // Get the instance of OSFactory
+ OSFactory *pOsFactory = OSFactory::instance( getIntf() );
+ pOsFactory->removeFromTray();
+}
+
/// Command to minimize VLC
DEFINE_COMMAND(Minimize, "minimize" )
+DEFINE_COMMAND(Restore, "restore" )
+DEFINE_COMMAND(AddInTray, "add in tray" )
+DEFINE_COMMAND(RemoveFromTray, "remove from tray" )
#endif
// TODO
}
+void MacOSXFactory::restore()
+{
+ // TODO
+}
+
+void MacOSXFactory::addInTray()
+{
+ // TODO
+}
+
+void MacOSXFactory::removeFromTray()
+{
+ // TODO
+}
+
OSTimer *MacOSXFactory::createOSTimer( const Callback &rCallback )
{
return new MacOSXTimer( getIntf(), rCallback );
bool playOnDrop, OSWindow *pParent )
{
return new MacOSXWindow( getIntf(), rWindow, dragDrop,
- playOnDrop, (MacOSXWindow*)pParent );
+ playOnDrop, (MacOSXWindow*)pParent );
}
/// Instantiate an OSTimer with the given callback
virtual OSTimer *createOSTimer( const Callback &rCallback );
- ///
+ /// Minimize all the windows
virtual void minimize();
+ /// Restore the minimized windows
+ virtual void restore();
+
+ /// Add an icon in the system tray
+ virtual void addInTray();
+
+ /// Remove the icon from the system tray
+ virtual void removeFromTray();
+
/// Instantiate an OSWindow object
virtual OSWindow *createOSWindow( GenericWindow &rWindow,
bool dragDrop, bool playOnDrop,
/// Destroy the instance of OSLoop
virtual void destroyOSLoop() = 0;
- ///
+ /// Minimize all the windows
virtual void minimize() = 0;
+ /// Restore the minimized windows
+ virtual void restore() = 0;
+
+ /// Add an icon in the system tray
+ virtual void addInTray() = 0;
+
+ /// Remove the icon from the system tray
+ virtual void removeFromTray() = 0;
+
/// Instantiate an OSTimer with the given command
virtual OSTimer *createOSTimer( CmdGeneric &rCmd ) = 0;
#include "../commands/async_queue.hpp"
#include "../commands/cmd_quit.hpp"
#include "../commands/cmd_dialogs.hpp"
+#include "../commands/cmd_minimize.hpp"
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
-// Local prototypes.
+// Local prototypes
//---------------------------------------------------------------------------
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
static int Demux( demux_t * );
static int DemuxControl( demux_t *, int, va_list );
+//---------------------------------------------------------------------------
+// Prototypes for configuration callbacks
+//---------------------------------------------------------------------------
+static int onSystrayChange( vlc_object_t *pObj, const char *pVariable,
+ vlc_value_t oldVal, vlc_value_t newVal,
+ void *pParam );
+
//---------------------------------------------------------------------------
// Open: initialize interface
}
+//---------------------------------------------------------------------------
+// Callbacks
+//---------------------------------------------------------------------------
+
+/// Callback for the systray configuration option
+static int onSystrayChange( 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 )
+ {
+ CmdAddInTray *pCmd = new CmdAddInTray( pIntf );
+ pQueue->push( CmdGenericPtr( pCmd ) );
+ }
+ else
+ {
+ CmdRemoveFromTray *pCmd = new CmdRemoveFromTray( pIntf );
+ pQueue->push( CmdGenericPtr( pCmd ) );
+ }
+
+ vlc_object_release( pIntf );
+}
+
+
//---------------------------------------------------------------------------
// Module descriptor
//---------------------------------------------------------------------------
VLC_TRUE );
change_autosave();
#ifdef WIN32
- add_bool( "skins2-systray", VLC_FALSE, NULL, SKINS2_SYSTRAY,
+ add_bool( "skins2-systray", VLC_FALSE, onSystrayChange, SKINS2_SYSTRAY,
SKINS2_SYSTRAY_LONG, VLC_FALSE );
add_bool( "skins2-transparency", VLC_FALSE, NULL, SKINS2_TRANSPARENCY,
SKINS2_TRANSPARENCY_LONG, VLC_FALSE );
#include "win32_loop.hpp"
#include "../src/theme.hpp"
#include "../src/window_manager.hpp"
-#include "commands/cmd_dialogs.hpp"
+#include "../commands/cmd_dialogs.hpp"
+#include "../commands/cmd_minimize.hpp"
// Custom message for the notifications of the system tray
#define MY_WSTRAYACTION (WM_APP + 1)
}
else if( (UINT)lParam == WM_LBUTTONDBLCLK )
{
- ShowWindow( hwnd, SW_RESTORE );
+ CmdRestore aCmdRestore( p_intf );
+ aCmdRestore.execute();
}
}
}
// Show the systray icon if needed
if( config_GetInt( getIntf(), "skins2-systray" ) )
{
- Shell_NotifyIcon( NIM_ADD, &m_trayIcon );
+ addInTray();
}
// We do it this way otherwise CreateWindowEx will fail
OleUninitialize();
// Remove the systray icon
- Shell_NotifyIcon( NIM_DELETE, &m_trayIcon );
+ removeFromTray();
if( m_hParentWindow ) DestroyWindow( m_hParentWindow );
ShowWindow( m_hParentWindow, SW_MINIMIZE );
}
+void Win32Factory::restore()
+{
+ ShowWindow( m_hParentWindow, SW_RESTORE );
+}
+
+void Win32Factory::addInTray()
+{
+ Shell_NotifyIcon( NIM_ADD, &m_trayIcon );
+}
+
+void Win32Factory::removeFromTray()
+{
+ Shell_NotifyIcon( NIM_DELETE, &m_trayIcon );
+}
+
OSTimer *Win32Factory::createOSTimer( CmdGeneric &rCmd )
{
return new Win32Timer( getIntf(), rCmd, m_hParentWindow );
/// Destroy the instance of OSLoop
virtual void destroyOSLoop();
- ///
+ /// Minimize all the windows
virtual void minimize();
+ /// Restore the minimized windows
+ virtual void restore();
+
+ /// Add an icon in the system tray
+ virtual void addInTray();
+
+ /// Remove the icon from the system tray
+ virtual void removeFromTray();
+
/// Instantiate an OSTimer with the given command
virtual OSTimer *createOSTimer( CmdGeneric &rCmd );
DefaultScreen( m_pDisplay->getDisplay() ) );
}
+void X11Factory::restore()
+{
+ // TODO
+}
+
+void X11Factory::addInTray()
+{
+ // TODO
+}
+
+void X11Factory::removeFromTray()
+{
+ // TODO
+}
+
OSTimer *X11Factory::createOSTimer( CmdGeneric &rCmd )
{
return new X11Timer( getIntf(), rCmd );
/// Instantiate an OSTimer with the given command
virtual OSTimer *createOSTimer( CmdGeneric &rCmd );
- ///
+ /// Minimize all the windows
virtual void minimize();
+ /// Restore the minimized windows
+ virtual void restore();
+
+ /// Add an icon in the system tray
+ virtual void addInTray();
+
+ /// Remove the icon from the system tray
+ virtual void removeFromTray();
+
/// Instantiate an OSWindow object
virtual OSWindow *createOSWindow( GenericWindow &rWindow,
bool dragDrop, bool playOnDrop,