e_client: Unset current focus when the new focusable ec found 10/284510/1
authorJunseok Kim <juns.kim@samsung.com>
Fri, 18 Nov 2022 05:43:22 +0000 (14:43 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Fri, 18 Nov 2022 08:24:07 +0000 (17:24 +0900)
There was a bug that couldn't receive focus changed event when client unobscured by activate using topmost focus policy.

For more detail, in topmost focus policy, issues following below sequence.
1. Focused window(winA) requests Activate below to fully obscured window(winB).
2. winA requests Activate before winB showing.

The Activate below request didn't doing uniconify render, so stack was changed immediately.
and it cause visiblity changes immediately and visibility changed event send to each client.

The winB didn't focused because of the winB is not shown till the uniconify rendering by visibility.
in this case, winA still focused but winA is not focusable window before winB shown or winA Activated.

It can cause the client didn't receive focus changed event after the client unobscured.
(client regards the fully-obscured means loose focus)

for fix this problem, always focus unset before focused window when there're new focusable window.

Change-Id: Iaccfa5ed77bd46f58a4f82acd9109e534da54606

src/bin/e_client.c

index a5beb78..7bef04a 100644 (file)
@@ -1108,6 +1108,7 @@ e_client_revert_focus(E_Client *ec)
             (!focus_ec->iconic || focus_ec->exp_iconify.buffer_flush))
           {
              ELOGF("FOCUS", "focus set   | topmost_focus", focus_ec);
+             if (focused) e_client_frame_focus_set(focused, EINA_FALSE);
              e_client_frame_focus_set(focus_ec, EINA_TRUE);
           }
         else if (focused && (focus_ec == NULL))
@@ -3916,15 +3917,17 @@ _e_client_focus_calculate(E_Zone *zone)
    if (e_config->focus_policy_ext == E_FOCUS_EXT_TOP_STACK)
      {
         ec = _e_client_focus_topmost_focusable_get();
-        if (ec && (ec != focused))
-          {
-             ELOGF("FOCUS", "focus set | topmost focus calculate", ec);
-             e_client_frame_focus_set(ec, EINA_TRUE);
-          }
-        else if (focused && (ec == NULL))
+
+        if (ec != focused)
           {
-             ELOGF("FOCUS", "focus unset | No focusable ec", focused);
+             if (!ec) ELOGF("FOCUS", "focus unset | No focusable ec", focused);
              e_client_frame_focus_set(focused, EINA_FALSE);
+
+             if (ec)
+               {
+                  ELOGF("FOCUS", "focus set | topmost focus calculate", ec);
+                  e_client_frame_focus_set(ec, EINA_TRUE);
+               }
           }
         return;
      }