e_focus_policy_history: make a E_ZONE_HOOK_FOCUS_RESET callback 28/297528/1
authorSooChan Lim <sc1.lim@samsung.com>
Thu, 10 Aug 2023 00:54:36 +0000 (09:54 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Mon, 21 Aug 2023 07:58:38 +0000 (16:58 +0900)
The focus may be changed at E_ZONE_HOOK_FOCUS_RESET callback.

Change-Id: Ifcea814b689c5b519fa12c9d3a4b691ae4e6b8d2

src/bin/e_comp.c
src/bin/e_comp_object.c
src/bin/e_focus_policy_history.c
src/bin/e_zone.c
src/bin/e_zone.h

index 93913d7..1126617 100644 (file)
@@ -818,8 +818,15 @@ e_comp_ungrab_input(Eina_Bool mouse, Eina_Bool kbd)
    evas_event_feed_mouse_out(e_comp->evas, 0, NULL);
    evas_event_feed_mouse_in(e_comp->evas, 0, NULL);
    if (e_client_focused_get()) return;
+
+#ifdef REFACTOR_FOCUS_POLICY
+   E_Zone *zone = e_zone_current_get();
+   if (!zone) return;
+   e_zone_focus_reset(zone);
+#else
    if (e_config->focus_policy != E_FOCUS_MOUSE)
      e_client_refocus();
+#endif
 }
 
 EINTERN Eina_Bool
index d2f4180..a626882 100644 (file)
@@ -5512,8 +5512,15 @@ _e_comp_object_autoclose_del(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_O
    evas_object_event_callback_del(obj, EVAS_CALLBACK_SHOW, _e_comp_object_autoclose_show);
    _e_comp_object_autoclose_cleanup(1);
    if (e_client_focused_get()) return;
+
+#ifdef REFACTOR_FOCUS_POLICY
+   E_Zone *zone = e_zone_current_get();
+   if (!zone) return;
+   e_zone_focus_reset(zone);
+#else
    if (e_config->focus_policy != E_FOCUS_MOUSE)
      e_client_refocus();
+#endif
 }
 
 EINTERN void
index 6ac4174..df03347 100644 (file)
@@ -145,6 +145,12 @@ _focus_policy_history_hook_cb_zone_focus_clear(void *data, E_Zone *zone)
 }
 
 static void
+_focus_policy_history_hook_cb_zone_focus_reset(void *data, E_Zone *zone)
+{
+   // TODO:
+}
+
+static void
 _focus_policy_history_del(E_Focus_Policy_Impl *impl)
 {
    E_Focus_Policy_History *history_policy = (E_Focus_Policy_History *)impl;
@@ -223,6 +229,8 @@ e_focus_policy_iface_history_new(E_Zone* zone)
    // e_zone hooks
    zone_hook = e_zone_hook_add(E_ZONE_HOOK_FOCUS_CLEAR, _focus_policy_history_hook_cb_zone_focus_clear, history_policy);
    if (zone_hook) history_policy->zone_hooks = eina_list_append(history_policy->zone_hooks, zone_hook);
+   zone_hook = e_zone_hook_add(E_ZONE_HOOK_FOCUS_RESET, _focus_policy_history_hook_cb_zone_focus_reset, history_policy);
+   if (zone_hook) history_policy->zone_hooks = eina_list_append(history_policy->zone_hooks, zone_hook);
 
    return policy_iface;
 
index 072a536..5fdf9f1 100644 (file)
@@ -50,6 +50,7 @@ static Eina_Inlist *_e_zone_hooks[] =
    [E_ZONE_HOOK_SPLISCREEN_DEACTIVATE] = NULL,
 //#ifdef REFACTOR_FOCUS_POLICY
    [E_ZONE_HOOK_FOCUS_CLEAR] = NULL,
+   [E_ZONE_HOOK_FOCUS_RESET] = NULL,
 //#endif
 };
 
@@ -1697,4 +1698,12 @@ e_zone_focus_clear(E_Zone *zone)
 
    _e_zone_hook_call(E_ZONE_HOOK_FOCUS_CLEAR, zone);
 }
+
+EINTERN void
+e_zone_focus_reset(E_Zone *zone)
+{
+   EINA_SAFETY_ON_NULL_RETURN(zone);
+
+   _e_zone_hook_call(E_ZONE_HOOK_FOCUS_RESET, zone);
+}
 #endif
index 4d9269b..05ffde6 100644 (file)
@@ -45,6 +45,7 @@ typedef enum _E_Zone_Hook_Point
    E_ZONE_HOOK_SPLISCREEN_DEACTIVATE,
 //#ifdef REFACTOR_FOCUS_POLICY
    E_ZONE_HOOK_FOCUS_CLEAR,
+   E_ZONE_HOOK_FOCUS_RESET,
 //#endif
    E_ZONE_HOOK_LAST
 } E_Zone_Hook_Point;
@@ -235,6 +236,7 @@ EINTERN Eina_Bool e_zone_is_displaying(E_Zone *zone);
 EINTERN Eina_Bool e_zone_visibility_calculate(E_Zone *zone);
 //#ifdef REFACTOR_FOCUS_POLICY
 EINTERN void      e_zone_focus_clear(E_Zone *zone);
+EINTERN void      e_zone_focus_reset(E_Zone *zone);
 //#endif
 
 extern EINTERN int E_EVENT_ZONE_DESK_COUNT_SET;