From 43a25ed63a9144afe32a4fea520412770394822c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 18 Mar 2017 12:02:05 +0100 Subject: Add suil_init() This allows the actual host argc and argv to be passed to QApplication if it is created by Suil (for Qt in non-Qt cases), and initializes X11 threads to fix Qt5 in Gtk2. --- src/instance.c | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) (limited to 'src/instance.c') diff --git a/src/instance.c b/src/instance.c index f05cc86..2563bf6 100644 --- a/src/instance.c +++ b/src/instance.c @@ -143,25 +143,8 @@ open_wrapper(SuilHost* host, return NULL; } - const char* const env_dir = getenv("SUIL_MODULE_DIR"); - const char* const mod_dir = env_dir ? env_dir : SUIL_MODULE_DIR; - - const size_t path_len = strlen(mod_dir) - + strlen(SUIL_DIR_SEP SUIL_MODULE_PREFIX SUIL_MODULE_EXT) - + strlen(module_name) - + 2; - - char* const path = (char*)calloc(path_len, 1); - snprintf(path, path_len, "%s%s%s%s%s", - mod_dir, SUIL_DIR_SEP, - SUIL_MODULE_PREFIX, module_name, SUIL_MODULE_EXT); - - // Open wrap module - dlerror(); - void* lib = dlopen(path, RTLD_NOW); + void* const lib = suil_open_module(module_name); if (!lib) { - SUIL_ERRORF("Unable to open wrap module %s (%s)\n", path, dlerror()); - free(path); return NULL; } @@ -176,17 +159,13 @@ open_wrapper(SuilHost* host, n_features) : NULL; - if (!wrapper) { - SUIL_ERRORF("Corrupt module %s\n", path); + if (wrapper) { + wrapper->lib = lib; + } else { + SUIL_ERRORF("Corrupt wrap module %s\n", module_name); dlclose(lib); - free(path); - return NULL; } - free(path); - - wrapper->lib = lib; - return wrapper; } -- cgit v1.2.1