diff options
author | 2024-11-13 11:09:14 +0200 | |
---|---|---|
committer | 2024-11-25 21:09:49 +0200 | |
commit | f2ebad30021414ae4a1c1b67f811bef0d9893993 (patch) | |
tree | 817ed733289ee55b7ca52342357452fad131a6d2 | |
parent | d60ccb86d2e4cf75f7b9c6ef30fcdba9dae9ffe8 (diff) |
compositor: Remove agl-shell-desktop extension
This has been for some time now in the making so let's remove it as we
have gRPC proxy for some time now.
Bug-AGL: SPEC-4672
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I2cb627cb30ef7756239779c70d9d9d2e317afed0
-rw-r--r-- | meson.build | 6 | ||||
-rw-r--r-- | protocol/agl-shell-desktop.xml | 163 | ||||
-rw-r--r-- | src/desktop.c | 6 | ||||
-rw-r--r-- | src/ivi-compositor.h | 4 | ||||
-rw-r--r-- | src/layout.c | 14 | ||||
-rw-r--r-- | src/shell.c | 504 |
6 files changed, 107 insertions, 590 deletions
diff --git a/meson.build b/meson.build index aa811ad..b17afa4 100644 --- a/meson.build +++ b/meson.build @@ -64,14 +64,12 @@ foreach depname : depnames endforeach agl_shell_xml = files('protocol/agl-shell.xml') -agl_shell_desktop_xml = files('protocol/agl-shell-desktop.xml') xdg_shell_xml = join_paths(dir_wp_base, 'stable', 'xdg-shell', 'xdg-shell.xml') dep_libweston_protocols = dependency('libweston-13-protocols', version: '>= 13') dir_protocol_libweston = dep_libweston_protocols.get_pkgconfig_variable('pkgdatadir') protocols = [ { 'name': 'agl-shell', 'source': 'internal' }, - { 'name': 'agl-shell-desktop', 'source': 'internal' }, { 'name': 'xdg-shell', 'source': 'wp-stable' }, { 'name': 'xdg-output', 'source': 'unstable', 'version': 'v1' }, { 'name': 'weston-output-capture', 'source': 'libweston-protocols' }, @@ -144,9 +142,7 @@ srcs_agl_compositor = [ 'shared/os-compatibility.c', 'shared/process-util.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, ] @@ -266,7 +262,7 @@ pkgconfig.generate( ) install_data( - [ agl_shell_xml, agl_shell_desktop_xml ], + [ agl_shell_xml ], install_dir: join_paths(dir_data, dir_data_agl_compositor) ) diff --git a/protocol/agl-shell-desktop.xml b/protocol/agl-shell-desktop.xml deleted file mode 100644 index e4445bd..0000000 --- a/protocol/agl-shell-desktop.xml +++ /dev/null @@ -1,163 +0,0 @@ -<?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="2"> - <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 responsible for filtering their own app_id when receiving application id. - - The compositor will allow clients to bind to this interface only if the - policy engine allows it. - </description> - - <enum name="app_role"> - <entry name="popup" value="0"/> - <entry name="fullscreen" value="1"/> - <entry name="split_vertical" value="2"/> - <entry name="split_horizontal" value="3"/> - <entry name="remote" value="4"/> - </enum> - - <enum name="app_state"> - <entry name="activated" value="0"/> - <entry name="deactivated" value="1"/> - <entry name="destroyed" value="2"/> - </enum> - - <event name="application"> - <description summary="advertise application id"> - The compositor may choose to advertise one or more application ids which - can be used to activate/switch to. - - When this global is bound, the compositor will send all application ids - available for activation, but may send additional application id at any - time (when they've been mapped in the compositor). - </description> - <arg name="app_id" type="string"/> - </event> - - <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="app_data" type="string" allow-null="true"/> - <arg name="output" type="object" interface="wl_output"/> - </request> - - <request name="set_app_property"> - <description summary="set properties for a client identified by app_id"> - Ask the compositor to make a top-level window obey the 'app_role' enum - and, depending on that role, to use some of the arguments as initial - values to take into account. - - Note that x, y, bx, by, width and height would only make sense for the - pop-up role, with the output argument being applicable to all the roles. - The width and height values define the maximum area which the - top-level window should be placed into. Note this doesn't correspond to - top-level surface size, but to a bounding box which will be used to - clip the surface to, in case the surface area extends that of this - bounding box. Both of these values need to be larger than 0 (zero) to be - taken into account by the compositor. Any negative values for the width - and height will be discarded. - - The x and y values will serve as the (initial) position values. - The bx and by values are the top-left x and y value of the bounding box. - Any clipping happening to the bounding box will not affect the surface - size or the position of the underlying surface backing the top-level - window. The bx and by values, like the positional values, could be - both set to zero, or even negative values. The compositor will pass - those on without any further validation. - - The initial position values and the bounding rectangle will still be - in effect on a subsequent activation request of the 'app_id', assuming - it was previously de-activated at some point in time. - - 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="role" type="uint" enum="app_role"/> - <arg name="x" type="int"/> - <arg name="y" type="int"/> - <arg name="bx" type="int"/> - <arg name="by" type="int"/> - <arg name="width" type="int"/> - <arg name="height" type="int"/> - <arg name="output" type="object" interface="wl_output"/> - </request> - - <request name="deactivate_app"> - <description summary="de-activate/hide window identified by app_id"> - Ask the compositor to hide the toplevel window for window - management purposes. Depending on the window role, this request - will either display the previously active window (or the background - in case there's no previously active surface) or temporarily (or - until a 'activate_app' is called upon) hide the surface. All - the surfaces are identifiable by using the app_id, and no actions are - taken in case the app_id is not/was not present. - - See xdg_toplevel.set_app_id from the xdg-shell protocol for a - description of app_id. - </description> - <arg name="app_id" type="string"/> - </request> - - <event name="state_app"> - <description summary="event sent when application has suffered state modification"> - Notifies application(s) when other application have suffered state modifications. - </description> - <arg name="app_id" type="string"/> - <arg name="app_data" type="string" allow-null="true"/> - <arg name="state" type="uint" enum="app_state"/> - <arg name="role" type="uint" enum="app_role"/> - </event> - - <!-- Version 2 addition --> - <request name="set_app_property_mode" since="2"> - <description summary="Request to change the application properties lifetime"> - Use this request to inform the compositor to maintain a pending state - for an app_id being set with set_app_property() request. Any - subsequent application matching that app_id would survive a potential - application destruction. Note that this request will take effect - globally on all applications. - - To turn it on, or off, use the 'permanent' argument. Initially, - the compositor will have this option set to off. Note that it - doesn't matter the order of this request with respect to - set_app_property() request, as the changes will only take effect - when the application itself does the commit with an app_id set, - therefore the only requirement is to call this request before - the app_id client does its first commit. - </description> - <arg name="permanent" type="uint"/> - </request> - - </interface> -</protocol> diff --git a/src/desktop.c b/src/desktop.c index d3c1d4e..8709d89 100644 --- a/src/desktop.c +++ b/src/desktop.c @@ -34,8 +34,6 @@ #include <libweston/xwayland-api.h> #endif -#include "agl-shell-desktop-server-protocol.h" - static void ivi_layout_destroy_saved_outputs(struct ivi_compositor *ivi) { @@ -56,8 +54,6 @@ desktop_advertise_app(struct wl_listener *listener, void *data) struct ivi_surface *surface; surface = wl_container_of(listener, surface, listener_advertise_app); - - agl_shell_desktop_advertise_application_id(surface->ivi, surface); } static void @@ -393,8 +389,6 @@ skip_output_asignment: app_id, ivi_layout_get_surface_role_name(surface)); if (app_id && output && output->output) { - shell_advertise_app_state(output->ivi, app_id, - NULL, AGL_SHELL_DESKTOP_APP_STATE_DESTROYED); if (output->ivi->shell_client.ready) shell_send_app_state(output->ivi, app_id, AGL_SHELL_APP_STATE_TERMINATED); } diff --git a/src/ivi-compositor.h b/src/ivi-compositor.h index 01afd17..f0fab95 100644 --- a/src/ivi-compositor.h +++ b/src/ivi-compositor.h @@ -92,7 +92,6 @@ struct ivi_compositor { const struct weston_remoting_api *remoting_api; struct wl_global *agl_shell; - struct wl_global *agl_shell_desktop; struct wl_global *agl_shell_ext; struct { @@ -501,9 +500,6 @@ void ivi_seat_reset_caps_sent(struct ivi_compositor *ivi); void -agl_shell_desktop_advertise_application_id(struct ivi_compositor *ivi, - struct ivi_surface *surface); -void ivi_check_pending_surface_desktop(struct ivi_surface *surface, enum ivi_surface_role *role); diff --git a/src/layout.c b/src/layout.c index 9d13e30..8950ac5 100644 --- a/src/layout.c +++ b/src/layout.c @@ -34,8 +34,6 @@ #include <libweston/libweston.h> #include <libweston/desktop.h> -#include "agl-shell-desktop-server-protocol.h" - #define AGL_COMP_DEBUG static const char *ivi_roles_as_string[] = { @@ -788,10 +786,6 @@ ivi_layout_fullscreen_committed(struct ivi_surface *surface) if (ivi_seat) ivi_shell_activate_surface(surface, ivi_seat, WESTON_ACTIVATE_FLAG_NONE); - - shell_advertise_app_state(ivi, app_id, - NULL, AGL_SHELL_DESKTOP_APP_STATE_ACTIVATED); - weston_log("Activation completed for app_id %s, role %s, " "output %s\n", app_id, ivi_layout_get_surface_role_name(surface), @@ -909,10 +903,6 @@ ivi_layout_split_committed(struct ivi_surface *surface) if (ivi_seat) ivi_shell_activate_surface(surface, ivi_seat, WESTON_ACTIVATE_FLAG_NONE); - - shell_advertise_app_state(ivi, app_id, - NULL, AGL_SHELL_DESKTOP_APP_STATE_ACTIVATED); - weston_log("Activation completed for app_id %s, role %s, output %s\n", app_id, ivi_layout_get_surface_role_name(surface), output->name); } @@ -1000,10 +990,6 @@ ivi_layout_popup_committed(struct ivi_surface *surface) ivi_shell_activate_surface(surface, ivi_seat, WESTON_ACTIVATE_FLAG_NONE); weston_surface_map(wsurface); - - shell_advertise_app_state(ivi, app_id, - NULL, AGL_SHELL_DESKTOP_APP_STATE_ACTIVATED); - weston_log("Activation completed for app_id %s, role %s, output %s\n", app_id, ivi_layout_get_surface_role_name(surface), output->name); } diff --git a/src/shell.c b/src/shell.c index 09ade52..a529010 100644 --- a/src/shell.c +++ b/src/shell.c @@ -44,7 +44,6 @@ #include "shared/process-util.h" #include "agl-shell-server-protocol.h" -#include "agl-shell-desktop-server-protocol.h" static uint32_t reverse_orientation(uint32_t orientation); @@ -53,117 +52,67 @@ const char * split_orientation_to_string(uint32_t orientation); void -agl_shell_desktop_advertise_application_id(struct ivi_compositor *ivi, - struct ivi_surface *surface) -{ - struct desktop_client *dclient; - static bool display_adv = false; - - if (surface->advertised_on_launch) - return; - - /* advertise to all desktop clients the new surface */ - wl_list_for_each(dclient, &ivi->desktop_clients, link) { - const char *app_id = - weston_desktop_surface_get_app_id(surface->dsurface); - if (app_id == NULL) { - if (!display_adv) { - weston_log("WARNING app_is is null, unable to advertise\n"); - display_adv = true; - } - return; - } - agl_shell_desktop_send_application(dclient->resource, app_id); - surface->advertised_on_launch = true; - } -} - -void ivi_set_desktop_surface(struct ivi_surface *surface) { struct ivi_compositor *ivi = surface->ivi; assert(surface->role == IVI_SURFACE_ROLE_NONE); surface->role = IVI_SURFACE_ROLE_DESKTOP; - wl_list_insert(&surface->ivi->surfaces, &surface->link); - - agl_shell_desktop_advertise_application_id(ivi, surface); -} - -static void -ivi_set_background_surface(struct ivi_surface *surface) -{ - struct ivi_compositor *ivi = surface->ivi; - assert(surface->role == IVI_SURFACE_ROLE_BACKGROUND); - - wl_list_insert(&surface->ivi->surfaces, &surface->link); - agl_shell_desktop_advertise_application_id(ivi, surface); + wl_list_insert(&ivi->surfaces, &surface->link); } -static void +void ivi_set_desktop_surface_popup(struct ivi_surface *surface) { - struct ivi_compositor *ivi = surface->ivi; - assert(surface->role == IVI_SURFACE_ROLE_NONE); + struct ivi_compositor *ivi = surface->ivi; + assert(surface->role == IVI_SURFACE_ROLE_NONE); - surface->role = IVI_SURFACE_ROLE_POPUP; - wl_list_insert(&ivi->surfaces, &surface->link); - - agl_shell_desktop_advertise_application_id(ivi, surface); + surface->role = IVI_SURFACE_ROLE_POPUP; + wl_list_insert(&ivi->surfaces, &surface->link); } -static void +void ivi_set_desktop_surface_fullscreen(struct ivi_surface *surface) { - struct ivi_compositor *ivi = surface->ivi; - assert(surface->role == IVI_SURFACE_ROLE_NONE); - - surface->role = IVI_SURFACE_ROLE_FULLSCREEN; - wl_list_insert(&ivi->surfaces, &surface->link); + struct ivi_compositor *ivi = surface->ivi; + assert(surface->role == IVI_SURFACE_ROLE_NONE); - agl_shell_desktop_advertise_application_id(ivi, surface); + surface->role = IVI_SURFACE_ROLE_FULLSCREEN; + wl_list_insert(&ivi->surfaces, &surface->link); } -static void +void ivi_set_desktop_surface_remote(struct ivi_surface *surface) { - struct ivi_compositor *ivi = surface->ivi; - struct weston_view *view; - struct ivi_output *output = surface->remote.output; + struct ivi_compositor *ivi = surface->ivi; + struct weston_view *view; + struct ivi_output *output = surface->remote.output; - assert(surface->role == IVI_SURFACE_ROLE_NONE); + assert(surface->role == IVI_SURFACE_ROLE_NONE); - /* remote type are the same as desktop just that client can tell - * the compositor to start on another output */ - surface->role = IVI_SURFACE_ROLE_REMOTE; + /* remote type are the same as desktop just that client can tell + * the compositor to start on another output */ + surface->role = IVI_SURFACE_ROLE_REMOTE; - /* if thew black surface view is mapped on the mean we need - * to remove it in order to start showing the 'remote' surface - * just being added */ - if (output->fullscreen_view.fs) { - view = output->fullscreen_view.fs->view; - if (view->is_mapped || view->surface->is_mapped) - remove_black_curtain(output); - } + /* if thew black surface view is mapped on the mean we need + * to remove it in order to start showing the 'remote' surface + * just being added */ + if (output->fullscreen_view.fs) { + view = output->fullscreen_view.fs->view; + if (view->is_mapped || view->surface->is_mapped) + remove_black_curtain(output); + } - wl_list_insert(&ivi->surfaces, &surface->link); + wl_list_insert(&ivi->surfaces, &surface->link); } - -static void -ivi_set_desktop_surface_split(struct ivi_surface *surface) +void +ivi_set_background_surface(struct ivi_surface *surface) { struct ivi_compositor *ivi = surface->ivi; - assert(surface->role == IVI_SURFACE_ROLE_NONE); - - if (surface->split.orientation == AGL_SHELL_DESKTOP_APP_ROLE_SPLIT_VERTICAL) - surface->role = IVI_SURFACE_ROLE_SPLIT_V; - else - surface->role = IVI_SURFACE_ROLE_SPLIT_H; + assert(surface->role == IVI_SURFACE_ROLE_BACKGROUND); wl_list_insert(&ivi->surfaces, &surface->link); - - agl_shell_desktop_advertise_application_id(ivi, surface); } static struct pending_popup * @@ -342,42 +291,6 @@ ivi_set_pending_desktop_surface_fullscreen(struct ivi_output *ioutput, wl_list_insert(&ivi->fullscreen_pending_apps, &p_fullscreen->link); } -static void -ivi_set_pending_desktop_surface_split(struct ivi_output *ioutput, - const char *app_id, uint32_t orientation) -{ - struct ivi_compositor *ivi = ioutput->ivi; - struct ivi_surface *surf; - size_t len_app_id = strlen(app_id); - struct pending_split *split; - - if (orientation != AGL_SHELL_DESKTOP_APP_ROLE_SPLIT_VERTICAL && - orientation != AGL_SHELL_DESKTOP_APP_ROLE_SPLIT_HORIZONTAL) - return; - - /* more than one is un-supported, do note we need to do - * conversion for surface roles instead of using the protocol ones */ - wl_list_for_each(surf, &ivi->surfaces, link) - if (surf->role == IVI_SURFACE_ROLE_SPLIT_V || - surf->role == IVI_SURFACE_ROLE_SPLIT_H) - return; - - split = zalloc(sizeof(*split)); - if (!split) - return; - split->app_id = zalloc(sizeof(char) * (len_app_id + 1)); - if (!split->app_id) { - free(split); - return; - } - memcpy(split->app_id, app_id, len_app_id); - - split->ioutput = ioutput; - split->orientation = orientation; - - wl_list_insert(&ivi->split_pending_apps, &split->link); -} - void ivi_set_pending_desktop_surface_remote(struct ivi_output *ioutput, const char *app_id) @@ -433,6 +346,73 @@ ivi_remove_pending_desktop_surface_remote(struct pending_remote *remote) free(remote); } +void +ivi_check_pending_surface_desktop(struct ivi_surface *surface, + enum ivi_surface_role *role) +{ + struct ivi_compositor *ivi = surface->ivi; + struct wl_list *role_pending_list; + struct pending_popup *p_popup; + struct pending_split *p_split; + struct pending_fullscreen *p_fullscreen; + struct pending_remote *p_remote; + const char *app_id = + weston_desktop_surface_get_app_id(surface->dsurface); + + role_pending_list = &ivi->popup_pending_apps; + wl_list_for_each(p_popup, role_pending_list, link) { + if (app_id && !strcmp(app_id, p_popup->app_id)) { + *role = IVI_SURFACE_ROLE_POPUP; + return; + } + } + + role_pending_list = &ivi->split_pending_apps; + wl_list_for_each(p_split, role_pending_list, link) { + if (app_id && !strcmp(app_id, p_split->app_id)) { + *role = IVI_SURFACE_ROLE_SPLIT_V; + return; + } + } + + role_pending_list = &ivi->fullscreen_pending_apps; + wl_list_for_each(p_fullscreen, role_pending_list, link) { + if (app_id && !strcmp(app_id, p_fullscreen->app_id)) { + *role = IVI_SURFACE_ROLE_FULLSCREEN; + return; + } + } + + role_pending_list = &ivi->remote_pending_apps; + wl_list_for_each(p_remote, role_pending_list, link) { + if (app_id && !strcmp(app_id, p_remote->app_id)) { + *role = IVI_SURFACE_ROLE_REMOTE; + return; + } + } + + /* else, we are a regular desktop surface */ + *role = IVI_SURFACE_ROLE_DESKTOP; +} + +struct pending_app * +ivi_check_pending_app_type(struct ivi_surface *surface, enum ivi_surface_role role) +{ + struct pending_app *papp; + const char *app_id = NULL; + + app_id = weston_desktop_surface_get_app_id(surface->dsurface); + if (!app_id) + return NULL; + + wl_list_for_each(papp, &surface->ivi->pending_apps, link) { + if (strcmp(app_id, papp->app_id) == 0 && papp->role == role) + return papp; + } + + return NULL; +} + static bool ivi_compositor_keep_pending_surfaces(struct ivi_surface *surface) { @@ -445,13 +425,13 @@ ivi_check_pending_desktop_surface_popup(struct ivi_surface *surface) struct ivi_compositor *ivi = surface->ivi; struct pending_popup *p_popup, *next_p_popup; const char *_app_id = - weston_desktop_surface_get_app_id(surface->dsurface); + weston_desktop_surface_get_app_id(surface->dsurface); if (wl_list_empty(&ivi->popup_pending_apps) || !_app_id) return false; wl_list_for_each_safe(p_popup, next_p_popup, - &ivi->popup_pending_apps, link) { + &ivi->popup_pending_apps, link) { if (!strcmp(_app_id, p_popup->app_id)) { surface->popup.output = p_popup->ioutput; surface->popup.x = p_popup->x; @@ -472,43 +452,18 @@ ivi_check_pending_desktop_surface_popup(struct ivi_surface *surface) } static bool -ivi_check_pending_desktop_surface_split(struct ivi_surface *surface) -{ - struct pending_split *split_surf, *next_split_surf; - struct ivi_compositor *ivi = surface->ivi; - const char *_app_id = - weston_desktop_surface_get_app_id(surface->dsurface); - - if (wl_list_empty(&ivi->split_pending_apps) || !_app_id) - return false; - - wl_list_for_each_safe(split_surf, next_split_surf, - &ivi->split_pending_apps, link) { - if (!strcmp(_app_id, split_surf->app_id)) { - surface->split.output = split_surf->ioutput; - surface->split.orientation = split_surf->orientation; - if (!ivi_compositor_keep_pending_surfaces(surface)) - ivi_remove_pending_desktop_surface_split(split_surf); - return true; - } - } - - return false; -} - -static bool ivi_check_pending_desktop_surface_fullscreen(struct ivi_surface *surface) { struct pending_fullscreen *fs_surf, *next_fs_surf; struct ivi_compositor *ivi = surface->ivi; const char *_app_id = - weston_desktop_surface_get_app_id(surface->dsurface); + weston_desktop_surface_get_app_id(surface->dsurface); if (wl_list_empty(&ivi->fullscreen_pending_apps) || !_app_id) return false; wl_list_for_each_safe(fs_surf, next_fs_surf, - &ivi->fullscreen_pending_apps, link) { + &ivi->fullscreen_pending_apps, link) { if (!strcmp(_app_id, fs_surf->app_id)) { surface->fullscreen.output = fs_surf->ioutput; if (!ivi_compositor_keep_pending_surfaces(surface)) @@ -532,7 +487,7 @@ ivi_check_pending_desktop_surface_remote(struct ivi_surface *surface) return false; wl_list_for_each_safe(remote_surf, next_remote_surf, - &ivi->remote_pending_apps, link) { + &ivi->remote_pending_apps, link) { if (!strcmp(_app_id, remote_surf->app_id)) { surface->remote.output = remote_surf->ioutput; if (!ivi_compositor_keep_pending_surfaces(surface)) @@ -543,73 +498,6 @@ ivi_check_pending_desktop_surface_remote(struct ivi_surface *surface) return false; } -void -ivi_check_pending_surface_desktop(struct ivi_surface *surface, - enum ivi_surface_role *role) -{ - struct ivi_compositor *ivi = surface->ivi; - struct wl_list *role_pending_list; - struct pending_popup *p_popup; - struct pending_split *p_split; - struct pending_fullscreen *p_fullscreen; - struct pending_remote *p_remote; - const char *app_id = - weston_desktop_surface_get_app_id(surface->dsurface); - - role_pending_list = &ivi->popup_pending_apps; - wl_list_for_each(p_popup, role_pending_list, link) { - if (app_id && !strcmp(app_id, p_popup->app_id)) { - *role = IVI_SURFACE_ROLE_POPUP; - return; - } - } - - role_pending_list = &ivi->split_pending_apps; - wl_list_for_each(p_split, role_pending_list, link) { - if (app_id && !strcmp(app_id, p_split->app_id)) { - *role = IVI_SURFACE_ROLE_SPLIT_V; - return; - } - } - - role_pending_list = &ivi->fullscreen_pending_apps; - wl_list_for_each(p_fullscreen, role_pending_list, link) { - if (app_id && !strcmp(app_id, p_fullscreen->app_id)) { - *role = IVI_SURFACE_ROLE_FULLSCREEN; - return; - } - } - - role_pending_list = &ivi->remote_pending_apps; - wl_list_for_each(p_remote, role_pending_list, link) { - if (app_id && !strcmp(app_id, p_remote->app_id)) { - *role = IVI_SURFACE_ROLE_REMOTE; - return; - } - } - - /* else, we are a regular desktop surface */ - *role = IVI_SURFACE_ROLE_DESKTOP; -} - -struct pending_app * -ivi_check_pending_app_type(struct ivi_surface *surface, enum ivi_surface_role role) -{ - struct pending_app *papp; - const char *app_id = NULL; - - app_id = weston_desktop_surface_get_app_id(surface->dsurface); - if (!app_id) - return NULL; - - wl_list_for_each(papp, &surface->ivi->pending_apps, link) { - if (strcmp(app_id, papp->app_id) == 0 && papp->role == role) - return papp; - } - - return NULL; -} - void ivi_check_pending_desktop_surface(struct ivi_surface *surface) @@ -623,13 +511,6 @@ ivi_check_pending_desktop_surface(struct ivi_surface *surface) return; } - ret = ivi_check_pending_desktop_surface_split(surface); - if (ret) { - ivi_set_desktop_surface_split(surface); - ivi_layout_split_committed(surface); - return; - } - ret = ivi_check_pending_desktop_surface_fullscreen(surface); if (ret) { ivi_set_desktop_surface_fullscreen(surface); @@ -784,7 +665,7 @@ ivi_shell_finalize(struct ivi_compositor *ivi) weston_layer_fini(&ivi->fullscreen); } -static void +void ivi_shell_advertise_xdg_surfaces(struct ivi_compositor *ivi, struct wl_resource *resource) { struct ivi_surface *surface; @@ -796,7 +677,6 @@ ivi_shell_advertise_xdg_surfaces(struct ivi_compositor *ivi, struct wl_resource weston_log("WARNING app_is is null, unable to advertise\n"); return; } - agl_shell_desktop_send_application(resource, app_id); } } @@ -1384,37 +1264,6 @@ shell_set_panel(struct wl_client *client, weston_desktop_surface_set_size(dsurface, width, height); } -void -shell_advertise_app_state(struct ivi_compositor *ivi, const char *app_id, - const char *data, uint32_t app_state) -{ - struct desktop_client *dclient; - uint32_t app_role; - struct ivi_surface *surf = ivi_find_app(ivi, app_id); - struct ivi_policy *policy = ivi->policy; - - /* FIXME: should queue it here and see when binding agl-shell-desktop - * if there are any to be sent */ - if (!surf) - return; - - if (!app_id) - return; - - if (policy && policy->api.surface_advertise_state_change && - !policy->api.surface_advertise_state_change(surf, surf->ivi)) { - return; - } - - app_role = surf->role; - if (app_role == IVI_SURFACE_ROLE_POPUP) - app_role = AGL_SHELL_DESKTOP_APP_ROLE_POPUP; - - wl_list_for_each(dclient, &ivi->desktop_clients, link) - agl_shell_desktop_send_state_app(dclient->resource, app_id, - data, app_state, app_role); -} - static void shell_activate_app(struct wl_client *client, struct wl_resource *shell_res, @@ -1450,7 +1299,7 @@ shell_activate_app(struct wl_client *client, } static void -shell_new_deactivate_app(struct wl_client *client, struct wl_resource *shell_res, +shell_deactivate_app(struct wl_client *client, struct wl_resource *shell_res, const char *app_id) { struct ivi_compositor *ivi = wl_resource_get_user_data(shell_res); @@ -1628,34 +1477,6 @@ shell_set_app_normal(struct wl_client *client, struct wl_resource *shell_res, } static void -shell_desktop_activate_app(struct wl_client *client, - struct wl_resource *shell_res, - const char *app_id, const char *data, - struct wl_resource *output_res) -{ - struct weston_head *head = weston_head_from_resource(output_res); - struct weston_output *woutput = weston_head_get_output(head); - struct ivi_output *output = to_ivi_output(woutput); - - ivi_layout_activate(output, app_id); - shell_advertise_app_state(output->ivi, app_id, - data, AGL_SHELL_DESKTOP_APP_STATE_ACTIVATED); -} - -static void -shell_deactivate_app(struct wl_client *client, - struct wl_resource *shell_res, - const char *app_id) -{ - struct desktop_client *dclient = wl_resource_get_user_data(shell_res); - struct ivi_compositor *ivi = dclient->ivi; - - ivi_layout_deactivate(ivi, app_id); - shell_advertise_app_state(ivi, app_id, - NULL, AGL_SHELL_DESKTOP_APP_STATE_DEACTIVATED); -} - -static void shell_destroy(struct wl_client *client, struct wl_resource *res) { struct ivi_compositor *ivi = wl_resource_get_user_data(res); @@ -2102,7 +1923,7 @@ static const struct agl_shell_interface agl_shell_implementation = { .activate_app = shell_activate_app, .destroy = shell_destroy, .set_activate_region = shell_set_activate_region, - .deactivate_app = shell_new_deactivate_app, + .deactivate_app = shell_deactivate_app, .set_app_float = shell_set_app_float, .set_app_normal = shell_set_app_normal, .set_app_fullscreen = shell_set_app_fullscreen, @@ -2117,38 +1938,6 @@ static const struct agl_shell_ext_interface agl_shell_ext_implementation = { .doas_shell_client = shell_ext_doas, }; -static void -shell_desktop_set_app_property(struct wl_client *client, - struct wl_resource *shell_res, - const char *app_id, uint32_t role, - int x, int y, int bx, int by, - int width, int height, - struct wl_resource *output_res) -{ - struct weston_head *head = weston_head_from_resource(output_res); - struct weston_output *woutput = weston_head_get_output(head); - struct ivi_output *output = to_ivi_output(woutput); - - switch (role) { - case AGL_SHELL_DESKTOP_APP_ROLE_POPUP: - ivi_set_pending_desktop_surface_popup(output, x, y, bx, by, - width, height, app_id); - break; - case AGL_SHELL_DESKTOP_APP_ROLE_FULLSCREEN: - ivi_set_pending_desktop_surface_fullscreen(output, app_id); - break; - case AGL_SHELL_DESKTOP_APP_ROLE_SPLIT_VERTICAL: - case AGL_SHELL_DESKTOP_APP_ROLE_SPLIT_HORIZONTAL: - ivi_set_pending_desktop_surface_split(output, app_id, role); - break; - case AGL_SHELL_DESKTOP_APP_ROLE_REMOTE: - ivi_set_pending_desktop_surface_remote(output, app_id); - break; - default: - break; - } -} - void ivi_compositor_destroy_pending_surfaces(struct ivi_compositor *ivi) { @@ -2175,27 +1964,6 @@ ivi_compositor_destroy_pending_surfaces(struct ivi_compositor *ivi) } static void -shell_desktop_set_app_property_mode(struct wl_client *client, - struct wl_resource *shell_res, uint32_t perm) -{ - struct desktop_client *dclient = wl_resource_get_user_data(shell_res); - if (perm) { - dclient->ivi->keep_pending_surfaces = true; - } else { - dclient->ivi->keep_pending_surfaces = false; - /* remove any previous pending surfaces */ - ivi_compositor_destroy_pending_surfaces(dclient->ivi); - } -} - -static const struct agl_shell_desktop_interface agl_shell_desktop_implementation = { - .activate_app = shell_desktop_activate_app, - .set_app_property = shell_desktop_set_app_property, - .deactivate_app = shell_deactivate_app, - .set_app_property_mode = shell_desktop_set_app_property_mode, -}; - -static void unbind_agl_shell(struct wl_resource *resource) { struct ivi_compositor *ivi; @@ -2357,58 +2125,6 @@ bind_agl_shell_ext(struct wl_client *client, ivi->shell_client_ext.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 ivi_policy *policy; - struct desktop_client *dclient; - void *interface; - - policy = ivi->policy; - interface = (void *) &agl_shell_desktop_interface; - if (policy && policy->api.shell_bind_interface && - !policy->api.shell_bind_interface(client, interface)) { - wl_client_post_implementation_error(client, - "client not authorized to use agl_shell_desktop"); - return; - } - - dclient = zalloc(sizeof(*dclient)); - if (!dclient) { - wl_client_post_no_memory(client); - return; - } - - resource = wl_resource_create(client, &agl_shell_desktop_interface, - version, id); - dclient->ivi = ivi; - 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); - - /* advertise xdg surfaces */ - ivi_shell_advertise_xdg_surfaces(ivi, resource); -} - int ivi_shell_create_global(struct ivi_compositor *ivi) { @@ -2428,13 +2144,5 @@ 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, 2, - 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; } |