diff options
author | Marius Vlad <marius.vlad@collabora.com> | 2023-01-11 17:23:37 +0200 |
---|---|---|
committer | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2023-01-29 22:26:50 +0000 |
commit | 53a039ff1c4b05aaacce118a04563620e676d7c6 (patch) | |
tree | d79410c6a8d21184472c4e64d473209eb102d54b | |
parent | ce8dd33f3762e0ec44927b70059fb2721338e8bf (diff) |
ivi-compositor: Add support for multiple app_ids
Verify if more than one app_id is being passed in the agl-shell-app-id
to allow more than one appid being placed to that output.
Bug-AGL: SPEC-4666
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I79dc77564ffca41148832af597b6836d7d28f686
-rw-r--r-- | src/compositor.c | 8 | ||||
-rw-r--r-- | src/ivi-compositor.h | 2 | ||||
-rw-r--r-- | src/layout.c | 27 |
3 files changed, 29 insertions, 8 deletions
diff --git a/src/compositor.c b/src/compositor.c index 9e71552..617f1b5 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -113,19 +113,19 @@ static void ivi_output_configure_app_id(struct ivi_output *ivi_output) { if (ivi_output->config) { - if (ivi_output->app_id != NULL) + if (ivi_output->app_ids != NULL) return; weston_config_section_get_string(ivi_output->config, "agl-shell-app-id", - &ivi_output->app_id, + &ivi_output->app_ids, NULL); - if (ivi_output->app_id == NULL) + if (ivi_output->app_ids == NULL) return; weston_log("Will place app_id %s on output %s\n", - ivi_output->app_id, ivi_output->name); + ivi_output->app_ids, ivi_output->name); } } diff --git a/src/ivi-compositor.h b/src/ivi-compositor.h index 6a72e2a..0ccbb52 100644 --- a/src/ivi-compositor.h +++ b/src/ivi-compositor.h @@ -179,7 +179,7 @@ struct ivi_output { size_t add_len; struct weston_head *add[8]; - char *app_id; + char *app_ids; enum ivi_output_type type; }; diff --git a/src/layout.c b/src/layout.c index f2fc6cc..028ff4a 100644 --- a/src/layout.c +++ b/src/layout.c @@ -315,6 +315,25 @@ ivi_layout_activate_complete(struct ivi_output *output, shell_send_app_state(ivi, app_id, AGL_SHELL_APP_STATE_ACTIVATED); } +static bool +ivi_layout_find_output_with_app_id(const char *app_id, struct ivi_output *output) +{ + char *cur; + size_t app_id_len; + + cur = output->app_ids; + app_id_len = strlen(app_id); + + while ((cur = strstr(cur, app_id))) { + if ((cur[app_id_len] == ',' || cur[app_id_len] == '\0') && + (cur == output->app_ids || cur[-1] == ',')) + return true; + cur++; + } + + return false; +} + struct ivi_output * ivi_layout_find_with_app_id(const char *app_id, struct ivi_compositor *ivi) { @@ -324,13 +343,12 @@ ivi_layout_find_with_app_id(const char *app_id, struct ivi_compositor *ivi) return NULL; wl_list_for_each(out, &ivi->outputs, link) { - if (!out->app_id) + if (!out->app_ids) continue; - if (!strcmp(app_id, out->app_id)) + if (ivi_layout_find_output_with_app_id(app_id, out)) return out; } - return NULL; } @@ -924,6 +942,9 @@ ivi_layout_activate_by_surf(struct ivi_output *output, struct ivi_surface *surf) struct ivi_output *remote_output = ivi_layout_find_with_app_id(app_id, ivi); + weston_log("Changed activation for app_id %s, type %s, on output %s\n", app_id, + ivi_layout_get_surface_role_name(surf), output->output->name); + /* if already active on a remote output do not * attempt to activate it again */ if (remote_output && remote_output->active == surf) |