layout: Allow by default to activate the application 99/24199/4
authorMarius Vlad <marius.vlad@collabora.com>
Fri, 6 Mar 2020 20:51:10 +0000 (22:51 +0200)
committerMarius Vlad <marius.vlad@collabora.com>
Wed, 11 Mar 2020 14:44:10 +0000 (16:44 +0200)
Installs, for the default policy, a callback that allows it.

Bug-AGL: SPEC-3217

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ic0f1a7db93df480d263db8240592f65a8864ccd6

src/layout.c
src/policy-default.c

index b531ed1..94327c4 100644 (file)
@@ -243,12 +243,15 @@ ivi_layout_desktop_committed(struct ivi_surface *surf)
        output = surf->desktop.pending_output;
        if (!output) {
                struct ivi_output *ivi_bg_output;
        output = surf->desktop.pending_output;
        if (!output) {
                struct ivi_output *ivi_bg_output;
+               struct ivi_policy *policy = surf->ivi->policy;
+
+               if (policy && policy->api.surface_activate_by_default)
+                       if (policy->api.surface_activate_by_default(surf, surf->ivi))
+                               goto skip_config_check;
 
 
-               /* FIXME: This should be changed to determine if the policy
-                * database allows that to happen */
                if (!surf->ivi->quirks.activate_apps_by_default)
                        return;
                if (!surf->ivi->quirks.activate_apps_by_default)
                        return;
-
+skip_config_check:
                ivi_bg_output = ivi_layout_find_bg_output(surf->ivi);
 
                /* use the output of the bg to activate the app on start-up by
                ivi_bg_output = ivi_layout_find_bg_output(surf->ivi);
 
                /* use the output of the bg to activate the app on start-up by
index 89b858a..bcfee6b 100644 (file)
@@ -57,6 +57,13 @@ ivi_policy_default_surface_activate(struct ivi_surface *surf, void *user_data)
        return true;
 }
 
        return true;
 }
 
+static bool
+ivi_policy_default_surface_activate_default(struct ivi_surface *surf, void *user_data)
+{
+       /* verify that the surface should be switched to */
+       return true;
+}
+
 static bool
 ivi_policy_default_allow_to_add(void *user_data)
 {
 static bool
 ivi_policy_default_allow_to_add(void *user_data)
 {
@@ -89,6 +96,7 @@ static const struct ivi_policy_api policy_api = {
        .surface_create = ivi_policy_default_surface_create,
        .surface_commited = ivi_policy_default_surface_commmited,
        .surface_activate = ivi_policy_default_surface_activate,
        .surface_create = ivi_policy_default_surface_create,
        .surface_commited = ivi_policy_default_surface_commmited,
        .surface_activate = ivi_policy_default_surface_activate,
+       .surface_activate_by_default = ivi_policy_default_surface_activate_default,
        .policy_rule_allow_to_add = ivi_policy_default_allow_to_add,
        .policy_rule_try_event = ivi_policy_default_try_event,
 };
        .policy_rule_allow_to_add = ivi_policy_default_allow_to_add,
        .policy_rule_try_event = ivi_policy_default_try_event,
 };