Commit 788d2256 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Lua: extension: reindent

parent 7031f81c
...@@ -340,95 +340,92 @@ static void* Run( void *data ) ...@@ -340,95 +340,92 @@ static void* Run( void *data )
vlc_restorecancel( cancel ); vlc_restorecancel( cancel );
/* Run command */ /* Run command */
if( true ) if( LockExtension( p_ext ) )
{ {
if( LockExtension( p_ext ) ) mutex_cleanup_push( &p_ext->p_sys->running_lock );
switch( cmd->i_command )
{ {
mutex_cleanup_push( &p_ext->p_sys->running_lock ); case CMD_ACTIVATE:
switch( cmd->i_command )
{ {
case CMD_ACTIVATE: if( lua_ExecuteFunction( p_mgr, p_ext, "activate", LUA_END ) < 0 )
{ {
if( lua_ExecuteFunction( p_mgr, p_ext, "activate", LUA_END ) < 0 ) msg_Err( p_mgr, "Could not activate extension!" );
{ Deactivate( p_mgr, p_ext );
msg_Err( p_mgr, "Could not activate extension!" );
Deactivate( p_mgr, p_ext );
}
break;
} }
break;
}
case CMD_DEACTIVATE: case CMD_DEACTIVATE:
{
msg_Dbg( p_mgr, "Deactivating '%s'", p_ext->psz_title );
if( lua_ExtensionDeactivate( p_mgr, p_ext ) < 0 )
{ {
msg_Dbg( p_mgr, "Deactivating '%s'", p_ext->psz_title ); msg_Warn( p_mgr, "Extension '%s' did not deactivate properly",
if( lua_ExtensionDeactivate( p_mgr, p_ext ) < 0 ) p_ext->psz_title );
{
msg_Warn( p_mgr, "Extension '%s' did not deactivate properly",
p_ext->psz_title );
}
p_ext->p_sys->b_exiting = true;
RemoveActivated( p_mgr, p_ext );
break;
} }
p_ext->p_sys->b_exiting = true;
RemoveActivated( p_mgr, p_ext );
break;
}
case CMD_CLOSE: case CMD_CLOSE:
{ {
lua_ExecuteFunction( p_mgr, p_ext, "close", LUA_END ); lua_ExecuteFunction( p_mgr, p_ext, "close", LUA_END );
break; break;
} }
case CMD_CLICK: case CMD_CLICK:
{
extension_widget_t *p_widget = cmd->data[0];
assert( p_widget );
msg_Dbg( p_mgr, "Clicking '%s': '%s'",
p_ext->psz_name, p_widget->psz_text );
if( !lua_ExtensionWidgetClick( p_mgr, p_ext, p_widget )
< 0 )
{ {
extension_widget_t *p_widget = cmd->data[0]; msg_Warn( p_mgr, "Could not translate click" );
assert( p_widget );
msg_Dbg( p_mgr, "Clicking '%s': '%s'",
p_ext->psz_name, p_widget->psz_text );
if( !lua_ExtensionWidgetClick( p_mgr, p_ext, p_widget )
< 0 )
{
msg_Warn( p_mgr, "Could not translate click" );
}
break;
} }
break;
}
case CMD_TRIGGERMENU: case CMD_TRIGGERMENU:
{ {
int *pi_id = cmd->data[0]; int *pi_id = cmd->data[0];
assert( pi_id ); assert( pi_id );
msg_Dbg( p_mgr, "Trigger menu %d of '%s'", msg_Dbg( p_mgr, "Trigger menu %d of '%s'",
*pi_id, p_ext->psz_name ); *pi_id, p_ext->psz_name );
lua_ExtensionTriggerMenu( p_mgr, p_ext, *pi_id ); lua_ExtensionTriggerMenu( p_mgr, p_ext, *pi_id );
break; break;
} }
case CMD_SET_INPUT: case CMD_SET_INPUT:
{ {
lua_ExecuteFunction( p_mgr, p_ext, "input_changed", LUA_END ); lua_ExecuteFunction( p_mgr, p_ext, "input_changed", LUA_END );
break; break;
} }
case CMD_UPDATE_META: case CMD_UPDATE_META:
{ {
lua_ExecuteFunction( p_mgr, p_ext, "meta_changed", LUA_END ); lua_ExecuteFunction( p_mgr, p_ext, "meta_changed", LUA_END );
break; break;
} }
case CMD_PLAYING_CHANGED: case CMD_PLAYING_CHANGED:
{ {
lua_ExecuteFunction( p_mgr, p_ext, "playing_changed", lua_ExecuteFunction( p_mgr, p_ext, "playing_changed",
LUA_NUM, *((int *)cmd->data[0]), LUA_END ); LUA_NUM, *((int *)cmd->data[0]), LUA_END );
break; break;
} }
default: default:
{ {
msg_Dbg( p_mgr, "Unknown command in extension command queue: %d", msg_Dbg( p_mgr, "Unknown command in extension command queue: %d",
cmd->i_command ); cmd->i_command );
break; break;
}
} }
vlc_cleanup_pop();
UnlockExtension( p_ext );
} }
vlc_cleanup_pop();
UnlockExtension( p_ext );
} }
FreeCommands( cmd ); FreeCommands( cmd );
......
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