Enlightenment CVS committal
Author : rbdpngn
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src
Modified Files:
ewl_config.c ewl_config.h ewl_image.c ewl_window.c
Log Message:
Beginnings of color class support.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_config.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- ewl_config.c 25 Oct 2003 05:55:46 -0000 1.28
+++ ewl_config.c 29 Oct 2003 21:08:30 -0000 1.29
@@ -8,17 +8,17 @@
static E_DB_File *config_db = NULL;
+void __ewl_color_class_free(void *data);
void __create_user_config(void);
static int __open_config_db(const char *name);
static void __close_config_db(void);
-
static int __config_exists(char *name);
-Ewl_Config ewl_config;
-
extern Ewd_List *ewl_embed_list;
+Ewl_Config ewl_config;
+
/**
* @return Returns true on success, false on failure.
* @brief Initialize the configuration system
@@ -36,6 +36,9 @@
else
__create_user_config();
+ if (__config_exists("system") == -1)
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+
DRETURN_INT(TRUE, DLEVEL_STABLE);
}
@@ -210,10 +213,22 @@
*/
void ewl_config_reread_and_apply(void)
{
+ int cc;
Ewl_Config nc;
DENTER_FUNCTION(DLEVEL_STABLE);
+ /*
+ * Clean out some memory first, this is likely to get re-used if the
+ * values have not changed.
+ */
+ IF_FREE(ewl_config.evas.render_method);
+ IF_FREE(ewl_config.theme.name);
+ if (ewl_config.theme.cclasses) {
+ ewd_list_destroy(ewl_config.theme.cclasses);
+ ewl_config.theme.cclasses = NULL;
+ }
+
nc.debug.enable = ewl_config_get_int("system", "/debug/enable");
nc.debug.level = ewl_config_get_int("system", "/debug/level");
nc.evas.font_cache = ewl_config_get_int("system", "/evas/font_cache");
@@ -222,6 +237,48 @@
ewl_config_get_str("system", "/evas/render_method");
nc.theme.name = ewl_config_get_str("system", "/theme/name");
nc.theme.cache = ewl_config_get_int("system", "/theme/cache");
+ nc.theme.cclass_override = ewl_config_get_int("system",
+ "/theme/color_classes/override");
+
+ nc.theme.cclasses = NULL;
+ if (nc.theme.cclass_override) {
+ int i;
+
+ nc.theme.cclasses = ewd_list_new();
+ ewd_list_set_free_cb(nc.theme.cclasses, __ewl_color_class_free);
+ cc = ewl_config_get_int("system", "/theme/color_classes/count");
+ for (i = 0; i < cc; i++) {
+ char key[PATH_MAX];
+ Ewl_Color_Class *cclass;
+
+ cclass = NEW(Ewl_Color_Class, 1);
+
+ snprintf(key, PATH_MAX,
+ "/theme/color_classes/%d/name", i);
+ cclass->name = ewl_config_get_str("system", key);
+ if (cclass->name) {
+ snprintf(key, PATH_MAX,
+ "/theme/color_classes/%d/r", i);
+ cclass->r = ewl_config_get_int("system", key);
+
+ snprintf(key, PATH_MAX,
+ "/theme/color_classes/%d/g", i);
+ cclass->g = ewl_config_get_int("system", key);
+
+ snprintf(key, PATH_MAX,
+ "/theme/color_classes/%d/b", i);
+ cclass->b = ewl_config_get_int("system", key);
+
+ snprintf(key, PATH_MAX,
+ "/theme/color_classes/%d/a", i);
+ cclass->a = ewl_config_get_int("system", key);
+
+ ewd_list_append(nc.theme.cclasses, cclass);
+ }
+ else
+ FREE(cclass);
+ }
+ }
if (ewl_embed_list && !ewd_list_is_empty(ewl_embed_list)) {
Ewl_Embed *e;
@@ -246,9 +303,6 @@
}
}
- IF_FREE(ewl_config.evas.render_method);
- IF_FREE(ewl_config.theme.name);
-
ewl_config.debug.enable = nc.debug.enable;
ewl_config.debug.level = nc.debug.level;
ewl_config.evas.font_cache = nc.evas.font_cache;
@@ -256,6 +310,20 @@
ewl_config.evas.render_method = nc.evas.render_method;
ewl_config.theme.name = nc.theme.name;
ewl_config.theme.cache = nc.theme.cache;
+ ewl_config.theme.cclass_override = nc.theme.cclass_override;
+ ewl_config.theme.cclasses = nc.theme.cclasses;
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+void __ewl_color_class_free(void *data)
+{
+ Ewl_Color_Class *class = data;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ FREE(class->name);
+ FREE(class);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -275,11 +343,11 @@
}
snprintf(pe, PATH_MAX, "%s/.e", home);
- mkdir(pe, 0755);
+ mkdir(pe, 0700);
snprintf(pe, PATH_MAX, "%s/.e/ewl", home);
- mkdir(pe, 0755);
+ mkdir(pe, 0700);
snprintf(pe, PATH_MAX, "%s/.e/ewl/config", home);
- mkdir(pe, 0755);
+ mkdir(pe, 0700);
ewl_config_set_int("system", "/debug/enable", 0);
ewl_config_set_int("system", "/debug/level", 0);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_config.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- ewl_config.h 25 Oct 2003 05:55:46 -0000 1.22
+++ ewl_config.h 29 Oct 2003 21:08:30 -0000 1.23
@@ -21,16 +21,24 @@
char *render_method;
} evas;
struct {
- Ewd_List *paths;
- int fps;
- } fx;
- struct {
char *name;
int cache;
+ int cclass_override;
+ Ewd_List *cclasses;
} theme;
};
extern Ewl_Config ewl_config;
+
+typedef struct _ewl_color_class Ewl_Color_Class;
+struct _ewl_color_class
+{
+ char *name; /**< The name of the class, for matching to theme */
+ int r; /**< Red color value */
+ int g; /**< Green color value */
+ int b; /**< Blue color value */
+ int a; /**< Alpha value */
+};
int ewl_config_init(void);
int ewl_config_set_str(char *config, char *k, char *v);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_image.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -3 -r1.33 -r1.34
--- ewl_image.c 21 Oct 2003 05:48:06 -0000 1.33
+++ ewl_image.c 29 Oct 2003 21:08:30 -0000 1.34
@@ -265,7 +265,6 @@
if (i->path)
evas_object_image_file_set(i->image, i->path, NULL);
-
}
evas_object_layer_set(i->image, ewl_widget_get_layer_sum(w));
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_window.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -3 -r1.58 -r1.59
--- ewl_window.c 25 Oct 2003 05:55:47 -0000 1.58
+++ ewl_window.c 29 Oct 2003 21:08:30 -0000 1.59
@@ -211,12 +211,13 @@
void __ewl_window_realize(Ewl_Widget * w, void *ev_data, void *user_data)
{
- Ewl_Object *o;
- Ewl_Embed *embed;
- Ewl_Window *window;
- char *font_path;
- Ewd_List *paths;
- char *render;
+ Ewl_Object *o;
+ Ewl_Embed *embed;
+ Ewl_Window *window;
+ char *font_path;
+ Ewd_List *paths;
+ char *render;
+ Evas_Engine_Info *info = NULL;
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR("w", w);
@@ -251,6 +252,18 @@
embed->evas = evas_new();
evas_output_method_set(embed->evas,
evas_render_method_lookup(render));
+
+ info = evas_engine_info_get(embed->evas);
+ if (!info) {
+ fprintf(stderr, "Unable to use %s engine for rendering, "
+ "falling back to software_x11\n", render);
+ FREE(render);
+ render = strdup("software_x11");
+ evas_output_method_set(embed->evas,
+ evas_render_method_lookup(render));
+ info = evas_engine_info_get(embed->evas);
+ }
+
evas_output_size_set(embed->evas, ewl_object_get_current_w(o),
ewl_object_get_current_h(o));
evas_output_viewport_set(embed->evas, ewl_object_get_current_x(o),
@@ -259,39 +272,37 @@
ewl_object_get_current_h(o));
if (!strcmp(render, "gl_x11")) {
- Evas_Engine_Info_GL_X11 *info;
+ Evas_Engine_Info_GL_X11 *glinfo;
- info = (Evas_Engine_Info_GL_X11 *)
- evas_engine_info_get(embed->evas);
+ glinfo = (Evas_Engine_Info_GL_X11 *)info;
- info->info.display = ecore_x_display_get();
- info->info.visual = DefaultVisual(info->info.display,
- DefaultScreen(info->info.display));
- info->info.colormap = DefaultColormap(info->info.display,
- DefaultScreen(info->info.display));
- info->info.drawable = window->window;
- info->info.depth = DefaultDepth(info->info.display,
- DefaultScreen(info->info.display));
- evas_engine_info_set(embed->evas, (Evas_Engine_Info *)info);
+ glinfo->info.display = ecore_x_display_get();
+ glinfo->info.visual = DefaultVisual(glinfo->info.display,
+ DefaultScreen(glinfo->info.display));
+ glinfo->info.colormap = DefaultColormap(glinfo->info.display,
+ DefaultScreen(glinfo->info.display));
+ glinfo->info.drawable = window->window;
+ glinfo->info.depth = DefaultDepth(glinfo->info.display,
+ DefaultScreen(glinfo->info.display));
}
else {
- Evas_Engine_Info_Software_X11 *info;
+ Evas_Engine_Info_Software_X11 *sinfo;
- info = (Evas_Engine_Info_Software_X11 *)
- evas_engine_info_get(embed->evas);
+ sinfo = (Evas_Engine_Info_Software_X11 *)info;
- info->info.display = ecore_x_display_get();
- info->info.visual = DefaultVisual(info->info.display,
- DefaultScreen(info->info.display));
- info->info.colormap = DefaultColormap(info->info.display,
- DefaultScreen(info->info.display));
- info->info.drawable = window->window;
- info->info.depth = DefaultDepth(info->info.display,
- DefaultScreen(info->info.display));
- info->info.rotation = 0;
- info->info.debug = 0;
- evas_engine_info_set(embed->evas, (Evas_Engine_Info *)info);
+ sinfo->info.display = ecore_x_display_get();
+ sinfo->info.visual = DefaultVisual(sinfo->info.display,
+ DefaultScreen(sinfo->info.display));
+ sinfo->info.colormap = DefaultColormap(sinfo->info.display,
+ DefaultScreen(sinfo->info.display));
+ sinfo->info.drawable = window->window;
+ sinfo->info.depth = DefaultDepth(sinfo->info.display,
+ DefaultScreen(sinfo->info.display));
+ sinfo->info.rotation = 0;
+ sinfo->info.debug = 0;
}
+
+ evas_engine_info_set(embed->evas, info);
paths = ewl_theme_font_path_get();
ewd_list_goto_first(paths);
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs