e_policy/policy_wl: modify handing aux hint 64/208864/3
authorDoyoun Kang <doyoun.kang@samsung.com>
Mon, 1 Jul 2019 04:17:50 +0000 (13:17 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Mon, 1 Jul 2019 06:52:28 +0000 (06:52 +0000)
There was a bug that the aux hint code was handled many times
and the aux_hint_allowed event was sent more than once in some case.
So, we modified code that e_policy handles an aux hint once
and sends an aux_hint_allowed event once.

Change-Id: I5a59fc9427296054f3d5fe085a1422d2b78a717b

src/bin/e_policy.c
src/bin/e_policy_wl.c
src/bin/e_policy_wl.h

index 35374df8662818149cff582318726277fd4bfa2d..9662416b52ab61e13aec494905a299bd8d64a9cf 100644 (file)
@@ -736,7 +736,6 @@ _e_policy_cb_hook_client_eval_pre_post_fetch(void *d EINA_UNUSED, E_Client *ec)
 
    e_policy_stack_hook_pre_post_fetch(ec);
    e_policy_wl_notification_level_fetch(ec);
-   e_policy_wl_eval_pre_post_fetch(ec);
 }
 
 static void
index 0f209367e15874a20604f633b8766ae17b088ec8..151de4a6ae188e6e846fc04b1c1290a2089caba8 100644 (file)
@@ -2365,31 +2365,15 @@ _tzpol_iface_cb_uniconify(struct wl_client *client EINA_UNUSED, struct wl_resour
 }
 
 static void
-_e_policy_wl_allowed_aux_hint_send(E_Client *ec, int id)
+_e_policy_wl_allowed_aux_hint_send(struct wl_resource *res_tzpol, struct wl_resource *surf, int32_t id)
 {
-   E_Policy_Wl_Tzpol *tzpol;
-   E_Policy_Wl_Surface *psurf;
-   Eina_List *l;
-   Eina_Iterator *it;
+   E_Client *ec;
 
-   it = eina_hash_iterator_data_new(polwl->tzpols);
-   EINA_ITERATOR_FOREACH(it, tzpol)
-     EINA_LIST_FOREACH(tzpol->psurfs, l, psurf)
-       {
-          if (e_pixmap_client_get(psurf->cp) != ec) continue;
-          if (!psurf->surf) continue;
+   ec = wl_resource_get_user_data(surf);
+   EINA_SAFETY_ON_NULL_RETURN(ec);
 
-          tizen_policy_send_allowed_aux_hint
-            (tzpol->res_tzpol,
-             psurf->surf,
-             id);
-          ELOGF("TZPOL",
-                "SEND     |res_tzpol:%8p|allowed hint->id:%d",
-                ec,
-                tzpol->res_tzpol,
-                id);
-       }
-   eina_iterator_free(it);
+   ELOGF("TZPOL", "SEND     |res_tzpol:%8p|id:%d, hint allowed ", ec, res_tzpol, id);
+   tizen_policy_send_allowed_aux_hint(res_tzpol, surf, id);
 }
 
 static void
@@ -2397,7 +2381,6 @@ _e_policy_wl_aux_hint_apply(E_Client *ec)
 {
    E_Comp_Wl_Aux_Hint *hint;
    Eina_List *l;
-   Eina_Bool send;
 
    if (!ec->comp_data) return;
    if (!ec->comp_data->aux_hint.changed) return;
@@ -2405,8 +2388,8 @@ _e_policy_wl_aux_hint_apply(E_Client *ec)
    EINA_LIST_FOREACH(ec->comp_data->aux_hint.hints, l, hint)
      {
         if (!hint->changed) continue;
+        EC_CHANGED(ec);
 
-        send = EINA_FALSE;
         if (!strcmp(hint->hint, hint_names[E_POLICY_HINT_USER_GEOMETRY]))
           {
              if (hint->deleted)
@@ -2417,12 +2400,10 @@ _e_policy_wl_aux_hint_apply(E_Client *ec)
 
              if (!strcmp(hint->val, "1"))
                {
-                  send = EINA_TRUE;
                   e_policy_allow_user_geometry_set(ec, EINA_TRUE);
                }
              else if (strcmp(hint->val, "1"))
                {
-                  send = EINA_TRUE;
                   e_policy_allow_user_geometry_set(ec, EINA_FALSE);
                }
           }
@@ -2567,27 +2548,15 @@ _e_policy_wl_aux_hint_apply(E_Client *ec)
              else
                ec->exp_iconify.buffer_flush = EINA_FALSE;
           }
-
-        if (send)
-          _e_policy_wl_allowed_aux_hint_send(ec, hint->id);
      }
 }
 
-void
-e_policy_wl_eval_pre_post_fetch(E_Client *ec)
-{
-   if (!ec) return;
-
-   _e_policy_wl_aux_hint_apply(ec);
-}
-
 static void
 _tzpol_iface_cb_aux_hint_add(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, struct wl_resource *surf, int32_t id, const char *name, const char *value)
 {
    E_Client *ec;
    Eina_Bool res = EINA_FALSE;
 
-
    ec = wl_resource_get_user_data(surf);
    EINA_SAFETY_ON_NULL_RETURN(ec);
 
@@ -2598,8 +2567,7 @@ _tzpol_iface_cb_aux_hint_add(struct wl_client *client EINA_UNUSED, struct wl_res
    if (res)
      {
         _e_policy_wl_aux_hint_apply(ec);
-        tizen_policy_send_allowed_aux_hint(res_tzpol, surf, id);
-        EC_CHANGED(ec);
+        _e_policy_wl_allowed_aux_hint_send(res_tzpol, surf, id);
      }
 }
 
@@ -2619,8 +2587,7 @@ _tzpol_iface_cb_aux_hint_change(struct wl_client *client EINA_UNUSED, struct wl_
    if (res)
      {
         _e_policy_wl_aux_hint_apply(ec);
-        tizen_policy_send_allowed_aux_hint(res_tzpol, surf, id);
-        EC_CHANGED(ec);
+        _e_policy_wl_allowed_aux_hint_send(res_tzpol, surf, id);
      }
 }
 
@@ -2639,7 +2606,7 @@ _tzpol_iface_cb_aux_hint_del(struct wl_client *client EINA_UNUSED, struct wl_res
    if (res)
      {
         _e_policy_wl_aux_hint_apply(ec);
-        EC_CHANGED(ec);
+        _e_policy_wl_allowed_aux_hint_send(res_tzpol, surf, id);
      }
 }
 
@@ -7167,8 +7134,6 @@ _e_policy_wl_cb_hook_shell_surface_ready(void *d, E_Client *ec)
    if (EINA_UNLIKELY(!ec))
      return;
 
-   _e_policy_wl_aux_hint_apply(ec);
-
    e_policy_client_maximize(ec);
 
    e_client_base_output_resolution_transform_adjust(ec);
index 2da5ab4426a9c391a3ce499d284d0afc14c3cb2f..b6ff5069290a2d5444aa9b41efb444963dcc05f9 100644 (file)
@@ -55,7 +55,6 @@ void      e_policy_wl_win_scrmode_apply(void);
 /* aux_hint */
 void      e_policy_wl_aux_hint_init(void);
 void      e_policy_wl_aux_message_send(E_Client *ec, const char *key, const char *val, Eina_List *options);
-void      e_policy_wl_eval_pre_post_fetch(E_Client *ec);
 
 /* window brightness */
 Eina_Bool e_policy_wl_win_brightness_apply(E_Client *ec);