Add pre callback only for the provider-app
authorSung-jae Park <nicesj.park@samsung.com>
Fri, 10 Apr 2015 01:33:17 +0000 (10:33 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Fri, 10 Apr 2015 01:33:17 +0000 (10:33 +0900)
[model] Redwood,Kiran,B3(Wearable)
[binary_type] AP
[customer] Docomo/Orange/ATT/Open
[issue#] N/A
[problem]
[cause]
[solution]
[team] HomeTF
[request]
[horizontal_expansion]

Change-Id: Idb323c7ca1efc20c865a2c4ec6aa6827a24d5ab3

include/widget_internal.h
src/virtual_window.c
src/widget.c

index 8c98f58..1daaac5 100644 (file)
@@ -781,6 +781,15 @@ extern int widget_freeze_scroller(const char *widgetid, const char *id);
  * TODO: plug-in type
  */
 extern int widget_thaw_scroller(const char *widgetid, const char *id);
+
+/**
+ */
+extern int widget_del_pre_callback(widget_pre_callback_e type, widget_pre_callback_t cb, void *data);
+
+/**
+ */
+extern int widget_add_pre_callback(widget_pre_callback_e type, widget_pre_callback_t cb, void *data);
+
 /**
  * @}
  */
index d2f3e23..37a7280 100644 (file)
@@ -863,7 +863,7 @@ static void post_render_cb(void *data, Evas *e, void *event_info)
        }
 }
 
-static void pre_destroy_cb(widget_pre_callback_e type, const char *pkgname, const char *id, void *data)
+static void pre_destroy_cb(const char *id, void *data)
 {
        vwin_info_t info = data;
 
@@ -891,7 +891,7 @@ static void ecore_evas_free_cb(Ecore_Evas *ee)
                return;
        }
 
-       widget_provider_del_pre_callback(WIDGET_PRE_DESTROY_CALLBACK, pre_destroy_cb, info);
+       widget_del_pre_callback(WIDGET_PRE_DESTROY_CALLBACK, pre_destroy_cb, info);
 
        if (info->e) {
                evas_event_callback_del(info->e, EVAS_CALLBACK_RENDER_POST, post_render_cb);
@@ -1036,7 +1036,7 @@ PUBLIC Evas *widget_get_evas(const char *id)
        evas_event_callback_add(info->e, EVAS_CALLBACK_RENDER_POST, post_render_cb, info);
        evas_event_callback_add(info->e, EVAS_CALLBACK_RENDER_PRE, pre_render_cb, info);
 
-       widget_provider_add_pre_callback(WIDGET_PRE_DESTROY_CALLBACK, pre_destroy_cb, info);
+       widget_add_pre_callback(WIDGET_PRE_DESTROY_CALLBACK, pre_destroy_cb, info);
 
        return info->e;
 }
index 2b29f12..9948de9 100644 (file)
@@ -108,14 +108,26 @@ static struct info {
 
                struct _app {
                        int (*send)(widget_buffer_h handle, int idx, int x, int y, int w, int h, int gbar);
+                       int (*add_pre_callback)(widget_pre_callback_e type, widget_pre_callback_t cb, void *data);
+                       int (*del_pre_callback)(widget_pre_callback_e type, widget_pre_callback_t cb, void *data);
                } app;
-       } updated;
+       } binder;
 } s_info = {
        .find_pkgname = NULL,
        .request_update_by_id = NULL,
        .trigger_update_monitor = NULL,
        .update_extra_info = NULL,
        .type = LOAD_TYPE_UNKNOWN,    /* Not initialized */
+       .binder = {
+               .slave = {
+                       .send = NULL,
+               },
+               .app = {
+                       .send = NULL,
+                       .add_pre_callback = NULL,
+                       .del_pre_callback = NULL,
+               },
+       },
 };
 
 #define FUNC_PREFIX                               "widget_"
