Added client_type config and E_CLIENT_PROPERTY_CLIENT_TYPE. 21/35121/1
authorMun, Gwan-gyeong <kk.moon@samsung.com>
Mon, 9 Feb 2015 11:18:30 +0000 (20:18 +0900)
committerMun, Gwan-gyeong <kk.moon@samsung.com>
Mon, 9 Feb 2015 11:18:30 +0000 (20:18 +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 6624032adb86bb836621d6ca1e41c9253c144409..b647af2588dc3bf614aaf0d5d454c468b46157fa 100644 (file)
@@ -2236,6 +2236,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)
@@ -2253,6 +2297,7 @@ e_client_idler_before(void)
         EINA_LIST_FOREACH(c->clients, ll, 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;
@@ -2263,6 +2308,10 @@ 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 ef56da98c2b092e7f78f6489a64c3dc376d2b891..040efe57c49dd2ed9d2e84cef75106d2b0f8abf1 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_
@@ -767,6 +768,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 ddc1ddf14083a73aa944d77307651ba34dd704e7..460dcf22e609adbb08d7b95b08694247efb8369c 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
@@ -767,6 +780,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 ad712451a12e1e82b6eed484f3d58bac1ccdd4ce..0f1c7dcef8d88d74b6a471762ce399873a7df101 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;
 
@@ -439,6 +440,7 @@ struct _E_Config
 #ifdef _F_ZONE_WINDOW_ROTATION_
    unsigned char wm_win_rotation;
 #endif
+   Eina_List *client_types;
 };
 
 struct E_Config_Bindings
@@ -646,6 +648,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);