]> git.sesse.net Git - vlc/blobdiff - modules/control/showintf.c
Remove intf_ShouldDie
[vlc] / modules / control / showintf.c
index 8e66b12c573a2dbd201dfc646f75a7f8ea45cb87..a59cad6c899dc5450597c37cc1cc09cc801542b1 100644 (file)
@@ -29,7 +29,7 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_interface.h>
 #include <vlc_vout.h>
@@ -53,8 +53,8 @@ struct intf_sys_t
 /*****************************************************************************
  * Local prototypes.
  *****************************************************************************/
-int  E_(Open) ( vlc_object_t * );
-void E_(Close)( vlc_object_t * );
+int  Open ( vlc_object_t * );
+void Close( vlc_object_t * );
 static void RunIntf( intf_thread_t *p_intf );
 static int  InitThread( intf_thread_t *p_intf );
 static int  MouseEvent( vlc_object_t *, char const *,
@@ -69,16 +69,16 @@ static int  MouseEvent( vlc_object_t *, char const *,
 vlc_module_begin();
     set_shortname( "Showintf" );
     add_integer( "showintf-threshold", 10, NULL, THRESHOLD_TEXT, THRESHOLD_LONGTEXT, true );
-    set_description( _("Show interface with mouse") );
+    set_description( N_("Show interface with mouse") );
 
     set_capability( "interface", 0 );
-    set_callbacks( E_(Open), E_(Close) );
+    set_callbacks( Open, Close );
 vlc_module_end();
 
 /*****************************************************************************
  * Open: initialize interface
  *****************************************************************************/
-int E_(Open)( vlc_object_t *p_this )
+int Open( vlc_object_t *p_this )
 {
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
 
@@ -97,7 +97,7 @@ int E_(Open)( vlc_object_t *p_this )
 /*****************************************************************************
  * Close: destroy interface
  *****************************************************************************/
-void E_(Close)( vlc_object_t *p_this )
+void Close( vlc_object_t *p_this )
 {
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
 
@@ -111,6 +111,7 @@ void E_(Close)( vlc_object_t *p_this )
  *****************************************************************************/
 static void RunIntf( intf_thread_t *p_intf )
 {
+    int canc = vlc_savecancel( );
     p_intf->p_sys->p_vout = NULL;
 
     if( InitThread( p_intf ) < 0 )
@@ -120,16 +121,14 @@ static void RunIntf( intf_thread_t *p_intf )
     }
 
     /* Main loop */
-    while( !intf_ShouldDie( p_intf ) )
+    while( vlc_object_alive( p_intf ) )
     {
         vlc_mutex_lock( &p_intf->change_lock );
 
         /* Notify the interfaces */
         if( p_intf->p_sys->b_triggered )
         {
-            playlist_t *p_playlist = pl_Yield( p_intf );
-            var_SetBool( p_playlist, "intf-show", true );
-            vlc_object_release( p_playlist );
+            var_SetBool( p_intf->p_libvlc, "intf-show", true );
             p_intf->p_sys->b_triggered = false;
         }
 
@@ -137,7 +136,7 @@ static void RunIntf( intf_thread_t *p_intf )
 
 
         /* Take care of the video output */
-        if( p_intf->p_sys->p_vout && p_intf->p_sys->p_vout->b_die )
+        if( p_intf->p_sys->p_vout && !vlc_object_alive (p_intf->p_sys->p_vout) )
         {
             var_DelCallback( p_intf->p_sys->p_vout, "mouse-moved",
                              MouseEvent, p_intf );
@@ -172,6 +171,7 @@ static void RunIntf( intf_thread_t *p_intf )
                          MouseEvent, p_intf );
         vlc_object_release( p_intf->p_sys->p_vout );
     }
+    vlc_restorecancel( canc );
 }
 
 /*****************************************************************************
@@ -179,7 +179,7 @@ static void RunIntf( intf_thread_t *p_intf )
  *****************************************************************************/
 static int InitThread( intf_thread_t * p_intf )
 {
-    if( !intf_ShouldDie( p_intf ) )
+    if( vlc_object_alive( p_intf ) )
     {
         vlc_mutex_lock( &p_intf->change_lock );