e_focus_policy_history: exclude given ec when finding next focusable ec 18/320618/1
authorJunseok Kim <juns.kim@samsung.com>
Wed, 19 Feb 2025 06:46:42 +0000 (15:46 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Wed, 5 Mar 2025 05:00:11 +0000 (14:00 +0900)
Exclude given client when finding next focusable ec
and clearfy the given ec is client to be exclude

Change-Id: I14dde8a27d41e405564eff97b9f58e1d9bc83667

src/bin/windowmgr/e_focus_policy_history.c

index 00e44fd291f0d72906599bba7f7f36fc1d034c1b..ac908220a7df77b22bf16433d2aa43b04e111e6f 100644 (file)
@@ -315,17 +315,19 @@ _e_focus_policy_history_focus_can_take(E_Focus_Policy_History *history_policy, E
 }
 
 static E_Client *
-_focus_policy_history_find_next_focusable_ec(E_Focus_Policy_History *history_policy, E_Client *ec)
+_focus_policy_history_find_next_focusable_ec(E_Focus_Policy_History *history_policy, E_Client *exclude_ec)
 {
    Eina_List *l = NULL;
    E_Client *temp_ec = NULL;
 
    // call the intercept hook of the revert focus
-   if (e_client_intercept_hook_focus_revert_call(ec))
+   if (e_client_intercept_hook_focus_revert_call(exclude_ec))
      return NULL;
 
    EINA_LIST_FOREACH(history_policy->focus_stack, l, temp_ec)
      {
+        if (exclude_ec == temp_ec) continue;
+
         if (_e_focus_policy_history_focus_can_take(history_policy, temp_ec))
           return temp_ec;
      }
@@ -334,7 +336,7 @@ _focus_policy_history_find_next_focusable_ec(E_Focus_Policy_History *history_pol
 }
 
 static E_Client *
-_focus_policy_history_focusable_get(E_Focus_Policy_History *history_policy, E_Client *ec)
+_focus_policy_history_focusable_get(E_Focus_Policy_History *history_policy, E_Client *exclude_ec)
 {
    E_Client *pec = NULL, *focusable_ec = NULL;
    E_Zone *zone;
@@ -342,42 +344,42 @@ _focus_policy_history_focusable_get(E_Focus_Policy_History *history_policy, E_Cl
 
    if (stopping) return NULL;
 
-   if (!ec)
+   if (!exclude_ec)
      return _focus_policy_history_find_next_focusable_ec(history_policy, NULL);
 
    zone = history_policy->zone;
+   if (!e_zone_is_displaying(zone)) return NULL;
 
    desk = e_desk_current_get(zone);
    if (!desk) return NULL;
-   if (!e_comp_client_zone_is_displaying(ec)) return NULL;
 
    if (e_config->focus_policy == E_FOCUS_MOUSE)
      {
         // set mouse over focus
-        pec = e_client_under_pointer_get(desk, ec);
+        pec = e_client_under_pointer_get(desk, exclude_ec);
         if (pec)
           focusable_ec = pec;
         /* no autoraise/revert here because it's probably annoying */
      }
    else
-     focusable_ec = _focus_policy_history_find_next_focusable_ec(history_policy, ec);
+     focusable_ec = _focus_policy_history_find_next_focusable_ec(history_policy, exclude_ec);
 
    return focusable_ec;
 }
 
 static void
-_focus_policy_history_next_focus_set(E_Focus_Policy_History *history_policy, E_Client *ec)
+_focus_policy_history_next_focus_set(E_Focus_Policy_History *history_policy, E_Client *exclude_ec)
 {
    E_Client *focusable_ec;
 
-   focusable_ec = _focus_policy_history_focusable_get(history_policy, ec);
+   focusable_ec = _focus_policy_history_focusable_get(history_policy, exclude_ec);
    if (!focusable_ec) return;
 
-   if (focusable_ec != ec)
+   if (focusable_ec != exclude_ec)
      {
-        _e_focus_policy_history_focus_defer_unset(history_policy, ec);
-        ELOGF("FOCUS_HISTORY", "focus unset | revert_focus", ec);
-        e_client_frame_focus_set(ec, EINA_FALSE);
+        _e_focus_policy_history_focus_defer_unset(history_policy, exclude_ec);
+        ELOGF("FOCUS_HISTORY", "focus unset | revert_focus", exclude_ec);
+        e_client_frame_focus_set(exclude_ec, EINA_FALSE);
      }
 
    if (!focusable_ec->iconic || focusable_ec->exp_iconify.buffer_flush)