summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 340d0e0..5605841 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1153,6 +1153,46 @@ load_backend(struct ivi_compositor *ivi, const char *backend,
return -1;
}
+static int
+load_modules(struct ivi_compositor *ivi, const char *modules,
+ int *argc, char *argv[], bool *xwayland)
+{
+ const char *p, *end;
+ char buffer[256];
+ int (*module_init)(struct weston_compositor *wc, int argc, char *argv[]);
+
+ if (modules == NULL)
+ return 0;
+
+ p = modules;
+ while (*p) {
+ end = strchrnul(p, ',');
+ snprintf(buffer, sizeof buffer, "%.*s", (int) (end - p), p);
+
+ if (strstr(buffer, "xwayland.so")) {
+ weston_log("Xwayland plug-in not supported!\n");
+ p = end;
+ while (*p == ',')
+ p++;
+ continue;
+ }
+
+ module_init = weston_load_module(buffer, "wet_module_init");
+ if (!module_init)
+ return -1;
+
+ if (module_init(ivi->compositor, *argc, argv) < 0)
+ return -1;
+
+ p = end;
+ while (*p == ',')
+ p++;
+ }
+
+ return 0;
+}
+
+
static char *
choose_default_backend(void)
{
@@ -1512,6 +1552,8 @@ int main(int argc, char *argv[])
char *backend = NULL;
char *socket_name = NULL;
char *log = NULL;
+ char *modules = NULL;
+ char *option_modules = NULL;
int help = 0;
int version = 0;
int no_config = 0;
@@ -1520,6 +1562,7 @@ int main(int argc, char *argv[])
struct weston_log_context *log_ctx = NULL;
struct weston_log_subscriber *logger;
int ret = EXIT_FAILURE;
+ bool xwayland = false;
const struct weston_option core_options[] = {
{ WESTON_OPTION_STRING, "backend", 'B', &backend },
@@ -1530,6 +1573,7 @@ int main(int argc, char *argv[])
{ WESTON_OPTION_BOOLEAN, "no-config", 0, &no_config },
{ WESTON_OPTION_BOOLEAN, "debug", 0, &debug },
{ WESTON_OPTION_STRING, "config", 'c', &config_file },
+ { WESTON_OPTION_STRING, "modules", 0, &option_modules },
};
wl_list_init(&ivi.outputs);
@@ -1625,6 +1669,14 @@ int main(int argc, char *argv[])
ivi_seat_init(&ivi);
+ /* load additional modules */
+ weston_config_section_get_string(section, "modules", &modules, "");
+ if (load_modules(&ivi, modules, &argc, argv, &xwayland) < 0)
+ goto error_compositor;
+
+ if (load_modules(&ivi, option_modules, &argc, argv, &xwayland) < 0)
+ goto error_compositor;
+
if (ivi_policy_init(&ivi) < 0)
goto error_compositor;