enhance of user geometry feature 40/211440/3
authorJuyeon Lee <juyeonne.lee@samsung.com>
Mon, 5 Aug 2019 03:16:26 +0000 (12:16 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Tue, 6 Aug 2019 01:31:31 +0000 (01:31 +0000)
the api e_policy_allow_user_geometry_set is called to allow/disallow
user defined geometry and was working reference count based
due to that reason, unexpected result(error) were found.

1) window user geometry policy is not chaned if ref==0(stay in default)
case 1 :
 id1 = elm_win_aux_hint_add(ad->win,"wm.policy.win.user.geometry", "1"); ref--
 id2 = elm_win_aux_hint_add(ad->win,"wm.policy.win.user.geometry", "0"); ref++

case 2
 id1 = elm_win_aux_hint_add(ad->win,"wm.policy.win.user.geometry", "0"); ref++
 id2 = elm_win_aux_hint_add(ad->win,"wm.policy.win.user.geometry", "1"); ref--

2) it is unclear if user geometry can be set or unset by calling this api
   the api is called in various e20 moudles and allow/disallow is decided when
   the last api call made.

NEW API e_policy_user_geometry_set

  by using it check bitmask refering to its usage
  allows/disallow user geometry on each bitmask type.
  if any of caller set its mask 1 than, the feature is turned on.

Change-Id: Icad8b54ac002dd610ea3c9e3ecc2e9e478dcba02

src/bin/e_comp_wl_rsm.c
src/bin/e_policy.c
src/bin/e_policy.h
src/bin/e_policy_wl.c
src/bin/services/e_service_quickpanel.c

index a8c50af2d1c4ad2d024b0f9cc60a0043521e4afe..1f107f92c0a3200f15bdbd400aca383b4ab08b90 100644 (file)
@@ -848,7 +848,7 @@ bind_ec_set:
           }
 
         /* TODO: enable user geometry? */
-        e_policy_allow_user_geometry_set(ec, EINA_TRUE);
+        e_policy_user_geometry_set(ec, E_POLICY_USERGEOM_RSM, EINA_TRUE);
         _remote_surface_bind_client_set(remote_surface, ec);
         eina_hash_add(_rsm->bind_surface_hash, &remote_surface->bind_ec, remote_surface);
 
index a034f6279ce6e40a880d044643af57675e1af2d3..0362e1e6047300f7da441e569d2b8c6bbfc4d108 100644 (file)
@@ -2181,7 +2181,9 @@ e_policy_hook_call(E_Policy_Hook_Point hookpoint, E_Client *ec)
 }
 
 E_API void
