[PATCH weston v2 4/5] weston: Make the shell entrypoint specific

Quentin Glidic sardemff7+wayland at sardemff7.net
Sun Dec 18 13:26:33 UTC 2016


From: Quentin Glidic <sardemff7+git at sardemff7.net>

This avoids loading a shell as a module, so we are sure to have only one
shell loaded at a time.

Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
---
 compositor/main.c                   | 17 ++++++++++++++++-
 compositor/weston.h                 |  3 +++
 desktop-shell/shell.c               |  4 ++--
 fullscreen-shell/fullscreen-shell.c |  4 ++--
 ivi-shell/ivi-shell.c               |  4 ++--
 5 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index af093f1..74b404b 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -828,6 +828,21 @@ wet_load_module(struct weston_compositor *compositor,
 	return 0;
 }
 
+static int
+wet_load_shell(struct weston_compositor *compositor,
+	       const char *name, int *argc, char *argv[])
+{
+	int (*shell_init)(struct weston_compositor *ec,
+			  int *argc, char *argv[]);
+
+	shell_init = wet_load_module_entrypoint(name, "wet_shell_init");
+	if (!shell_init)
+		return -1;
+	if (shell_init(compositor, argc, argv) < 0)
+		return -1;
+	return 0;
+}
+
 static int
 load_modules(struct weston_compositor *ec, const char *modules,
 	     int *argc, char *argv[])
@@ -1895,7 +1910,7 @@ int main(int argc, char *argv[])
 		weston_config_section_get_string(section, "shell", &shell,
 						 "desktop-shell.so");
 
-	if (load_modules(ec, shell, &argc, argv) < 0)
+	if (wet_load_shell(ec, shell, &argc, argv) < 0)
 		goto out;
 
 	weston_config_section_get_string(section, "modules", &modules, "");
diff --git a/compositor/weston.h b/compositor/weston.h
index 6229b34..5708aca 100644
--- a/compositor/weston.h
+++ b/compositor/weston.h
@@ -64,6 +64,9 @@ void *
 wet_load_module_entrypoint(const char *name, const char *entrypoint);
 
 int
+wet_shell_init(struct weston_compositor *ec,
+	       int *argc, char *argv[]);
+int
 wet_module_init(struct weston_compositor *ec,
 		int *argc, char *argv[]);
 int
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 47f7e16..a5e32bd 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -4875,8 +4875,8 @@ handle_seat_created(struct wl_listener *listener, void *data)
 }
 
 WL_EXPORT int
-wet_module_init(struct weston_compositor *ec,
-		int *argc, char *argv[])
+wet_shell_init(struct weston_compositor *ec,
+	       int *argc, char *argv[])
 {
 	struct weston_seat *seat;
 	struct desktop_shell *shell;
diff --git a/fullscreen-shell/fullscreen-shell.c b/fullscreen-shell/fullscreen-shell.c
index fcecc8d..2037f1c 100644
--- a/fullscreen-shell/fullscreen-shell.c
+++ b/fullscreen-shell/fullscreen-shell.c
@@ -897,8 +897,8 @@ bind_fullscreen_shell(struct wl_client *client, void *data, uint32_t version,
 }
 
 WL_EXPORT int
-wet_module_init(struct weston_compositor *compositor,
-		int *argc, char *argv[])
+wet_shell_init(struct weston_compositor *compositor,
+	       int *argc, char *argv[])
 {
 	struct fullscreen_shell *shell;
 	struct weston_seat *seat;
diff --git a/ivi-shell/ivi-shell.c b/ivi-shell/ivi-shell.c
index 6095ff7..efaa889 100644
--- a/ivi-shell/ivi-shell.c
+++ b/ivi-shell/ivi-shell.c
@@ -492,8 +492,8 @@ shell_add_bindings(struct weston_compositor *compositor,
  * Initialization of ivi-shell.
  */
 WL_EXPORT int
-wet_module_init(struct weston_compositor *compositor,
-		int *argc, char *argv[])
+wet_shell_init(struct weston_compositor *compositor,
+	       int *argc, char *argv[])
 {
 	struct ivi_shell *shell;
 	struct ivi_shell_setting setting = { };
-- 
2.10.0



More information about the wayland-devel mailing list