From fba88dc548700188b1216018aeeeeedab3f20776 Mon Sep 17 00:00:00 2001 From: Junseok Kim Date: Thu, 4 Apr 2024 21:27:09 +0900 Subject: [PATCH] e_client: Correct order of the focus history when appending 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 | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/bin/e_client.c b/src/bin/e_client.c index f2e61e0323..5b6d865df2 100644 --- a/src/bin/e_client.c +++ b/src/bin/e_client.c @@ -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; } -- 2.34.1