X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fshell.c;h=9100ad797dd73d14b2bc865c9a7bab1558197b2e;hb=a35a7f2e5cc20bd40ece91918e753c709e2ee10b;hp=0553f30217a1f9267aea834b0cf341cc5319db25;hpb=dbba1adda7fd9aaaa46263d8c878132a523327e4;p=src%2Fagl-compositor.git diff --git a/src/shell.c b/src/shell.c index 0553f30..9100ad7 100644 --- a/src/shell.c +++ b/src/shell.c @@ -39,6 +39,7 @@ #include "shared/os-compatibility.h" #include "agl-shell-server-protocol.h" +#include "agl-shell-desktop-server-protocol.h" static void create_black_surface_view(struct ivi_output *output); @@ -439,6 +440,10 @@ static const struct agl_shell_interface agl_shell_implementation = { .activate_app = shell_activate_app, }; +static const struct agl_shell_desktop_interface agl_shell_desktop_implementation = { + .activate_app = shell_activate_app, +}; + static void unbind_agl_shell(struct wl_resource *resource) { @@ -526,6 +531,42 @@ bind_agl_shell(struct wl_client *client, ivi->shell_client.resource = resource; } +static void +unbind_agl_shell_desktop(struct wl_resource *resource) +{ + struct desktop_client *dclient = wl_resource_get_user_data(resource); + + wl_list_remove(&dclient->link); + free(dclient); +} + +static void +bind_agl_shell_desktop(struct wl_client *client, + void *data, uint32_t version, uint32_t id) +{ + struct ivi_compositor *ivi = data; + struct wl_resource *resource; + struct desktop_client *dclient = zalloc(sizeof(*dclient)); + + if (!dclient) { + wl_client_post_no_memory(client); + return; + } + + resource = wl_resource_create(client, &agl_shell_desktop_interface, + version, id); + if (!resource) { + wl_client_post_no_memory(client); + return; + } + + wl_resource_set_implementation(resource, &agl_shell_desktop_implementation, + dclient, unbind_agl_shell_desktop); + + dclient->resource = resource; + wl_list_insert(&ivi->desktop_clients, &dclient->link); +} + int ivi_shell_create_global(struct ivi_compositor *ivi) { @@ -537,5 +578,13 @@ ivi_shell_create_global(struct ivi_compositor *ivi) return -1; } + ivi->agl_shell_desktop = wl_global_create(ivi->compositor->wl_display, + &agl_shell_desktop_interface, 1, + ivi, bind_agl_shell_desktop); + if (!ivi->agl_shell_desktop) { + weston_log("Failed to create wayland global (agl_shell_desktop).\n"); + return -1; + } + return 0; }