e_comp: calculate the visibility and the focus at e_comp 69/296169/1 accepted/tizen/unified/20230726.020650
authorSooChan Lim <sc1.lim@samsung.com>
Thu, 20 Jul 2023 07:41:32 +0000 (16:41 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Fri, 21 Jul 2023 01:20:44 +0000 (10:20 +0900)
The logic for calculating the visibility and the focus moves
from e_client.c to e_comp.c at idler handler.

Change-Id: I408f8733ca342cbe927889163b4ea11e037e45ae

src/bin/e_client.c
src/bin/e_client.h
src/bin/e_comp.c

index 21c7240..41b32ca 100644 (file)
@@ -3355,8 +3355,8 @@ _e_client_visibility_touched_check(E_Client *ec)
    return _e_client_position_inside_input_rect(ec, tx, ty);
 }
 
-static Eina_Bool
-_e_client_visibility_zone_calculate(E_Zone *zone)
+EINTERN Eina_Bool
+e_client_visibility_zone_calculate(E_Zone *zone)
 {
    E_Client *ec;
 
@@ -3726,8 +3726,8 @@ end:
    return;
 }
 
-static void
-_e_client_focus_calculate(E_Zone *zone)
+EINTERN void
+e_client_focus_calculate(E_Zone *zone)
 {
    E_Client *defered_focus_ec = NULL, *reverted_focus_ec = NULL;
    E_Client *ec = NULL, *old_focused = NULL, *cec = NULL;
@@ -4173,11 +4173,12 @@ e_client_clients_hash_exist()
 }
 
 EINTERN void
-e_client_idler_before(void)
+e_client_idler_before(Eina_Bool *check_focus)
 {
    const Eina_List *l;
    E_Client *ec;
-   Eina_Bool check_focus = EINA_FALSE;
+
+   *check_focus = EINA_FALSE;
 
    if (!e_client_clients_hash_exist()) return;
 
@@ -4249,7 +4250,7 @@ e_client_idler_before(void)
              _e_client_eval(ec);
              e_comp_visibility_calculation_set(EINA_TRUE);
              if (ec->changes.accepts_focus)
-               check_focus = EINA_TRUE;
+               *check_focus = EINA_TRUE;
              ec->changes.accepts_focus = 0;
           }
 
@@ -4262,28 +4263,6 @@ e_client_idler_before(void)
           }
      }
 
-   if (e_comp_canvas_norender_get() <= 0)
-     {
-        E_Zone *zone;
-        Eina_List *zl;
-        Eina_Bool e_visibility_changed = EINA_FALSE;
-
-        EINA_LIST_FOREACH(e_comp->zones, zl, zone)
-          {
-             if (e_comp_visibility_calculation_get())
-               e_visibility_changed = _e_client_visibility_zone_calculate(zone);
-             if (check_focus ||
-                 (e_client_focused_get() == NULL) ||
-                 (e_comp_visibility_calculation_get() && (defer_focus_stack != NULL)) ||
-                 (e_visibility_changed))
-               {
-                  _e_client_focus_calculate(zone);
-               }
-          }
-        e_comp_visibility_calculation_set(EINA_FALSE);
-     }
-
-
    TRACE_DS_END();
 }
 
@@ -5749,6 +5728,12 @@ e_client_focus_stack_get(void)
    return focus_stack;
 }
 
+EINTERN Eina_List *
+e_client_defer_focus_stack_get(void)
+{
+   return defer_focus_stack;
+}
+
 YOLO EINTERN void
 e_client_focus_stack_set(Eina_List *l)
 {
index b710c32..5d865e1 100644 (file)
@@ -1088,7 +1088,7 @@ E_API extern int E_EVENT_CLIENT_BUFFER_CHANGE;
 E_API extern int E_EVENT_CLIENT_FOCUS_SKIP_SET;
 E_API extern int E_EVENT_CLIENT_FOCUS_SKIP_UNSET;
 
-EINTERN void e_client_idler_before(void);
+EINTERN void e_client_idler_before(Eina_Bool *check_focus);
 EINTERN Eina_Bool e_client_init(void);
 EINTERN void e_client_shutdown(void);
 E_API E_Client *e_client_from_surface_resource(struct wl_resource *surface_resource);
@@ -1140,6 +1140,7 @@ EINTERN void e_client_focus_set_with_pointer(E_Client *ec);
 EINTERN void e_client_activate(E_Client *ec, Eina_Bool just_do_it);
 E_API E_Client *e_client_focused_get(void);
 EINTERN Eina_List *e_client_focus_stack_get(void);
+EINTERN Eina_List *e_client_defer_focus_stack_get(void);
 EINTERN void e_client_focus_stack_clear(void);
 EINTERN Eina_List *e_client_lost_windows_get(E_Zone *zone);
 EINTERN void e_client_shade(E_Client *ec, E_Direction dir);
@@ -1317,6 +1318,8 @@ EINTERN Eina_Bool e_client_explicit_sync_get(E_Client *ec);
 EINTERN Eina_Bool e_client_explicit_sync_set(E_Client *ec, Eina_Bool enable);
 EINTERN int       e_client_explicit_sync_acquire_fence_fd_get(E_Client *ec);
 EINTERN Eina_Bool e_client_explicit_sync_acquire_fence_fd_set(E_Client *ec, int fd);
+EINTERN Eina_Bool e_client_visibility_zone_calculate(E_Zone *zone);
+EINTERN void      e_client_focus_calculate(E_Zone *zone);
 
 /**
  * Move window to coordinates that do not account client decorations yet.
index 21d3cd8..70c29a2 100644 (file)
@@ -1447,8 +1447,30 @@ e_comp_client_zone_is_displaying(E_Client *ec)
 EINTERN void
 e_comp_idler_before(void)
 {
+   Eina_Bool check_focus = EINA_FALSE;
+   E_Zone *zone;
+   Eina_List *zl;
+   Eina_Bool e_visibility_changed = EINA_FALSE;
+
    // TODO: call e_zone_idle_before() for each zone
-   e_client_idler_before();
+   e_client_idler_before(&check_focus);
+
+   if (e_comp_canvas_norender_get() <= 0)
+     {
+        EINA_LIST_FOREACH(e_comp->zones, zl, zone)
+           {
+              if (e_comp_visibility_calculation_get())
+              e_visibility_changed = e_client_visibility_zone_calculate(zone);
+              if (check_focus ||
+                  (e_client_focused_get() == NULL) ||
+                  (e_comp_visibility_calculation_get() && (e_client_defer_focus_stack_get() != NULL)) ||
+                  (e_visibility_changed))
+              {
+                 e_client_focus_calculate(zone);
+              }
+           }
+        e_comp_visibility_calculation_set(EINA_FALSE);
+     }
 }
 
 EINTERN void