]> git.sesse.net Git - vlc/commitdiff
* skins2: new skins2-taskbar configuration option, to allow removing VLC from the...
authorOlivier Teulière <ipkiss@videolan.org>
Sat, 13 May 2006 17:54:21 +0000 (17:54 +0000)
committerOlivier Teulière <ipkiss@videolan.org>
Sat, 13 May 2006 17:54:21 +0000 (17:54 +0000)
modules/gui/skins2/commands/cmd_minimize.cpp
modules/gui/skins2/commands/cmd_minimize.hpp
modules/gui/skins2/macosx/macosx_factory.cpp
modules/gui/skins2/macosx/macosx_factory.hpp
modules/gui/skins2/src/os_factory.hpp
modules/gui/skins2/src/skin_main.cpp
modules/gui/skins2/win32/win32_factory.cpp
modules/gui/skins2/win32/win32_factory.hpp
modules/gui/skins2/x11/x11_factory.cpp
modules/gui/skins2/x11/x11_factory.hpp

index dfdf2d54ca715c6a9c65511af5a3e2ea0c3907a0..815e6f6c15b1ff2e7aa17308f49eee2335caf849 100644 (file)
@@ -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();
+}
+
index 6cf78c0eaa62256c12b2cdadfda30bc69ff3797e..4748313a003337e3fd423de8f3883a97c7580f6c 100644 (file)
 #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
index cf07bbc877be91a9b628ba06804ed565a5d2d9b3..be00008591b887338f5801267b3836ebdc7ceb36 100644 (file)
@@ -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 );
index 30f7bfef9d8ec5acb30a94d46eac0090f497aa67..f2cd09a02fa03f2a5dc880150eba83c43178a63d 100644 (file)
@@ -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,
index f01fba01ecc66bfe21b9546562d91309428773c5..cced448cb9b1a737d7feb1c2677c1bf5cf38b4b1 100644 (file)
@@ -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;
 
index f6511d14305ce367e577ff516c83057a7f383e4d..503966114f0fe25bda9e0e40cf7ba58573409341 100644 (file)
@@ -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
index b94227b0bf4ce2d1b3283b2e42d673a9b69744ce..7e384f869139dad6ece09a362d7fb03049eed855 100644 (file)
@@ -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 );
index f0815bbf1bfb40ad341d8f2dee48bc845bb8665c..42a181799ed4efba9d7fbc8697aba9c55c042b27 100644 (file)
@@ -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 );
 
index 38e38a402db55e16c68e303fd4f2175107807ac0..a010836b37b250fdc186ea1f8caf669e205746c0 100644 (file)
@@ -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 );
index 9a7ce7b9fbfb3a4b15aafb9a00ee28223b384940..bf99bbb3b3426c1b769389ac9d63820604d2113a 100644 (file)
@@ -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,