]> git.sesse.net Git - vlc/commitdiff
Extensions: call lua_DialogFlush after Lua call
authorJean-Philippe André <jpeg@videolan.org>
Wed, 3 Feb 2010 13:31:07 +0000 (14:31 +0100)
committerJean-Philippe André <jpeg@videolan.org>
Wed, 3 Feb 2010 16:14:00 +0000 (17:14 +0100)
This flushes the dialog (updates it at the UI level) after a Lua
function return.

modules/misc/lua/extension.c
modules/misc/lua/extension.h
modules/misc/lua/extension_thread.c
modules/misc/lua/libs/dialog.c

index 0f7e5061d84391455bc3f17a6b3e77db196e6688..5d377a38ecfea1afbbd0eb53057be73c42418a54 100644 (file)
@@ -144,6 +144,7 @@ void Close_Extension( vlc_object_t *p_this )
     FOREACH_ARRAY( p_ext, p_mgr->p_sys->activated_extensions )
     {
         if( !p_ext ) break;
+        msg_Dbg( p_mgr, "Deactivating '%s'", p_ext->psz_title );
         Deactivate( p_mgr, p_ext );
         WaitForDeactivation( p_ext );
     }
@@ -791,7 +792,7 @@ int lua_ExecuteFunction( extensions_manager_t *p_mgr,
         goto exit;
     }
 
-    i_ret = VLC_SUCCESS;
+    i_ret = lua_DialogFlush( L );
 exit:
     return i_ret;
 }
@@ -831,6 +832,7 @@ int lua_ExtensionTriggerMenu( extensions_manager_t *p_mgr,
         return VLC_EGENERIC;
     }
 
+    i_ret = lua_DialogFlush( L );
     if( i_ret < VLC_SUCCESS )
     {
         msg_Dbg( p_mgr, "Something went wrong in %s (%s:%d)",
index dc5ca3119d00d1823a1628bff99d192a9f9f5fa3..78928b53a6598fbb4cfaa8d0b7d79af7f22897c1 100644 (file)
@@ -90,12 +90,23 @@ int Activate( extensions_manager_t *p_mgr, extension_t * );
 bool IsActivated( extensions_manager_t *p_mgr, extension_t * );
 int Deactivate( extensions_manager_t *p_mgr, extension_t * );
 void WaitForDeactivation( extension_t *p_ext );
-int __PushCommand( extension_t *p_ext, bool b_unique,
-                   int i_command, ... );
-#define PushCommand( ext, cmd, ... ) \
-      __PushCommand( ext, false, cmd, ## __VA_ARGS__ )
-#define PushCommandUnique( ext, cmd, ... ) \
-      __PushCommand( ext, true, cmd, ## __VA_ARGS__ )
+int __PushCommand( extension_t *ext, bool unique, int cmd, va_list options );
+static inline int PushCommand( extension_t *ext, int cmd, ... )
+{
+    va_list args;
+    va_start( args, cmd );
+    int i_ret = __PushCommand( ext, false, cmd, args );
+    va_end( args );
+    return i_ret;
+}
+static inline int PushCommandUnique( extension_t *ext, int cmd, ... )
+{
+    va_list args;
+    va_start( args, cmd );
+    int i_ret = __PushCommand( ext, true, cmd, args );
+    va_end( args );
+    return i_ret;
+}
 bool LockExtension( extension_t *p_ext );
 void UnlockExtension( extension_t *p_ext );
 
index c04b60a14215970713a980ff9e2784fb089af23b..ac3a4592e45fcc387d07d7654da0c8797582c11b 100644 (file)
@@ -204,16 +204,11 @@ void WaitForDeactivation( extension_t *p_ext )
 }
 
 /** Push a UI command */
-int __PushCommand( extension_t *p_ext,
-                   bool b_unique,
-                   int i_command,
-                   ... )
+int __PushCommand( extension_t *p_ext,  bool b_unique, int i_command,
+                   va_list args )
 {
     vlc_mutex_lock( &p_ext->p_sys->command_lock );
 
-    va_list args;
-    va_start( args, i_command );
-
     /* Create command */
     struct command_t *cmd = calloc( 1, sizeof( struct command_t ) );
     cmd->i_command = i_command;
@@ -246,8 +241,6 @@ int __PushCommand( extension_t *p_ext,
             break;
     }
 
-    va_end( args );
-
     /* Push command to the end of the queue */
     struct command_t *last = p_ext->p_sys->command;
     if( !last )
index 0ef17771f6f822cc56e525a065af98eeb0e14c4e..e38faa9009f1b8e026f14586008ee13bdff0caa8 100644 (file)
@@ -53,8 +53,9 @@ static int vlclua_dialog_delete( lua_State *L );
 static int vlclua_dialog_show( lua_State *L );
 static int vlclua_dialog_hide( lua_State *L );
 static int vlclua_dialog_flush( lua_State *L );
-static void lua_SetDialogUpdate( lua_State *L, int flag )
-static int lua_GetDialogUpdate( lua_State *L )
+static void lua_SetDialogUpdate( lua_State *L, int flag );
+static int lua_GetDialogUpdate( lua_State *L );
+int lua_DialogFlush( lua_State *L );
 
 static int vlclua_dialog_add_button( lua_State *L );
 static int vlclua_dialog_add_label( lua_State *L );
@@ -347,7 +348,7 @@ static void lua_SetDialogUpdate( lua_State *L, int flag )
     /* Set entry in the Lua registry */
     lua_pushlightuserdata( L, (void*) &key_update );
     lua_pushinteger( L, flag );
-    lua_settable( L, LUA_REGISTRYINDEX ); 
+    lua_settable( L, LUA_REGISTRYINDEX );
 }
 
 static int lua_GetDialogUpdate( lua_State *L )
@@ -368,7 +369,7 @@ int lua_DialogFlush( lua_State *L )
 {
     lua_getglobal( L, "vlc" );
     lua_getfield( L, -1, "__dialog" );
-    extension_dialog_t *p_dlg = ( extension_dialog*t )
+    extension_dialog_t *p_dlg = ( extension_dialog_t* )
             lua_topointer( L, lua_gettop( L ) );
 
     if( !p_dlg )