e_client/e_policy: support always_on_parent feature 39/257939/4 accepted/tizen/unified/20210510.155219 submit/tizen/20210510.040235
authorDoyoun Kang <doyoun.kang@samsung.com>
Fri, 7 May 2021 02:16:55 +0000 (11:16 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Mon, 10 May 2021 03:55:53 +0000 (03:55 +0000)
If child window set the always_on_parent aux_hint, then it always has to be placed
on the parent window even if it request to lower window.

Currently, this feature can be set by below aux hint key.
- wm.policy.win.transient_for.always_on_parent

Change-Id: Icd26fabf437a976df52018f4ad9587ac9f0f3390

src/bin/e_client.c
src/bin/e_client.h
src/bin/e_policy_wl.c

index 196d5b623d18db44f1fd7365c2a5257f78fb376f..68f9f32071773ee7213f947c31c5752443090ab4 100644 (file)
@@ -8179,6 +8179,31 @@ e_client_raise(E_Client *ec)
           }
      }
 
+   if (ec->parent)
+     {
+        if (ec->transient_for_always_on_parent)
+          {
+             E_Client *top_child = NULL;
+             top_child = e_client_transient_child_top_get(ec->parent, EINA_FALSE);
+             if (!top_child)
+               {
+                  ELOGF("POL", "RAISE child window... Stack above on the parent (win:%zx, ec:%p)", ec, e_client_util_win_get(ec->parent), ec->parent);
+                  e_client_stack_above(ec, ec->parent);
+               }
+             else
+               {
+                  if (top_child != ec)
+                    {
+                       ELOGF("POL", "RAISE child window... Stack above on the top child (win:%zx, ec:%p)", ec, e_client_util_win_get(top_child), top_child);
+                       e_client_stack_above(ec, top_child);
+                    }
+                  else
+                    ELOGF("POL", "RAISE child window... already on the top. STAY", ec);
+               }
+             return;
+          }
+     }
+
    evas_object_raise(ec->frame);
 }
 
@@ -8198,6 +8223,16 @@ e_client_lower(E_Client *ec)
           }
      }
 
+   if (ec->parent)
+     {
+        if (ec->transient_for_always_on_parent)
+          {
+             ELOGF("POL", "LOWER child window... So, stack above on the parent (win:%zx, ec:%p)", ec, e_client_util_win_get(ec->parent), ec->parent);
+             e_client_stack_above(ec, ec->parent);
+             return;
+          }
+     }
+
    evas_object_lower(ec->frame);
 }
 
index 1b46ab63cdef45ddef5d241e9d73bff4ba73ee31..b228bbcfe4b07ee7623b2b94f94aa52e0a7f9dd9 100644 (file)
@@ -1017,6 +1017,7 @@ struct E_Client
    } desk_group;
 
    Eina_Bool transient_for_always_on_top;
+   Eina_Bool transient_for_always_on_parent;
    struct
    {
       int count;
index e3779cab70dd3edd3f08b9d5ccd7ac22d1cbbdb0..4c4ae3ec4599a6cf4bd111f7b10bfb259660e6da 100644 (file)
@@ -253,6 +253,7 @@ enum _E_Policy_Hint_Type
    E_POLICY_HINT_ROT_RENDER_NOPENDING = 10,
    E_POLICY_HINT_ICONIFY_BUFFER_FLUSH = 11,
    E_POLICY_HINT_TRANSIENT_FOR_ALWAYS_ON_TOP = 12,
+   E_POLICY_HINT_TRANSIENT_FOR_ALWAYS_ON_PARENT = 13,
 };
 
 static const char *hint_names[] =
@@ -270,6 +271,7 @@ static const char *hint_names[] =
    "wm.policy.win.rot.render.nopending",
    "wm.policy.win.iconify.buffer.flush",
    "wm.policy.win.transient_for.always_on_top",
+   "wm.policy.win.transient_for.always_on_parent",
 };
 
 static void                _e_policy_wl_surf_del(E_Policy_Wl_Surface *psurf);
@@ -2457,6 +2459,19 @@ _e_policy_wl_aux_hint_apply(E_Client *ec)
                   ec->transient_for_always_on_top = EINA_FALSE;
                }
           }
+        else if (!strncmp(hint->hint, hint_names[E_POLICY_HINT_TRANSIENT_FOR_ALWAYS_ON_PARENT], strlen(hint->hint)))
+          {
+             if (!strncmp(hint->val, "1", 1))
+               {
+                  ELOGF("TF_SET", "Transient for Always_on_parent enabled", ec);
+                  ec->transient_for_always_on_parent = EINA_TRUE;
+               }
+             else
+               {
+                  ELOGF("TF_SET", "Transient for Always_on_parent disabled", ec);
+                  ec->transient_for_always_on_parent = EINA_FALSE;
+               }
+          }
      }
 }