src: Allow to start other clients
authorMarius Vlad <marius.vlad@collabora.com>
Mon, 10 Oct 2022 14:03:15 +0000 (17:03 +0300)
committerMarius Vlad <marius.vlad@collabora.com>
Fri, 21 Oct 2022 17:16:53 +0000 (20:16 +0300)
With shell-client-ext is a new section entry to add to allow starting
the gRPC server helper client.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I41d62c932648699aa21837afc2de5103912c370d

src/compositor.c
src/ivi-compositor.h
src/shell.c

index 634c468..c143fd2 100644 (file)
@@ -1816,7 +1816,12 @@ int wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_da
        weston_compositor_wake(ivi.compositor);
 
        ivi_shell_create_global(&ivi);
-       ivi_launch_shell_client(&ivi);
+
+       ivi_launch_shell_client(&ivi, "shell-client",
+                               &ivi.shell_client.client);
+       ivi_launch_shell_client(&ivi, "shell-client-ext",
+                               &ivi.shell_client_ext.client);
+
        if (debug)
                ivi_screenshooter_create(&ivi);
        ivi_agl_systemd_notify(&ivi);
index 5a0f66c..1d03747 100644 (file)
@@ -94,6 +94,7 @@ struct ivi_compositor {
        } shell_client;
 
        struct {
+               struct wl_client *client;
                struct wl_resource *resource;
                bool doas_requested;
                enum agl_shell_bound_status status;
@@ -361,7 +362,7 @@ int
 ivi_shell_create_global(struct ivi_compositor *ivi);
 
 int
-ivi_launch_shell_client(struct ivi_compositor *ivi);
+ivi_launch_shell_client(struct ivi_compositor *ivi, const char *cmd_section, struct wl_client **client);
 
 int
 ivi_desktop_init(struct ivi_compositor *ivi);
index 4211399..9fe6cf1 100644 (file)
@@ -986,17 +986,16 @@ process_handle_sigchld(struct weston_process *process, int status)
 }
 
 int
-ivi_launch_shell_client(struct ivi_compositor *ivi)
+ivi_launch_shell_client(struct ivi_compositor *ivi, const char *cmd_section,
+                       struct wl_client **client)
 {
        struct process_info *pinfo;
        struct weston_config_section *section;
        char *command = NULL;
 
-       section = weston_config_get_section(ivi->config, "shell-client",
-                                           NULL, NULL);
+       section = weston_config_get_section(ivi->config, cmd_section, NULL, NULL);
        if (section)
-               weston_config_section_get_string(section, "command",
-                                                &command, NULL);
+               weston_config_section_get_string(section, "command", &command, NULL);
 
        if (!command)
                return -1;
@@ -1009,9 +1008,8 @@ ivi_launch_shell_client(struct ivi_compositor *ivi)
        if (!pinfo->path)
                goto out_free;
 
-       ivi->shell_client.client = client_launch(ivi->compositor, &pinfo->proc,
-                                                command, process_handle_sigchld);
-       if (!ivi->shell_client.client)
+       *client = client_launch(ivi->compositor, &pinfo->proc, command, process_handle_sigchld);
+       if (!*client)
                goto out_str;
 
        return 0;