Commit 1f3bd0cc authored by Jean-Philippe André's avatar Jean-Philippe André

Extensions: call lua_DialogFlush after Lua call

This flushes the dialog (updates it at the UI level) after a Lua
function return.
parent 7dcda04f
...@@ -144,6 +144,7 @@ void Close_Extension( vlc_object_t *p_this ) ...@@ -144,6 +144,7 @@ void Close_Extension( vlc_object_t *p_this )
FOREACH_ARRAY( p_ext, p_mgr->p_sys->activated_extensions ) FOREACH_ARRAY( p_ext, p_mgr->p_sys->activated_extensions )
{ {
if( !p_ext ) break; if( !p_ext ) break;
msg_Dbg( p_mgr, "Deactivating '%s'", p_ext->psz_title );
Deactivate( p_mgr, p_ext ); Deactivate( p_mgr, p_ext );
WaitForDeactivation( p_ext ); WaitForDeactivation( p_ext );
} }
...@@ -791,7 +792,7 @@ int lua_ExecuteFunction( extensions_manager_t *p_mgr, ...@@ -791,7 +792,7 @@ int lua_ExecuteFunction( extensions_manager_t *p_mgr,
goto exit; goto exit;
} }
i_ret = VLC_SUCCESS; i_ret = lua_DialogFlush( L );
exit: exit:
return i_ret; return i_ret;
} }
...@@ -831,6 +832,7 @@ int lua_ExtensionTriggerMenu( extensions_manager_t *p_mgr, ...@@ -831,6 +832,7 @@ int lua_ExtensionTriggerMenu( extensions_manager_t *p_mgr,
return VLC_EGENERIC; return VLC_EGENERIC;
} }
i_ret = lua_DialogFlush( L );
if( i_ret < VLC_SUCCESS ) if( i_ret < VLC_SUCCESS )
{ {
msg_Dbg( p_mgr, "Something went wrong in %s (%s:%d)", msg_Dbg( p_mgr, "Something went wrong in %s (%s:%d)",
......
...@@ -90,12 +90,23 @@ int Activate( extensions_manager_t *p_mgr, extension_t * ); ...@@ -90,12 +90,23 @@ int Activate( extensions_manager_t *p_mgr, extension_t * );
bool IsActivated( 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 * ); int Deactivate( extensions_manager_t *p_mgr, extension_t * );
void WaitForDeactivation( extension_t *p_ext ); void WaitForDeactivation( extension_t *p_ext );
int __PushCommand( extension_t *p_ext, bool b_unique, int __PushCommand( extension_t *ext, bool unique, int cmd, va_list options );
int i_command, ... ); static inline int PushCommand( extension_t *ext, int cmd, ... )
#define PushCommand( ext, cmd, ... ) \ {
__PushCommand( ext, false, cmd, ## __VA_ARGS__ ) va_list args;
#define PushCommandUnique( ext, cmd, ... ) \ va_start( args, cmd );
__PushCommand( ext, true, cmd, ## __VA_ARGS__ ) 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 ); bool LockExtension( extension_t *p_ext );
void UnlockExtension( extension_t *p_ext ); void UnlockExtension( extension_t *p_ext );
......
...@@ -204,16 +204,11 @@ void WaitForDeactivation( extension_t *p_ext ) ...@@ -204,16 +204,11 @@ void WaitForDeactivation( extension_t *p_ext )
} }
/** Push a UI command */ /** Push a UI command */
int __PushCommand( extension_t *p_ext, int __PushCommand( extension_t *p_ext, bool b_unique, int i_command,
bool b_unique, va_list args )
int i_command,
... )
{ {
vlc_mutex_lock( &p_ext->p_sys->command_lock ); vlc_mutex_lock( &p_ext->p_sys->command_lock );
va_list args;
va_start( args, i_command );
/* Create command */ /* Create command */
struct command_t *cmd = calloc( 1, sizeof( struct command_t ) ); struct command_t *cmd = calloc( 1, sizeof( struct command_t ) );
cmd->i_command = i_command; cmd->i_command = i_command;
...@@ -246,8 +241,6 @@ int __PushCommand( extension_t *p_ext, ...@@ -246,8 +241,6 @@ int __PushCommand( extension_t *p_ext,
break; break;
} }
va_end( args );
/* Push command to the end of the queue */ /* Push command to the end of the queue */
struct command_t *last = p_ext->p_sys->command; struct command_t *last = p_ext->p_sys->command;
if( !last ) if( !last )
......
...@@ -53,8 +53,9 @@ static int vlclua_dialog_delete( lua_State *L ); ...@@ -53,8 +53,9 @@ static int vlclua_dialog_delete( lua_State *L );
static int vlclua_dialog_show( lua_State *L ); static int vlclua_dialog_show( lua_State *L );
static int vlclua_dialog_hide( lua_State *L ); static int vlclua_dialog_hide( lua_State *L );
static int vlclua_dialog_flush( lua_State *L ); static int vlclua_dialog_flush( lua_State *L );
static void lua_SetDialogUpdate( lua_State *L, int flag ) static void lua_SetDialogUpdate( lua_State *L, int flag );
static int lua_GetDialogUpdate( lua_State *L ) 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_button( lua_State *L );
static int vlclua_dialog_add_label( 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 ) ...@@ -347,7 +348,7 @@ static void lua_SetDialogUpdate( lua_State *L, int flag )
/* Set entry in the Lua registry */ /* Set entry in the Lua registry */
lua_pushlightuserdata( L, (void*) &key_update ); lua_pushlightuserdata( L, (void*) &key_update );
lua_pushinteger( L, flag ); lua_pushinteger( L, flag );
lua_settable( L, LUA_REGISTRYINDEX ); lua_settable( L, LUA_REGISTRYINDEX );
} }
static int lua_GetDialogUpdate( lua_State *L ) static int lua_GetDialogUpdate( lua_State *L )
...@@ -368,7 +369,7 @@ int lua_DialogFlush( lua_State *L ) ...@@ -368,7 +369,7 @@ int lua_DialogFlush( lua_State *L )
{ {
lua_getglobal( L, "vlc" ); lua_getglobal( L, "vlc" );
lua_getfield( L, -1, "__dialog" ); 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 ) ); lua_topointer( L, lua_gettop( L ) );
if( !p_dlg ) if( !p_dlg )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment