focus: added focus policy check whether above window is full or not. 26/105626/1 accepted/tizen/3.0/common/20161220.101605 accepted/tizen/3.0/ivi/20161220.011154 accepted/tizen/3.0/mobile/20161220.011101 accepted/tizen/3.0/tv/20161220.011116 accepted/tizen/3.0/wearable/20161220.011136 accepted/tizen/common/20161219.152333 accepted/tizen/ivi/20161219.230333 accepted/tizen/mobile/20161219.230237 accepted/tizen/tv/20161219.230259 accepted/tizen/wearable/20161219.230311 submit/tizen/20161219.121320 submit/tizen_3.0/20161219.121346
authorDoyoun Kang <doyoun.kang@samsung.com>
Mon, 19 Dec 2016 06:44:19 +0000 (15:44 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Mon, 19 Dec 2016 06:44:19 +0000 (15:44 +0900)
we added code that the new (or activate) window didn't get focus when its above window is full size.

Change-Id: Ief93bfd985cb0a6882f03db36cbe2e421128198e

src/bin/e_client.c
src/bin/e_policy_wl.c

index 1fd276a4579471242eb9ad05bd5688a9ba4f2f33..e2087664aae0059d6340abcd7f6d0ad2b230f774 100644 (file)
@@ -774,6 +774,42 @@ _e_client_find_focus_same_layer(E_Client *ec)
    return NULL;
 }
 
+static Eina_Bool
+_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;
+
+   above = e_client_above_get(ec);
+   while (above)
+     {
+        if ((check_layer) &&
+            (above->layer <= ec->layer))
+          {
+             above = e_client_above_get(above);
+             continue;
+          }
+
+        if ((!e_object_is_del(E_OBJECT(above))) &&
+            (!e_client_util_ignored_get(above)) &&
+            (above->visible) &&
+            (above->frame) &&
+            (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;
+               }
+          }
+        above = e_client_above_get(above);
+     }
+
+   return fully_contain;
+}
+
 static void
 _e_client_find_next_focus(E_Client *ec)
 {
@@ -784,6 +820,9 @@ _e_client_find_next_focus(E_Client *ec)
    if (!_e_client_intercept_hook_call(E_CLIENT_INTERCEPT_HOOK_FOCUS_REVERT, ec))
      return;
 
+   if (_e_client_check_fully_contain_by_above(ec, EINA_TRUE))
+     return;
+
    next_focus = _e_client_find_focus_same_layer(ec);
    if (next_focus)
      evas_object_focus_set(next_focus->frame, 1);
@@ -3054,8 +3093,13 @@ _e_client_visibility_zone_calculate(E_Zone *zone)
                          {
                             if (!focus_ec)
                               {
-                                 focus_ec = ec;
-                                 evas_object_focus_set(ec->frame, 1);
+                                 Eina_Bool obscured = EINA_FALSE;
+                                 obscured = _e_client_check_fully_contain_by_above(ec, EINA_FALSE);
+                                 if (!obscured)
+                                   {
+                                      focus_ec = ec;
+                                      evas_object_focus_set(ec->frame, 1);
+                                   }
                               }
                          }
                        e_client_focus_defer_unset(ec);
@@ -4706,11 +4750,16 @@ e_client_activate(E_Client *ec, Eina_Bool just_do_it)
         if (!ec->lock_focus_out)
           {
              E_Client *focus_ec = ec;
+             Eina_Bool obscured = EINA_FALSE;
 
              if (ec->transients)
                focus_ec = e_client_transient_child_top_get(ec, EINA_TRUE);
 
-             evas_object_focus_set(focus_ec->frame, 1);
+             obscured = _e_client_check_fully_contain_by_above(focus_ec, EINA_FALSE);
+             if (!obscured)
+               evas_object_focus_set(focus_ec->frame, 1);
+             else
+               e_client_focus_defer_set(focus_ec);
           }
      }
 
index 3f46f740246ca3037f9d18218b7f76e691ad2300..de333ebd953da2a70d1283073e5b5be64425f9e0 100644 (file)
@@ -1444,7 +1444,7 @@ _tzpol_iface_cb_raise(struct wl_client *client EINA_UNUSED, struct wl_resource *
 static void
 _tzpol_iface_cb_lower(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol EINA_UNUSED, struct wl_resource *surf)
 {
-   E_Client *ec, *below = NULL;
+   E_Client *ec = NULL;
 
    ec = wl_resource_get_user_data(surf);
    EINA_SAFETY_ON_NULL_RETURN(ec);
@@ -1455,30 +1455,16 @@ _tzpol_iface_cb_lower(struct wl_client *client EINA_UNUSED, struct wl_resource *
    if (e_policy_visibility_client_lower(ec))
      return;
 
-   below = ec;
-   while ((below = e_client_below_get(below)))
-     {
-        if ((e_client_util_ignored_get(below)) ||
-            (below->iconic))
-          continue;
-
-        break;
-     }
-
    evas_object_lower(ec->frame);
 
    if (!e_client_first_mapped_get(ec))
      e_client_post_raise_lower_set(ec, EINA_FALSE, EINA_TRUE);
-
-   if ((!below) || (!ec->focused)) return;
-
-   evas_object_focus_set(below->frame, 1);
 }
 
 static void
 _tzpol_iface_cb_lower_by_res_id(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol,  uint32_t res_id)
 {
-   E_Client *ec, *below = NULL;
+   E_Client *ec = NULL;
 
    ELOGF("TZPOL",
          "LOWER_RES|res_tzpol:0x%08x|res_id:%d",
@@ -1488,25 +1474,10 @@ _tzpol_iface_cb_lower_by_res_id(struct wl_client *client EINA_UNUSED, struct wl_
    EINA_SAFETY_ON_NULL_RETURN(ec);
    EINA_SAFETY_ON_NULL_RETURN(ec->frame);
 
-   below = ec;
-   while ((below = e_client_below_get(below)))
-     {
-        if ((e_client_util_ignored_get(below)) ||
-            (below->iconic))
-          continue;
-
-        break;
-     }
-
    evas_object_lower(ec->frame);
 
    if (!e_client_first_mapped_get(ec))
      e_client_post_raise_lower_set(ec, EINA_FALSE, EINA_TRUE);
-
-   if ((!below) || (!ec->focused)) return;
-
-   if ((below->icccm.accepts_focus) ||(below->icccm.take_focus))
-     evas_object_focus_set(below->frame, 1);
 }
 
 // --------------------------------------------------------