e_focus_policy_topmost: implement the update 53/297553/1
authorSooChan Lim <sc1.lim@samsung.com>
Thu, 10 Aug 2023 07:37:01 +0000 (16:37 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Mon, 21 Aug 2023 07:58:39 +0000 (16:58 +0900)
The implementation update the current updated ec.

Change-Id: Icf9771c78406200e8e42197e432ace0b7e826b10

src/bin/e_focus_policy_topmost.c

index f3ca74b..861405c 100644 (file)
@@ -404,10 +404,37 @@ static Eina_Bool
 _focus_policy_topmost_update(E_Focus_Policy_Impl *impl)
 {
    E_Focus_Policy_Topmost *topmost_policy;
+   E_Zone *zone;
+   E_Client *focusable_ec, *focused_ec;
 
    topmost_policy = (E_Focus_Policy_Topmost *)impl;
    EINA_SAFETY_ON_NULL_RETURN_VAL(topmost_policy, EINA_FALSE);
 
+   zone = topmost_policy->zone;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(zone, EINA_FALSE);
+
+   // no need to update the focused ec when zone is not displaying
+   if (!e_zone_is_displaying(zone)) return EINA_FALSE;
+
+   // current focused ec
+   focused_ec = topmost_policy->focused_ec;
+
+   // next focusable ec
+   focusable_ec = _e_focus_policy_topmost_focusable_get();
+   if (focusable_ec == focused_ec) return EINA_TRUE;
+
+   e_client_frame_focus_set(focused_ec, EINA_FALSE);
+
+   if (focusable_ec)
+     {
+        ELOGF("FOCUS", "focus set | topmost focus calculate Zone(%d)", focusable_ec, zone->id);
+        e_client_frame_focus_set(focusable_ec, EINA_TRUE);
+     }
+   else
+     {
+        ELOGF("FOCUS", "focus unset | No focusable ec Zone(%d)", focused_ec, zone->id);
+     }
+
    return EINA_TRUE;
 }