1. add elm module internal code. will be used later for things like:

* putting policy into modules
* multitouch handling being able to be farmed off to modules
* farming off things that are not compatible with license/code of elm into a
3rd party piece of code via a clean defined interface API

2. fix doc image - dont need it

3. fix toolbar bounce settings. was wrong



SVN revision: 42793
This commit is contained in:
Carsten Haitzler 2009-09-29 04:35:35 +00:00
parent f81ba03770
commit 111735b63d
8 changed files with 212 additions and 23 deletions

View File

@ -233,6 +233,10 @@ AC_SUBST(requirement_elm)
EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
MODULE_ARCH="$host_os-$host_cpu-$release"
AC_SUBST(MODULE_ARCH)
AC_DEFINE_UNQUOTED(MODULE_ARCH, "$MODULE_ARCH", "Module architecture")
AC_OUTPUT([
Makefile
elementary.pc

View File

@ -126,8 +126,6 @@ td.nav_active {
#header h1 {
width: 63px;
height: 63px;
background-image: url(e.png);
background-repeat: no-repeat;
position: absolute;
margin: 0px;
}

View File

@ -908,7 +908,6 @@ extern "C" {
////////////////////////////////////////////////////////////////////////////
//
//// (bugs - high priority)
// * scale change for hover doesnt seem to do new size alloc nicely
// * left/right arrow broken with password mode for entry + utf8 chars...
// * bubble doesnt handle child size changes right
// * table doesnt do homogenous properly
@ -920,11 +919,9 @@ extern "C" {
// * when entries are in a scroller and change size, the scroller shows scrollbars. fix. same for selecting. for 1 line entries in a scroller should only have scroll arrow indicators.
//
//// (more widgets/features - medium priority)
// * multiple genlist item styles (multi-label, 1 icon + 2 line label, header etc.)
// * carousel selector widget
// * auto-size label/text that adapts text size to its allocated region
// * [ scrollable dropdown combo box ]
// * [ notepad widget ]
// * [ toggle with 2x labelled button for 2 states ]
// * [ poker spinner with numbers + labels ]
// * [ wrapping text button bar ]
@ -934,8 +931,6 @@ extern "C" {
// * "dialogbutton" widget (bigger button for bottom of wins)
// * dialog window widget
// * phone-number widget (hilight country dial prefixes, add flags, photos of contacts that match etc.)
// * imageview widget (for large not iconic images)
// * tiled image + zoom widget (tiled map viewer)
// * dialpad widget - need one with a phone dialpad
// * file selector widget - needs look and functionality improvement :)
// * generic "tacho" widget (set min/max labels - and up to 3 intermediate labels etc.)

View File

@ -8,6 +8,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/lib \
-I$(top_builddir)/src/lib \
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
@ELEMENTARY_CFLAGS@ \
@ELEMENTARY_X_CFLAGS@ \
@ELEMENTARY_FB_CFLAGS@ \
@ -28,6 +29,7 @@ libelementary_la_SOURCES = \
elm_priv.h \
elm_main.c \
elm_theme.c \
elm_module.c \
\
elm_win.c \
elm_widget.c \

View File

@ -264,6 +264,7 @@ static void _elm_rescale(void);
char *_elm_appname = NULL;
Elm_Config *_elm_config = NULL;
const char *_elm_data_dir = NULL;
const char *_elm_lib_dir = NULL;
int _elm_log_dom = -1;
static Ecore_Event_Handler *_elm_exit_handler = NULL;
@ -442,6 +443,7 @@ elm_quicklaunch_init(int argc, char **argv)
evas_init();
edje_init();
ecore_evas_init(); // FIXME: check errors
_elm_module_init();
_elm_exit_handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _elm_signal_exit, NULL);
@ -461,8 +463,22 @@ elm_quicklaunch_init(int argc, char **argv)
_elm_data_dir = eina_stringshare_add(buf);
}
}
if (!_elm_lib_dir)
{
s = getenv("ELM_LIB_DIR");
_elm_lib_dir = eina_stringshare_add(s);
}
if (!_elm_lib_dir)
{
s = getenv("ELM_PREFIX");
if (s)
{
snprintf(buf, sizeof(buf), "%s/lib", s);
_elm_lib_dir = eina_stringshare_add(buf);
}
}
#ifdef HAVE_DLADDR
if (!_elm_data_dir)
if ((!_elm_data_dir) || (!_elm_lib_dir))
{
Dl_info elementary_dl;
// libelementary.so/../../share/elementary/
@ -473,27 +489,35 @@ elm_quicklaunch_init(int argc, char **argv)
dir = ecore_file_dir_get(elementary_dl.dli_fname);
if (dir)
{
dir2 = ecore_file_dir_get(dir);
if (dir2)
{
snprintf(buf, sizeof(buf), "%s/share/elementary", dir2);
if (ecore_file_is_dir(buf))
_elm_data_dir = eina_stringshare_add(buf);
free(dir2);
}
if (!_elm_lib_dir)
{
if (ecore_file_is_dir(dir))
_elm_lib_dir = eina_stringshare_add(dir);
}
if (!_elm_data_dir)
{
dir2 = ecore_file_dir_get(dir);
if (dir2)
{
snprintf(buf, sizeof(buf), "%s/share/elementary", dir2);
if (ecore_file_is_dir(buf))
_elm_data_dir = eina_stringshare_add(buf);
free(dir2);
}
}
free(dir);
}
}
}
#endif
if (!_elm_data_dir)
{
_elm_data_dir = eina_stringshare_add(PACKAGE_DATA_DIR);
}
_elm_data_dir = eina_stringshare_add(PACKAGE_DATA_DIR);
if (!_elm_data_dir)
{
_elm_data_dir = eina_stringshare_add("/");
}
_elm_data_dir = eina_stringshare_add("/");
if (!_elm_lib_dir)
_elm_lib_dir = eina_stringshare_add(PACKAGE_LIB_DIR);
if (!_elm_lib_dir)
_elm_lib_dir = eina_stringshare_add("/");
// FIXME: actually load config
_elm_config = ELM_NEW(Elm_Config);
@ -724,6 +748,7 @@ elm_quicklaunch_shutdown(void)
free(_elm_appname);
_elm_unneed_efreet();
_elm_unneed_e_dbus();
_elm_module_shutdown();
ecore_evas_shutdown();
edje_shutdown();
evas_shutdown();

View File

@ -0,0 +1,139 @@
#include <Elementary.h>
#include "elm_priv.h"
#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#include <dlfcn.h> /* dlopen,dlclose,etc */
static Eina_Hash *modules = NULL;
void
_elm_module_init(void)
{
modules = eina_hash_string_small_new(NULL);
}
void
_elm_module_shutdown(void)
{
// FIXME: unload all modules
eina_hash_free(modules);
modules = NULL;
}
Elm_Module *
_elm_module_add(const char *name)
{
Elm_Module *m;
char buf[PATH_MAX];
m = eina_hash_find(modules, name);
if (m)
{
m->references++;
return m;
}
m = calloc(1, sizeof(Elm_Module));
if (!m) return NULL;
m->version = 1;
if (name[0] != '/')
{
const char *home = getenv("HOME");
if (home)
{
snprintf(buf, sizeof(buf), "%s/.elementary/modules/%s/%s/module.so", home, name, MODULE_ARCH);
m->handle = dlopen(buf, RTLD_NOW | RTLD_GLOBAL);
if (m->handle)
{
m->init_func = dlsym(m->handle, "elm_modapi_init");
if (m->init_func)
{
m->shutdown_func = dlsym(m->handle, "elm_modapi_shutdown");
m->so_path = eina_stringshare_add(buf);
m->name = eina_stringshare_add(name);
snprintf(buf, sizeof(buf), "%s/.elementary/modules/%s/%s", home, name, MODULE_ARCH);
m->bin_dir = eina_stringshare_add(buf);
snprintf(buf, sizeof(buf), "%s/.elementary/modules/%s", home, name);
m->data_dir = eina_stringshare_add(buf);
}
else
{
dlclose(m->handle);
free(m);
return NULL;
}
}
}
if (!m->handle)
{
snprintf(buf, sizeof(buf), "%s/elementary/modules/%s/%s/module.so", _elm_lib_dir, name, MODULE_ARCH);
m->handle = dlopen(buf, RTLD_NOW | RTLD_GLOBAL);
if (m->handle)
{
m->init_func = dlsym(m->handle, "elm_modapi_init");
if (m->init_func)
{
m->shutdown_func = dlsym(m->handle, "elm_modapi_shutdown");
m->so_path = eina_stringshare_add(buf);
m->name = eina_stringshare_add(name);
snprintf(buf, sizeof(buf), "%s/elementary/modules/%s/%s", _elm_lib_dir, name, MODULE_ARCH);
m->bin_dir = eina_stringshare_add(buf);
snprintf(buf, sizeof(buf), "%s/elementary/modules/%s", _elm_lib_dir, name, MODULE_ARCH);
m->data_dir = eina_stringshare_add(buf);
}
else
{
dlclose(m->handle);
free(m);
return NULL;
}
}
}
}
if (!m->handle)
{
free(m);
return NULL;
}
if (!m->init_func(m))
{
dlclose(m->handle);
eina_stringshare_del(m->name);
eina_stringshare_del(m->so_path);
eina_stringshare_del(m->data_dir);
eina_stringshare_del(m->bin_dir);
free(m);
return NULL;
}
m->references = 1;
eina_hash_direct_add(modules, m->name, m);
return m;
}
void
_elm_module_del(Elm_Module *m)
{
m->references--;
if (m->references > 0) return;
if (m->shutdown_func) m->shutdown_func(m);
eina_hash_del(modules, m->name, m);
dlclose(m->handle);
eina_stringshare_del(m->name);
eina_stringshare_del(m->so_path);
eina_stringshare_del(m->data_dir);
eina_stringshare_del(m->bin_dir);
free(m);
}
const void *
_elm_module_symbol_get(Elm_Module *m, const char *name)
{
return dlsym(m->handle, name);
}

View File

@ -19,7 +19,9 @@
#include "els_icon.h"
// FIXME: totally disorganised. clean this up!
//
// Why EAPI in a private header ?
// EAPI is temporaty - that widget api will change, but makign it EAPI right now to indicate its bound for externalness
typedef enum _Elm_Engine
{
@ -57,6 +59,22 @@ struct _Elm_Config
double fps;
};
typedef struct _Elm_Module Elm_Module;
struct _Elm_Module
{
int version;
const char *name;
const char *so_path;
const char *data_dir;
const char *bin_dir;
void *handle;
void *data;
int (*init_func) (Elm_Module *m);
int (*shutdown_func) (Elm_Module *m);
int references;
};
#define ELM_NEW(t) calloc(1, sizeof(t))
void _elm_win_shutdown(void);
@ -66,6 +84,12 @@ int _elm_theme_set(Evas_Object *o, const char *clas, const char *group, const ch
int _elm_theme_icon_set(Evas_Object *o, const char *group, const char *style);
int _elm_theme_parse(const char *theme);
void _elm_module_init(void);
void _elm_module_shutdown(void);
Elm_Module *_elm_module_add(const char *name);
void _elm_module_del(Elm_Module *m);
const void *_elm_module_symbol_get(Elm_Module *m, const char *name);
/* FIXME: should this be public? for now - private (but public symbols) */
EAPI Evas_Object *elm_widget_add(Evas *evas);
EAPI void elm_widget_del_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
@ -116,10 +140,12 @@ EAPI const char *elm_widget_type_get(const Evas_Object *obj);
EAPI Eina_List *_stringlist_get(const char *str);
EAPI void _stringlist_free(Eina_List *list);
extern char *_elm_appname;
extern Elm_Config *_elm_config;
extern const char *_elm_data_dir;
extern const char *_elm_lib_dir;
extern int _elm_log_dom;
#define CRITICAL(...) EINA_LOG_DOM_CRIT(_elm_log_dom, __VA_ARGS__)

View File

@ -228,7 +228,7 @@ elm_toolbar_add(Evas_Object *parent)
elm_widget_can_focus_set(obj, 0);
wd->scr = elm_smart_scroller_add(e);
elm_scroller_bounce_set(wd->scr, 1, 0);
elm_smart_scroller_bounce_allow_set(wd->scr, 1, 0);
elm_smart_scroller_theme_set(wd->scr, "toolbar", "base", "default");
elm_widget_resize_object_set(obj, wd->scr);
elm_smart_scroller_policy_set(wd->scr,