Enlightenment CVS committal
Author : rbdpngn
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src
Modified Files:
Ewl.h ewl_config.c ewl_config.h ewl_embed.c ewl_embed.h
ewl_window.c ewl_window.h
Log Message:
Support for the new global color classes in edje. Autofoo for detecting gl_x11
and software_x11 engines in evas. Slight include reorganization, may do more
of this soon.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/Ewl.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -3 -r1.38 -r1.39
--- Ewl.h 25 Oct 2003 05:55:46 -0000 1.38
+++ Ewl.h 4 Nov 2003 07:16:45 -0000 1.39
@@ -226,13 +226,11 @@
extern"C" {
#endif
+#include <Evas.h>
#include <Edje.h>
#include <Ecore.h>
#include <Ecore_X.h>
#include <Edb.h>
-#include <Evas.h>
-#include <Evas_Engine_GL_X11.h>
-#include <Evas_Engine_Software_X11.h>
#include <Etox.h>
#include <Ewd.h>
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_config.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- ewl_config.c 29 Oct 2003 21:08:30 -0000 1.29
+++ ewl_config.c 4 Nov 2003 07:16:45 -0000 1.30
@@ -8,12 +8,12 @@
static E_DB_File *config_db = NULL;
-void __ewl_color_class_free(void *data);
-void __create_user_config(void);
+void __ewl_config_db_create(void);
-static int __open_config_db(const char *name);
-static void __close_config_db(void);
-static int __config_exists(char *name);
+static int __ewl_config_db_open(const char *name);
+static int __ewl_config_db_stat(char *name);
+static void __ewl_config_db_close(void);
+static int __ewl_config_db_exists(char *name);
extern Ewd_List *ewl_embed_list;
@@ -31,12 +31,12 @@
memset(&ewl_config, 0, sizeof(Ewl_Config));
- if (__config_exists("system") != -1)
- __close_config_db();
+ if (__ewl_config_db_exists("system") != -1)
+ __ewl_config_db_close();
else
- __create_user_config();
+ __ewl_config_db_create();
- if (__config_exists("system") == -1)
+ if (__ewl_config_db_exists("system") == -1)
DRETURN_INT(FALSE, DLEVEL_STABLE);
DRETURN_INT(TRUE, DLEVEL_STABLE);
@@ -56,12 +56,12 @@
{
DENTER_FUNCTION(DLEVEL_STABLE);
- if (!__open_config_db(config))
+ if (!__ewl_config_db_open(config))
DRETURN_INT(FALSE, DLEVEL_STABLE);
e_db_str_set(config_db, k, v);
- __close_config_db();
+ __ewl_config_db_close();
DRETURN_INT(TRUE, DLEVEL_STABLE);
}
@@ -82,12 +82,12 @@
{
DENTER_FUNCTION(DLEVEL_STABLE);
- if (!__open_config_db(config))
+ if (!__ewl_config_db_open(config))
DRETURN_INT(FALSE, DLEVEL_STABLE);
e_db_int_set(config_db, k, v);
- __close_config_db();
+ __ewl_config_db_close();
DRETURN_INT(TRUE, DLEVEL_STABLE);
}
@@ -107,12 +107,12 @@
{
DENTER_FUNCTION(DLEVEL_STABLE);
- if (!__open_config_db(config))
+ if (!__ewl_config_db_open(config))
DRETURN_INT(FALSE, DLEVEL_STABLE);
e_db_float_set(config_db, k, v);
- __close_config_db();
+ __ewl_config_db_close();
DRETURN_INT(TRUE, DLEVEL_STABLE);
}
@@ -130,10 +130,10 @@
DENTER_FUNCTION(DLEVEL_STABLE);
- if (__open_config_db(config)) {
+ if (__ewl_config_db_open(config)) {
ret = e_db_str_get(config_db, k);
- __close_config_db();
+ __ewl_config_db_close();
}
DRETURN_PTR(ret, DLEVEL_STABLE);
@@ -153,10 +153,10 @@
DENTER_FUNCTION(DLEVEL_STABLE);
- if (__open_config_db(config)) {
+ if (__ewl_config_db_open(config)) {
ret = e_db_int_get(config_db, k, &v);
- __close_config_db();
+ __ewl_config_db_close();
}
if (!ret)
@@ -178,10 +178,10 @@
DENTER_FUNCTION(DLEVEL_STABLE);
- if (__open_config_db(config)) {
+ if (__ewl_config_db_open(config)) {
ret = e_db_float_get(config_db, k, &v);
- __close_config_db();
+ __ewl_config_db_close();
}
if (!ret)
@@ -214,20 +214,23 @@
void ewl_config_reread_and_apply(void)
{
int cc;
+ time_t mt;
Ewl_Config nc;
DENTER_FUNCTION(DLEVEL_STABLE);
+ mt = __ewl_config_db_stat("system");
+ if (mt == ewl_config.mtime)
+ DRETURN(DLEVEL_STABLE);
+
+ ewl_config.mtime = mt;
+
/*
* 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");
@@ -240,43 +243,83 @@
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 *name;
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) {
+ name = ewl_config_get_str("system", key);
+ if (name) {
+ int r, g, b, a;
+ int r2, g2, b2, a2;
+ int r3, g3, b3, a3;
+
snprintf(key, PATH_MAX,
"/theme/color_classes/%d/r", i);
- cclass->r = ewl_config_get_int("system", key);
+ 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);
+ 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);
+ 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);
+ a = ewl_config_get_int("system", key);
- ewd_list_append(nc.theme.cclasses, cclass);
+ snprintf(key, PATH_MAX,
+ "/theme/color_classes/%d/r2",
+ i);
+ r2 = ewl_config_get_int("system", key);
+
+ snprintf(key, PATH_MAX,
+ "/theme/color_classes/%d/g2",
+ i);
+ g2 = ewl_config_get_int("system", key);
+
+ snprintf(key, PATH_MAX,
+ "/theme/color_classes/%d/b2",
+ i);
+ b2 = ewl_config_get_int("system", key);
+
+ snprintf(key, PATH_MAX,
+ "/theme/color_classes/%d/a2",
+ i);
+ a2 = ewl_config_get_int("system", key);
+
+ snprintf(key, PATH_MAX,
+ "/theme/color_classes/%d/r3",
+ i);
+ r3 = ewl_config_get_int("system", key);
+
+ snprintf(key, PATH_MAX,
+ "/theme/color_classes/%d/g3",
+ i);
+ g3 = ewl_config_get_int("system", key);
+
+ snprintf(key, PATH_MAX,
+ "/theme/color_classes/%d/b3",
+ i);
+ b3 = ewl_config_get_int("system", key);
+
+ snprintf(key, PATH_MAX,
+ "/theme/color_classes/%d/a3",
+ i);
+ a3 = ewl_config_get_int("system", key);
+
+ edje_color_class_set(name, r, g, b, a,
+ r2, g2, b2, a2,
+ r3, g3, b3, a3);
+ FREE(name);
}
- else
- FREE(cclass);
}
}
@@ -311,24 +354,11 @@
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);
-}
-
-void __create_user_config(void)
+void __ewl_config_db_create(void)
{
char *home;
char pe[PATH_MAX];
@@ -360,7 +390,7 @@
DRETURN(DLEVEL_STABLE);
}
-static int __open_config_db(const char *name)
+static int __ewl_config_db_open(const char *name)
{
char *home;
char path[PATH_MAX];
@@ -384,21 +414,43 @@
DRETURN_INT(FALSE, DLEVEL_STABLE);
}
-static void __close_config_db()
+static int __ewl_config_db_stat(char *name)
{
+ char *home;
+ char path[PATH_MAX];
+ struct stat st;
+
DENTER_FUNCTION(DLEVEL_STABLE);
- e_db_flush();
+ home = getenv("HOME");
+
+ if (!home) {
+ DWARNING("Failed to fetch environment variable HOME\n");
+ DRETURN_INT(FALSE, DLEVEL_STABLE);
+ }
+
+ snprintf(path, PATH_MAX, "%s/.e/ewl/config/%s.db", home, name);
+
+ stat(path, &st);
+
+ DRETURN_INT(st.st_mtime, DLEVEL_STABLE);
+}
+
+static void __ewl_config_db_close()
+{
+ DENTER_FUNCTION(DLEVEL_STABLE);
if (config_db)
e_db_close(config_db);
+ e_db_flush();
+
config_db = NULL;
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
-static int __config_exists(char *name)
+static int __ewl_config_db_exists(char *name)
{
char *home;
char path[PATH_MAX];
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_config.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- ewl_config.h 29 Oct 2003 21:08:30 -0000 1.23
+++ ewl_config.h 4 Nov 2003 07:16:45 -0000 1.24
@@ -11,6 +11,7 @@
struct _ewl_config
{
+ time_t mtime;
struct {
int enable;
int level;
@@ -24,21 +25,10 @@
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_embed.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- ewl_embed.c 20 Oct 2003 05:05:48 -0000 1.10
+++ ewl_embed.c 4 Nov 2003 07:16:45 -0000 1.11
@@ -229,7 +229,7 @@
* @return Returns the found embed on success, NULL on failure.
* @brief Find an ewl embed by its evas window
*/
-Ewl_Embed *ewl_embed_find_by_evas_window(Window window)
+Ewl_Embed *ewl_embed_find_by_evas_window(Ecore_X_Window window)
{
Ewl_Embed *retemb;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_embed.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- ewl_embed.h 16 Oct 2003 20:54:25 -0000 1.6
+++ ewl_embed.h 4 Nov 2003 07:16:45 -0000 1.7
@@ -36,7 +36,7 @@
Ewl_Container container; /**< Inherits from the Ewl_Container class */
Evas *evas; /**< Evas where drawing takes place. */
- Window evas_window; /**< The window holding the evas. */
+ Ecore_X_Window evas_window; /**< The window holding the evas. */
Evas_Object *smart; /**< Object to manipulate Ewl_Embed from evas */
};
@@ -45,7 +45,7 @@
int ewl_embed_init(Ewl_Embed * win);
Evas_Object *ewl_embed_set_evas(Ewl_Embed *emb, Evas *evas);
void ewl_embed_font_path_add(char *path);
-Ewl_Embed *ewl_embed_find_by_evas_window(Window win);
+Ewl_Embed *ewl_embed_find_by_evas_window(Ecore_X_Window win);
Ewl_Embed *ewl_embed_find_by_widget(Ewl_Widget * w);
/**
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_window.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -3 -r1.59 -r1.60
--- ewl_window.c 29 Oct 2003 21:08:30 -0000 1.59
+++ ewl_window.c 4 Nov 2003 07:16:45 -0000 1.60
@@ -1,6 +1,17 @@
-
#include <Ewl.h>
+#ifdef HAVE_CONFIG_H
+#include "ewl-config.h"
+#endif
+
+#ifdef HAVE_EVAS_ENGINE_GL_X11_H
+#include <Evas_Engine_GL_X11.h>
+#endif
+
+#ifdef HAVE_EVAS_ENGINE_SOFTWARE_X11_H
+#include <Evas_Engine_Software_X11.h>
+#endif
+
extern Ewd_List *ewl_embed_list;
void __ewl_window_realize(Ewl_Widget * w, void *ev_data,
@@ -44,7 +55,7 @@
* @return Returns the found ewl window on success, NULL on failure.
* @brief Find an ewl window by it's X window
*/
-Ewl_Window *ewl_window_find_window(Window window)
+Ewl_Window *ewl_window_find_window(Ecore_X_Window window)
{
Ewl_Window *retwin;
@@ -271,6 +282,7 @@
ewl_object_get_current_w(o),
ewl_object_get_current_h(o));
+#ifdef HAVE_EVAS_ENGINE_GL_X11_H
if (!strcmp(render, "gl_x11")) {
Evas_Engine_Info_GL_X11 *glinfo;
@@ -285,7 +297,10 @@
glinfo->info.depth = DefaultDepth(glinfo->info.display,
DefaultScreen(glinfo->info.display));
}
- else {
+ else
+#endif
+#ifdef HAVE_EVAS_ENGINE_SOFTWARE_X11_H
+ {
Evas_Engine_Info_Software_X11 *sinfo;
sinfo = (Evas_Engine_Info_Software_X11 *)info;
@@ -301,6 +316,7 @@
sinfo->info.rotation = 0;
sinfo->info.debug = 0;
}
+#endif
evas_engine_info_set(embed->evas, info);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_window.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- ewl_window.h 16 Oct 2003 20:54:25 -0000 1.23
+++ ewl_window.h 4 Nov 2003 07:16:45 -0000 1.24
@@ -31,7 +31,7 @@
{
Ewl_Embed embed; /**< Inherits from the Ewl_Embed class */
- Window window; /**< Provides a window for drawing */
+ Ecore_X_Window window; /**< Provides a window for drawing */
char *title; /**< The current title on the provided window */
@@ -44,7 +44,7 @@
Ewl_Widget *ewl_window_new();
int ewl_window_init(Ewl_Window * win);
-Ewl_Window *ewl_window_find_window(Window window);
+Ewl_Window *ewl_window_find_window(Ecore_X_Window window);
void ewl_window_set_title(Ewl_Window * win, char *title);
char *ewl_window_get_title(Ewl_Window * win);
void ewl_window_set_borderless(Ewl_Window * win);
-------------------------------------------------------
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