@@ -125,23 +137,55 @@ static struct info {
 #define FUNC_WIDGET_REQUEST_UPDATE_BY_ID      FUNC_PREFIX "request_update_by_id"
 #define FUNC_WIDGET_TRIGGER_UPDATE_MONITOR    FUNC_PREFIX "trigger_update_monitor"
 #define FUNC_WIDGET_UPDATE_EXTRA_INFO         FUNC_PREFIX "update_extra_info"
+#define FUNC_WIDGET_ADD_PRE_CALLBACK          FUNC_PREFIX "provider_app_add_pre_callback"
+#define FUNC_WIDGET_DEL_PRE_CALLBACK          FUNC_PREFIX "provider_app_del_pre_callback"
 
 static inline void load_update_function(void)
 {
        /* Must to be checked the slave function first. */
-       s_info.updated.slave.send = dlsym(RTLD_DEFAULT, FUNC_WIDGET_SEND_UPDATED);
-       if (s_info.updated.slave.send) {
+       s_info.binder.slave.send = dlsym(RTLD_DEFAULT, FUNC_WIDGET_SEND_UPDATED);
+       if (s_info.binder.slave.send) {
                s_info.type = LOAD_TYPE_SLAVE;
                DbgPrint("Slave detected\n");
        } else {
-               s_info.updated.app.send = dlsym(RTLD_DEFAULT, FUNC_WIDGET_PROVIDER_APP_UPDATED);
-               if (s_info.updated.app.send) {
+               s_info.binder.app.send = dlsym(RTLD_DEFAULT, FUNC_WIDGET_PROVIDER_APP_UPDATED);
+               if (s_info.binder.app.send) {
                        s_info.type = LOAD_TYPE_APP;
                        DbgPrint("App detected\n");
                }
        }
 }
 
+int widget_add_pre_callback(widget_pre_callback_e type, widget_pre_callback_t cb, void *data)
+{
+       static int loaded = 0;
+       if (!loaded && !s_info.binder.app.add_pre_callback) {
+               s_info.binder.app.add_pre_callback = dlsym(RTLD_DEFAULT, FUNC_WIDGET_ADD_PRE_CALLBACK);
+               loaded = 1;
+       }
+
+       if (!s_info.binder.app.add_pre_callback) {
+               return WIDGET_ERROR_NOT_SUPPORTED;
+       }
+
+       return s_info.binder.app.add_pre_callback(type, cb, data);
+}
+
+int widget_del_pre_callback(widget_pre_callback_e type, widget_pre_callback_t cb, void *data)
+{
+       static int loaded = 0;
+       if (!loaded && !s_info.binder.app.del_pre_callback) {
+               s_info.binder.app.del_pre_callback = dlsym(RTLD_DEFAULT, FUNC_WIDGET_DEL_PRE_CALLBACK);
+               loaded = 1;
+       }
+
+       if (!s_info.binder.app.del_pre_callback) {
+               return WIDGET_ERROR_NOT_SUPPORTED;
+       }
+
+       return s_info.binder.app.del_pre_callback(type, cb, data);
+}
+
 static int send_updated(const char *pkgname, const char *id, widget_buffer_h handle, int idx, int x, int y, int w, int h, int gbar, const char *descfile)
 {
        int ret = WIDGET_ERROR_INVALID_PARAMETER;
@@ -151,12 +195,12 @@ static int send_updated(const char *pkgname, const char *id, widget_buffer_h han
        }
 
        if (s_info.type == LOAD_TYPE_APP) {
-               ret = s_info.updated.app.send(handle, idx, x, y, w, h, gbar);
+               ret = s_info.binder.app.send(handle, idx, x, y, w, h, gbar);
        } else if (s_info.type == LOAD_TYPE_SLAVE) {
                /**
                 * pkgname, id are used for finding handle of direct connection.
                 */
-               ret = s_info.updated.slave.send(pkgname, id, handle, idx, x, y, w, h, gbar, descfile);
+               ret = s_info.binder.slave.send(pkgname, id, handle, idx, x, y, w, h, gbar, descfile);
        } else {
                widget_damage_region_s region = {
                        .x = x,