NSM: Minor cleanup.

This commit is contained in:
Jonathan Moore Liles 2012-02-29 03:46:22 -08:00
parent 677d4976b2
commit c1a7848670
2 changed files with 49 additions and 21 deletions

View File

@ -695,6 +695,15 @@ OSC_HANDLER( announce )
int minor = argv[4]->i;
int pid = argv[5]->i;
if ( ! session_path )
{
osc_server->send( lo_message_get_source( msg ), "/error",
path,
ERR_NO_SESSION_OPEN,
"Sorry, but there's no session open for this application to join." );
return 0;
}
bool expected_client = false;
Client *c = NULL;
@ -727,6 +736,7 @@ OSC_HANDLER( announce )
DMESSAGE( "Client is using incompatible and more recent API version %i.%i", major, minor );
osc_server->send( lo_message_get_source( msg ), "/error",
path,
ERR_INCOMPATIBLE_API,
"Server is using an incompatible API version." );

View File

@ -21,6 +21,8 @@
#include "OSC/Endpoint.H"
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Widget.H>
@ -470,6 +472,12 @@ public:
return NULL;
}
const char *session_name ( void ) const
{
clients_pack->parent()->label();
}
void
session_name ( const char *name )
{
@ -892,6 +900,31 @@ ping ( void * )
Fl::repeat_timeout( 1.0, ping, NULL );
}
void
cb_main ( Fl_Widget *o, void *v )
{
if ( Fl::event_key() != FL_Escape )
{
int children = 0;
foreach_daemon ( d )
{
if ( (*d)->is_child )
++children;
}
if ( children )
{
if ( strlen( controller->session_name() ) )
{
fl_message( "%s", "You have to close the session before you can quit." );
return;
}
}
while ( Fl::first_window() ) Fl::first_window()->hide();
}
}
int
main (int argc, char **argv )
{
@ -924,12 +957,12 @@ main (int argc, char **argv )
o->size_range( main_window->w(), controller->min_h(), 0, 0 );
// o->callback( (Fl_Callback*)cb_main, main_window );
o->callback( (Fl_Callback*)cb_main, main_window );
#ifdef HAVE_XPM
o->icon((char *)p);
#endif
o->show( argc, argv );
o->show( 0, NULL );
}
static struct option long_options[] =
@ -999,9 +1032,7 @@ main (int argc, char **argv )
{
/* pass non-option arguments on to daemon */
option_index += 2;
char **args = (char **)malloc( 4 + argc - option_index );
char **args = (char **)malloc( 4 + argc - optind );
int i = 0;
args[i++] = (char*)"nsmd";
@ -1009,10 +1040,10 @@ main (int argc, char **argv )
args[i++] = url;
for ( ; option_index < argc; i++, option_index++ )
for ( ; optind < argc; i++, optind++ )
{
DMESSAGE( "Passing argument: %s", argv[option_index] );
args[i] = argv[option_index];
DMESSAGE( "Passing argument: %s", argv[optind] );
args[i] = argv[optind];
}
args[i] = 0;
@ -1039,16 +1070,3 @@ main (int argc, char **argv )
return 0;
}