e_deskpreview.h \
e_exebuf.h \
e_int_config_modules.h \
-e_exehist.h
+e_exehist.h \
+e_color_class.h
enlightenment_src = \
e_user.c \
e_exebuf.c \
e_int_config_modules.c \
e_exehist.c \
+e_color_class.c \
$(ENLIGHTENMENTHEADERS)
enlightenment_SOURCES = \
#define E_NEW_BIG(s, n) (s *)malloc(n * sizeof(s))
#define E_FREE(p) { if (p) {free(p); p = NULL;} }
+#define E_CLAMP(x, min, max) (x < min ? min : (x > max ? max : x))
+
#define E_REMOTE_OPTIONS 1
#define E_REMOTE_OUT 2
#define E_WM_IN 3
--- /dev/null
+#include "e.h"
+
+
+EAPI int
+e_color_class_init(void)
+{
+ Evas_List *l;
+
+ for (l = e_config->color_classes; l; l = l->next)
+ {
+ E_Color_Class *cc;
+
+ cc = l->data;
+ if (!cc) continue;
+
+ printf("INIT CC: %s, %d %d %d %d\n", cc->name, cc->r, cc->g, cc->b, cc->a);
+ edje_color_class_set(cc->name,
+ cc->r, cc->g, cc->b, cc->a,
+ cc->r2, cc->g2, cc->b2, cc->a2,
+ cc->r3, cc->g3, cc->b3, cc->a3);
+
+ }
+ return 1;
+}
+
+EAPI int
+e_color_class_shutdown(void)
+{
+ return 1;
+}
+
+EAPI void
+e_color_class_set(const char *color_class, int r, int g, int b, int a, int r2, int b2, int g2, int a2, int r3, int g3, int b3, int a3)
+{
+ E_Color_Class *cc = NULL;
+ Evas_List *l;
+ int found = 0;
+
+ cc = e_color_class_find(color_class);
+ if (!cc)
+ {
+ cc = E_NEW(E_Color_Class, 1);
+ e_config->color_classes = evas_list_append(e_config->color_classes, cc);
+ cc->name = evas_stringshare_add(color_class);
+ }
+
+ if (r != -1) cc->r = E_CLAMP(r, 0, 255);
+ if (g != -1) cc->g = E_CLAMP(g, 0, 255);
+ if (b != -1) cc->b = E_CLAMP(b, 0, 255);
+ if (a != -1) cc->a = E_CLAMP(a, 0, 255);
+ if (r != -1) cc->r2 = E_CLAMP(r2, 0, 255);
+ if (g != -1) cc->g2 = E_CLAMP(g2, 0, 255);
+ if (b != -1) cc->b2 = E_CLAMP(b2, 0, 255);
+ if (a != -1) cc->a2 = E_CLAMP(a2, 0, 255);
+ if (r != -1) cc->r3 = E_CLAMP(r3, 0, 255);
+ if (g != -1) cc->g3 = E_CLAMP(g3, 0, 255);
+ if (b != -1) cc->b3 = E_CLAMP(b3, 0, 255);
+ if (a != -1) cc->a3 = E_CLAMP(a3, 0, 255);
+
+ edje_color_class_set(cc->name,
+ cc->r, cc->g, cc->b, cc->a,
+ cc->r2, cc->g2, cc->b2, cc->a2,
+ cc->r3, cc->g3, cc->b3, cc->a3);
+}
+
+EAPI void
+e_color_class_del(const char *name)
+{
+ E_Color_Class *cc = NULL;
+
+ cc = e_color_class_find(name);
+ if (cc)
+ {
+ e_config->color_classes = evas_list_remove(e_config->color_classes, cc);
+ /* FIXME: add edje_color_class_del() and use that) */
+ edje_color_class_set(cc->name, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255);
+ evas_stringshare_del(cc->name);
+ E_FREE(cc);
+ }
+}
+
+EAPI E_Color_Class *
+e_color_class_find(const char *name)
+{
+ Evas_List *l;
+ E_Color_Class *cc = NULL;
+
+ for(l = e_config->color_classes; l; l = l->next)
+ {
+ cc = l->data;
+ if (!cc) continue;
+
+ if (!strcmp(cc->name, name))
+ {
+ return cc;
+ break;
+ }
+ }
+ return NULL;
+}
+
+
+EAPI Evas_List *
+e_color_class_list(void)
+{
+ return e_config->color_classes;
+}
--- /dev/null
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+
+#ifdef E_TYPEDEFS
+
+typedef struct _E_Color_Class E_Color_Class;
+
+#else
+#ifndef E_COLOR_CLASSES_H
+#define E_COLOR_CLASSES_H
+
+struct _E_Color_Class
+{
+ char *name;
+ int r, g, b, a;
+ int r2, g2, b2, a2;
+ int r3, g3, b3, a3;
+};
+
+EAPI int e_color_class_init(void);
+EAPI int e_color_class_shutdown(void);
+EAPI void e_color_class_set(const char *color_class,
+ int r, int g, int b, int a,
+ int r2, int b2, int g2, int a2,
+ int r3, int g3, int b3, int a3);
+EAPI E_Color_Class *e_color_class_find(const char *name);
+EAPI void e_color_class_del(const char *name);
+
+EAPI Evas_List *e_color_class_list(void);
+
+#endif
+#endif
static E_Config_DD *_e_config_desktop_bg_edd = NULL;
static E_Config_DD *_e_config_desktop_name_edd = NULL;
static E_Config_DD *_e_config_remember_edd = NULL;
+static E_Config_DD *_e_config_color_class_edd = NULL;
+
/* externally accessible functions */
EAPI int
E_CONFIG_VAL(D, T, prop.head, INT);
E_CONFIG_VAL(D, T, prop.command, STR);
+ _e_config_color_class_edd = E_CONFIG_DD_NEW("E_Color_Class", E_Color_Class);
+#undef T
+#undef D
+#define T E_Color_Class
+#define D _e_config_color_class_edd
+ E_CONFIG_VAL(D, T, name, STR);
+ E_CONFIG_VAL(D, T, r, INT);
+ E_CONFIG_VAL(D, T, g, INT);
+ E_CONFIG_VAL(D, T, b, INT);
+ E_CONFIG_VAL(D, T, a, INT);
+ E_CONFIG_VAL(D, T, r2, INT);
+ E_CONFIG_VAL(D, T, g2, INT);
+ E_CONFIG_VAL(D, T, b2, INT);
+ E_CONFIG_VAL(D, T, a2, INT);
+ E_CONFIG_VAL(D, T, r3, INT);
+ E_CONFIG_VAL(D, T, g3, INT);
+ E_CONFIG_VAL(D, T, b3, INT);
+ E_CONFIG_VAL(D, T, a3, INT);
+
_e_config_edd = E_CONFIG_DD_NEW("E_Config", E_Config);
#undef T
#undef D
E_CONFIG_VAL(D, T, exebuf_pos_min_h, INT);
E_CONFIG_VAL(D, T, exebuf_pos_max_w, INT);
E_CONFIG_VAL(D, T, exebuf_pos_max_h, INT);
+ E_CONFIG_LIST(D, T, color_classes, _e_config_color_class_edd);
e_config = e_config_domain_load("e", _e_config_edd);
if (e_config)
{
E_FREE(rem);
}
+ while (e_config->color_classes)
+ {
+ E_Color_Class *cc;
+ cc = e_config->color_classes->data;
+ e_config->color_classes = evas_list_remove_list(e_config->color_classes, e_config->color_classes);
+
+ if (cc->name) evas_stringshare_del(cc->name);
+ E_FREE(cc);
+ }
if (e_config->desktop_default_background) evas_stringshare_del(e_config->desktop_default_background);
if (e_config->desktop_default_name) evas_stringshare_del(e_config->desktop_default_name);
if (e_config->language) evas_stringshare_del(e_config->language);
int exebuf_pos_min_h;
int exebuf_pos_max_w;
int exebuf_pos_max_h;
+ Evas_List *color_classes;
};
struct _E_Config_Module
#include "e_exebuf.h"
#include "e_int_config_modules.h"
#include "e_exehist.h"
+#include "e_color_class.h"
static Eet_Data_Descriptor *_e_ipc_3int_4str_list_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_3int_3str_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_3int_3str_list_edd = NULL;
+static Eet_Data_Descriptor *_e_ipc_str_4int_edd = NULL;
+static Eet_Data_Descriptor *_e_ipc_str_4int_list_edd = NULL;
#define E_IPC_DD_NEW(str, typ) \
eet_data_descriptor_new(str, sizeof(typ), \
_e_ipc_3int_3str_list_edd = E_IPC_DD_NEW("3int_3str_list", E_Ipc_List);
E_CONFIG_LIST(_e_ipc_3int_3str_list_edd, E_Ipc_List, list, _e_ipc_3int_3str_edd);
+
+ _e_ipc_str_4int_edd = E_IPC_DD_NEW("str_4int", E_Ipc_Str_4Int);
+ E_CONFIG_VAL(_e_ipc_str_4int_edd, E_Ipc_Str_4Int, str, STR);
+ E_CONFIG_VAL(_e_ipc_str_4int_edd, E_Ipc_Str_4Int, val1, INT);
+ E_CONFIG_VAL(_e_ipc_str_4int_edd, E_Ipc_Str_4Int, val2, INT);
+ E_CONFIG_VAL(_e_ipc_str_4int_edd, E_Ipc_Str_4Int, val3, INT);
+ E_CONFIG_VAL(_e_ipc_str_4int_edd, E_Ipc_Str_4Int, val4, INT);
+
+ _e_ipc_str_4int_list_edd = E_IPC_DD_NEW("str_4int_list", E_Ipc_List);
+ E_CONFIG_LIST(_e_ipc_str_4int_list_edd, E_Ipc_List, list, _e_ipc_str_4int_edd);
+
return 1;
}
dat.list = list;
return eet_data_descriptor_encode(_e_ipc_3int_3str_list_edd, &dat, size_ret);
}
+
+EAPI int
+e_ipc_codec_str_4int_dec(char *data, int bytes, E_Ipc_Str_4Int **dest)
+{
+ E_Ipc_Str_4Int *dat;
+
+ if (!data) return 0;
+ dat = eet_data_descriptor_decode(_e_ipc_str_4int_edd, data, bytes);
+ if (!dat) return 0;
+ if (dest) *dest = dat;
+ return 1;
+}
+
+EAPI void *
+e_ipc_codec_str_4int_enc(char *str1, int val1, int val2, int val3, int val4, int *size_ret)
+{
+ E_Ipc_Str_4Int dat;
+
+ dat.str = str1;
+ dat.val1 = val1;
+ dat.val2 = val2;
+ dat.val3 = val3;
+ dat.val4 = val4;
+
+ return eet_data_descriptor_encode(_e_ipc_str_4int_edd, &dat, size_ret);
+}
+
+EAPI int
+e_ipc_codec_str_4int_list_dec(char *data, int bytes, Evas_List **dest)
+{
+ E_Ipc_List *dat;
+
+ if (!data) return 0;
+ dat = eet_data_descriptor_decode(_e_ipc_str_4int_list_edd, data, bytes);
+ if (!dat) return 0;
+ if (dest) *dest = dat->list;
+ free(dat);
+ return 1;
+}
+
+EAPI void *
+e_ipc_codec_str_4int_list_enc(Evas_List *list, int *size_ret)
+{
+ E_Ipc_List dat;
+ dat.list = list;
+ return eet_data_descriptor_encode(_e_ipc_str_4int_list_edd, &dat, size_ret);
+}
+
/* local subsystem globals */
typedef struct _E_Ipc_5Int_2Str E_Ipc_5Int_2Str;
typedef struct _E_Ipc_3Int_4Str E_Ipc_3Int_4Str;
typedef struct _E_Ipc_3Int_3Str E_Ipc_3Int_3Str;
+typedef struct _E_Ipc_Str_4Int E_Ipc_Str_4Int;
#else
#ifndef E_IPC_CODEC_H
char *str1, *str2, *str3;
};
+struct _E_Ipc_Str_4Int
+{
+ char *str;
+ int val1, val2, val3, val4;
+};
+
EAPI int e_ipc_codec_init(void);
EAPI void e_ipc_codec_shutdown(void);
EAPI void *e_ipc_codec_3int_3str_enc(int val1, int val2, int val3, char *str1, char *str2, char *str3, int *size_ret);
EAPI int e_ipc_codec_3int_3str_list_dec(char *data, int bytes, Evas_List **dest);
EAPI void *e_ipc_codec_3int_3str_list_enc(Evas_List *list, int *size_ret);
+EAPI int e_ipc_codec_str_4int_dec(char *data, int bytes, E_Ipc_Str_4Int **dest);
+EAPI void *e_ipc_codec_str_4int_enc(char *str1, int val1, int val2, int val3, int val4, int *size_ret);
#endif
#endif
} \
break;
+# define STRING_4INT(__str, __int1, __int2, __int3, __int4, __str_4int, HDL) \
+case HDL: \
+if (e->data) { \
+ char *__str = NULL; \
+ int __int1, __int2, __int3, __int4; \
+ E_Ipc_Str_4Int *__str_4int = NULL; \
+ __str_4int = calloc(1, sizeof(E_Ipc_Str_4Int)); \
+ if (e_ipc_codec_str_4int_dec(e->data, e->size, &(__str_4int))) { \
+ __str = __str_4int->str; \
+ __int1 = __str_4int->val1; \
+ __int2 = __str_4int->val2; \
+ __int3 = __str_4int->val3; \
+ __int4 = __str_4int->val4;
+# define END_STRING_4INT(__str_4int) \
+ free(__str_4int->str); \
+ free(__str_4int); \
+ } \
+} \
+break;
+
+
/**
* Get event data for libe processing
*/
} \
break;
+# define REQ_STRING_4INT(__str, __int1, __int2, __int3, __int4, HDL) \
+case HDL: { void *data; int bytes; \
+ data = e_ipc_codec_str_4int_enc(__str, __int1, __int2, __int3, __int4, &bytes); \
+ if (data) { \
+ ecore_ipc_server_send(e->server, E_IPC_DOMAIN_REQUEST, HDL, 0, 0, 0, data, bytes); \
+ free(data); \
+ } \
+} \
+break;
+
# define REQ_DOUBLE(__dbl, HDL) \
case HDL: { void *data; int bytes; \
data = e_ipc_codec_double_enc(__dbl, &bytes); \
} \
break;
+# define STRING_INT4_LIST(__v, HDL) \
+ case HDL: { \
+ Evas_List *dat = NULL, *l; \
+ if (e_ipc_codec_str_4int_list_dec(e->data, e->size, &dat)) { \
+ for (l = dat; l; l = l->next) { \
+ E_Ipc_Str_4Int *__v; \
+ __v = l->data;
+#define END_STRING_INT4_LIST(__v) \
+ free(__v->str); \
+ free(__v); \
+ } \
+ evas_list_free(dat); \
+ } \
+ } \
+ break;
+
+/**
+ * SEND_STRING_INT4_LIST:
+ * Start to encode a list of objects to prepare them for sending via
+ * ipc. The object __v1 will be of type __typ1 and __v2 will be of type
+ * E_Ipc_Str_4Int.
+ *
+ * Use END_SEND_STRING_INT4_LIST to terminate the encode iteration and
+ * send that data. The list will be freed.
+ */
+#define SEND_STRING_INT4_LIST(__list, __typ1, __v1, __v2, HDL) \
+ case HDL: { \
+ Evas_List *dat = NULL, *l; \
+ void *data; int bytes; \
+ for (l = __list; l; l = l->next) { \
+ __typ1 *__v1; \
+ E_Ipc_Str_4Int *__v2; \
+ __v1 = l->data; \
+ __v2 = calloc(1, sizeof(E_Ipc_Str_4Int));
+#define END_SEND_STRING_INT4_LIST(__v1, __op) \
+ dat = evas_list_append(dat, __v1); \
+ } \
+ data = e_ipc_codec_str_4int_list_enc(dat, &bytes); \
+ SEND_DATA(__op); \
+ FREE_LIST(dat); \
+ } \
+ break;
+
+
/**
* STRING2_INT_LIST:
* Decode event data which is a list of E_Ipc_2Str_Int objects and iterate
#endif
#undef HDL
/****************************************************************************/
+#define HDL E_IPC_OP_COLOR_CLASS_COLOR_SET
+#if (TYPE == E_REMOTE_OPTIONS)
+ OP("-color-class-color-set", 5, "Set color_class (OPT1) r, g, b, a (OPT2-5)", 0, HDL)
+#elif (TYPE == E_REMOTE_OUT)
+ REQ_STRING_4INT(params[0], atoi(params[1]), atoi(params[2]), atoi(params[3]), atoi(params[4]), HDL)
+#elif (TYPE == E_WM_IN)
+ STRING_4INT(color_class, r, g, b, a, e_str_4int, HDL);
+ e_color_class_set(color_class, r, g, b, a, -1, -1, -1, -1, -1, -1, -1, -1);
+ SAVE;
+ END_STRING_4INT(e_str_4int);
+#elif (TYPE == E_REMOTE_IN)
+#endif
+#undef HDL
+/****************************************************************************/
+#define HDL E_IPC_OP_COLOR_CLASS_COLOR2_SET
+#if (TYPE == E_REMOTE_OPTIONS)
+ OP("-color-class-color-set2", 5, "Set color_class (OPT1) color2 r, g, b, a (OPT2-5)", 0, HDL)
+#elif (TYPE == E_REMOTE_OUT)
+ REQ_STRING_4INT(params[0], atoi(params[1]), atoi(params[2]), atoi(params[3]), atoi(params[4]), HDL)
+#elif (TYPE == E_WM_IN)
+ STRING_4INT(color_class, r, g, b, a, e_str_4int, HDL);
+ e_color_class_set(color_class, -1, -1, -1, -1, r, g, b, a, -1, -1, -1, -1);
+ SAVE;
+ END_STRING_4INT(e_str_4int);
+#elif (TYPE == E_REMOTE_IN)
+#endif
+#undef HDL
+/****************************************************************************/
+#define HDL E_IPC_OP_COLOR_CLASS_COLOR3_SET
+#if (TYPE == E_REMOTE_OPTIONS)
+ OP("-color-class-color-set3", 5, "Set color_class (OPT1) color3 r, g, b, a (OPT2-5)", 0, HDL)
+#elif (TYPE == E_REMOTE_OUT)
+ REQ_STRING_4INT(params[0], atoi(params[1]), atoi(params[2]), atoi(params[3]), atoi(params[4]), HDL)
+#elif (TYPE == E_WM_IN)
+ STRING_4INT(color_class, r, g, b, a, e_str_4int, HDL);
+ e_color_class_set(color_class, -1, -1, -1, -1, -1, -1, -1, -1, r, g, b, a);
+ SAVE;
+ END_STRING_4INT(e_str_4int);
+#elif (TYPE == E_REMOTE_IN)
+#endif
+#undef HDL
+/****************************************************************************/
+#define HDL E_IPC_OP_COLOR_CLASS_COLOR_LIST
+#if (TYPE == E_REMOTE_OPTIONS)
+ OP("-color-class-color-list", 0, "List color values for all set color classes", 1, HDL)
+#elif (TYPE == E_REMOTE_OUT)
+ REQ_NULL(HDL);
+#elif (TYPE == E_WM_IN)
+ SEND_STRING_INT4_LIST(e_color_class_list(), E_Color_Class, cc, v, HDL);
+ v->str = cc->name;
+ v->val1 = cc->r;
+ v->val2 = cc->g;
+ v->val3 = cc->b;
+ v->val4 = cc->a;
+ END_SEND_STRING_INT4_LIST(v, E_IPC_OP_COLOR_CLASS_COLOR_LIST_REPLY);
+#elif (TYPE == E_REMOTE_IN)
+#endif
+#undef HDL
+/****************************************************************************/
+#define HDL E_IPC_OP_COLOR_CLASS_COLOR2_LIST
+#if (TYPE == E_REMOTE_OPTIONS)
+ OP("-color-class-color2-list", 0, "List color2 values for all set color classes", 1, HDL)
+#elif (TYPE == E_REMOTE_OUT)
+ REQ_NULL(HDL);
+#elif (TYPE == E_WM_IN)
+ SEND_STRING_INT4_LIST(e_color_class_list(), E_Color_Class, cc, v, HDL);
+ v->str = cc->name;
+ v->val1 = cc->r2;
+ v->val2 = cc->g2;
+ v->val3 = cc->b2;
+ v->val4 = cc->a2;
+ END_SEND_STRING_INT4_LIST(v, E_IPC_OP_COLOR_CLASS_COLOR_LIST_REPLY);
+#elif (TYPE == E_REMOTE_IN)
+#endif
+#undef HDL
+/****************************************************************************/
+#define HDL E_IPC_OP_COLOR_CLASS_COLOR3_LIST
+#if (TYPE == E_REMOTE_OPTIONS)
+ OP("-color-class-color3-list", 0, "List color3 values for all set color classes", 1, HDL)
+#elif (TYPE == E_REMOTE_OUT)
+ REQ_NULL(HDL);
+#elif (TYPE == E_WM_IN)
+ SEND_STRING_INT4_LIST(e_color_class_list(), E_Color_Class, cc, v, HDL);
+ v->str = cc->name;
+ v->val1 = cc->r3;
+ v->val2 = cc->g3;
+ v->val3 = cc->b3;
+ v->val4 = cc->a3;
+ END_SEND_STRING_INT4_LIST(v, E_IPC_OP_COLOR_CLASS_COLOR_LIST_REPLY);
+#elif (TYPE == E_REMOTE_IN)
+#endif
+#undef HDL
+/****************************************************************************/
+#define HDL E_IPC_OP_COLOR_CLASS_DEL
+#if (TYPE == E_REMOTE_OPTIONS)
+ OP("-color-class-del", 1, "Delete color class named OPT1", 0, HDL)
+#elif (TYPE == E_REMOTE_OUT)
+ REQ_STRING(params[0], HDL);
+#elif (TYPE == E_WM_IN)
+ STRING(s, HDL);
+ e_color_class_del(s);
+ END_STRING(s);
+#elif (TYPE == E_REMOTE_IN)
+#endif
+#undef HDL
+
+/****************************************************************************/
+#define HDL E_IPC_OP_COLOR_CLASS_COLOR_LIST_REPLY
+#if (TYPE == E_REMOTE_OPTIONS)
+#elif (TYPE == E_REMOTE_OUT)
+#elif (TYPE == E_WM_IN)
+#elif (TYPE == E_REMOTE_IN)
+ STRING_INT4_LIST(v, HDL);
+ if (v->str) printf("REPLY: \"%s\" (RGBA) %i %i %i %i\n", v->str, v->val1, v->val2, v->val3, v->val4);
+ else printf("REPLY: \"\" (RGBA) %i %i %i %i\n", v->val1, v->val2, v->val3, v->val4);
+ END_STRING_INT_LIST(v);
+#elif (TYPE == E_LIB_IN)
+ /* FIXME implement */
+#endif
+#undef HDL
+
+/****************************************************************************/
#define E_IPC_OP_CACHE_FLUSH_INTERVAL_GET 331
#define E_IPC_OP_CACHE_FLUSH_INTERVAL_GET_REPLY 332
-#define E_IPC_EAP_EDIT_START 333
+#define E_IPC_EAP_EDIT_START 333
+
+#define E_IPC_OP_COLOR_CLASS_COLOR_SET 334
+#define E_IPC_OP_COLOR_CLASS_COLOR2_SET 335
+#define E_IPC_OP_COLOR_CLASS_COLOR3_SET 336
+#define E_IPC_OP_COLOR_CLASS_COLOR_LIST 337
+#define E_IPC_OP_COLOR_CLASS_COLOR2_LIST 338
+#define E_IPC_OP_COLOR_CLASS_COLOR3_LIST 339
+#define E_IPC_OP_COLOR_CLASS_COLOR_LIST_REPLY 340
+#define E_IPC_OP_COLOR_CLASS_DEL 341
_e_main_shutdown(-1);
}
_e_main_shutdown_push(e_winlist_shutdown);
+ /* setup color_class */
+ if (!e_color_class_init())
+ {
+ e_error_message_show(_("Enlightenment cannot set up its color class system."));
+ _e_main_shutdown(-1);
+ }
+ _e_main_shutdown_push(e_color_class_shutdown);
if (ipc_failed)
e_error_dialog_show(_("Enlightenment IPC setup error!"),