e_policy_zone: add e_policy_zone_evaluate 12/322412/2
authorSooChan Lim <sc1.lim@samsung.com>
Mon, 7 Apr 2025 09:52:28 +0000 (18:52 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Wed, 9 Apr 2025 00:48:49 +0000 (00:48 +0000)
This function evaluates the e_clients belong to the zone.

Change-Id: Ic90c21891037fa33cfd2f41830f189de5eaf54c0

src/bin/windowmgr/e_policy_zone.c
src/bin/windowmgr/e_policy_zone_intern.h

index eefa27588d9e7219f646d739ea106b735e9f9fe1..2ee490a6b2dcd4c85b58c9ea0073def5d3561aa4 100644 (file)
@@ -21,6 +21,8 @@
 #include "e_process_intern.h"
 #include "e_policy_wl_display_intern.h"
 #include "e_tizen_display_policy_intern.h"
+#include "e_policy_stack_intern.h"
+#include "e_policy_wl_intern.h"
 
 #define ZONE_EC_DATA_KEY  "E_Zone_Client"
 
@@ -1974,3 +1976,110 @@ e_policy_zone_del(E_Policy_Zone *policy_zone)
    return;
 }
 
+EINTERN void
+e_policy_zone_evaluate(E_Policy_Zone *policy_zone, Eina_Bool *check_focus)
+{
+   E_Zone *zone;
+   E_Client *ec;
+
+   EINA_SAFETY_ON_NULL_RETURN(policy_zone);
+
+   // if no clients are managed, just return
+   if (!eina_hash_population(policy_zone->clients_hash))
+     return;
+
+   zone = policy_zone->zone;
+
+   TRACE_DS_BEGIN(CLIENT:IDLE BEFORE);
+
+   E_ZONE_CLIENT_FOREACH(zone, ec)
+     {
+        // pass 1 - eval0. fetch properties on new or on change and
+        // call hooks to decide what to do - maybe move/resize
+        if (ec->ignored || (!ec->changed)) continue;
+
+        e_policy_stack_transient_for_fetch(ec);
+        if (!e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_FETCH, ec)) continue;
+
+        /* FETCH is hooked by the compositor to get client hints */
+        if (!e_client_hook_call(E_CLIENT_HOOK_EVAL_FETCH, ec)) continue;
+
+        if (ec->new_client)
+          {
+             e_client_type_update(ec);
+          }
+
+        /* PRE_POST_FETCH calls e_remember apply for new client */
+        e_policy_wl_notification_level_fetch(ec);
+        if (!e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_POST_FETCH, ec)) continue;
+
+        e_policy_client_evaluation(ec);
+        if (!e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_FETCH, ec)) continue;
+
+        if (!e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_FRAME_ASSIGN, ec)) continue;
+
+        e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_FRAME_ASSIGN, ec);
+     }
+
+   // pass 2 - show and hide windows needing hide and eval (main eval)
+   E_ZONE_CLIENT_FOREACH(zone, ec)
+     {
+        if (e_object_is_del(E_OBJECT(ec))) continue;
+        if (ec->ignored)
+          {
+             // ignored client but needing eval (aux hint) such as remote surfaces
+              if (ec->changed)
+                 {
+                    E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
+                    if (cdata && cdata->first_commit)
+                       e_client_aux_hint_eval(ec);
+                 }
+              continue;
+           }
+
+         if (ec->changes.visible)
+           {
+              if (ec->visible)
+                 {
+                    if ((!ec->new_client) &&
+                       (!ec->changes.pos) &&
+                       (!ec->changes.size))
+                       {
+                          e_view_client_show(e_client_view_get(ec));
+                          ec->changes.visible = !e_view_client_visible_get(e_client_view_get(ec));
+                       }
+                 }
+              else
+                 {
+                    e_view_client_hide(e_client_view_get(ec));
+                    ec->changes.visible = 0;
+                 }
+           }
+
+         if (ec->changed)
+           {
+              e_client_eval(ec);
+              e_comp_visibility_calculation_set(EINA_TRUE);
+              if (ec->changes.accepts_focus)
+                 *check_focus = EINA_TRUE;
+              ec->changes.accepts_focus = 0;
+
+              if (e_client_focus_check_get(ec))
+                {
+                   *check_focus = EINA_TRUE;
+                   e_client_focus_check_set(ec, EINA_FALSE);
+                }
+           }
+
+         if ((ec->changes.visible) && (ec->visible) && (!ec->changed))
+           {
+              e_view_client_show(e_client_view_get(ec));
+              ec->changes.visible = !e_view_client_visible_get(e_client_view_get(ec));
+              ec->changed = ec->changes.visible;
+              e_comp_visibility_calculation_set(EINA_TRUE);
+           }
+     }
+
+   TRACE_DS_END();
+}
+
index 4cdb43465f2195a8b627ecf1ed984c3d8023a0fa..4ac1a45ddb1de5dcef4dd1274cf039b879bb694f 100644 (file)
@@ -7,6 +7,7 @@
 typedef struct _E_Policy_Zone E_Policy_Zone;
 
 EINTERN Eina_Bool e_policy_zone_visibility_calculate(E_Zone *zone);
+EINTERN void      e_policy_zone_evaluate(E_Policy_Zone *policy_zone, Eina_Bool *check_focus);
 
 EINTERN void e_policy_zone_desk_count_set(E_Policy_Zone *policy_zone, size_t count);
 EINTERN void e_policy_zone_focus_clear(E_Policy_Zone *policy_zone);