e_client: modify code for setting latest focus 19/170819/2
authorDoyoun Kang <doyoun.kang@samsung.com>
Thu, 22 Feb 2018 10:04:02 +0000 (19:04 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Thu, 22 Feb 2018 10:40:02 +0000 (10:40 +0000)
We added code to set latest focus while handling defered focus.
If above window of defered focus window is current focus window,
then we prepend a current focus window to the latest focus list.

Change-Id: Iccc7560bd9a1cbef1f334683a8a7dfd0683d5eac

src/bin/e_client.c

index b85d84562da81dcd0d13384ba1274998a758ed4e..8f2118044018ebcfc65053a55e74d1e59337f2d0 100644 (file)
@@ -783,13 +783,12 @@ _e_client_find_focus_same_layer(E_Client *ec)
    return NULL;
 }
 
-static Eina_Bool
+static E_Client *
 _e_client_check_fully_contain_by_above(E_Client *ec, Eina_Bool check_layer)
 {
    E_Client *above = NULL;
-   Eina_Bool fully_contain = EINA_FALSE;
 
-   if (!ec) return EINA_FALSE;
+   if (!ec) return NULL;
 
    above = e_client_above_get(ec);
    while (above)
@@ -808,15 +807,12 @@ _e_client_check_fully_contain_by_above(E_Client *ec, Eina_Bool check_layer)
             (above->icccm.accepts_focus || above->icccm.take_focus))
           {
              if (E_CONTAINS(above->x, above->y, above->w, above->h, ec->x, ec->y, ec->w, ec->h))
-               {
-                  fully_contain = EINA_TRUE;
-                  break;
-               }
+               break;
           }
         above = e_client_above_get(above);
      }
 
-   return fully_contain;
+   return above;
 }
 
 static void
@@ -3245,15 +3241,19 @@ _e_client_visibility_zone_calculate(E_Zone *zone, Eina_Bool check_focus)
                          {
                             if (!focus_ec)
                               {
-                                 Eina_Bool obscured = EINA_FALSE;
-                                 obscured = _e_client_check_fully_contain_by_above(ec, EINA_FALSE);
-                                 if (!obscured)
+                                 E_Client *obscured_above = NULL;
+                                 obscured_above = _e_client_check_fully_contain_by_above(ec, EINA_FALSE);
+                                 if (!obscured_above)
                                    {
                                       focus_ec = ec;
                                       evas_object_focus_set(ec->frame, 1);
                                    }
                                  else
-                                   e_client_focus_latest_set(ec);
+                                   {
+                                      e_client_focus_latest_set(ec);
+                                      if (obscured_above == e_client_focused_get())
+                                        e_client_focus_latest_set(obscured_above);
+                                   }
                               }
                          }
                        e_client_focus_defer_unset(ec);
@@ -4982,7 +4982,7 @@ e_client_activate(E_Client *ec, Eina_Bool just_do_it)
         if (!ec->lock_focus_out)
           {
              E_Client *focus_ec = NULL;
-             Eina_Bool obscured = EINA_FALSE;
+             E_Client *obscured_above = NULL;
 
              if (ec->transients)
                focus_ec = e_client_transient_child_top_get(ec, EINA_TRUE);
@@ -4990,8 +4990,8 @@ e_client_activate(E_Client *ec, Eina_Bool just_do_it)
              if (!focus_ec)
                focus_ec = ec;
 
-             obscured = _e_client_check_fully_contain_by_above(focus_ec, EINA_FALSE);
-             if (!obscured)
+             obscured_above = _e_client_check_fully_contain_by_above(focus_ec, EINA_FALSE);
+             if (!obscured_above)
                evas_object_focus_set(focus_ec->frame, 1);
              else
                {