76#define NSM_API_VERSION_MAJOR 1
77#define NSM_API_VERSION_MINOR 0
87typedef int (
nsm_open_callback)(
const char *name,
const char *display_name,
const char *client_id,
char **out_msg,
void *userdata );
95#define _NSM() ((struct _nsm_client_t*)nsm)
97#define NSM_EXPORT __attribute__((unused)) static
152 return _NSM()->nsm_is_active;
159 return _NSM()->_session_manager_name;
166 return _NSM()->_session_manager_features;
246 lo_send_from(
_NSM()->
nsm_addr,
_NSM()->
_server, LO_TT_IMMEDIATE,
"/nsm/client/message",
"is", priority, msg );
252 lo_address to = lo_address_new_from_url(
_NSM()->
nsm_url );
256 fprintf( stderr,
"NSM: Bad address!" );
260 int pid = (int)getpid();
262 lo_send_from( to,
_NSM()->
_server, LO_TT_IMMEDIATE,
"/nsm/server/announce",
"sssiii",
270 lo_address_free( to );
287 while ( lo_server_recv_noblock(
_NSM()->
_server, 0 ) ) {}
302 lo_server_thread_start(
_NSM()->
_st );
310 lo_server_thread_stop(
_NSM()->
_st );
322 lo_server_thread_free(
_NSM()->
_st );
342 _NSM()->open = open_callback;
343 _NSM()->open_userdata = userdata;
350 _NSM()->save = save_callback;
351 _NSM()->save_userdata = userdata;
359 _NSM()->show = show_callback;
360 _NSM()->show_userdata = userdata;
367 _NSM()->hide = hide_callback;
368 _NSM()->hide_userdata = userdata;
375 _NSM()->active = active_callback;
376 _NSM()->active_userdata = userdata;
383 _NSM()->session_is_loaded = session_is_loaded_callback;
384 _NSM()->session_is_loaded_userdata = userdata;
392 _NSM()->broadcast = broadcast_callback;
393 _NSM()->broadcast_userdata = userdata;
405#define OSC_REPLY( value ) lo_send_from( ((struct _nsm_client_t*)user_data)->nsm_addr, ((struct _nsm_client_t*)user_data)->_server, LO_TT_IMMEDIATE, "/reply", "ss", path, value )
407#define OSC_REPLY_ERR( errcode, value ) lo_send_from( ((struct _nsm_client_t*)user_data)->nsm_addr, ((struct _nsm_client_t*)user_data)->_server, LO_TT_IMMEDIATE, "/error", "sis", path, errcode, value )
416 char *out_msg = NULL;
425 int r = nsm->
open( &argv[0]->s, &argv[1]->s, &argv[2]->s, &out_msg, nsm->
open_userdata );
445 char *out_msg = NULL;
471 if ( strcmp( &argv[0]->s,
"/nsm/server/announce" ) )
476 fprintf( stderr,
"NSM: Successfully registered. NSM says: %s\n", &argv[1]->s );
482 nsm->
nsm_addr = lo_address_new_from_url( lo_address_get_url( lo_message_get_source( msg ) ));
497 if ( strcmp( &argv[0]->s,
"/nsm/server/announce" ) )
502 fprintf( stderr,
"NSM: Failed to register with NSM server: %s", &argv[2]->s );
578 lo_address addr = lo_address_new_from_url(
nsm_url );
579 int proto = lo_address_get_protocol( addr );
580 lo_address_free( addr );
582 _NSM()->_server = lo_server_new_with_proto( NULL, proto, NULL );
606 lo_address addr = lo_address_new_from_url(
nsm_url );
607 int proto = lo_address_get_protocol( addr );
608 lo_address_free( addr );
610 _NSM()->_st = lo_server_thread_new_with_proto( NULL, proto, NULL );
611 _NSM()->_server = lo_server_thread_get_server(
_NSM()->
_st );
NSM_EXPORT int _nsm_osc_announce_reply(const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data)
NSM_EXPORT const char * nsm_get_session_manager_name(nsm_client_t *nsm)
NSM_EXPORT nsm_client_t * nsm_new(void)
void() nsm_active_callback(int b, void *userdata)
void() nsm_session_is_loaded_callback(void *userdata)
NSM_EXPORT void nsm_send_message(nsm_client_t *nsm, int priority, const char *msg)
#define NSM_API_VERSION_MINOR
#define OSC_REPLY_ERR(errcode, value)
NSM_EXPORT void nsm_thread_stop(nsm_client_t *nsm)
int() nsm_open_callback(const char *name, const char *display_name, const char *client_id, char **out_msg, void *userdata)
NSM_EXPORT int _nsm_osc_broadcast(const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data)
NSM_EXPORT void nsm_thread_start(nsm_client_t *nsm)
NSM_EXPORT void nsm_check_wait(nsm_client_t *nsm, int timeout)
void() nsm_show_gui_callback(void *userdata)
NSM_EXPORT void nsm_set_broadcast_callback(nsm_client_t *nsm, nsm_broadcast_callback *broadcast_callback, void *userdata)
NSM_EXPORT int _nsm_osc_session_is_loaded(const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data)
void() nsm_hide_gui_callback(void *userdata)
NSM_EXPORT int _nsm_osc_hide(const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data)
NSM_EXPORT void nsm_set_save_callback(nsm_client_t *nsm, nsm_save_callback *save_callback, void *userdata)
NSM_EXPORT const char * nsm_get_session_manager_features(nsm_client_t *nsm)
NSM_EXPORT int nsm_init(nsm_client_t *nsm, const char *nsm_url)
NSM_EXPORT void nsm_send_broadcast(nsm_client_t *nsm, lo_message msg)
NSM_EXPORT int _nsm_osc_open(const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data)
NSM_EXPORT void nsm_set_session_is_loaded_callback(nsm_client_t *nsm, nsm_session_is_loaded_callback *session_is_loaded_callback, void *userdata)
NSM_EXPORT void nsm_set_active_callback(nsm_client_t *nsm, nsm_active_callback *active_callback, void *userdata)
NSM_EXPORT void nsm_send_progress(nsm_client_t *nsm, float p)
int() nsm_save_callback(char **out_msg, void *userdata)
NSM_EXPORT int nsm_init_thread(nsm_client_t *nsm, const char *nsm_url)
NSM_EXPORT int _nsm_osc_show(const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data)
int() nsm_broadcast_callback(const char *, lo_message m, void *userdata)
NSM_EXPORT void nsm_send_is_clean(nsm_client_t *nsm)
NSM_EXPORT void nsm_check_nowait(nsm_client_t *nsm)
NSM_EXPORT int _nsm_osc_save(const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data)
NSM_EXPORT void nsm_send_announce(nsm_client_t *nsm, const char *app_name, const char *capabilities, const char *process_name)
NSM_EXPORT void nsm_set_open_callback(nsm_client_t *nsm, nsm_open_callback *open_callback, void *userdata)
NSM_EXPORT int nsm_is_active(nsm_client_t *nsm)
NSM_EXPORT int _nsm_osc_error(const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data)
#define NSM_API_VERSION_MAJOR
NSM_EXPORT void nsm_send_is_dirty(nsm_client_t *nsm)
NSM_EXPORT void nsm_free(nsm_client_t *nsm)
NSM_EXPORT void nsm_send_is_shown(nsm_client_t *nsm)
NSM_EXPORT void nsm_set_hide_callback(nsm_client_t *nsm, nsm_hide_gui_callback *hide_callback, void *userdata)
NSM_EXPORT void nsm_send_is_hidden(nsm_client_t *nsm)
NSM_EXPORT void nsm_set_show_callback(nsm_client_t *nsm, nsm_show_gui_callback *show_callback, void *userdata)
nsm_active_callback * active
char * _session_manager_features
nsm_hide_gui_callback * hide
char * _session_manager_name
nsm_show_gui_callback * show
void * broadcast_userdata
nsm_session_is_loaded_callback * session_is_loaded
nsm_broadcast_callback * broadcast
void * session_is_loaded_userdata