Sync with the latest tizen 2.x
[apps/native/widget/widget.git] / src / binder.c
index a839c87..c71329a 100644 (file)
@@ -36,6 +36,7 @@ static struct info {
        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);
        int (*orientation)(const char *id);
+       int (*get_last_ctrl_mode)(const char *id, int *cmd, int *value);
        Ecore_Evas *(*alloc_canvas)(int w, int h, void *(*a)(void *data, int size), void (*f)(void *data, void *ptr), void *data);
        Ecore_Evas *(*alloc_canvas_with_stride)(int w, int h, void *(*a)(void *data, int size, int *stride, int *bpp), void (*f)(void *data, void *ptr), void *data);
        Ecore_Evas *(*alloc_canvas_with_pixmap)(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h, Ecore_X_Pixmap (*alloc_cb)(void *data, Ecore_X_Window parent, int w, int h, int depth), void (*free_cb)(void *data, Ecore_X_Pixmap pixmap), void *data);
@@ -63,6 +64,7 @@ static struct info {
        .add_pre_callback = NULL,
        .del_pre_callback = NULL,
        .orientation = NULL,
+       .get_last_ctrl_mode = NULL,
        .alloc_canvas = NULL,
        .alloc_canvas_with_stride = NULL,
        .alloc_canvas_with_pixmap = NULL,
@@ -89,6 +91,7 @@ static struct info {
 #define FUNC_WIDGET_PROVIDER_APP_ADD_PRE_CALLBACK FUNC_PREFIX "provider_app_add_pre_callback"
 #define FUNC_WIDGET_PROVIDER_APP_DEL_PRE_CALLBACK FUNC_PREFIX "provider_app_del_pre_callback"
 #define FUNC_WIDGET_PROVIDER_APP_ORIENTATION      FUNC_PREFIX "provider_app_get_orientation"
+#define FUNC_WIDGET_PROVIDER_APP_LAST_CTRL_MODE   FUNC_PREFIX "provider_app_get_last_ctrl_mode"
 
 static inline void load_ecore_evas_function(void)
 {
@@ -130,6 +133,18 @@ static inline void load_update_function(void)
        }
 }
 
+PUBLIC int widget_get_last_ctrl_mode(const char *id, int *cmd, int *value)
+{
+       if (!s_info.get_last_ctrl_mode) {
+               s_info.get_last_ctrl_mode = dlsym(RTLD_DEFAULT, FUNC_WIDGET_PROVIDER_APP_LAST_CTRL_MODE);
+               if (!s_info.get_last_ctrl_mode) {
+                       return WIDGET_ERROR_NOT_SUPPORTED;
+               }
+       }
+
+       return s_info.get_last_ctrl_mode(id, cmd, value);
+}
+
 PUBLIC int widget_get_orientation(const char *id)
 {
        if (!s_info.orientation) {
@@ -388,7 +403,7 @@ static void free_pixmap_cb(void *data, Ecore_X_Pixmap pixmap)
                }
        }
 
-       if (info->deleted && info->resource_cnt == 0) {
+       if (info->flags.field.deleted && info->resource_cnt == 0) {
                DbgPrint("Destroy buffer handle\n");
 
                info->state = VWIN_INFO_DESTROYED;
@@ -491,7 +506,7 @@ static void free_fb(void *data, void *ptr)
                ErrPrint("Failed to release buffer\n");
        }
 
-       if (info->deleted) {
+       if (info->flags.field.deleted) {
                info->state = VWIN_INFO_DESTROYED;
                widget_destroy_buffer(info->handle);
                free(info->resource_array);