e_client: Correct order of the focus history when appending 92/309092/2 accepted/tizen/7.0/unified/20240405.142915
authorJunseok Kim <juns.kim@samsung.com>
Thu, 4 Apr 2024 12:27:09 +0000 (21:27 +0900)
committerJunseok Kim <juns.kim@samsung.com>
Fri, 5 Apr 2024 01:24:35 +0000 (10:24 +0900)
In the previous patch, we fixed an issue where the order of focus history was incorrect.
(previous commit : d5355f3943cfb00ce19454840abf140e8be8c843)

The original purpose of the patch was to append a new client after a client with a higher layer after the focused client.
However, there was a problem that the wrong condition of the previous patch
caused the new client to be placed at the beginning of the focus history.
This is a patch that fixes this problem.

Change-Id: I6600431a18f6153bfdaef7f6ddddd34f661b33f8

src/bin/e_client.c

index f2e61e032362f25604f964a55a4660ee20b8faef..5b6d865df26016fb79ec6880ee5405affb211d2a 100644 (file)
@@ -5841,22 +5841,35 @@ e_client_focus_stack_append_current_focused(E_Client *ec)
 {
    Eina_List *l = NULL;
    E_Client *temp_ec = NULL;
+   Eina_Bool find_focus = EINA_FALSE;
 
    EINA_SAFETY_ON_NULL_RETURN(ec);
    if (focus_track_frozen > 0) return;
 
-   focus_stack = eina_list_remove(focus_stack, ec);
-
    EINA_LIST_FOREACH(focus_stack, l, temp_ec)
      {
-        if (temp_ec != focused) continue;
-        if (temp_ec->layer > ec->layer) continue;
+        if (temp_ec == ec) return;
+        if (temp_ec == focused)
+          {
+             find_focus = EINA_TRUE;
+             continue;
+          }
+        else if (find_focus)
+          {
+             if (temp_ec->layer > ec->layer) continue;
 
-        focus_stack = eina_list_append_relative_list(focus_stack, ec, l);
-        return;
+             focus_stack = eina_list_remove(focus_stack, ec);
+             focus_stack = eina_list_prepend_relative_list(focus_stack, ec, l);
+             return;
+          }
      }
 
-   focus_stack = eina_list_prepend(focus_stack, ec);
+   focus_stack = eina_list_remove(focus_stack, ec);
+   if (find_focus)
+     focus_stack = eina_list_append(focus_stack, ec);
+   else
+     focus_stack = eina_list_prepend(focus_stack, ec);
+
    return;
 }