]> git.sesse.net Git - vlc/blobdiff - modules/control/gestures.c
Include vlc_plugin.h as needed
[vlc] / modules / control / gestures.c
index 2d046dbea932a5489b4635d2ce8866c111de4a2a..ec46547abdd5dba71981acce60c8bef1a0da3524 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 
 #include <vlc/vlc.h>
+#include <vlc_plugin.h>
 #include <vlc_interface.h>
 #include <vlc_vout.h>
 #include <vlc_aout.h>
@@ -43,8 +46,8 @@
 struct intf_sys_t
 {
     vlc_object_t *      p_vout;
-    vlc_bool_t          b_got_gesture;
-    vlc_bool_t          b_button_pressed;
+    bool          b_got_gesture;
+    bool          b_button_pressed;
     int                 i_mouse_x, i_mouse_y;
     int                 i_last_x, i_last_y;
     unsigned int        i_pattern;
@@ -93,9 +96,9 @@ vlc_module_begin();
     set_category( CAT_INTERFACE );
     set_subcategory( SUBCAT_INTERFACE_CONTROL );
     add_integer( "gestures-threshold", 30, NULL,
-                 THRESHOLD_TEXT, THRESHOLD_LONGTEXT, VLC_TRUE );
+                 THRESHOLD_TEXT, THRESHOLD_LONGTEXT, true );
     add_string( "gestures-button", "right", NULL,
-                BUTTON_TEXT, BUTTON_LONGTEXT, VLC_FALSE );
+                BUTTON_TEXT, BUTTON_LONGTEXT, false );
         change_string_list( button_list, button_list_text, 0 );
     set_description( _("Mouse gestures control interface") );
 
@@ -138,10 +141,10 @@ static input_thread_t * input_from_playlist ( playlist_t *p_playlist )
 {
     input_thread_t * p_input;
 
-    PL_LOCK; 
-    p_input = p_playlist->p_input; 
-    if( p_input ) 
-        vlc_object_yield( p_input ); 
+    PL_LOCK;
+    p_input = p_playlist->p_input;
+    if( p_input )
+        vlc_object_yield( p_input );
     PL_UNLOCK;
 
     return p_input;
@@ -231,10 +234,10 @@ static void RunIntf( intf_thread_t *p_intf )
 
                     p_input = input_from_playlist( p_playlist );
                     vlc_object_release( p_playlist );
-                    
                     if( !p_input )
                         break;
-                    
                     val.i_int = PLAYING_S;
                     if( p_input )
                     {
@@ -323,13 +326,12 @@ static void RunIntf( intf_thread_t *p_intf )
                    if( i_count <= 1 )
                    {
                        vlc_object_release( p_input );
-                       continue;
+                       break;
                    }
                    for( i = 0; i < i_count; i++ )
                    {
                        if( val.i_int == list.p_list->p_values[i].i_int )
                        {
-                           vlc_object_release( p_input );
                            break;
                        }
                    }
@@ -383,13 +385,12 @@ static void RunIntf( intf_thread_t *p_intf )
                     if( i_count <= 1 )
                     {
                         vlc_object_release( p_input );
-                        continue;
+                        break;
                     }
                     for( i = 0; i < i_count; i++ )
                     {
                         if( val.i_int == list.p_list->p_values[i].i_int )
                         {
-                            vlc_object_release( p_input );
                             break;
                         }
                     }
@@ -408,7 +409,7 @@ static void RunIntf( intf_thread_t *p_intf )
                     }
                     else
                     {
-                        var_Set( p_input, "spu-es", 
+                        var_Set( p_input, "spu-es",
                                 list.p_list->p_values[i+1] );
                         i = i + 1;
                     }
@@ -424,7 +425,7 @@ static void RunIntf( intf_thread_t *p_intf )
                 break;
             case GESTURE(DOWN,LEFT,NONE,NONE):
                 /* FIXME: Should close the vout!"*/
-                p_intf->p_libvlc->b_die = VLC_TRUE;
+                vlc_object_kill( p_intf->p_libvlc );
                 break;
             case GESTURE(DOWN,LEFT,UP,RIGHT):
             case GESTURE(UP,RIGHT,DOWN,LEFT):
@@ -435,7 +436,7 @@ static void RunIntf( intf_thread_t *p_intf )
             }
             p_intf->p_sys->i_num_gestures = 0;
             p_intf->p_sys->i_pattern = 0;
-            p_intf->p_sys->b_got_gesture = VLC_FALSE;
+            p_intf->p_sys->b_got_gesture = false;
         }
 
         /*
@@ -489,8 +490,8 @@ static int InitThread( intf_thread_t * p_intf )
          *   during those operations */
         vlc_mutex_lock( &p_intf->change_lock );
 
-        p_intf->p_sys->b_got_gesture = VLC_FALSE;
-        p_intf->p_sys->b_button_pressed = VLC_FALSE;
+        p_intf->p_sys->b_got_gesture = false;
+        p_intf->p_sys->b_button_pressed = false;
         p_intf->p_sys->i_threshold =
                      config_GetInt( p_intf, "gestures-threshold" );
         psz_button = config_GetPsz( p_intf, "gestures-button" );
@@ -544,6 +545,7 @@ static void EndThread( intf_thread_t * p_intf )
 static int MouseEvent( vlc_object_t *p_this, char const *psz_var,
                        vlc_value_t oldval, vlc_value_t newval, void *p_data )
 {
+    VLC_UNUSED(p_this); VLC_UNUSED(oldval);
     vlc_value_t val;
     int pattern = 0;
 
@@ -610,7 +612,7 @@ static int MouseEvent( vlc_object_t *p_this, char const *psz_var,
         && newval.i_int & p_intf->p_sys->i_button_mask
         && !p_intf->p_sys->b_button_pressed )
     {
-        p_intf->p_sys->b_button_pressed = VLC_TRUE;
+        p_intf->p_sys->b_button_pressed = true;
         var_Get( p_intf->p_sys->p_vout, "mouse-x", &val );
         p_intf->p_sys->i_last_x = val.i_int;
         var_Get( p_intf->p_sys->p_vout, "mouse-y", &val );
@@ -620,8 +622,8 @@ static int MouseEvent( vlc_object_t *p_this, char const *psz_var,
         && !( newval.i_int & p_intf->p_sys->i_button_mask )
         && p_intf->p_sys->b_button_pressed )
     {
-        p_intf->p_sys->b_button_pressed = VLC_FALSE;
-        p_intf->p_sys->b_got_gesture = VLC_TRUE;
+        p_intf->p_sys->b_button_pressed = false;
+        p_intf->p_sys->b_got_gesture = true;
     }
 
     vlc_mutex_unlock( &p_intf->change_lock );