Added client_type config and E_CLIENT_PROPERTY_CLIENT_TYPE.
authorMun, Gwan-gyeong <kk.moon@samsung.com>
Mon, 9 Feb 2015 11:18:30 +0000 (20:18 +0900)
committerBoram Park <boram1288.park@samsung.com>
Wed, 18 Mar 2015 04:03:08 +0000 (13:03 +0900)
Change-Id: I6aafc020437c7aaec500a8c1a4db378f9ed87dcf

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

index d8b4de0544b2330e69c992e14a1282bf1c9f0228..ff0a1946edd6258db5416a693d9fbdbd3f446321 100644 (file)
@@ -2272,6 +2272,50 @@ _e_client_frame_update(E_Client *ec)
    e_client_border_set(ec, bordername);
 }
 
+static Eina_Bool
+_e_client_type_match(E_Client *ec, E_Config_Client_Type *m)
+{
+   if (!ec || !m) return EINA_FALSE;
+   if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE;
+
+   if ((int)ec->netwm.type != m->window_type)
+     return EINA_FALSE;
+
+   if (((m->clas) && (!ec->icccm.class)) ||
+       ((ec->icccm.class) && (m->clas) && (!e_util_glob_match(ec->icccm.class, m->clas))))
+     return EINA_FALSE;
+
+   if (((m->name) && (!ec->icccm.name)) ||
+       ((ec->icccm.name) && (m->name) && (!e_util_glob_match(ec->icccm.name, m->name))))
+     return EINA_FALSE;
+
+   return EINA_TRUE;
+}
+
+static int
+_e_client_type_get(E_Client *ec)
+{
+   E_Config_Client_Type *m;
+   Eina_List *l;
+   int type = 0;
+
+   if (!e_config->client_types) return 0;
+
+   EINA_LIST_FOREACH(e_config->client_types, l, m)
+     {
+        if (!_e_client_type_match(ec, m)) continue;
+        else
+          {
+             type = m->client_type;
+             break;
+          }
+     }
+
+   ec->client_type = type;
+
+   return ec->client_type;
+}
+
 ////////////////////////////////////////////////
 EINTERN void
 e_client_idler_before(void)
@@ -2286,6 +2330,8 @@ e_client_idler_before(void)
    EINA_LIST_FOREACH(e_comp->clients, l, ec)
      {
         Eina_Stringshare *title;
+        int client_type;
+
         // pass 1 - eval0. fetch properties on new or on change and
         // call hooks to decide what to do - maybe move/resize
         if (!ec->changed) continue;
@@ -2296,6 +2342,11 @@ e_client_idler_before(void)
         if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_FETCH, ec)) continue;
         if (title != e_client_util_name_get(ec))
           _e_client_event_property(ec, E_CLIENT_PROPERTY_TITLE);
+
+        client_type = ec->client_type;
+        if (client_type != _e_client_type_get(ec))
+           _e_client_event_property(ec, E_CLIENT_PROPERTY_CLIENT_TYPE);
+
         /* PRE_POST_FETCH calls e_remember apply for new client */
         if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_POST_FETCH, ec)) continue;
         if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_POST_FETCH, ec)) continue;
index dacc9259b80a7c071d10121f6c9e5b7c3cf5551f..527b3707d0e96e8a6fe2cac666212dce5365b945 100644 (file)
@@ -129,6 +129,7 @@ typedef enum E_Client_Property
    E_CLIENT_PROPERTY_GRAVITY = (1 << 5),
    E_CLIENT_PROPERTY_NETWM_STATE = (1 << 6),
    E_CLIENT_PROPERTY_STICKY = (1 << 7),
+   E_CLIENT_PROPERTY_CLIENT_TYPE = (1 << 8),
 } E_Client_Property;
 
 #ifdef _F_E_VIRTUAL_KEYBOARD_TYPE_
@@ -764,6 +765,8 @@ struct E_Client
 #if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY)
    uuid_t uuid;
 #endif
