]> git.sesse.net Git - vlc/commitdiff
* all: show/hide the interface with middle-click on the vout
authorCyril Deguet <asmax@videolan.org>
Tue, 24 Jun 2003 22:26:01 +0000 (22:26 +0000)
committerCyril Deguet <asmax@videolan.org>
Tue, 24 Jun 2003 22:26:01 +0000 (22:26 +0000)
       (when the last vout is closed, the interface reappears)
       Works only with the skins interface and X11/Xvideo vouts, but it's
       very easy to implement (just add a callback on "intf-show" in the
       interface, and trigger it in the vout)

modules/gui/skins/src/vlcproc.cpp
modules/gui/skins/src/vlcproc.h
modules/video_output/x11/xcommon.c
src/playlist/playlist.c
src/video_output/video_output.c

index 773c1560226bc84373bd655ec336d48a929e0097..0daa1de1c1fea4e06a61b7986b4120fdbaa6efc8 100644 (file)
@@ -2,7 +2,7 @@
  * vlcproc.cpp: VlcProc class
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: vlcproc.cpp,v 1.39 2003/06/23 20:35:36 asmax Exp $
+ * $Id: vlcproc.cpp,v 1.40 2003/06/24 22:26:01 asmax Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -54,6 +54,10 @@ VlcProc::VlcProc( intf_thread_t *_p_intf )
     {
         // We want to be noticed of playlit changes
         var_AddCallback( p_playlist, "intf-change", RefreshCallback, this );
+        
+        // Raise/lower interface with middle click on vout
+        var_AddCallback( p_playlist, "intf-show", IntfShowCallback, this );
+        
         vlc_object_release( p_playlist );   
     }
 }
@@ -251,6 +255,21 @@ int VlcProc::RefreshCallback( vlc_object_t *p_this, const char *psz_variable,
     return VLC_SUCCESS;
 }
 
+// Interface show/hide callback
+int VlcProc::IntfShowCallback( vlc_object_t *p_this, const char *psz_variable,
+        vlc_value_t old_val, vlc_value_t new_val, void *param )
+{
+    if( new_val.b_bool == VLC_TRUE )
+    {
+        OSAPI_PostMessage( NULL, VLC_SHOW, 1, 0 );
+    }
+    else
+    {
+        OSAPI_PostMessage( NULL, VLC_HIDE, 1, 0 );
+    }
+    return VLC_SUCCESS;
+}
+
 void VlcProc::InterfaceRefresh()
 {
     // Shortcut pointers
index 57f2a3ea238352e0e27a48218f2e24919a579c21..a0e9d7afe8c55b8f5dd7e611c87e4baf22679bc6 100644 (file)
@@ -2,7 +2,7 @@
  * vlcproc.h: VlcProc class
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: vlcproc.h,v 1.8 2003/06/23 20:35:36 asmax Exp $
+ * $Id: vlcproc.h,v 1.9 2003/06/24 22:26:01 asmax Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -55,6 +55,10 @@ class VlcProc
         static int RefreshCallback( vlc_object_t *p_this, 
             const char *psz_variable, vlc_value_t old_val, vlc_value_t new_val, 
             void *param );
+        static int IntfShowCallback( vlc_object_t *p_this, 
+            const char *psz_variable, vlc_value_t old_val, vlc_value_t new_val, 
+            void *param );
+            
         void InterfaceRefresh();
         void EnabledEvent( string type, bool state );
 
index 21b5abeb2c32cf1133ebc5aab89e352095c1d1da..5e6a66b5333a9e8070f166de850dcfb6bb8ef1be 100644 (file)
@@ -2,7 +2,7 @@
  * xcommon.c: Functions common to the X11 and XVideo plugins
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: xcommon.c,v 1.20 2003/05/28 00:52:05 titer Exp $
+ * $Id: xcommon.c,v 1.21 2003/06/24 22:26:01 asmax Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -542,7 +542,7 @@ static int ManageVideo( vout_thread_t *p_vout )
                         vlc_object_release( p_intf );
                     }
 
