e_comp: refactor e_comp_idler_before function 19/322419/2
authorSooChan Lim <sc1.lim@samsung.com>
Mon, 7 Apr 2025 10:51:56 +0000 (19:51 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Wed, 9 Apr 2025 00:49:41 +0000 (00:49 +0000)
traverse e_screens for evaluation

Change-Id: I58831141fced625dfd251e64916b31562e18811f

src/bin/compmgr/e_comp.c
src/bin/core/e_client.c
src/bin/core/e_client_intern.h
src/bin/windowmgr/e_policy_zone.c
src/bin/windowmgr/e_policy_zone_intern.h

index 1e4d220ff7f446185dcba7d8d3864d516248b10d..baa8b5e916f98cd4a664ec3961b5143ecf7fe9fd 100644 (file)
@@ -1431,34 +1431,54 @@ e_comp_client_zone_is_displaying(E_Client *ec)
 EINTERN void
 e_comp_idler_before(void)
 {
-   Eina_Bool check_focus = EINA_FALSE;
+   Eina_List *screens;
+   E_Screen *screen;
+   E_Policy_Zone *policy_zone;
    E_Zone *zone;
-   Eina_List *zl;
+   Eina_List *s;
+   Eina_Bool check_focus = EINA_FALSE;
    Eina_Bool e_visibility_changed = EINA_FALSE;
 
-   // TODO: call e_zone_idle_before() for each zone
-   e_client_idler_before(&check_focus);
+   screens = (Eina_List *)e_comp_screen_e_screens_get(e_comp_screen_get());
+   EINA_SAFETY_ON_NULL_RETURN(screens);
+
+   // evaluate the e_client policy of each zone
+   EINA_LIST_FOREACH(screens, s, screen)
+     {
+        policy_zone = e_screen_policy_zone_get(screen);
+        if (!policy_zone) continue;
+
+        // FIXME: check_focus has to be checked in each zone
+        e_policy_zone_evaluate(policy_zone, &check_focus);
+     }
+
+   // don't evaluate the visibility calculation if norender is enabled
+   if (e_comp_canvas_norender_get() > 0)
+     return;
 
-   if (e_comp_canvas_norender_get() <= 0)
+   // evaluate the visibility of each zone
+   EINA_LIST_FOREACH(screens, s, screen)
      {
-        EINA_LIST_FOREACH(e_comp->zones, zl, zone)
-           {
-              e_visibility_changed = EINA_FALSE;
-
-              if (e_comp_visibility_calculation_get())
-                e_visibility_changed = e_policy_zone_visibility_calculate(zone);
-
-              if (zone->focus &&
-                  (check_focus ||
-                  (e_zone_focused_client_get(zone) == NULL) ||
-                  e_visibility_changed))
-                {
-
-                   e_focus_update(zone->focus);
-                }
-           }
-        e_comp_visibility_calculation_set(EINA_FALSE);
+        policy_zone = e_screen_policy_zone_get(screen);
+        if (!policy_zone) continue;
+
+        zone = e_policy_zone_get_zone(policy_zone);
+        if (!zone) continue;
+
+        e_visibility_changed = EINA_FALSE;
+
+        if (e_comp_visibility_calculation_get())
+          e_visibility_changed = e_policy_zone_visibility_calculate(policy_zone);
+
+        if (zone->focus &&
+            (check_focus ||
+            (e_zone_focused_client_get(zone) == NULL) ||
+            e_visibility_changed))
+          {
+             e_focus_update(zone->focus);
+          }
      }
+   e_comp_visibility_calculation_set(EINA_FALSE);
 }
 
 EINTERN void
index 633dcba65dd7f9ab292cb4f90550aaa819841b4e..040fbc8b75ce3249843d2c78d270402bea47f67e 100644 (file)
@@ -25,8 +25,6 @@
 #include "e_hwc_window_intern.h"
 #include "e_canvas_intern.h"
 #include "e_policy_visibility_intern.h"
-#include "e_policy_stack_intern.h"
-#include "e_policy_wl_intern.h"
 
 #define PRI(ec) ((E_Client_Private *)e_object_data_get(E_OBJECT(ec)))
 
@@ -2705,111 +2703,6 @@ e_client_clients_hash_exist()
   return EINA_FALSE;
 }
 
-EINTERN void
-e_client_idler_before(Eina_Bool *check_focus)
-{
-   E_Zone *zone;
-   E_Client *ec;
-
-   *check_focus = EINA_FALSE;
-
-   if (!e_client_clients_hash_exist()) return;
-
-   TRACE_DS_BEGIN(CLIENT:IDLE BEFORE);
-
-   E_COMP_ZONE_FOREACH(zone)
-     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_COMP_ZONE_FOREACH(zone)
-     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(PRI(ec)->view_client);
-                         ec->changes.visible = !e_view_client_visible_get(PRI(ec)->view_client);
-                      }
-                 }
-               else
-                 {
-                    e_view_client_hide(PRI(ec)->view_client);
-                    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(PRI(ec)->view_client);
-               ec->changes.visible = !e_view_client_visible_get(PRI(ec)->view_client);
-               ec->changed = ec->changes.visible;
-               e_comp_visibility_calculation_set(EINA_TRUE);
-            }
-       }
-
-   TRACE_DS_END();
-}
-
 static Eina_Bool
 _e_client_cb_hook_comp_render_update_lock_set(void *data, E_Client *ec)
 {
index c73c24b29e6c01bd32bb7a45de57cb40e71dd1e9..9cb4693368aa47d763d5437644551bc98a9661f6 100644 (file)
@@ -43,7 +43,6 @@ struct _E_Event_Mouse_Wheel
 EINTERN Eina_Bool e_client_init(void);
 EINTERN void      e_client_shutdown(void);
 
-EINTERN void          e_client_idler_before(Eina_Bool *check_focus);
 EINTERN unsigned int  e_clients_count(void);
 EINTERN void          e_client_focused_set(E_Client *ec);
 EINTERN void          e_client_focused_unset(E_Client *ec);
index 2ee490a6b2dcd4c85b58c9ea0073def5d3561aa4..94b498e556335894487dc63dcac3960f03430e1e 100644 (file)
@@ -1312,8 +1312,9 @@ _e_policy_zone_cb_desk_find_by_ec(struct wl_listener *listener, void *data)
 #define EC_IS_NOT_VISIBLE if (e_client_visibility_get(ec) != E_VISIBILITY_UNOBSCURED)
 
 EINTERN Eina_Bool
-e_policy_zone_visibility_calculate(E_Zone *zone)
+e_policy_zone_visibility_calculate(E_Policy_Zone *policy_zone)
 {
+   E_Zone *zone;
    E_Client *ec;
 
    Eina_Tiler *t;
@@ -1349,7 +1350,9 @@ e_policy_zone_visibility_calculate(E_Zone *zone)
         if (comp && comp->animating) return EINA_FALSE;
      }
 
-   EINA_SAFETY_ON_NULL_RETURN_VAL(zone, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(policy_zone, EINA_FALSE);
+
+   zone = policy_zone->zone;
 
    TRACE_DS_BEGIN(CLIENT:VISIBILITY CALCULATE);
 
index 4ac1a45ddb1de5dcef4dd1274cf039b879bb694f..2164c5f4ff284a0aac3cdf5a82ad92476422a0fc 100644 (file)
@@ -6,7 +6,7 @@
 
 typedef struct _E_Policy_Zone E_Policy_Zone;
 
-EINTERN Eina_Bool e_policy_zone_visibility_calculate(E_Zone *zone);
+EINTERN Eina_Bool e_policy_zone_visibility_calculate(E_Policy_Zone *policy_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);