e_client: fix bug for setting focus to invalid window in visibility calculation 21/212121/2
authorDoyoun Kang <doyoun.kang@samsung.com>
Wed, 14 Aug 2019 09:57:47 +0000 (18:57 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Wed, 14 Aug 2019 10:22:35 +0000 (19:22 +0900)
When the skip-focus set and full size window was shown on the higher layer,
there was a bug that the normal window got and lost focus when it requested to activate.
It had not to get the focus because it was obscured by the higher layer window.
For this bug, the normal window got both focus-in and focus-out event.

To resolve this problem,
we added checking code whether the top visible full size window set skip-focus or not.

Change-Id: Iaa2c7564187f39e260bf33ab315ef4b02e4431df

src/bin/e_client.c

index 9a7c918039ae9a320b67ac457778c44a3be26650..3889d53f8b2d611de0644e8ed26c1225fc136802 100644 (file)
@@ -3119,7 +3119,8 @@ _e_client_visibility_zone_calculate(E_Zone *zone, Eina_Bool check_focus)
    E_Client *ec;
    E_Client *focus_ec = NULL;
    E_Client *cur_focused_ec = NULL;
-   E_Client *top_vis_full_ec = NULL;
+   E_Client *top_vis_full_focusable_ec = NULL;
+   E_Client *top_vis_full_non_focusable_ec = NULL;
    Eina_Bool top_vis_full_ec_vis_changed = EINA_FALSE;
    Eina_Bool find_top_vis_ec = EINA_FALSE;
 
@@ -3384,14 +3385,25 @@ _e_client_visibility_zone_calculate(E_Zone *zone, Eina_Bool check_focus)
                   if (!find_top_vis_ec)
                     {
                        find_top_vis_ec = EINA_TRUE;
-                       if ((!ec->iconic) &&
-                           (ec->icccm.accepts_focus || ec->icccm.take_focus))
+                       if (!ec->iconic)
                          {
-                            e_client_geometry_get(ec, &x, &y, &w, &h);
-                            if (E_CONTAINS(x, y, w, h, zone->x, zone->y, zone->w, zone->h))
+                            if ((ec->icccm.accepts_focus || ec->icccm.take_focus))
                               {
-                                 top_vis_full_ec = ec;
-                                 top_vis_full_ec_vis_changed = ec->visibility.changed;
+                                 e_client_geometry_get(ec, &x, &y, &w, &h);
+                                 if (E_CONTAINS(x, y, w, h, zone->x, zone->y, zone->w, zone->h))
+                                   {
+                                      top_vis_full_focusable_ec = ec;
+                                      top_vis_full_ec_vis_changed = ec->visibility.changed;
+                                   }
+                              }
+                            else
+                              {
+                                 if (!ec->argb && !top_vis_full_non_focusable_ec)
+                                   {
+                                      e_client_geometry_get(ec, &x, &y, &w, &h);
+                                      if (E_CONTAINS(x, y, w, h, zone->x, zone->y, zone->w, zone->h))
+                                        top_vis_full_non_focusable_ec = ec;
+                                   }
                               }
                          }
                     }
@@ -3449,23 +3461,26 @@ _e_client_visibility_zone_calculate(E_Zone *zone, Eina_Bool check_focus)
         if (!focus_ec)
           {
              cur_focused_ec = e_client_focused_get();
-             if (top_vis_full_ec)
+             if (top_vis_full_focusable_ec)
                {
-                  if (top_vis_full_ec != cur_focused_ec)
+                  if (top_vis_full_focusable_ec != cur_focused_ec)
                     {
                        if (!cur_focused_ec)
-                         evas_object_focus_set(top_vis_full_ec->frame, 1);
+                         evas_object_focus_set(top_vis_full_focusable_ec->frame, 1);
                        else
                          {
                             if (top_vis_full_ec_vis_changed || check_focus)
-                              evas_object_focus_set(top_vis_full_ec->frame, 1);
+                              evas_object_focus_set(top_vis_full_focusable_ec->frame, 1);
                          }
                     }
                }
              else
                {
                   if (!cur_focused_ec)
-                    _e_client_latest_stacked_focus_set();
+                    {
+                       if (!top_vis_full_non_focusable_ec)
+                         _e_client_latest_stacked_focus_set();
+                    }
                }
           }
      }