summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2020-04-21 12:41:31 +0300
committerMarius Vlad <marius.vlad@collabora.com>2020-05-12 21:56:35 +0300
commitb4ae3794bc969bdb0d54f2e882f0ef36c51d7ed4 (patch)
tree9995a98d5f4b5e77beca54aa45b253a70c4a503f
parent401773a463992f926086b178caff14dd55dbd148 (diff)
policy: Add another hook for controlling the application state change
event With the introduction of the events that notify regular applications of others' application state we require some way of controlling that. This patch adds another hook for controlling just that. Bug-AGL: SPEC-3269 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I2ade01eb5dfa454e360edd2e3943df91975da88f
-rw-r--r--src/policy.h1
-rw-r--r--src/shell.c7
2 files changed, 8 insertions, 0 deletions
diff --git a/src/policy.h b/src/policy.h
index 2499278..67da4aa 100644
--- a/src/policy.h
+++ b/src/policy.h
@@ -73,6 +73,7 @@ struct ivi_policy_api {
bool (*surface_deactivate)(struct ivi_surface *surf, void *user_data);
bool (*surface_activate_by_default)(struct ivi_surface *surf, void *user_data);
+ bool (*surface_advertise_state_change)(struct ivi_surface *surf, void *user_data);
/** see also ivi_policy_add(). If set this will be executed before
* adding a new policy rule */
diff --git a/src/shell.c b/src/shell.c
index aa63b86..96f3c0a 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -24,6 +24,7 @@
*/
#include "ivi-compositor.h"
+#include "policy.h"
#include <assert.h>
#include <errno.h>
@@ -517,12 +518,18 @@ shell_advertise_app_state(struct ivi_compositor *ivi, const char *app_id,
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;