protocols = [
{ 'name': 'agl-shell', 'source': 'internal' },
+ { 'name': 'agl-shell-desktop', 'source': 'internal' },
{ 'name': 'xdg-shell', 'source': 'wp-stable' },
]
'shared/option-parser.c',
'shared/os-compatibility.c',
agl_shell_server_protocol_h,
+ agl_shell_desktop_server_protocol_h,
agl_shell_protocol_c,
+ agl_shell_desktop_protocol_c,
xdg_shell_protocol_c,
]
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="agl_shell_desktop">
+ <copyright>
+ Copyright © 2020 Collabora, Ltd.
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice (including the next
+ paragraph) shall be included in all copies or substantial portions of the
+ Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ </copyright>
+ <interface name="agl_shell_desktop" version="1">
+ <description summary="Private extension to allow applications activate other apps">
+ This extension can be used by regular application to instruct to compositor
+ to activate or switch to other running (regular) applications. The client
+ is responsbile for filtering their own app_id when receiving application id.
+
+ Note that other (regular) applications can bind to this interface and there is
+ no mechanism to place to restrict or limit that.
+ </description>
+
+ <request name="activate_app">
+ <description summary="make client current window">
+ Ask the compositor to make a toplevel to become the current/focused
+ window for window management purposes.
+
+ See xdg_toplevel.set_app_id from the xdg-shell protocol for a
+ description of app_id.
+ </description>
+ <arg name="app_id" type="string"/>
+ <arg name="output" type="object" interface="wl_output"/>
+ </request>
+ </interface>
+</protocol>
#define ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0]))
+struct desktop_client {
+ struct wl_resource *resource;
+ struct wl_list link; /* ivi_compositor::desktop_clients */
+};
+
struct ivi_compositor {
struct weston_compositor *compositor;
struct weston_config *config;
const struct weston_drm_output_api *drm_api;
struct wl_global *agl_shell;
+ struct wl_global *agl_shell_desktop;
struct {
int activate_apps_by_default; /* switches once xdg top level has been 'created' */
} quirks;
bool ready;
} shell_client;
+ struct wl_list desktop_clients; /* desktop_client::link */
+
struct wl_list outputs; /* ivi_output.link */
struct wl_list surfaces; /* ivi_surface.link */
wl_list_init(&ivi.outputs);
wl_list_init(&ivi.surfaces);
wl_list_init(&ivi.pending_surfaces);
+ wl_list_init(&ivi.desktop_clients);
/* Prevent any clients we spawn getting our stdin */
os_fd_set_cloexec(STDIN_FILENO);
#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);
.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)
{
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)
{
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;
}