+
+   int client_type; //e_client_type
 };
 
 #define e_client_focus_policy_click(ec) \
index 22d090eff687fcc3b3c5ff01a541658074aa338d..6a1efd0b41ae4babcb223917fa95f3c9ebcf6d25 100644 (file)
@@ -50,6 +50,7 @@ static E_Config_DD *_e_config_syscon_action_edd = NULL;
 static E_Config_DD *_e_config_env_var_edd = NULL;
 static E_Config_DD *_e_config_xkb_layout_edd = NULL;
 static E_Config_DD *_e_config_xkb_option_edd = NULL;
+static E_Config_DD *_e_config_client_type_edd = NULL;
 
 EAPI int E_EVENT_CONFIG_ICON_THEME = 0;
 EAPI int E_EVENT_CONFIG_MODE_CHANGED = 0;
@@ -127,6 +128,7 @@ _e_config_edd_shutdown(void)
    E_CONFIG_DD_FREE(_e_config_env_var_edd);
    E_CONFIG_DD_FREE(_e_config_xkb_layout_edd);
    E_CONFIG_DD_FREE(_e_config_xkb_option_edd);
+   E_CONFIG_DD_FREE(_e_config_client_type_edd);
 }
 
 static void
@@ -422,6 +424,17 @@ _e_config_edd_init(Eina_Bool old)
 #define D _e_config_xkb_option_edd
    E_CONFIG_VAL(D, T, name, STR);
 
+   _e_config_client_type_edd = E_CONFIG_DD_NEW("E_Config_Client_Type",
+                                               E_Config_Client_Type);
+#undef T
+#undef D
+#define T E_Config_Client_Type
+#define D _e_config_client_type_edd
+   E_CONFIG_VAL(D, T, name, STR);
+   E_CONFIG_VAL(D, T, clas, STR);
+   E_CONFIG_VAL(D, T, window_type, INT);
+   E_CONFIG_VAL(D, T, client_type, INT);
+
    _e_config_edd = E_CONFIG_DD_NEW("E_Config", E_Config);
 #undef T
 #undef D
@@ -768,6 +781,7 @@ _e_config_edd_init(Eina_Bool old)
 #ifdef _F_ZONE_WINDOW_ROTATION_
    E_CONFIG_VAL(D, T, wm_win_rotation, UCHAR);
 #endif
+   E_CONFIG_LIST(D, T, client_types, _e_config_client_type_edd);
 }
 
 /* externally accessible functions */
index 1ea879abc9548350744cb4f93bb2c23b1d22f991..9ab8fed77392a8abec49c93533c71abd04380c64 100644 (file)
@@ -23,6 +23,7 @@ typedef struct _E_Config_Syscon_Action      E_Config_Syscon_Action;
 typedef struct _E_Config_Env_Var            E_Config_Env_Var;
 typedef struct _E_Config_XKB_Layout         E_Config_XKB_Layout;
 typedef struct _E_Config_XKB_Option         E_Config_XKB_Option;
+typedef struct _E_Config_Client_Type        E_Config_Client_Type;
 
 typedef struct _E_Event_Config_Icon_Theme   E_Event_Config_Icon_Theme;
 
@@ -440,6 +441,7 @@ struct _E_Config
 #ifdef _F_ZONE_WINDOW_ROTATION_
    unsigned char wm_win_rotation;
 #endif
+   Eina_List *client_types;
 };
 
 struct E_Config_Bindings
@@ -647,6 +649,14 @@ struct _E_Config_XKB_Option
    const char *name;
 };
 
+struct _E_Config_Client_Type
+{
+   const char     *name; /* icccm.class_name */
+   const char     *clas; /* icccm.class */
+   E_Window_Type   window_type; /* Ecore_X_Window_Type / E_Window_Type */
+   int             client_type; /* E_Client_Type */
+};
+
 EINTERN int                   e_config_init(void);
 EINTERN int                   e_config_shutdown(void);