*/
#include "ivi-compositor.h"
+#include "policy.h"
#include <assert.h>
#include <errno.h>
weston_desktop_surface_set_size(dsurface, width, height);
}
+
+static 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 (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,
ivi_layout_activate(output, app_id);
}
+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 const struct agl_shell_interface agl_shell_implementation = {
.ready = shell_ready,
.set_background = shell_set_background,
}
static const struct agl_shell_desktop_interface agl_shell_desktop_implementation = {
- .activate_app = shell_activate_app,
- .set_app_property = shell_desktop_set_app_property
+ .activate_app = shell_desktop_activate_app,
+ .set_app_property = shell_desktop_set_app_property,
+ .deactivate_app = shell_deactivate_app,
};
static void
ivi = wl_resource_get_user_data(resource);
wl_list_for_each(output, &ivi->outputs, link) {
- free(output->background);
- output->background = NULL;
-
- free(output->top);
- output->top = NULL;
-
- free(output->bottom);
- output->bottom = NULL;
-
- free(output->left);
- output->left = NULL;
-
- free(output->right);
- output->right = NULL;
-
/* reset the active surf if there's one present */
if (output->active) {
output->active->view->is_mapped = false;
resource = wl_resource_create(client, &agl_shell_desktop_interface,
version, id);
+ dclient->ivi = ivi;
if (!resource) {
wl_client_post_no_memory(client);
return;