-e_policy_allow_user_geometry_set(E_Client *ec, Eina_Bool set)
+e_policy_user_geometry_set(E_Client *ec,
+                           E_Policy_Allow_User_Geometry type,
+                           Eina_Bool set)
 {
    E_Policy_Client *pc;
 
@@ -2192,10 +2194,30 @@ e_policy_allow_user_geometry_set(E_Client *ec, Eina_Bool set)
    if (EINA_UNLIKELY(!pc))
      return;
 
-   if (set) pc->user_geom_ref++;
-   else     pc->user_geom_ref--;
+   if (set)
+     pc->user_geom_state |= type;
+   else
+     pc->user_geom_state &= ~(type);
+
+   if (pc->user_geom_state)
+     e_policy_allow_user_geometry_set(ec, EINA_TRUE);
+   else
+     e_policy_allow_user_geometry_set(ec, EINA_FALSE);
+}
+
+E_API void
+e_policy_allow_user_geometry_set(E_Client *ec, Eina_Bool set)
+{
+   E_Policy_Client *pc;
+
+   if (EINA_UNLIKELY(!ec))
+     return;
+
+   pc = eina_hash_find(hash_policy_clients, &ec);
+   if (EINA_UNLIKELY(!pc))
+     return;
 
-   if (pc->user_geom_ref == 1 && !pc->allow_user_geom)
+   if (set &&  !pc->allow_user_geom)
      {
         pc->allow_user_geom = EINA_TRUE;
 
@@ -2211,7 +2233,7 @@ e_policy_allow_user_geometry_set(E_Client *ec, Eina_Bool set)
         _e_policy_client_maximize_policy_cancel(pc);
         EC_CHANGED(ec);
      }
-   else if (pc->user_geom_ref == 0 && pc->allow_user_geom)
+   else if (!set && pc->allow_user_geom)
      {
         pc->allow_user_geom = EINA_FALSE;
 
index 23d0cabd12cc3e2878dfec231c19470d8c84977b..ede54f2c76c6a4d80e5c0e3966aa8d40bf3474bf 100644 (file)
@@ -53,6 +53,13 @@ typedef enum {
    E_POLICY_ANIMATABLE_CUSTOMIZED  = (1 << 3), // no animation by app customized animation
 } E_Policy_Animatable_Lock;
 
+typedef enum {
+   E_POLICY_USERGEOM_WTYPE          = (1 << 0),  // set by client if netwm.type == E_WINDOW_TYPE_UTILITY
+   E_POLICY_USERGEOM_HINT           = (1 << 1),  // set by client aux hint request if "wm.policy.win.user.geometry" is "1"
+   E_POLICY_USERGEOM_RSM            = (1 << 2),  // set if window works as remote surface provider
+   E_POLICY_USERGEOM_SERVICE        = (1 << 3),  // set if window works as special service provider (e.g quickpanel client)
+} E_Policy_Allow_User_Geometry;
+
 typedef Eina_Bool (*E_Policy_Intercept_Cb)(void *data, E_Client *ec, va_list list);
 typedef void (*E_Policy_Hook_Cb)(void *data, E_Client *ec);
 
@@ -106,7 +113,7 @@ struct _E_Policy_Client
    Eina_Bool flt_policy_state;
    Eina_Bool allow_user_geom;
    Eina_Bool split_policy_state;
-   int       user_geom_ref;
+   int       user_geom_state;
    unsigned int lock_animatable;
 };
 
@@ -255,6 +262,7 @@ E_API E_Policy_Hook        *e_policy_hook_add(E_Policy_Hook_Point hookpoint, E_P
 E_API void                  e_policy_hook_del(E_Policy_Hook *hook);
 E_API Eina_Bool             e_policy_hook_call(E_Policy_Hook_Point hookpoint, E_Client *ec);
 
+E_API void e_policy_user_geometry_set(E_Client *ec, E_Policy_Allow_User_Geometry type, Eina_Bool set);
 E_API void e_policy_allow_user_geometry_set(E_Client *ec, Eina_Bool set);
 E_API Eina_Bool e_policy_allow_user_geometry_get(E_Client *ec);
 E_API void e_policy_deferred_job(void);
index ee1857a6fff771ec352b8f705b0bddff9dce2a07..8710c974fa8f72f520f0ce25c6cf5272f136df86 100644 (file)
@@ -2396,17 +2396,17 @@ _e_policy_wl_aux_hint_apply(E_Client *ec)
           {
              if (hint->deleted)
                {
-                  e_policy_allow_user_geometry_set(ec, EINA_FALSE);
+                  e_policy_user_geometry_set(ec, E_POLICY_USERGEOM_HINT, EINA_FALSE);
                   continue;
                }
 
              if (!strcmp(hint->val, "1"))
                {
-                  e_policy_allow_user_geometry_set(ec, EINA_TRUE);
+                  e_policy_user_geometry_set(ec, E_POLICY_USERGEOM_HINT, EINA_TRUE);
                }
              else if (strcmp(hint->val, "1"))
                {
-                  e_policy_allow_user_geometry_set(ec, EINA_FALSE);
+                  e_policy_user_geometry_set(ec, E_POLICY_USERGEOM_HINT, EINA_FALSE);
                }
           }
         else if (!strcmp(hint->hint, hint_names[E_POLICY_HINT_FIXED_RESIZE]))
index 634deb558397d39ee8174d26ca29212799fc8f8a..f56a996389996e86e1ea30b783af37c6ee9df32f 100644 (file)
@@ -2076,14 +2076,14 @@ e_service_quickpanel_effect_type_set(E_Client *ec, E_Service_Quickpanel_Effect_T
      {
       case E_SERVICE_QUICKPANEL_EFFECT_TYPE_SWIPE:
          ec->lock_client_location = 1;
-         e_policy_allow_user_geometry_set(ec, EINA_FALSE);
+         e_policy_user_geometry_set(ec, E_POLICY_USERGEOM_SERVICE, EINA_FALSE);
          if ((ec->maximized == E_MAXIMIZE_NONE) &&
              (qp->saved_maximize != E_MAXIMIZE_NONE))
            e_client_maximize(ec, qp->saved_maximize);
          break;
       case E_SERVICE_QUICKPANEL_EFFECT_TYPE_MOVE:
          ec->lock_client_location = 0;
-         e_policy_allow_user_geometry_set(ec, EINA_TRUE);
+         e_policy_user_geometry_set(ec, E_POLICY_USERGEOM_SERVICE, EINA_TRUE);
          if (ec->maximized != E_MAXIMIZE_NONE)
            {
               qp->saved_maximize = ec->maximized;