lv2 ui_get_hostinfo macos using proc_name
This commit is contained in:
parent
71527bb45e
commit
09c1598c20
@ -69,11 +69,6 @@
|
|||||||
# else
|
# else
|
||||||
# include <sched.h>
|
# include <sched.h>
|
||||||
# define yield sched_yield
|
# define yield sched_yield
|
||||||
# ifdef __linux__
|
|
||||||
# define _GNU_SOURCE
|
|
||||||
# include <errno.h>
|
|
||||||
extern char *program_invocation_name;
|
|
||||||
# endif
|
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -548,6 +543,16 @@ LV2_SYMBOL_EXPORT const LV2_Descriptor * lv2_descriptor(uint32_t index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DATA_UI
|
#ifdef DATA_UI
|
||||||
|
|
||||||
|
#if defined(__linux__)
|
||||||
|
# define _GNU_SOURCE
|
||||||
|
# include <errno.h>
|
||||||
|
extern char *program_invocation_name;
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
# include <libproc.h>
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
plugin_ui * ui;
|
plugin_ui * ui;
|
||||||
char * bundle_path;
|
char * bundle_path;
|
||||||
@ -557,6 +562,7 @@ typedef struct {
|
|||||||
char has_touch;
|
char has_touch;
|
||||||
LV2UI_Touch touch;
|
LV2UI_Touch touch;
|
||||||
# endif
|
# endif
|
||||||
|
char processname[128];
|
||||||
} ui_instance;
|
} ui_instance;
|
||||||
|
|
||||||
static const char * ui_get_bundle_path_cb(void *handle) {
|
static const char * ui_get_bundle_path_cb(void *handle) {
|
||||||
@ -565,9 +571,18 @@ static const char * ui_get_bundle_path_cb(void *handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char * ui_get_hostinfo(void *handle) {
|
static const char * ui_get_hostinfo(void *handle) {
|
||||||
|
#if defined(__linux__)
|
||||||
(void) handle;
|
(void) handle;
|
||||||
#ifdef __linux__
|
|
||||||
return program_invocation_name;
|
return program_invocation_name;
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
ui_instance *instance = (ui_instance *)handle;
|
||||||
|
pid_t pid = getpid();
|
||||||
|
instance->processname[0] = 0;
|
||||||
|
if (proc_name(pid, instance->processname, 128) <= 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
instance->processname[127] = 0;
|
||||||
|
return instance->processname;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user