Added extended focus policy :Top visible window takes focus.
authorMun, Gwan-gyeong <kk.moon@samsung.com>
Fri, 13 Mar 2015 09:01:33 +0000 (18:01 +0900)
committerBoram Park <boram1288.park@samsung.com>
Wed, 18 Mar 2015 04:03:45 +0000 (13:03 +0900)
Change-Id: Ic92f1bda9eecfe0104ceee9ee3d76d433959eda4

src/bin/e_client.c
src/bin/e_client.h
src/bin/e_config.c
src/bin/e_config.h

index 3174d0aec96bb9e1a57caee8ea279b5fe723cb50..f68ca2452c20cfdf4187752516bc1a84750c08d3 100644 (file)
@@ -2320,7 +2320,7 @@ _e_client_type_get(E_Client *ec)
 static void
 _e_client_visibility_zone_calculate(E_Zone *zone)
 {
-   E_Client *ec;
+   E_Client *ec, *top_visible_ec = NULL;
    Evas_Object *o;
    Eina_Tiler *t;
    Eina_Rectangle r, *_r;
@@ -2385,6 +2385,8 @@ _e_client_visibility_zone_calculate(E_Zone *zone)
         if (is_intersected)
           {
              Eina_Bool opaque = EINA_FALSE;
+             if (!top_visible_ec) top_visible_ec = ec;
+
              /* unobscured case */
              if (ec->visibility.obscured == 0)
                {
@@ -2425,6 +2427,15 @@ _e_client_visibility_zone_calculate(E_Zone *zone)
                   /* do nothing */
                }
           }
+
+       if ((e_config->focus_policy_ext == E_FOCUS_EXT_TOP_STACK) &&
+           (!ec->focused) && (ec == top_visible_ec) &&
+           (!ec->visibility.obscured) &&
+           ((ec->icccm.accepts_focus) || (ec->icccm.take_focus)))
+        {
+           e_client_focused_set(ec);
+        }
+
      }
 
    eina_tiler_free(t);
index 7126d77b23d8c417bb7dfa6321255dcaabd14f1a..e1c1207a6dc77df55abe1b8c531adb17b692b574 100644 (file)
@@ -49,6 +49,12 @@ typedef enum _E_Focus_Policy
    E_FOCUS_LAST,
 } E_Focus_Policy;
 
+typedef enum _E_Focus_Policy_Ext
+{
+   E_FOCUS_EXT_NONE,
+   E_FOCUS_EXT_TOP_STACK,
+} E_Focus_Policy_Ext;
+
 typedef enum
 {
    /* same as ecore-x types */
index 6a1efd0b41ae4babcb223917fa95f3c9ebcf6d25..c0506cbe32469dcabcd58f5074f8a45ebd2e5013 100644 (file)
@@ -489,6 +489,7 @@ _e_config_edd_init(Eina_Bool old)
    E_CONFIG_VAL(D, T, window_placement_policy, INT); /**/
    E_CONFIG_VAL(D, T, window_grouping, INT); /**/
    E_CONFIG_VAL(D, T, focus_policy, INT); /**/
+   E_CONFIG_VAL(D, T, focus_policy_ext, INT); /**/
    E_CONFIG_VAL(D, T, focus_setting, INT); /**/
    E_CONFIG_VAL(D, T, pass_click_on, INT); /**/
    E_CONFIG_VAL(D, T, window_activehint_policy, INT); /**/
@@ -1372,6 +1373,7 @@ e_config_load(void)
    E_CONFIG_LIMIT(e_config->window_placement_policy, E_WINDOW_PLACEMENT_SMART, E_WINDOW_PLACEMENT_MANUAL);
    E_CONFIG_LIMIT(e_config->window_grouping, 0, 1);
    E_CONFIG_LIMIT(e_config->focus_policy, 0, 2);
+   E_CONFIG_LIMIT(e_config->focus_policy_ext, 0, 1);
    E_CONFIG_LIMIT(e_config->focus_setting, 0, 3);
    E_CONFIG_LIMIT(e_config->pass_click_on, 0, 1);
    E_CONFIG_LIMIT(e_config->window_activehint_policy, E_ACTIVEHINT_POLICY_IGNORE, E_ACTIVEHINT_POLICY_LAST - 1);
index 9ab8fed77392a8abec49c93533c71abd04380c64..3cbf20a6c36cb3efbcc8320d52309c4b3c291908 100644 (file)
@@ -107,6 +107,7 @@ struct _E_Config
    int         window_placement_policy; // GUI
    int         window_grouping; // GUI
    int         focus_policy; // GUI
+   int         focus_policy_ext; // GUI
    int         focus_setting; // GUI
    int         pass_click_on; // GUI
    int         window_activehint_policy; // GUI