summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2014-01-05 18:09:36 +0900
committerSung-jae Park <nicesj.park@samsung.com>2014-01-05 18:09:36 +0900
commitde7db30b4a4f7dd7c9e6f7889dccc12f261b71dd (patch)
tree37f3c966b0deeae6080376eb2182a1e1eb936f0d
parent7128bbdc0c314d34a0bd7861a41de5de929b264d (diff)
downloadlivebox-edje-de7db30b4a4f7dd7c9e6f7889dccc12f261b71dd.tar.gz
livebox-edje-de7db30b4a4f7dd7c9e6f7889dccc12f261b71dd.tar.bz2
livebox-edje-de7db30b4a4f7dd7c9e6f7889dccc12f261b71dd.zip
Sync with the latest one.
Get all EFL codes from the data-provider-master. So now the data-provider-master doesn't have any relation with Evas. Change-Id: I75a5a8c5db807a2f6311568becae40917f3db3c2
-rw-r--r--CMakeLists.txt7
-rw-r--r--include/abi.h39
-rw-r--r--include/script_port.h36
-rw-r--r--packaging/liblivebox-edje.spec10
-rw-r--r--src/abi.c387
-rw-r--r--src/script_port.c623
6 files changed, 827 insertions, 275 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cd118df..bc78327 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,7 +14,7 @@ pkg_check_modules(live_edje REQUIRED
livebox-service
elementary
capi-system-system-settings
- #efl-assist
+# efl-assist
)
FOREACH (flag ${live_edje_CFLAGS})
@@ -29,15 +29,16 @@ ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
ADD_DEFINITIONS("-DPATH_MAX=256")
ADD_DEFINITIONS("-DPACKAGE=\"${PROJECT_NAME}\"")
-ADD_DEFINITIONS("${EXTRA_CFLAGS} -g -Wall")
+ADD_DEFINITIONS("${EXTRA_CFLAGS} -g -Wall -Werror")
ADD_DEFINITIONS("-DNDEBUG")
ADD_DEFINITIONS("-D_USE_ECORE_TIME_GET")
ADD_DEFINITIONS("-DLOG_TAG=\"LIVEBOX_EDJE\"")
ADD_LIBRARY(${PROJECT_NAME} SHARED
src/script_port.c
+ src/abi.c
)
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${live_edje_LDFLAGS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${live_edje_LDFLAGS} "-ldl")
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION "/usr/share/data-provider-master/plugin-script")
INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME "lib${PROJECT_NAME}")
diff --git a/include/abi.h b/include/abi.h
new file mode 100644
index 0000000..5c611d7
--- /dev/null
+++ b/include/abi.h
@@ -0,0 +1,39 @@
+enum buffer_type { /*!< Must have to be sync with libprovider, liblivebox-viewer, liblivebox-edje */
+ BUFFER_TYPE_FILE,
+ BUFFER_TYPE_SHM,
+ BUFFER_TYPE_PIXMAP,
+ BUFFER_TYPE_ERROR
+};
+
+extern int script_buffer_load(void *handle);
+extern int script_buffer_unload(void *handle);
+extern int script_buffer_is_loaded(const void *handle);
+extern int script_buffer_resize(void *handle, int w, int h);
+extern void script_buffer_update_size(void *handle, int w, int h);
+extern const char *script_buffer_id(const void *handle);
+extern enum buffer_type script_buffer_type(const void *handle);
+
+extern int script_buffer_pixmap(const void *handle);
+extern void *script_buffer_pixmap_acquire_buffer(void *handle);
+extern int script_buffer_pixmap_release_buffer(void *canvas);
+extern void *script_buffer_pixmap_ref(void *handle);
+extern int script_buffer_pixmap_unref(void *buffer_ptr);
+extern void *script_buffer_pixmap_find(int pixmap);
+extern void *script_buffer_pixmap_buffer(void *handle);
+extern int script_buffer_lock(void *handle);
+extern int script_buffer_unlock(void *handle);
+
+
+extern void *script_buffer_fb(void *handle);
+extern int script_buffer_get_size(void *handle, int *w, int *h);
+extern void script_buffer_flush(void *handle);
+extern void *script_buffer_instance(void *handle);
+
+extern void *script_buffer_raw_open(enum buffer_type type, void *resource);
+extern int script_buffer_raw_close(void *buffer);
+extern void *script_buffer_raw_data(void *buffer);
+extern int script_buffer_raw_size(void *buffer);
+
+extern int script_buffer_signal_emit(void *buffer_handle, const char *part, const char *signal, double x, double y, double ex, double ey);
+
+/* End of a file */
diff --git a/include/script_port.h b/include/script_port.h
index b5e821a..941bb71 100644
--- a/include/script_port.h
+++ b/include/script_port.h
@@ -19,28 +19,24 @@ extern "C" {
#endif
/*!
- */
-extern int script_signal_emit(Evas *e, const char *part, const char *signal, double x, double y, double ex, double ey);
-
-/*!
* Implement below functions
*/
-extern int script_update_color(void *h, Evas *e, const char *id, const char *part, const char *rgba);
-extern int script_update_text(void *h, Evas *e, const char *id, const char *part, const char *text);
-extern int script_update_image(void *h, Evas *e, const char *id, const char *part, const char *path, const char *option);
-extern int script_update_access(void *h, Evas *e, const char *id, const char *part, const char *text, const char *option);
-extern int script_operate_access(void *_h, Evas *e, const char *id, const char *part, const char *operation, const char *option);
-extern int script_update_script(void *h, Evas *e, const char *src_id, const char *target_id, const char *part, const char *path, const char *group);
-extern int script_update_signal(void *h, Evas *e, const char *id, const char *part, const char *signal);
-extern int script_update_drag(void *h, Evas *e, const char *id, const char *part, double x, double y);
-extern int script_update_size(void *handle, Evas *e, const char *id, int w, int h);
-extern int script_update_category(void *h, Evas *e, const char *id, const char *category);
-
-extern void *script_create(const char *file, const char *group);
+extern int script_update_color(void *handle, const char *id, const char *part, const char *rgba);
+extern int script_update_text(void *handle, const char *id, const char *part, const char *text);
+extern int script_update_image(void *handle, const char *id, const char *part, const char *path, const char *option);
+extern int script_update_access(void *handle, const char *id, const char *part, const char *text, const char *option);
+extern int script_operate_access(void *handle, const char *id, const char *part, const char *operation, const char *option);
+extern int script_update_script(void *handle, const char *src_id, const char *target_id, const char *part, const char *path, const char *group);
+extern int script_update_signal(void *handle, const char *id, const char *part, const char *signal);
+extern int script_update_drag(void *handle, const char *id, const char *part, double x, double y);
+extern int script_update_size(void *handle, const char *id, int w, int h);
+extern int script_update_category(void *handle, const char *id, const char *category);
+
+extern void *script_create(void *buffer_handle, const char *file, const char *group);
extern int script_destroy(void *handle);
-extern int script_load(void *handle, Evas *e, int w, int h);
-extern int script_unload(void *handle, Evas *e);
+extern int script_load(void *handle, int (*render_pre)(void *buffer_handle, void *data), int (*render_post)(void *render_handle, void *data), void *data);
+extern int script_unload(void *handle);
/*!
LB_ACCESS_HIGHLIGHT 0
@@ -50,9 +46,9 @@ extern int script_unload(void *handle, Evas *e);
LB_ACCESS_VALUE_CHANGE 4
LB_ACCESS_SCROLL 5
*/
-extern int script_feed_event(void *h, Evas *e, int event_type, int x, int y, int down, double timestamp);
+extern int script_feed_event(void *handle, int event_type, int x, int y, int down, unsigned int keycode, double timestamp);
-extern int script_init(double scale);
+extern int script_init(double scale, int premultiplied);
extern int script_fini(void);
extern const char *script_magic_id(void);
diff --git a/packaging/liblivebox-edje.spec b/packaging/liblivebox-edje.spec
index 2e94f3c..a05f47d 100644
--- a/packaging/liblivebox-edje.spec
+++ b/packaging/liblivebox-edje.spec
@@ -1,9 +1,9 @@
Name: liblivebox-edje
Summary: EDJE Script loader for the data provider master
-Version: 0.5.26
+Version: 0.6.1
Release: 1
Group: HomeTF/Livebox
-License: Flora License
+License: Flora
Source0: %{name}-%{version}.tar.gz
Source1001: %{name}.manifest
BuildRequires: cmake, gettext-tools, coreutils
@@ -28,6 +28,12 @@ Plugin for the data provider master to load the edje scripts
cp %{SOURCE1001} .
%build
+%if 0%{?sec_build_binary_debug_enable}
+export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
+export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
+%endif
+
%if 0%{?tizen_build_binary_release_type_eng}
export CFLAGS="${CFLAGS} -DTIZEN_ENGINEER_MODE"
export CXXFLAGS="${CXXFLAGS} -DTIZEN_ENGINEER_MODE"
diff --git a/src/abi.c b/src/abi.c
new file mode 100644
index 0000000..98a42c8
--- /dev/null
+++ b/src/abi.c
@@ -0,0 +1,387 @@
+#define _GNU_SOURCE
+
+#include <stdio.h>
+#include <dlfcn.h>
+
+#include <dlog.h>
+#include <livebox-errno.h>
+
+#include "debug.h"
+#include "abi.h"
+
+int script_buffer_load(void *handle)
+{
+ static int (*load)(void *handle) = NULL;
+ if (!load) {
+ load = dlsym(RTLD_DEFAULT, "buffer_handler_load");
+ if (!load) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ }
+
+ return load(handle);
+}
+
+int script_buffer_unload(void *handle)
+{
+ static int (*unload)(void *handle) = NULL;
+
+ if (!unload) {
+ unload = dlsym(RTLD_DEFAULT, "buffer_handler_unload");
+ if (!unload) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ }
+
+ return unload(handle);
+}
+
+int script_buffer_is_loaded(const void *handle)
+{
+ static int (*is_loaded)(const void *handle) = NULL;
+
+ if (!is_loaded) {
+ is_loaded = dlsym(RTLD_DEFAULT, "buffer_handler_is_loaded");
+ if (!is_loaded) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ }
+
+ return is_loaded(handle);
+}
+
+int script_buffer_resize(void *handle, int w, int h)
+{
+ static int (*resize)(void *handle, int w, int h) = NULL;
+
+ if (!resize) {
+ resize = dlsym(RTLD_DEFAULT, "buffer_handler_resize");
+ if (!resize) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ }
+
+ return resize(handle, w, h);
+}
+
+void script_buffer_update_size(void *handle, int w, int h)
+{
+ static void (*update_size)(void *handle, int w, int h) = NULL;
+
+ if (!update_size) {
+ update_size = dlsym(RTLD_DEFAULT, "buffer_handler_update_size");
+ if (!update_size) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return;
+ }
+ }
+
+ return update_size(handle, w, h); /*! "void" function can be used with "return" statement */
+}
+
+const char *script_buffer_id(const void *handle)
+{
+ static const char *(*buffer_id)(const void *handle) = NULL;
+
+ if (!buffer_id) {
+ buffer_id = dlsym(RTLD_DEFAULT, "buffer_handler_id");
+ if (!buffer_id) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return NULL;
+ }
+ }
+
+ return buffer_id(handle);
+}
+
+enum buffer_type script_buffer_type(const void *handle)
+{
+ static enum buffer_type (*buffer_type)(const void *handle) = NULL;
+
+ if (!buffer_type) {
+ buffer_type = dlsym(RTLD_DEFAULT, "buffer_handler_type");
+ if (!buffer_type) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return BUFFER_TYPE_ERROR;
+ }
+ }
+
+ return buffer_type(handle);
+}
+
+int script_buffer_pixmap(const void *handle)
+{
+ static int (*buffer_pixmap)(const void *handle) = NULL;
+
+ if (!buffer_pixmap) {
+ buffer_pixmap = dlsym(RTLD_DEFAULT, "buffer_handler_pixmap");
+ if (!buffer_pixmap) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ }
+
+ return buffer_pixmap(handle);
+}
+
+void *script_buffer_pixmap_acquire_buffer(void *handle)
+{
+ static void *(*pixmap_acquire_buffer)(void *handle) = NULL;
+
+ if (!pixmap_acquire_buffer) {
+ pixmap_acquire_buffer = dlsym(RTLD_DEFAULT, "buffer_handler_pixmap_acquire_buffer");
+ if (!pixmap_acquire_buffer) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return NULL;
+ }
+ }
+
+ return pixmap_acquire_buffer(handle);
+}
+
+int script_buffer_pixmap_release_buffer(void *canvas)
+{
+ static int (*pixmap_release_buffer)(void *canvas) = NULL;
+
+ if (!pixmap_release_buffer) {
+ pixmap_release_buffer = dlsym(RTLD_DEFAULT, "buffer_handler_pixmap_release_buffer");
+ if (!pixmap_release_buffer) {
+ ErrPrint("broekn ABI: %s\n", dlerror());
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ }
+
+ return pixmap_release_buffer(canvas);
+}
+
+void *script_buffer_pixmap_ref(void *handle)
+{
+ static void *(*pixmap_ref)(void *handle) = NULL;
+
+ if (!pixmap_ref) {
+ pixmap_ref = dlsym(RTLD_DEFAULT, "buffer_handler_pixmap_ref");
+ if (!pixmap_ref) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return NULL;
+ }
+ }
+
+ return pixmap_ref(handle);
+}
+
+int script_buffer_pixmap_unref(void *buffer_ptr)
+{
+ static int (*pixmap_unref)(void *ptr) = NULL;
+
+ if (!pixmap_unref) {
+ pixmap_unref = dlsym(RTLD_DEFAULT, "buffer_handler_pixmap_unref");
+ if (!pixmap_unref) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ }
+
+ return pixmap_unref(buffer_ptr);
+}
+
+void *script_buffer_pixmap_find(int pixmap)
+{
+ static void *(*pixmap_find)(int pixmap) = NULL;
+
+ if (!pixmap_find) {
+ pixmap_find = dlsym(RTLD_DEFAULT, "buffer_handler_pixmap_find");
+ if (!pixmap_find) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return NULL;
+ }
+ }
+
+ return pixmap_find(pixmap);
+}
+
+void *script_buffer_pixmap_buffer(void *handle)
+{
+ static void *(*pixmap_buffer)(void *handle) = NULL;
+
+ if (!pixmap_buffer) {
+ pixmap_buffer = dlsym(RTLD_DEFAULT, "buffer_handler_pixmap_buffer");
+ if (!pixmap_buffer) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return NULL;
+ }
+ }
+
+ return pixmap_buffer(handle);
+}
+
+void *script_buffer_fb(void *handle)
+{
+ static void *(*buffer_fb)(void *handle) = NULL;
+
+ if (!buffer_fb) {
+ buffer_fb = dlsym(RTLD_DEFAULT, "buffer_handler_fb");
+ if (!buffer_fb) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return NULL;
+ }
+ }
+
+ return buffer_fb(handle);
+}
+
+int script_buffer_get_size(void *handle, int *w, int *h)
+{
+ static int (*get_size)(void *handle, int *w, int *h) = NULL;
+
+ if (!get_size) {
+ get_size = dlsym(RTLD_DEFAULT, "buffer_handler_get_size");
+ if (!get_size) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ }
+
+ return get_size(handle, w, h);
+}
+
+void script_buffer_flush(void *handle)
+{
+ static void (*buffer_flush)(void *handle) = NULL;
+
+ if (!buffer_flush) {
+ buffer_flush = dlsym(RTLD_DEFAULT, "buffer_handler_flush");
+ if (!buffer_flush) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return;
+ }
+ }
+
+ return buffer_flush(handle); /* "void" function can be used to return from this function ;) */
+}
+
+void *script_buffer_instance(void *handle)
+{
+ static void *(*buffer_instance)(void *handle) = NULL;
+
+ if (!buffer_instance) {
+ buffer_instance = dlsym(RTLD_DEFAULT, "buffer_handler_instance");
+ if (!buffer_instance) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return NULL;
+ }
+ }
+
+ return buffer_instance(handle);
+}
+
+void *script_buffer_raw_open(enum buffer_type type, void *resource)
+{
+ static void *(*raw_open)(enum buffer_type type, void *resource) = NULL;
+
+ if (!raw_open) {
+ raw_open = dlsym(RTLD_DEFAULT, "buffer_handler_raw_open");
+ if (!raw_open) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return NULL;
+ }
+ }
+
+ return raw_open(type, resource);
+}
+
+int script_buffer_raw_close(void *buffer)
+{
+ static int (*raw_close)(void *buffer) = NULL;
+
+ if (!raw_close) {
+ raw_close = dlsym(RTLD_DEFAULT, "buffer_handler_raw_close");
+ if (!raw_close) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ }
+
+ return raw_close(buffer);
+}
+
+void *script_buffer_raw_data(void *buffer)
+{
+ static void *(*raw_data)(void *buffer) = NULL;
+
+ if (!raw_data) {
+ raw_data = dlsym(RTLD_DEFAULT, "buffer_handler_raw_data");
+ if (!raw_data) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return NULL;
+ }
+ }
+
+ return raw_data(buffer);
+}
+
+int script_buffer_raw_size(void *buffer)
+{
+ static int (*raw_size)(void *buffer) = NULL;
+
+ if (!raw_size) {
+ raw_size = dlsym(RTLD_DEFAULT, "buffer_handler_raw_size");
+ if (!raw_size) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ }
+
+ return raw_size(buffer);
+}
+
+int script_buffer_lock(void *handle)
+{
+ static int (*buffer_lock)(void *handle) = NULL;
+
+ if (!buffer_lock) {
+ buffer_lock = dlsym(RTLD_DEFAULT, "buffer_handler_lock");
+ if (!buffer_lock) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ }
+
+ return buffer_lock(handle);
+}
+
+int script_buffer_unlock(void *handle)
+{
+ static int (*buffer_unlock)(void *handle) = NULL;
+
+ if (!buffer_unlock) {
+ buffer_unlock = dlsym(RTLD_DEFAULT, "buffer_handler_unlock");
+ if (!buffer_unlock) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ }
+
+ return buffer_unlock(handle);
+}
+
+int script_buffer_signal_emit(void *buffer_handle, const char *part, const char *signal, double x, double y, double ex, double ey)
+{
+ static int (*signal_emit)(void *buffer_handle, const char *part, const char *signal, double x, double y, double ex, double ey) = NULL;
+
+ if (!signal_emit) {
+ signal_emit = dlsym(RTLD_DEFAULT, "script_signal_emit");
+ if (!signal_emit) {
+ ErrPrint("broken ABI: %s\n", dlerror());
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ }
+
+ return signal_emit(buffer_handle, part, signal, x, y, ex, ey);
+}
+
+/* End of a file */
+
diff --git a/src/script_port.c b/src/script_port.c
index c94ddea..88cfa2f 100644
--- a/src/script_port.c
+++ b/src/script_port.c
@@ -28,6 +28,7 @@
#include <Ecore_Evas.h>
#include <Eet.h>
#include <Ecore_X.h>
+//#include <efl_assist.h>
#include <system_settings.h>
@@ -38,18 +39,13 @@
#include <livebox-service.h>
#include "script_port.h"
+#include "abi.h"
#define TEXT_CLASS "tizen"
#define DEFAULT_FONT_SIZE -100
#define PUBLIC __attribute__((visibility("default")))
-#if defined(TIZEN_ENGINEER_MODE)
-#define ENGINEER_MODE_ENABLED 1
-#else
-#define ENGINEER_MODE_ENABLED 0
-#endif
-
struct image_option {
int orient;
int aspect;
@@ -75,16 +71,20 @@ struct info {
char *file;
char *group;
char *category;
- int w;
- int h;
int is_mouse_down;
+ void *buffer_handle;
+ Ecore_Evas *ee;
Evas *e;
+
Evas_Object *parent;
Eina_List *obj_list;
- Eina_List *access_chain;
+
+ int (*render_pre)(void *buffer_handle, void *data);
+ int (*render_post)(void *render_handle, void *data);
+ void *render_data;
};
struct child {
@@ -96,18 +96,23 @@ struct obj_info {
char *id;
Eina_List *children;
Evas_Object *parent;
+ int delete_me;
};
static struct {
char *font_name;
int font_size;
+ int access_on;
Eina_List *handle_list;
+ int premultiplied;
} s_info = {
.font_name = NULL,
.font_size = -100,
.handle_list = NULL,
+ .access_on = 0,
+ .premultiplied = 1,
};
static inline Evas_Object *find_edje(struct info *handle, const char *id)
@@ -147,7 +152,7 @@ PUBLIC const char *script_magic_id(void)
return "edje";
}
-PUBLIC int script_update_color(void *h, Evas *e, const char *id, const char *part, const char *rgba)
+PUBLIC int script_update_color(void *h, const char *id, const char *part, const char *rgba)
{
struct info *handle = h;
Evas_Object *edje;
@@ -179,8 +184,6 @@ PUBLIC int script_update_color(void *h, Evas *e, const char *id, const char *par
static void activate_cb(void *data, Evas_Object *part_obj, Elm_Object_Item *item)
{
- Evas_Object *ao;
- Evas_Object *edje;
Evas *e;
int x;
int y;
@@ -188,16 +191,6 @@ static void activate_cb(void *data, Evas_Object *part_obj, Elm_Object_Item *item
int h;
double timestamp;
- ao = evas_object_data_get(part_obj, "ao");
- if (!ao) {
- return;
- }
-
- edje = evas_object_data_get(ao, "edje");
- if (!edje) {
- return;
- }
-
e = evas_object_evas_get(part_obj);
evas_object_geometry_get(part_obj, &x, &y, &w, &h);
x += w / 2;
@@ -222,25 +215,18 @@ static void activate_cb(void *data, Evas_Object *part_obj, Elm_Object_Item *item
evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, (timestamp + 0.03f) * 1000, NULL);
}
-static void access_del_cb(void *_info, Evas *e, Evas_Object *ao, void *event_info)
+static void update_focus_chain(struct info *handle, Evas_Object *ao)
{
- struct info *handle = _info;
- Evas_Object *edje_part;
+ const Eina_List *list;
- edje_part = evas_object_data_del(ao, "edje,part");
-
- /*!
- * \note
- * (void)evas_object_data_del(ao, "edje");
- * edje_part will delete the "ao" tag when it is deleted.
- * (void)evas_object_data_del(edje_part, "ao");
- */
-
- handle->access_chain = eina_list_remove(handle->access_chain, edje_part);
- DbgPrint("AO(%p) is removed from local access chain\n", ao);
+ list = elm_object_focus_custom_chain_get(handle->parent);
+ if (!eina_list_data_find(list, ao)) {
+ DbgPrint("Append again to the focus chain\n");
+ elm_object_focus_custom_chain_append(handle->parent, ao, NULL);
+ }
}
-PUBLIC int script_update_text(void *h, Evas *e, const char *id, const char *part, const char *text)
+PUBLIC int script_update_text(void *h, const char *id, const char *part, const char *text)
{
struct obj_info *obj_info;
struct info *handle = h;
@@ -273,23 +259,15 @@ PUBLIC int script_update_text(void *h, Evas *e, const char *id, const char *part
ErrPrint("Unable to register an access object(%s)\n", part);
goto out;
}
- handle->access_chain = eina_list_append(handle->access_chain, edje_part);
+
evas_object_data_set(edje_part, "ao", ao);
- evas_object_data_set(ao, "edje", edje);
- evas_object_data_set(ao, "edje,part", edje_part);
elm_access_activate_cb_set(ao, activate_cb, NULL);
elm_object_focus_custom_chain_append(handle->parent, ao, NULL);
- evas_object_event_callback_add(ao, EVAS_CALLBACK_DEL, access_del_cb, handle);
DbgPrint("[%s] Register access info: (%s) to, %p\n", part, text, handle->parent);
}
if (!text || !strlen(text)) {
- /*
- handle->access_chain = eina_list_remove(handle->access_chain, edje_part);
- (void)evas_object_data_del(edje_part, "ao");
- (void)evas_object_data_del(ao, "edje");
- */
/*!
* \note
* Delete callback will be called
@@ -303,12 +281,6 @@ PUBLIC int script_update_text(void *h, Evas *e, const char *id, const char *part
utf8 = elm_entry_markup_to_utf8(text);
if ((!utf8 || !strlen(utf8))) {
free(utf8);
-
- /*
- handle->access_chain = eina_list_remove(handle->access_chain, edje_part);
- (void)evas_object_data_del(edje_part, "ao");
- (void)evas_object_data_del(ao, "edje");
- */
/*!
* \note
* Delete callback will be called
@@ -321,6 +293,8 @@ PUBLIC int script_update_text(void *h, Evas *e, const char *id, const char *part
elm_access_info_set(ao, ELM_ACCESS_INFO, utf8);
free(utf8);
+
+ update_focus_chain(handle, ao);
} else {
ErrPrint("Unable to get text part[%s]\n", part);
}
@@ -552,7 +526,7 @@ static inline void parse_image_option(const char *option, struct image_option *i
}
}
-PUBLIC int script_update_access(void *_h, Evas *e, const char *id, const char *part, const char *text, const char *option)
+PUBLIC int script_update_access(void *_h, const char *id, const char *part, const char *text, const char *option)
{
struct info *handle = _h;
Evas_Object *edje;
@@ -579,13 +553,9 @@ PUBLIC int script_update_access(void *_h, Evas *e, const char *id, const char *p
if (ao) {
if (text && strlen(text)) {
elm_access_info_set(ao, ELM_ACCESS_INFO, text);
- DbgPrint("Access info is updated: [%s]\n", text);
+ DbgPrint("Access info is updated: %s [%s], %p\n", part, text, ao);
+ update_focus_chain(handle, ao);
} else {
- /*
- handle->access_chain = eina_list_remove(handle->access_chain, edje_part);
- (void)evas_object_data_del(edje_part, "ao");
- (void)evas_object_data_del(ao, "edje");
- */
/*!
* \note
* Delete clalback will be called
@@ -599,14 +569,11 @@ PUBLIC int script_update_access(void *_h, Evas *e, const char *id, const char *p
ErrPrint("Unable to register an access object(%s)\n", part);
} else {
elm_access_info_set(ao, ELM_ACCESS_INFO, text);
- handle->access_chain = eina_list_append(handle->access_chain, edje_part);
+
evas_object_data_set(edje_part, "ao", ao);
- evas_object_data_set(ao, "edje", edje);
- evas_object_data_set(ao, "edje,part", edje_part);
elm_object_focus_custom_chain_append(handle->parent, ao, NULL);
elm_access_activate_cb_set(ao, activate_cb, NULL);
- evas_object_event_callback_add(ao, EVAS_CALLBACK_DEL, access_del_cb, handle);
- DbgPrint("[%s] Register access info: (%s) to, %p\n", part, text, handle->parent);
+ DbgPrint("[%s] Register access info: (%s) to, %p (%p)\n", part, text, handle->parent, ao);
}
}
} else {
@@ -616,7 +583,7 @@ PUBLIC int script_update_access(void *_h, Evas *e, const char *id, const char *p
return LB_STATUS_SUCCESS;
}
-PUBLIC int script_operate_access(void *_h, Evas *e, const char *id, const char *part, const char *operation, const char *option)
+PUBLIC int script_operate_access(void *_h, const char *id, const char *part, const char *operation, const char *option)
{
struct info *handle = _h;
Evas_Object *edje;
@@ -690,6 +657,9 @@ PUBLIC int script_operate_access(void *_h, Evas *e, const char *id, const char *
if (ret == EINA_FALSE) {
ErrPrint("Action error\n");
}
+ } else if (!strcasecmp(operation, "reset,focus")) {
+ DbgPrint("Reset Focus\n");
+ elm_object_focus_custom_chain_set(edje, NULL);
}
out:
@@ -698,12 +668,13 @@ out:
static inline void apply_shadow_effect(struct image_option *img_opt, Evas_Object *img)
{
+/*
+ ea_effect_h *ea_effect;
+
if (!img_opt->shadow.enabled) {
return;
}
- /*
- ea_effect_h *ea_effect;
ea_effect = ea_image_effect_create();
if (!ea_effect) {
return;
@@ -713,18 +684,11 @@ static inline void apply_shadow_effect(struct image_option *img_opt, Evas_Object
ea_image_effect_add_outer_shadow(ea_effect, img_opt->shadow.angle, img_opt->shadow.offset, img_opt->shadow.softness, img_opt->shadow.color);
ea_object_image_effect_set(img, ea_effect);
- if (ENGINEER_MODE_ENABLED) {
- int x, y, w, h;
- ea_image_effect_offset_get(ea_effect, &x, &y);
- evas_object_image_size_get(img, &w, &h);
- DbgPrint("Effect applied (%dx%d) - (%dx%d), (%d,%d,%d,%d)\n", x, y, w, h, img_opt->shadow.angle, img_opt->shadow.offset, img_opt->shadow.softness, img_opt->shadow.color);
- }
-
ea_image_effect_destroy(ea_effect);
- */
+*/
}
-PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *part, const char *path, const char *option)
+PUBLIC int script_update_image(void *_h, const char *id, const char *part, const char *path, const char *option)
{
struct info *handle = _h;
Evas_Load_Error err;
@@ -732,7 +696,6 @@ PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *pa
Evas_Object *img;
Evas_Coord w, h;
struct obj_info *obj_info;
- struct child *child;
struct image_option img_opt = {
.aspect = 0,
.orient = 0,
@@ -758,20 +721,6 @@ PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *pa
img = elm_object_part_content_unset(edje, part);
if (img) {
- Eina_List *l;
- Eina_List *n;
-
- EINA_LIST_FOREACH_SAFE(obj_info->children, l, n, child) {
- if (child->obj != img) {
- continue;
- }
-
- obj_info->children = eina_list_remove(obj_info->children, child);
- free(child->part);
- free(child);
- break;
- }
-
DbgPrint("delete object %s %p\n", part, img);
evas_object_del(img);
}
@@ -781,24 +730,9 @@ PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *pa
return LB_STATUS_SUCCESS;
}
- child = malloc(sizeof(*child));
- if (!child) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return LB_STATUS_ERROR_MEMORY;
- }
-
- child->part = strdup(part);
- if (!child->part) {
- ErrPrint("Heap: %s\n", strerror(errno));
- free(child);
- return LB_STATUS_ERROR_MEMORY;
- }
-
- img = evas_object_image_add(e);
+ img = evas_object_image_add(handle->e);
if (!img) {
ErrPrint("Failed to add an image object\n");
- free(child->part);
- free(child);
return LB_STATUS_ERROR_FAULT;
}
@@ -811,8 +745,6 @@ PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *pa
if (err != EVAS_LOAD_ERROR_NONE) {
ErrPrint("Load error: %s\n", evas_load_error_str(err));
evas_object_del(img);
- free(child->part);
- free(child);
return LB_STATUS_ERROR_IO;
}
@@ -852,8 +784,6 @@ PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *pa
if (!part_w || !part_h || !w || !h) {
evas_object_del(img);
- free(child->part);
- free(child);
return LB_STATUS_ERROR_INVALID;
}
@@ -875,8 +805,6 @@ PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *pa
if (!ee) {
ErrPrint("Failed to create a EE\n");
evas_object_del(img);
- free(child->part);
- free(child);
return LB_STATUS_ERROR_FAULT;
}
@@ -886,10 +814,7 @@ PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *pa
if (!e) {
ErrPrint("Unable to get Evas\n");
ecore_evas_free(ee);
-
evas_object_del(img);
- free(child->part);
- free(child);
return LB_STATUS_ERROR_FAULT;
}
@@ -897,10 +822,7 @@ PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *pa
if (!src_img) {
ErrPrint("Unable to add an image\n");
ecore_evas_free(ee);
-
evas_object_del(img);
- free(child->part);
- free(child);
return LB_STATUS_ERROR_FAULT;
}
@@ -914,10 +836,7 @@ PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *pa
ErrPrint("Load error: %s\n", evas_load_error_str(err));
evas_object_del(src_img);
ecore_evas_free(ee);
-
evas_object_del(img);
- free(child->part);
- free(child);
return LB_STATUS_ERROR_IO;
}
evas_object_image_size_get(src_img, &rw, &rh);
@@ -931,10 +850,7 @@ PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *pa
ErrPrint("Unable to get pixels\n");
evas_object_del(src_img);
ecore_evas_free(ee);
-
evas_object_del(img);
- free(child->part);
- free(child);
return LB_STATUS_ERROR_IO;
}
@@ -944,9 +860,6 @@ PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *pa
if (!img) {
evas_object_del(src_img);
ecore_evas_free(ee);
-
- free(child->part);
- free(child);
return LB_STATUS_ERROR_MEMORY;
}
@@ -1022,9 +935,7 @@ PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *pa
* object will be shown by below statement automatically
*/
DbgPrint("%s part swallow image %p (%dx%d)\n", part, img, w, h);
- child->obj = img;
elm_object_part_content_set(edje, part, img);
- obj_info->children = eina_list_append(obj_info->children, child);
/*!
* \note
@@ -1063,7 +974,7 @@ static void script_signal_cb(void *data, Evas_Object *obj, const char *emission,
ey = (double)(py + ph) / (double)h;
}
- script_signal_emit(handle->e, source, emission, sx, sy, ex, ey);
+ script_buffer_signal_emit(handle->buffer_handle, source, emission, sx, sy, ex, ey);
}
static void edje_del_cb(void *_info, Evas *e, Evas_Object *obj, void *event_info)
@@ -1075,82 +986,61 @@ static void edje_del_cb(void *_info, Evas *e, Evas_Object *obj, void *event_info
handle->obj_list = eina_list_remove(handle->obj_list, obj);
- obj_info = evas_object_data_del(obj, "obj_info");
+ obj_info = evas_object_data_get(obj, "obj_info");
if (!obj_info) {
ErrPrint("Object info is not valid\n");
return;
}
+ elm_object_signal_callback_del(obj, "*", "*", script_signal_cb);
+
DbgPrint("delete object %s %p\n", obj_info->id, obj);
- parent_obj_info = evas_object_data_get(obj_info->parent, "obj_info");
- if (parent_obj_info) {
+ if (obj_info->parent == obj) {
+ DbgPrint("Parent EDJE\n");
+ } else if (obj_info->parent) {
Eina_List *l;
Eina_List *n;
- EINA_LIST_FOREACH_SAFE(parent_obj_info->children, l, n, child) {
- if (child->obj != obj) {
- continue;
+ parent_obj_info = evas_object_data_get(obj_info->parent, "obj_info");
+ if (parent_obj_info) {
+ EINA_LIST_FOREACH_SAFE(parent_obj_info->children, l, n, child) {
+ if (child->obj != obj) {
+ continue;
+ }
+
+ /*!
+ * \note
+ * If this code is executed,
+ * The parent is not deleted by desc, this object is deleted by itself.
+ * It is not possible, but we care it.
+ */
+ DbgPrint("Children is updated: %s (%s)\n", child->part, parent_obj_info->id);
+ parent_obj_info->children = eina_list_remove(parent_obj_info->children, child);
+ free(child->part);
+ free(child);
+ break;
}
- /*!
- * \note
- * If this code is executed,
- * The parent is not deleted by desc, this object is deleted by itself.
- * It is not possible, but we care it.
- */
- DbgPrint("Parent's children is updated: %s\n", child->part);
- parent_obj_info->children = eina_list_remove(parent_obj_info->children, child);
- free(child->part);
- free(child);
- break;
+ if (!parent_obj_info->children && parent_obj_info->delete_me == 1) {
+ DbgPrint("Children is cleared: %s (by a child)\n", parent_obj_info->id);
+ evas_object_data_del(obj_info->parent, "obj_info");
+ free(parent_obj_info->id);
+ free(parent_obj_info);
+ }
}
} else {
- DbgPrint("Parent EDJE\n");
- }
-
- elm_object_signal_callback_del(obj, "*", "*", script_signal_cb);
-
- EINA_LIST_FREE(obj_info->children, child) {
- DbgPrint("delete object %s %p\n", child->part, child->obj);
- if (child->obj) {
- evas_object_del(child->obj);
- }
- free(child->part);
- free(child);
+ DbgPrint("obj_info->parent is NULL (skipped)\n");
}
-#if 0
- Eina_List *l;
- Eina_List *n;
- Evas_Object *ao;
- Evas_Object *edje_part;
- Evas_Object *edje;
- EINA_LIST_FOREACH_SAFE(handle->access_chain, l, n, edje_part) {
- ao = evas_object_data_get(edje_part, "ao");
- if (ao) {
- edje = evas_object_data_get(ao, "edje");
- } else {
- ErrPrint("edje_part has no ao\n");
- continue;
- }
-
- if (edje == obj) {
- /*!
- handle->access_chain = eina_list_remove(handle->access_chain, edje_part);
- (void)evas_object_data_del(edje_part, "ao");
- (void)evas_object_data_del(ao, "edje");
- */
- /*!
- * Delete callback will be called
- */
- DbgPrint("Remove access object(%p)\n", ao);
- elm_access_object_unregister(ao);
- }
+ if (!obj_info->children) {
+ DbgPrint("Children is cleared: %s\n", obj_info->id);
+ evas_object_data_del(obj, "obj_info");
+ free(obj_info->id);
+ free(obj_info);
+ } else {
+ DbgPrint("Children is remained: %s\n", obj_info->id);
+ obj_info->delete_me = 1;
}
-#endif
-
- free(obj_info->id);
- free(obj_info);
}
static inline Evas_Object *get_highlighted_object(Evas_Object *obj)
@@ -1158,7 +1048,9 @@ static inline Evas_Object *get_highlighted_object(Evas_Object *obj)
Evas_Object *o, *ho;
o = evas_object_name_find(evas_object_evas_get(obj), "_elm_access_disp");
- if (!o) return NULL;
+ if (!o) {
+ return NULL;
+ }
ho = evas_object_data_get(o, "_elm_access_target");
return ho;
@@ -1172,7 +1064,7 @@ static inline Evas_Object *get_highlighted_object(Evas_Object *obj)
LB_ACCESS_ACTION 4
LB_ACCESS_SCROLL 5
*/
-PUBLIC int script_feed_event(void *h, Evas *e, int event_type, int x, int y, int down, double timestamp)
+PUBLIC int script_feed_event(void *h, int event_type, int x, int y, int down, unsigned int keycode, double timestamp)
{
struct info *handle = h;
Evas_Object *edje;
@@ -1306,39 +1198,84 @@ PUBLIC int script_feed_event(void *h, Evas *e, int event_type, int x, int y, int
switch (event_type) {
case LB_SCRIPT_MOUSE_DOWN:
if (handle->is_mouse_down == 0) {
- evas_event_feed_mouse_move(e, x, y, timestamp * 1000, NULL);
- evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, (timestamp + 0.01f) * 1000, NULL);
+ evas_event_feed_mouse_move(handle->e, x, y, timestamp * 1000, NULL);
+ evas_event_feed_mouse_down(handle->e, 1, EVAS_BUTTON_NONE, (timestamp + 0.01f) * 1000, NULL);
handle->is_mouse_down = 1;
}
break;
case LB_SCRIPT_MOUSE_MOVE:
- evas_event_feed_mouse_move(e, x, y, timestamp * 1000, NULL);
+ evas_event_feed_mouse_move(handle->e, x, y, timestamp * 1000, NULL);
break;
case LB_SCRIPT_MOUSE_UP:
if (handle->is_mouse_down == 1) {
- evas_event_feed_mouse_move(e, x, y, timestamp * 1000, NULL);
- evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, (timestamp + 0.01f) * 1000, NULL);
+ evas_event_feed_mouse_move(handle->e, x, y, timestamp * 1000, NULL);
+ evas_event_feed_mouse_up(handle->e, 1, EVAS_BUTTON_NONE, (timestamp + 0.01f) * 1000, NULL);
handle->is_mouse_down = 0;
}
break;
case LB_SCRIPT_MOUSE_IN:
- evas_event_feed_mouse_in(e, timestamp * 1000, NULL);
+ evas_event_feed_mouse_in(handle->e, timestamp * 1000, NULL);
break;
case LB_SCRIPT_MOUSE_OUT:
- evas_event_feed_mouse_out(e, timestamp * 1000, NULL);
+ evas_event_feed_mouse_out(handle->e, timestamp * 1000, NULL);
break;
default:
return LB_STATUS_ERROR_INVALID;
}
} else if (event_type & LB_SCRIPT_KEY_EVENT) {
- DbgPrint("Key event is not implemented\n");
- return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+ const char *keyname = "";
+ const char *key = "";
+ const char *string = "";
+ const char *compose = "";
+
+ switch (event_type) {
+ case LB_SCRIPT_KEY_DOWN:
+ evas_event_feed_key_down(handle->e, keyname, key, string, compose, timestamp * 1000, NULL);
+ ret = LB_KEY_STATUS_DONE;
+ /*!
+ * \TODO
+ * If the keyname == RIGHT, Need to check that
+ * Does it reach to the last focusable object?
+ */
+
+ /*!
+ * if (REACH to the LAST) {
+ * ret = LB_KEY_STATUS_LAST;
+ * } else {
+ * ret = LB_KEY_STATUS_DONE;
+ * }
+ *
+ * if (REACH to the FIRST) {
+ * ret = LB_KEY_STATUS_FIRST;
+ * } else {
+ * ret = LB_KEY_STATUS_DONE;
+ * }
+ */
+ break;
+ case LB_SCRIPT_KEY_UP:
+ evas_event_feed_key_up(handle->e, keyname, key, string, compose, timestamp * 1000, NULL);
+ ret = LB_KEY_STATUS_DONE;
+ break;
+ case LB_SCRIPT_KEY_FOCUS_IN:
+ // evas_event_callback_call(handle->e, EVAS_CALLBACK_CANVAS_FOCUS_IN, NULL);
+ ret = LB_KEY_STATUS_DONE;
+ break;
+ case LB_SCRIPT_KEY_FOCUS_OUT:
+ // evas_event_callback_call(handle->e, EVAS_CALLBACK_CANVAS_FOCUS_OUT, NULL);
+ ret = LB_KEY_STATUS_DONE;
+ break;
+ default:
+ DbgPrint("Event is not implemented\n");
+ ret = LB_KEY_STATUS_ERROR;
+ break;
+ }
+
}
return ret;
}
-PUBLIC int script_update_script(void *h, Evas *e, const char *src_id, const char *target_id, const char *part, const char *path, const char *group)
+PUBLIC int script_update_script(void *h, const char *src_id, const char *target_id, const char *part, const char *path, const char *group)
{
struct info *handle = h;
Evas_Object *edje;
@@ -1361,21 +1298,6 @@ PUBLIC int script_update_script(void *h, Evas *e, const char *src_id, const char
obj = elm_object_part_content_unset(edje, part);
if (obj) {
- Eina_List *l;
- Eina_List *n;
-
- EINA_LIST_FOREACH_SAFE(obj_info->children, l, n, child) {
- if (child->obj != obj) {
- continue;
- }
-
- obj_info->children = eina_list_remove(obj_info->children, child);
-
- free(child->part);
- free(child);
- break;
- }
-
DbgPrint("delete object %s %p\n", part, obj);
/*!
* \note
@@ -1488,7 +1410,7 @@ PUBLIC int script_update_script(void *h, Evas *e, const char *src_id, const char
return LB_STATUS_SUCCESS;
}
-PUBLIC int script_update_signal(void *h, Evas *e, const char *id, const char *part, const char *signal)
+PUBLIC int script_update_signal(void *h, const char *id, const char *part, const char *signal)
{
struct info *handle = h;
Evas_Object *edje;
@@ -1502,7 +1424,7 @@ PUBLIC int script_update_signal(void *h, Evas *e, const char *id, const char *pa
return LB_STATUS_SUCCESS;
}
-PUBLIC int script_update_drag(void *h, Evas *e, const char *id, const char *part, double x, double y)
+PUBLIC int script_update_drag(void *h, const char *id, const char *part, double x, double y)
{
struct info *handle = h;
Evas_Object *edje;
@@ -1516,7 +1438,7 @@ PUBLIC int script_update_drag(void *h, Evas *e, const char *id, const char *part
return LB_STATUS_SUCCESS;
}
-PUBLIC int script_update_size(void *han, Evas *e, const char *id, int w, int h)
+PUBLIC int script_update_size(void *han, const char *id, int w, int h)
{
struct info *handle = han;
Evas_Object *edje;
@@ -1527,8 +1449,11 @@ PUBLIC int script_update_size(void *han, Evas *e, const char *id, int w, int h)
}
if (!id) {
- handle->w = w;
- handle->h = h;
+ /*!
+ * \note
+ * Need to resize the canvas too
+ */
+ ecore_evas_resize(handle->ee, w, h);
}
DbgPrint("Resize object to %dx%d\n", w, h);
@@ -1536,7 +1461,7 @@ PUBLIC int script_update_size(void *han, Evas *e, const char *id, int w, int h)
return LB_STATUS_SUCCESS;
}
-PUBLIC int script_update_category(void *h, Evas *e, const char *id, const char *category)
+PUBLIC int script_update_category(void *h, const char *id, const char *category)
{
struct info *handle = h;
@@ -1558,7 +1483,7 @@ PUBLIC int script_update_category(void *h, Evas *e, const char *id, const char *
return LB_STATUS_SUCCESS;
}
-PUBLIC void *script_create(const char *file, const char *group)
+PUBLIC void *script_create(void *buffer_handle, const char *file, const char *group)
{
struct info *handle;
@@ -1583,6 +1508,8 @@ PUBLIC void *script_create(const char *file, const char *group)
return NULL;
}
+ handle->buffer_handle = buffer_handle;
+
s_info.handle_list = eina_list_append(s_info.handle_list, handle);
return handle;
@@ -1607,6 +1534,7 @@ PUBLIC int script_destroy(void *_handle)
evas_object_del(edje);
}
+ DbgPrint("Release handle\n");
free(handle->category);
free(handle->file);
free(handle->group);
@@ -1614,24 +1542,221 @@ PUBLIC int script_destroy(void *_handle)
return LB_STATUS_SUCCESS;
}
-PUBLIC int script_load(void *_handle, Evas *e, int w, int h)
+static void sw_render_pre_cb(void *data, Evas *e, void *event_info)
+{
+ struct info *handle = data;
+
+ if (handle->render_pre) {
+ handle->render_pre(handle->buffer_handle, handle->render_data);
+ }
+
+ script_buffer_lock(handle->buffer_handle);
+
+ if (s_info.premultiplied) {
+ int w;
+ int h;
+
+ script_buffer_get_size(handle->buffer_handle, &w, &h);
+ evas_damage_rectangle_add(handle->e, 0, 0, w, h);
+ }
+}
+
+static void sw_render_post_cb(void *data, Evas *e, void *event_info)
+{
+ struct info *handle = data;
+
+ if (s_info.premultiplied) {
+ void *canvas;
+ int x, y, w, h;
+
+ // Get a pointer of a buffer of the virtual canvas
+ canvas = (void *)ecore_evas_buffer_pixels_get(handle->ee);
+ if (!canvas) {
+ ErrPrint("Failed to get pixel canvas\n");
+ return;
+ }
+
+ ecore_evas_geometry_get(handle->ee, &x, &y, &w, &h);
+ evas_data_argb_unpremul(canvas, w * h);
+ }
+
+ script_buffer_unlock(handle->buffer_handle);
+
+ if (handle->render_post) {
+ handle->render_post(handle->buffer_handle, handle->render_data);
+ }
+}
+
+static void render_pre_cb(void *data, Evas *e, void *event_info)
+{
+ struct info *handle = data;
+ void *canvas;
+
+ canvas = script_buffer_pixmap_acquire_buffer(handle->buffer_handle);
+ if (!canvas) {
+ ErrPrint("Acquired buffer is NULL\n");
+ }
+
+ sw_render_pre_cb(data, handle->e, event_info);
+}
+
+static void render_post_cb(void *data, Evas *e, void *event_info)
+{
+ struct info *handle = data;
+ void *canvas;
+
+ sw_render_post_cb(data, handle->e, event_info);
+ canvas = script_buffer_pixmap_buffer(handle->buffer_handle);
+ if (!canvas) {
+ ErrPrint("Acquired buffer is NULL\n");
+ } else {
+ script_buffer_pixmap_release_buffer(canvas);
+ }
+}
+
+static void *alloc_fb(void *data, int size)
+{
+ struct info *handle = data;
+
+ if (script_buffer_load(handle->buffer_handle) < 0) {
+ ErrPrint("Failed to load buffer handler\n");
+ return NULL;
+ }
+
+ return script_buffer_fb(handle->buffer_handle);
+}
+
+static void free_fb(void *data, void *ptr)
+{
+ struct info *handle = data;
+
+ if (!handle->buffer_handle) {
+ ErrPrint("Buffer is not valid (maybe already released)\n");
+ return;
+ }
+
+ if (script_buffer_fb(handle->buffer_handle) != ptr) {
+ ErrPrint("Buffer pointer is not matched\n");
+ }
+
+ (void)script_buffer_unload(handle->buffer_handle);
+}
+
+static int destroy_ecore_evas(struct info *handle)
+{
+ if (!handle->ee) {
+ return LB_STATUS_SUCCESS;
+ }
+ ecore_evas_free(handle->ee);
+ handle->ee = NULL;
+ handle->e = NULL;
+ return LB_STATUS_SUCCESS;
+}
+
+static int create_ecore_evas(struct info *handle, int *w, int *h)
+{
+ script_buffer_get_size(handle->buffer_handle, w, h);
+ if (*w == 0 && *h == 0) {
+ ErrPrint("ZERO size FB accessed\n");
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ if (handle->ee) {
+ int ow = 0;
+ int oh = 0;
+
+ ecore_evas_geometry_get(handle->ee, NULL, NULL, &ow, &oh);
+ if (*w != ow || *h != oh) {
+ ErrPrint("EE exists, But different size - buffer_handle(%dx%d) -> ee(%dx%d)\n", ow, oh, *w, *h);
+ ecore_evas_resize(handle->ee, *w, *h);
+ }
+
+ return LB_STATUS_SUCCESS;
+ }
+
+ handle->ee = ecore_evas_buffer_allocfunc_new(*w, *h, alloc_fb, free_fb, handle);
+ if (!handle->ee) {
+ ErrPrint("Failed to create a buffer\n");
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ handle->e = ecore_evas_get(handle->ee);
+ if (!handle->e) {
+ ErrPrint("Failed to get an Evas\n");
+ ecore_evas_free(handle->ee);
+ handle->ee = NULL;
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ if (script_buffer_type(handle->buffer_handle) == BUFFER_TYPE_PIXMAP) {
+ void *canvas;
+
+ evas_event_callback_add(handle->e, EVAS_CALLBACK_RENDER_PRE, render_pre_cb, handle);
+ evas_event_callback_add(handle->e, EVAS_CALLBACK_RENDER_POST, render_post_cb, handle);
+
+ /*
+ * \note
+ * ecore_evas_alpha_set tries to access the canvas buffer.
+ * Without any render_pre/render_post callback.
+ */
+ canvas = script_buffer_pixmap_acquire_buffer(handle->buffer_handle);
+ if (!canvas) {
+ ErrPrint("Acquired buffer is NULL\n");
+ } else {
+ ecore_evas_alpha_set(handle->ee, EINA_TRUE);
+ script_buffer_pixmap_release_buffer(canvas);
+ }
+ } else {
+ evas_event_callback_add(handle->e, EVAS_CALLBACK_RENDER_PRE, sw_render_pre_cb, handle);
+ evas_event_callback_add(handle->e, EVAS_CALLBACK_RENDER_POST, sw_render_post_cb, handle);
+ ecore_evas_alpha_set(handle->ee, EINA_TRUE);
+ }
+
+ ecore_evas_manual_render_set(handle->ee, EINA_FALSE);
+ ecore_evas_resize(handle->ee, *w, *h);
+ ecore_evas_show(handle->ee);
+ ecore_evas_activate(handle->ee);
+
+ return LB_STATUS_SUCCESS;
+}
+
+PUBLIC int script_load(void *_handle, int (*render_pre)(void *buffer_handle, void *data), int (*render_post)(void *render_handle, void *data), void *data)
{
struct info *handle;
Evas_Object *edje;
struct obj_info *obj_info;
+ int ret;
+ int w;
+ int h;
+
+ /*!
+ * \TODO
+ * Create "Ecore_Evas *"
+ */
handle = _handle;
+ handle->render_pre = render_pre;
+ handle->render_post = render_post;
+ handle->render_data = data;
+
+ ret = create_ecore_evas(handle, &w, &h);
+ if (ret < 0) {
+ return ret;
+ }
+
obj_info = calloc(1, sizeof(*obj_info));
if (!obj_info) {
ErrPrint("Heap: %s\n", strerror(errno));
+ destroy_ecore_evas(handle);
return LB_STATUS_ERROR_MEMORY;
}
- obj_info->parent = evas_object_rectangle_add(e);
+ obj_info->parent = evas_object_rectangle_add(handle->e);
if (!obj_info->parent) {
ErrPrint("Unable to create a parent box\n");
free(obj_info);
+ destroy_ecore_evas(handle);
return LB_STATUS_ERROR_FAULT;
}
@@ -1640,6 +1765,7 @@ PUBLIC int script_load(void *_handle, Evas *e, int w, int h)
ErrPrint("Failed to create an edje object\n");
evas_object_del(obj_info->parent);
free(obj_info);
+ destroy_ecore_evas(handle);
return LB_STATUS_ERROR_FAULT;
}
@@ -1653,19 +1779,17 @@ PUBLIC int script_load(void *_handle, Evas *e, int w, int h)
evas_object_del(edje);
evas_object_del(obj_info->parent);
free(obj_info);
+ destroy_ecore_evas(handle);
return LB_STATUS_ERROR_IO;
}
- handle->e = e;
- handle->w = w;
- handle->h = h;
handle->parent = edje;
elm_object_signal_callback_add(edje, "*", "*", script_signal_cb, handle);
evas_object_event_callback_add(edje, EVAS_CALLBACK_DEL, edje_del_cb, handle);
evas_object_size_hint_weight_set(edje, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_fill_set(edje, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_resize(edje, handle->w, handle->h);
+ evas_object_resize(edje, w, h);
evas_object_show(edje);
evas_object_data_set(edje, "obj_info", obj_info);
@@ -1673,31 +1797,23 @@ PUBLIC int script_load(void *_handle, Evas *e, int w, int h)
return LB_STATUS_SUCCESS;
}
-PUBLIC int script_unload(void *_handle, Evas *e)
+PUBLIC int script_unload(void *_handle)
{
struct info *handle;
- Evas_Object *edje;
- Evas_Object *parent = NULL;
- handle = _handle;
-
- edje = eina_list_nth(handle->obj_list, 0);
- if (edje) {
- struct obj_info *obj_info;
+ /*!
+ * \TODO
+ * Destroy "Ecore_Evas *"
+ */
- obj_info = evas_object_data_get(edje, "obj_info");
- if (obj_info) {
- parent = obj_info->parent;
- }
- evas_object_del(edje);
- }
+ handle = _handle;
- if (parent) {
+ if (handle->parent) {
DbgPrint("Delete parent box\n");
- evas_object_del(parent);
+ evas_object_del(handle->parent);
}
- handle->e = NULL;
+ (void)destroy_ecore_evas(handle);
return LB_STATUS_SUCCESS;
}
@@ -1716,6 +1832,7 @@ static void access_cb(keynode_t *node, void *user_data)
DbgPrint("ELM CONFIG ACCESS: %d\n", state);
elm_config_access_set(state);
+ s_info.access_on = state;
}
static void update_font_cb(void *data)
@@ -1728,7 +1845,11 @@ static void font_changed_cb(keynode_t *node, void *user_data)
{
char *font_name;
- evas_font_reinit();
+ /*!
+ * \note
+ * Private has only this.
+ * evas_font_reinit();
+ */
if (s_info.font_name) {
font_name = vconf_get_str("db/setting/accessibility/font_name");
@@ -1815,7 +1936,7 @@ static void font_size_cb(system_settings_key_e key, void *user_data)
DbgPrint("Font size is changed to %d, but don't update the font info\n", size);
}
-PUBLIC int script_init(double scale)
+PUBLIC int script_init(double scale, int premultiplied)
{
int ret;
char *argv[] = {
@@ -1823,6 +1944,8 @@ PUBLIC int script_init(double scale)
NULL,
};
+ s_info.premultiplied = premultiplied;
+
/* ecore is already initialized */
elm_init(1, argv);
elm_config_scale_set(scale);