diff options
author | Marius Vlad <marius.vlad@collabora.com> | 2020-10-08 17:46:24 +0300 |
---|---|---|
committer | Marius Vlad <marius.vlad@collabora.com> | 2020-10-08 17:46:24 +0300 |
commit | e0110aa587acfa5b011162ea86873675c2fc96d9 (patch) | |
tree | b1286a341aa9961865bbc77e22aec2f66e2ed1a8 | |
parent | 097713d92a9b42457e5d10de8a5c500aec926f1b (diff) |
'Push' or foward depending on the remote output the app_id to thesandbox/mvlad/add-waltham-support
receiver side.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I8b40057b56bc234e907cf321cc1c5094674f5d93
-rw-r--r-- | src/desktop.c | 5 | ||||
-rw-r--r-- | src/ivi-compositor.h | 7 | ||||
-rw-r--r-- | src/layout.c | 4 | ||||
-rw-r--r-- | src/main.c | 7 | ||||
-rw-r--r-- | src/shell.c | 42 |
5 files changed, 61 insertions, 4 deletions
diff --git a/src/desktop.c b/src/desktop.c index 58d2887..236724b 100644 --- a/src/desktop.c +++ b/src/desktop.c @@ -96,8 +96,11 @@ desktop_surface_added(struct weston_desktop_surface *dsurface, void *userdata) app_id = weston_desktop_surface_get_app_id(dsurface); - if ((active_output = ivi_layout_find_with_app_id(app_id, ivi))) + if ((active_output = ivi_layout_find_with_app_id(app_id, ivi))) { + weston_log("Found active_output %s for app_id %s\n", + active_output->output->name, app_id); ivi_set_pending_desktop_surface_remote(active_output, app_id); + } /* reset any caps to make sure we apply the new caps */ ivi_seat_reset_caps_sent(ivi); diff --git a/src/ivi-compositor.h b/src/ivi-compositor.h index ea80b1a..5b08acd 100644 --- a/src/ivi-compositor.h +++ b/src/ivi-compositor.h @@ -107,6 +107,12 @@ struct ivi_compositor { struct ivi_surface; +enum ivi_output_type { + OUTPUT_LOCAL, + OUTPUT_REMOTING, + OUTPUT_WALTHAM, +}; + struct ivi_output { struct wl_list link; /* ivi_compositor.outputs */ struct ivi_compositor *ivi; @@ -145,6 +151,7 @@ struct ivi_output { struct weston_head *add[8]; char *app_id; + enum ivi_output_type type; }; enum ivi_surface_role { diff --git a/src/layout.c b/src/layout.c index 0345807..c58b39b 100644 --- a/src/layout.c +++ b/src/layout.c @@ -241,8 +241,10 @@ ivi_layout_find_with_app_id(const char *app_id, struct ivi_compositor *ivi) { struct ivi_output *out; - if (!app_id) + if (!app_id) { + weston_log("ivi_layout_find_with_app_id() failed w/ no app_id\n"); return NULL; + } wl_list_for_each(out, &ivi->outputs, link) { if (!out->app_id) @@ -652,7 +652,7 @@ ivi_enable_waltham_outputs(struct ivi_compositor *ivi, struct weston_config *con ivi_output = zalloc(sizeof(*ivi_output)); ivi_output->ivi = ivi; - ivi_output->name = _name; + ivi_output->name = transmitter_output_name; ivi_output->config = transmitter_section; /* waltham creates the output */ ivi_output->output = @@ -664,10 +664,13 @@ ivi_enable_waltham_outputs(struct ivi_compositor *ivi, struct weston_config *con weston_output_add_destroy_listener(ivi_output->output, &ivi_output->output_destroy); + ivi_output->type = OUTPUT_WALTHAM; + wl_list_insert(&ivi->outputs, &ivi_output->link); ivi_output_configure_app_id(ivi_output); - free(transmitter_output_name); + /* FIXME: handle it correctly? */ + /* free(transmitter_output_name); */ } } #else diff --git a/src/shell.c b/src/shell.c index 21f321d..b5f13b4 100644 --- a/src/shell.c +++ b/src/shell.c @@ -42,6 +42,10 @@ #include "agl-shell-server-protocol.h" #include "agl-shell-desktop-server-protocol.h" +#ifdef HAVE_WALTHAM +#include <waltham-transmitter/transmitter_api.h> +#endif + static void create_black_surface_view(struct ivi_output *output); @@ -96,6 +100,41 @@ ivi_set_desktop_surface_fullscreen(struct ivi_surface *surface) } static void +ivi_output_notify_waltham_plugin(struct ivi_surface *surface) +{ + struct ivi_compositor *ivi = surface->ivi; + const struct weston_transmitter_api *api = ivi->waltham_transmitter_api; + struct weston_transmitter *transmitter; + struct weston_transmitter_remote *trans_remote; + struct weston_surface *weston_surface; + struct weston_output *woutput = surface->remote.output->output; + const char *app_id; + + if (!api) + return; + + transmitter = api->transmitter_get(ivi->compositor); + + if (!transmitter) + return; + + trans_remote = api->get_transmitter_remote(woutput->name, transmitter); + + if (!trans_remote) { + weston_log("Could not find a valie weston_transmitter_remote " + "that matches the output %s\n", woutput->name); + return; + } + + app_id = weston_desktop_surface_get_app_id(surface->dsurface); + weston_surface = + weston_desktop_surface_get_surface(surface->dsurface); + + weston_log("Forwarding app_id %s to remote %s\n", app_id, woutput->name); + api->surface_push_to_remote(weston_surface, app_id, trans_remote, NULL); +} + +static void ivi_set_desktop_surface_remote(struct ivi_surface *surface) { struct ivi_compositor *ivi = surface->ivi; @@ -115,6 +154,9 @@ ivi_set_desktop_surface_remote(struct ivi_surface *surface) if (view->is_mapped || view->surface->is_mapped) remove_black_surface(output); + if (output->type == OUTPUT_WALTHAM) + ivi_output_notify_waltham_plugin(surface); + wl_list_insert(&ivi->surfaces, &surface->link); } |