-                    p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+                    p_playlist = vlc_object_find( p_vout, VLC_OBJECT_PLAYLIST,
                                                            FIND_ANYWHERE );
                     if( p_playlist != NULL )
                     {
@@ -669,9 +669,25 @@ static int ManageVideo( vout_thread_t *p_vout )
                     break;
                     
                 case Button2:
-                    var_Get( p_vout, "mouse-button-down", &val );
-                    val.i_int &= ~2;
-                    var_Set( p_vout, "mouse-button-down", val );
+                    {
+                        playlist_t *p_playlist;
+
+                        var_Get( p_vout, "mouse-button-down", &val );
+                        val.i_int &= ~2;
+                        var_Set( p_vout, "mouse-button-down", val );
+
+                        p_playlist = vlc_object_find( p_vout,
+                                                      VLC_OBJECT_PLAYLIST,
+                                                      FIND_ANYWHERE );
+                        if( p_playlist != NULL )
+                        {
+                            vlc_value_t val;
+                            var_Get( p_playlist, "intf-show", &val );
+                            val.b_bool = !val.b_bool;
+                            var_Set( p_playlist, "intf-show", val );
+                            vlc_object_release( p_playlist );
+                        }
+                    }
                     break;
                     
                 case Button3:
@@ -690,7 +706,7 @@ static int ManageVideo( vout_thread_t *p_vout )
                             vlc_object_release( p_intf );
                         }
 
-                        p_playlist = vlc_object_find( p_intf,
+                        p_playlist = vlc_object_find( p_vout,
                                                       VLC_OBJECT_PLAYLIST,
                                                       FIND_ANYWHERE );
                         if( p_playlist != NULL )
index 5a2de7843509ca008c989e62c9a8fb3a7f2a40ab..163d3baee13f691f85aa3c35a0968f3ea17149fe 100644 (file)
@@ -2,7 +2,7 @@
  * playlist.c : Playlist management functions
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: playlist.c,v 1.37 2003/06/23 20:35:36 asmax Exp $
+ * $Id: playlist.c,v 1.38 2003/06/24 22:26:01 asmax Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -66,6 +66,10 @@ playlist_t * __playlist_Create ( vlc_object_t *p_parent )
 
     var_Create( p_playlist, "intf-popupmenu", VLC_VAR_VOID );
 
+    var_Create( p_playlist, "intf-show", VLC_VAR_BOOL );
+    val.b_bool = VLC_TRUE;
+    var_Set( p_playlist, "intf-show", val );
+
     p_playlist->p_input = NULL;
     p_playlist->i_status = PLAYLIST_STOPPED;
     p_playlist->i_index = -1;
index 1301e03aa17459a2803df975955a76e6dd0549e1..15482d893214bd06ba97ee138d5716648fb2294e 100644 (file)
@@ -5,7 +5,7 @@
  * thread, and destroy a previously oppened video output thread.
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: video_output.c,v 1.225 2003/05/25 11:31:54 gbazin Exp $
+ * $Id: video_output.c,v 1.226 2003/06/24 22:26:01 asmax Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -446,15 +446,38 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
  * update using one of the THREAD_* constants.
  *****************************************************************************/
 void vout_Destroy( vout_thread_t *p_vout )
-{
+{ 
+    vlc_object_t *p_playlist;
+    
     /* Request thread destruction */
     p_vout->b_die = VLC_TRUE;
     vlc_thread_join( p_vout );
 
     var_Destroy( p_vout, "intf-change" );
 
+    p_playlist = vlc_object_find( p_vout, VLC_OBJECT_PLAYLIST, 
+                                  FIND_ANYWHERE );
+
     /* Free structure */
     vlc_object_destroy( p_vout );
+
+    /* If it was the last vout, tell the interface to show up */
+    if( p_playlist != NULL )
+    {
+        vout_thread_t *p_another_vout = vlc_object_find( p_playlist, 
+                                            VLC_OBJECT_VOUT, FIND_ANYWHERE );
+        if( p_another_vout == NULL )
+        {
+            vlc_value_t val;
+            val.b_bool = VLC_TRUE;
+            var_Set( p_playlist, "intf-show", val );
+        }
+        else
+        {
+            vlc_object_release( p_another_vout );
+        }
+        vlc_object_release( p_playlist );
+    }
 }
 
 /*****************************************************************************