${BUILD_SOURCE}
src/dlist.c
src/util.c
+ src/binder.c
src/widget.c
src/snapshot_window.c
)
--- /dev/null
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @brief
+ * Abstracted Data Type of Virtual Window
+ */
+typedef struct virtual_window_info {
+ char *id; /**< Identification */
+ widget_buffer_h handle; /**< Livebox buffer handle */
+ enum win_type {
+ VWIN_SW_BUF = 0x00, /**< S/W buffer */
+ VWIN_GEM = 0x01, /**< GEM buffer */
+ VWIN_PIXMAP = 0x02, /**< PIXMAP */
+ VWIN_ERROR = 0x03 /**< Unknown */
+ } type;
+ Ecore_Evas *ee;
+ Evas *e;
+ int is_gbar;
+ int deleted;
+ int w;
+ int h;
+ unsigned int *resource_array;
+ int resource_cnt;
+
+ int pressed;
+
+ int orientation;
+} *vwin_info_t;
+
+extern int binder_widget_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);
+extern int binder_widget_update_extra_info(const char *id, const char *content, const char *title, const char *icon, const char *name);
+extern const char *binder_widget_find_pkgname(const char *uri);
+extern Ecore_Evas *binder_ecore_evas_new(vwin_info_t info);
+extern int binder_widget_auto_align(void);
+
+#define GL_ENGINE "opengl_x11"
+
+/* End of a file */
* limitations under the License.
*/
+#define FILE_SCHEMA "file://"
+
extern int util_check_extension(const char *filename, const char *check_ptr);
extern double util_timestamp(void);
+extern char *util_id_to_uri(const char *id);
/* End of a file */
extern int widget_add_pre_callback(widget_pre_callback_e type, widget_pre_callback_t cb, void *data);
/**
+ */
+extern int widget_get_orientation(const char *id);
+
+/**
* @}
*/
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#define __USE_GNU
+#include <dlfcn.h>
+
+#include <Elementary.h>
+#include <Ecore_Evas.h>
+
+#include <widget_service.h>
+#include <widget_service_internal.h>
+#include <widget_errno.h>
+#include <widget_provider.h>
+#include <widget_provider_buffer.h>
+#include <widget_conf.h>
+
+#include <dlog.h>
+
+#include "widget.h"
+#include "widget_internal.h"
+#include "binder.h"
+#include "debug.h"
+#include "util.h"
+
+#define PUBLIC __attribute__((visibility("default")))
+
+/**
+ * @brief These functions are defined in the data-provider-slave
+ */
+static struct info {
+ const char *(*find_pkgname)(const char *filename);
+ int (*request_update_by_id)(const char *uri);
+ int (*trigger_update_monitor)(const char *id, int is_gbar);
+ int (*update_extra_info)(const char *id, const char *content, const char *title, const char *icon, const char *name);
+ 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);
+ 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);
+
+ enum load_type {
+ LOAD_TYPE_UNKNOWN = -1,
+ LOAD_TYPE_SLAVE = 0,
+ LOAD_TYPE_APP = 1
+ } type;
+
+ union _updated {
+ struct _slave {
+ int (*send)(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);
+ } slave;
+
+ struct _app {
+ int (*send)(widget_buffer_h handle, int idx, int x, int y, int w, int h, int gbar);
+ } app;
+ } binder;
+} s_info = {
+ .find_pkgname = NULL,
+ .request_update_by_id = NULL,
+ .trigger_update_monitor = NULL,
+ .update_extra_info = NULL,
+ .add_pre_callback = NULL,
+ .del_pre_callback = NULL,
+ .orientation = NULL,
+ .alloc_canvas = NULL,
+ .alloc_canvas_with_stride = NULL,
+ .alloc_canvas_with_pixmap = NULL,
+ .type = LOAD_TYPE_UNKNOWN, /* Not initialized */
+ .binder = {
+ .slave = {
+ .send = NULL,
+ },
+ .app = {
+ .send = NULL,
+ },
+ },
+};
+
+#define FUNC_PREFIX "widget_"
+#define FUNC_WIDGET_SEND_UPDATED FUNC_PREFIX "send_buffer_updated"
+#define FUNC_WIDGET_FIND_PKGNAME FUNC_PREFIX "find_pkgname"
+#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_PROVIDER_APP_UPDATED FUNC_PREFIX "provider_app_buffer_updated"
+
+#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"
+
+static inline void load_ecore_evas_function(void)
+{
+ if (!s_info.alloc_canvas && !s_info.alloc_canvas_with_stride && !s_info.alloc_canvas_with_pixmap) {
+ s_info.alloc_canvas_with_pixmap = dlsym(RTLD_DEFAULT, "ecore_evas_gl_x11_pixmap_allocfunc_new");
+ if (!s_info.alloc_canvas_with_pixmap) {
+ DbgPrint("pixmap_allocfunc_new is not found\n");
+ }
+
+ s_info.alloc_canvas_with_stride = dlsym(RTLD_DEFAULT, "ecore_evas_buffer_allocfunc_with_stride_new");
+ if (!s_info.alloc_canvas_with_stride) {
+ DbgPrint("allocfunc_with_stirde_new is not found\n");
+ }
+
+ s_info.alloc_canvas = dlsym(RTLD_DEFAULT, "ecore_evas_buffer_allocfunc_new");
+ if (!s_info.alloc_canvas) {
+ ErrPrint("allocfunc_new is not found\n");
+ }
+
+ if (!s_info.alloc_canvas_with_stride && !s_info.alloc_canvas && !s_info.alloc_canvas_with_pixmap) {
+ ErrPrint("No way to allocate canvas\n");
+ }
+ }
+}
+
+static inline void load_update_function(void)
+{
+ /* Must to be checked the slave function first. */
+ 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.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");
+ }
+ }
+}
+
+PUBLIC int widget_get_orientation(const char *id)
+{
+ if (!s_info.orientation) {
+ s_info.orientation = dlsym(RTLD_DEFAULT, FUNC_WIDGET_PROVIDER_APP_ORIENTATION);
+ if (!s_info.orientation) {
+ return WIDGET_ERROR_NOT_SUPPORTED;
+ }
+ }
+
+ return s_info.orientation(id);
+}
+
+PUBLIC int widget_add_pre_callback(widget_pre_callback_e type, widget_pre_callback_t cb, void *data)
+{
+ if (!s_info.add_pre_callback) {
+ s_info.add_pre_callback = dlsym(RTLD_DEFAULT, FUNC_WIDGET_PROVIDER_APP_ADD_PRE_CALLBACK);
+ if (!s_info.add_pre_callback) {
+ return WIDGET_ERROR_NOT_SUPPORTED;
+ }
+ }
+
+ return s_info.add_pre_callback(type, cb, data);
+}
+
+PUBLIC int widget_del_pre_callback(widget_pre_callback_e type, widget_pre_callback_t cb, void *data)
+{
+ if (!s_info.del_pre_callback) {
+ s_info.del_pre_callback = dlsym(RTLD_DEFAULT, FUNC_WIDGET_PROVIDER_APP_DEL_PRE_CALLBACK);
+ if (!s_info.del_pre_callback) {
+ return WIDGET_ERROR_NOT_SUPPORTED;
+ }
+ }
+
+ return s_info.del_pre_callback(type, cb, data);
+}
+
+int binder_widget_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;
+
+ if (s_info.type == LOAD_TYPE_UNKNOWN) {
+ load_update_function();
+ }
+
+ if (s_info.type == LOAD_TYPE_APP) {
+ 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.binder.slave.send(pkgname, id, handle, idx, x, y, w, h, gbar, descfile);
+ } else {
+ widget_damage_region_s region = {
+ .x = x,
+ .y = y,
+ .w = w,
+ .h = h,
+ };
+ ret = widget_provider_send_buffer_updated(handle, idx, ®ion, gbar, descfile);
+ }
+
+ return ret;
+}
+
+PUBLIC int widget_content_is_updated(const char *filename, int is_gbar)
+{
+ if (!s_info.trigger_update_monitor) {
+ s_info.trigger_update_monitor = dlsym(RTLD_DEFAULT, FUNC_WIDGET_TRIGGER_UPDATE_MONITOR);
+ if (!s_info.trigger_update_monitor) {
+ ErrPrint("Trigger update monitor function is not exists\n");
+ return WIDGET_ERROR_FAULT;
+ }
+ }
+
+ return s_info.trigger_update_monitor(filename, is_gbar);
+}
+
+const char *binder_widget_find_pkgname(const char *uri)
+{
+ const char *pkgname;
+
+ if (!s_info.find_pkgname) {
+ s_info.find_pkgname = dlsym(RTLD_DEFAULT, FUNC_WIDGET_FIND_PKGNAME);
+ if (!s_info.find_pkgname) {
+ ErrPrint("Failed to find a \"widget_find_pkgname\"\n");
+ return NULL;
+ }
+ }
+
+ pkgname = s_info.find_pkgname(uri);
+ if (!pkgname) {
+ ErrPrint("Failed to find a package (%s)\n", uri);
+ return NULL;
+ }
+
+ return pkgname;
+}
+
+PUBLIC int widget_request_update(const char *filename)
+{
+ char *uri;
+ int ret;
+
+ if (!filename) {
+ ErrPrint("Invalid argument\n");
+ return WIDGET_ERROR_INVALID_PARAMETER;
+ }
+
+ uri = util_id_to_uri(filename);
+ if (!uri) {
+ ErrPrint("Heap: %d\n", errno);
+ return WIDGET_ERROR_OUT_OF_MEMORY;
+ }
+
+ if (!s_info.request_update_by_id) {
+ s_info.request_update_by_id = dlsym(RTLD_DEFAULT, FUNC_WIDGET_REQUEST_UPDATE_BY_ID);
+ if (!s_info.request_update_by_id) {
+ ErrPrint("\"widget_request_update_by_id\" is not exists\n");
+ free(uri);
+ return WIDGET_ERROR_FAULT;
+ }
+ }
+
+ ret = s_info.request_update_by_id(uri);
+ free(uri);
+ return ret;
+}
+
+int binder_widget_update_extra_info(const char *id, const char *content, const char *title, const char *icon, const char *name)
+{
+ if (!s_info.update_extra_info) {
+ s_info.update_extra_info = dlsym(RTLD_DEFAULT, FUNC_WIDGET_UPDATE_EXTRA_INFO);
+ if (!s_info.update_extra_info) {
+ ErrPrint("Failed to find a \"widget_update_extra_info\"\n");
+ return WIDGET_ERROR_INVALID_PARAMETER;
+ }
+ }
+
+ return s_info.update_extra_info(id, content, title, icon, name);
+}
+
+/**
+ * @note
+ * This callback can be called twice (or more) to get a several pixmaps
+ * Acquired pixmaps are used for double/tripple buffering for canvas
+ */
+static Ecore_X_Pixmap alloc_pixmap_cb(void *data, Ecore_X_Window parent, int w, int h, int depth)
+{
+ vwin_info_t info = data;
+ Ecore_X_Pixmap pixmap;
+
+ if (!info->handle) {
+ ErrPrint("Invalid handle\n");
+ return 0u;
+ }
+
+ info->w = w;
+ info->h = h;
+ DbgPrint("Size of ee is updated: %dx%d - %d (info: %p)\n", info->w, info->h, depth, info);
+ depth >>= 3;
+
+ if (widget_viewer_get_resource_id(info->handle, WIDGET_PRIMARY_BUFFER) == 0u) {
+ /**
+ * @note
+ * Need to allocate a primary buffer
+ */
+ widget_viewer_acquire_buffer(info->handle, WIDGET_PRIMARY_BUFFER, info->w, info->h, depth);
+ if (!info->handle) {
+ ErrPrint("Failed to get the buffer\n");
+ return 0u;
+ }
+
+ pixmap = (Ecore_X_Pixmap)widget_viewer_get_resource_id(info->handle, WIDGET_PRIMARY_BUFFER);
+ } else if (WIDGET_CONF_EXTRA_BUFFER_COUNT > 0) {
+ int idx;
+
+ if (!info->resource_array) {
+ info->resource_array = calloc(WIDGET_CONF_EXTRA_BUFFER_COUNT, sizeof(*info->resource_array));
+ if (!info->resource_array) {
+ ErrPrint("Out of memory: %d\n", errno);
+ return 0u;
+ }
+
+ idx = 0;
+ } else {
+ for (idx = 0; idx < WIDGET_CONF_EXTRA_BUFFER_COUNT; idx++) {
+ if (info->resource_array[idx] == 0u) {
+ break;
+ }
+ }
+
+ if (idx == WIDGET_CONF_EXTRA_BUFFER_COUNT) {
+ ErrPrint("Out of index: %d\n", idx);
+ return 0u;
+ }
+ }
+
+ if (widget_viewer_acquire_buffer(info->handle, idx, info->w, info->h, depth) < 0) {
+ ErrPrint("Failed to acquire a buffer for %d\n", idx);
+ return 0u;
+ }
+
+ info->resource_array[idx] = widget_viewer_get_resource_id(info->handle, idx);
+ if (info->resource_array[idx] == 0u) {
+ ErrPrint("Failed to allocate pixmap\n");
+ }
+
+ DbgPrint("Allocated index: %d/%d - %u\n", idx, WIDGET_CONF_EXTRA_BUFFER_COUNT, info->resource_array[idx]);
+ pixmap = info->resource_array[idx];
+ } else {
+ ErrPrint("Unable to allocate pixmap\n");
+ pixmap = 0u;
+ }
+
+ /**
+ * Acquire a buffer for canvas.
+ */
+ info->type = VWIN_PIXMAP;
+ info->resource_cnt += !!(unsigned int)pixmap;
+ return pixmap;
+}
+
+static void free_pixmap_cb(void *data, Ecore_X_Pixmap pixmap)
+{
+ vwin_info_t info = data;
+
+ if (!info->handle) {
+ return;
+ }
+
+ if (info->type != VWIN_PIXMAP) {
+ ErrPrint("Impossible\n");
+ }
+
+ if (widget_viewer_get_resource_id(info->handle, WIDGET_PRIMARY_BUFFER) == pixmap) {
+ if (widget_viewer_release_buffer(info->handle, WIDGET_PRIMARY_BUFFER) < 0) {
+ DbgPrint("Failed to release buffer\n");
+ }
+ info->resource_cnt--;
+ } else {
+ int idx;
+
+ for (idx = 0; idx < WIDGET_CONF_EXTRA_BUFFER_COUNT; idx++) {
+ /**
+ * @note
+ * Find a index to release it
+ */
+ if (info->resource_array[idx] == pixmap) {
+ if (widget_viewer_release_buffer(info->handle, idx) < 0) {
+ DbgPrint("Failed to release buffer\n");
+ }
+ info->resource_array[idx] = 0u;
+ info->resource_cnt--;
+ break;
+ }
+ }
+ }
+
+ if (info->deleted && info->resource_cnt == 0) {
+ DbgPrint("Destroy buffer handle\n");
+
+ widget_destroy_buffer(info->handle);
+ free(info->resource_array);
+ free(info->id);
+ free(info);
+ }
+}
+
+static void *alloc_fb(void *data, int size)
+{
+ vwin_info_t info = data;
+ void *buffer;
+
+ if (info->ee) {
+ ecore_evas_geometry_get(info->ee, NULL, NULL, &info->w, &info->h);
+ DbgPrint("Size of ee is updated: %dx%d (info: %p)\n", info->w, info->h, info);
+ }
+
+ if (!info->handle) {
+ ErrPrint("Failed to create a buffer\n");
+ return NULL;
+ }
+
+ if (widget_viewer_acquire_buffer(info->handle, WIDGET_PRIMARY_BUFFER, info->w, info->h, sizeof(int)) < 0) {
+ ErrPrint("Failed to acquire buffer\n");
+ return NULL;
+ }
+
+ /**
+ * If it supports the H/W accelerated buffer,
+ * Use it.
+ */
+ if (widget_support_hw_buffer(info->handle)) {
+ if (widget_create_hw_buffer(info->handle) == 0) {
+ buffer = widget_buffer_hw_buffer(info->handle);
+ if (buffer) {
+ DbgPrint("HW Accelerated buffer is created %p, (%dx%d)\n", info, info->w, info->h);
+ info->type = VWIN_GEM;
+ return buffer;
+ }
+ }
+
+ ErrPrint("Failed to allocate HW Accelerated buffer\n");
+ }
+
+ /**
+ * Or use the buffer of a S/W backend.
+ */
+ buffer = widget_ref_buffer(info->handle);
+ DbgPrint("SW buffer is created (%dx%d)\n", info->w, info->h);
+ info->type = VWIN_SW_BUF;
+ return buffer;
+}
+
+static void *alloc_stride_fb(void *data, int size, int *stride, int *bpp)
+{
+ void *buffer;
+
+ buffer = alloc_fb(data, size);
+ if (buffer) {
+ vwin_info_t info = data;
+ int _stride;
+
+ *bpp = sizeof(int);
+ _stride = widget_buffer_stride(info->handle);
+ if (_stride < 0) {
+ _stride = info->w * *bpp;
+ }
+
+ *stride = _stride;
+ *bpp <<= 3;
+ DbgPrint("bpp: %d, stride: %d\n", *bpp, *stride);
+ }
+
+ return buffer;
+}
+
+static void free_fb(void *data, void *ptr)
+{
+ vwin_info_t info = data;
+
+ if (!info->handle) {
+ return;
+ }
+
+ if (info->type == VWIN_GEM) {
+ if (widget_destroy_hw_buffer(info->handle) == 0) {
+ DbgPrint("HW Accelerated buffer is destroyed\n");
+ }
+ } else if (info->type == VWIN_SW_BUF) {
+ DbgPrint("SW buffer is destroyed, %p\n", info);
+ widget_unref_buffer(ptr);
+ } else if (info->type == VWIN_PIXMAP) {
+ ErrPrint("Unable to reach to here\n");
+ }
+
+ if (widget_viewer_release_buffer(info->handle, WIDGET_PRIMARY_BUFFER) < 0) {
+ ErrPrint("Failed to release buffer\n");
+ }
+
+ if (info->deleted) {
+ widget_destroy_buffer(info->handle);
+ free(info->resource_array);
+ free(info->id);
+ free(info);
+ }
+}
+
+Ecore_Evas *binder_ecore_evas_new(vwin_info_t info)
+{
+ const char *engine;
+ Ecore_Evas *ee = NULL;
+
+ load_ecore_evas_function();
+
+ engine = elm_config_preferred_engine_get();
+
+ DbgPrint("Preferred engine: %s (%s)\n", engine, GL_ENGINE);
+ if (engine && !strcmp(engine, GL_ENGINE)) {
+ if (s_info.alloc_canvas_with_pixmap) {
+ ee = s_info.alloc_canvas_with_pixmap(NULL, 0u, 0, 0, info->w, info->h, alloc_pixmap_cb, free_pixmap_cb, info);
+ if (!ee) {
+ ErrPrint("Unable to create a ee for pixmap\n");
+ }
+ }
+ }
+
+ if (!ee) {
+ if (!widget_conf_auto_align() && s_info.alloc_canvas_with_stride) {
+ ee = s_info.alloc_canvas_with_stride(info->w, info->h, alloc_stride_fb, free_fb, info);
+ } else if (s_info.alloc_canvas) {
+ ee = s_info.alloc_canvas(info->w, info->h, alloc_fb, free_fb, info);
+ }
+ }
+
+ return ee;
+}
+
+int binder_widget_auto_align(void)
+{
+ load_ecore_evas_function();
+
+ return widget_conf_auto_align() || !s_info.alloc_canvas_with_stride;
+}
+
+/* End of a file */
#endif
}
+char *util_id_to_uri(const char *id)
+{
+ char *uri;
+ int uri_len;
+
+ uri_len = strlen(id) + strlen(FILE_SCHEMA) + 1;
+
+ uri = malloc(uri_len);
+ if (!uri) {
+ return NULL;
+ }
+
+ snprintf(uri, uri_len, FILE_SCHEMA "%s", id);
+ return uri;
+}
+
/* End of a file */
#include "widget.h"
#include "widget_internal.h"
#include "debug.h"
+#include "binder.h"
#define IS_GBAR 1
#define WIDGET_DEFAULT_WIDTH 1
#define WIDGET_DEFAULT_HEIGHT 1
-#define GL_ENGINE "opengl_x11"
-
-static struct static_info {
- 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);
-} s_info = {
- .alloc_canvas = NULL,
- .alloc_canvas_with_stride = NULL,
- .alloc_canvas_with_pixmap = NULL,
-};
-
-/**
- * @brief
- * Abstracted Data Type of Virtual Window
- */
-typedef struct virtual_window_info {
- char *id; /**< Identification */
- widget_buffer_h handle; /**< Livebox buffer handle */
- enum win_type {
- VWIN_SW_BUF = 0x00, /**< S/W buffer */
- VWIN_GEM = 0x01, /**< GEM buffer */
- VWIN_PIXMAP = 0x02, /**< PIXMAP */
- VWIN_ERROR = 0x03 /**< Unknown */
- } type;
- Ecore_Evas *ee;
- Evas *e;
- int is_gbar;
- int deleted;
- int w;
- int h;
- unsigned int *resource_array;
- int resource_cnt;
-
- int pressed;
-
- int orientation;
-} *vwin_info_t;
static inline Evas_Object *get_highlighted_object(Evas_Object *obj)
{
evas_event_feed_mouse_out(info->e, timestamp, NULL);
break;
case WIDGET_BUFFER_EVENT_DOWN:
- apply_orientation(info->degree, &event_info->info.pointer.x, &event_info->info.pointer.y);
+ apply_orientation(info->orientation, &event_info->info.pointer.x, &event_info->info.pointer.y);
if (info->pressed) {
ErrPrint("MOUSE UP is not called\n");
ErrPrint("DOWN[%s] %dx%d - %lf\n", info->id, event_info->info.pointer.x, event_info->info.pointer.y, timestamp);
break;
case WIDGET_BUFFER_EVENT_MOVE:
- apply_orientation(info->degree, &event_info->info.pointer.x, &event_info->info.pointer.y);
+ apply_orientation(info->orientation, &event_info->info.pointer.x, &event_info->info.pointer.y);
/**
* @note
* Calculate the event occurred X & Y on the buffer
evas_event_feed_mouse_move(info->e, event_info->info.pointer.x, event_info->info.pointer.y, timestamp, NULL);
break;
case WIDGET_BUFFER_EVENT_UP:
- apply_orientation(info->degree, &event_info->info.pointer.x, &event_info->info.pointer.y);
+ apply_orientation(info->orientation, &event_info->info.pointer.x, &event_info->info.pointer.y);
evas_event_feed_mouse_move(info->e, event_info->info.pointer.x, event_info->info.pointer.y, timestamp, NULL);
evas_event_feed_mouse_up(info->e, 1, EVAS_BUTTON_NONE, timestamp, NULL);
info->pressed = 0;
return ret;
}
-/**
- * @note
- * This callback can be called twice (or more) to get a several pixmaps
- * Acquired pixmaps are used for double/tripple buffering for canvas
- */
-static Ecore_X_Pixmap alloc_pixmap_cb(void *data, Ecore_X_Window parent, int w, int h, int depth)
-{
- vwin_info_t info = data;
- Ecore_X_Pixmap pixmap;
-
- if (!info->handle) {
- ErrPrint("Invalid handle\n");
- return 0u;
- }
-
- info->w = w;
- info->h = h;
- DbgPrint("Size of ee is updated: %dx%d - %d (info: %p)\n", info->w, info->h, depth, info);
- depth >>= 3;
-
- if (widget_viewer_get_resource_id(info->handle, WIDGET_PRIMARY_BUFFER) == 0u) {
- /**
- * @note
- * Need to allocate a primary buffer
- */
- widget_viewer_acquire_buffer(info->handle, WIDGET_PRIMARY_BUFFER, info->w, info->h, depth);
- if (!info->handle) {
- ErrPrint("Failed to get the buffer\n");
- return 0u;
- }
-
- pixmap = (Ecore_X_Pixmap)widget_viewer_get_resource_id(info->handle, WIDGET_PRIMARY_BUFFER);
- } else if (WIDGET_CONF_EXTRA_BUFFER_COUNT > 0) {
- int idx;
-
- if (!info->resource_array) {
- info->resource_array = calloc(WIDGET_CONF_EXTRA_BUFFER_COUNT, sizeof(*info->resource_array));
- if (!info->resource_array) {
- ErrPrint("Out of memory: %d\n", errno);
- return 0u;
- }
-
- idx = 0;
- } else {
- for (idx = 0; idx < WIDGET_CONF_EXTRA_BUFFER_COUNT; idx++) {
- if (info->resource_array[idx] == 0u) {
- break;
- }
- }
-
- if (idx == WIDGET_CONF_EXTRA_BUFFER_COUNT) {
- ErrPrint("Out of index: %d\n", idx);
- return 0u;
- }
- }
-
- if (widget_viewer_acquire_buffer(info->handle, idx, info->w, info->h, depth) < 0) {
- ErrPrint("Failed to acquire a buffer for %d\n", idx);
- return 0u;
- }
-
- info->resource_array[idx] = widget_viewer_get_resource_id(info->handle, idx);
- if (info->resource_array[idx] == 0u) {
- ErrPrint("Failed to allocate pixmap\n");
- }
-
- DbgPrint("Allocated index: %d/%d - %u\n", idx, WIDGET_CONF_EXTRA_BUFFER_COUNT, info->resource_array[idx]);
- pixmap = info->resource_array[idx];
- } else {
- ErrPrint("Unable to allocate pixmap\n");
- pixmap = 0u;
- }
-
- /**
- * Acquire a buffer for canvas.
- */
- info->type = VWIN_PIXMAP;
- info->resource_cnt += !!(unsigned int)pixmap;
- return pixmap;
-}
-
-static void free_pixmap_cb(void *data, Ecore_X_Pixmap pixmap)
-{
- vwin_info_t info = data;
-
- if (!info->handle) {
- return;
- }
-
- if (info->type != VWIN_PIXMAP) {
- ErrPrint("Impossible\n");
- }
-
- if (widget_viewer_get_resource_id(info->handle, WIDGET_PRIMARY_BUFFER) == pixmap) {
- if (widget_viewer_release_buffer(info->handle, WIDGET_PRIMARY_BUFFER) < 0) {
- DbgPrint("Failed to release buffer\n");
- }
- info->resource_cnt--;
- } else {
- int idx;
-
- for (idx = 0; idx < WIDGET_CONF_EXTRA_BUFFER_COUNT; idx++) {
- /**
- * @note
- * Find a index to release it
- */
- if (info->resource_array[idx] == pixmap) {
- if (widget_viewer_release_buffer(info->handle, idx) < 0) {
- DbgPrint("Failed to release buffer\n");
- }
- info->resource_array[idx] = 0u;
- info->resource_cnt--;
- break;
- }
- }
- }
-
- if (info->deleted && info->resource_cnt == 0) {
- DbgPrint("Destroy buffer handle\n");
-
- widget_destroy_buffer(info->handle);
- free(info->resource_array);
- free(info->id);
- free(info);
- }
-}
-
-static void *alloc_fb(void *data, int size)
-{
- vwin_info_t info = data;
- void *buffer;
-
- if (info->ee) {
- ecore_evas_geometry_get(info->ee, NULL, NULL, &info->w, &info->h);
- DbgPrint("Size of ee is updated: %dx%d (info: %p)\n", info->w, info->h, info);
- }
-
- if (!info->handle) {
- ErrPrint("Failed to create a buffer\n");
- return NULL;
- }
-
- if (widget_viewer_acquire_buffer(info->handle, WIDGET_PRIMARY_BUFFER, info->w, info->h, sizeof(int)) < 0) {
- ErrPrint("Failed to acquire buffer\n");
- return NULL;
- }
-
- /**
- * If it supports the H/W accelerated buffer,
- * Use it.
- */
- if (widget_support_hw_buffer(info->handle)) {
- if (widget_create_hw_buffer(info->handle) == 0) {
- buffer = widget_buffer_hw_buffer(info->handle);
- if (buffer) {
- DbgPrint("HW Accelerated buffer is created %p, (%dx%d)\n", info, info->w, info->h);
- info->type = VWIN_GEM;
- return buffer;
- }
- }
-
- ErrPrint("Failed to allocate HW Accelerated buffer\n");
- }
-
- /**
- * Or use the buffer of a S/W backend.
- */
- buffer = widget_ref_buffer(info->handle);
- DbgPrint("SW buffer is created (%dx%d)\n", info->w, info->h);
- info->type = VWIN_SW_BUF;
- return buffer;
-}
-
-static void *alloc_stride_fb(void *data, int size, int *stride, int *bpp)
-{
- void *buffer;
-
- buffer = alloc_fb(data, size);
- if (buffer) {
- vwin_info_t info = data;
- int _stride;
-
- *bpp = sizeof(int);
- _stride = widget_buffer_stride(info->handle);
- if (_stride < 0) {
- _stride = info->w * *bpp;
- }
-
- *stride = _stride;
- *bpp <<= 3;
- DbgPrint("bpp: %d, stride: %d\n", *bpp, *stride);
- }
-
- return buffer;
-}
-
-static void free_fb(void *data, void *ptr)
-{
- vwin_info_t info = data;
-
- if (!info->handle) {
- return;
- }
-
- if (info->type == VWIN_GEM) {
- if (widget_destroy_hw_buffer(info->handle) == 0) {
- DbgPrint("HW Accelerated buffer is destroyed\n");
- }
- } else if (info->type == VWIN_SW_BUF) {
- DbgPrint("SW buffer is destroyed, %p\n", info);
- widget_unref_buffer(ptr);
- } else if (info->type == VWIN_PIXMAP) {
- ErrPrint("Unable to reach to here\n");
- }
-
- if (widget_viewer_release_buffer(info->handle, WIDGET_PRIMARY_BUFFER) < 0) {
- ErrPrint("Failed to release buffer\n");
- }
-
- if (info->deleted) {
- widget_destroy_buffer(info->handle);
- free(info->resource_array);
- free(info->id);
- free(info);
- }
-}
-
static void pre_render_cb(void *data, Evas *e, void *event_info)
{
vwin_info_t info = data;
}
}
-static void pre_orientation_cb(const char *id, void *data)
+static int pre_orientation_cb(const char *id, void *data)
{
vwin_info_t info = data;
- char *path = NULL;
+ const char *path;
+ int orientation;
/* Try provider_app first */
- if (id) {
- path = widget_util_uri_to_path(id);
+ if (!id) {
+ return WIDGET_ERROR_INVALID_PARAMETER;
+ }
- if (path && strcmp(info->id, path)) {
- /* Skip */
- DbgPrint("SKIP: Pre orientation event callback is called [%s], %s\n", id, info->id);
- return;
- }
+ path = widget_util_uri_to_path(id);
+ if (path && strcmp(info->id, path)) {
+ /* Skip */
+ DbgPrint("SKIP: Pre orientation event callback is called [%s], %s\n", id, info->id);
+ return WIDGET_ERROR_INVALID_PARAMETER;
+ }
- DbgPrint("Pre orientation event callback is called [%s]\n", id);
- info->orientation = widget_get_orientation(path);
+ DbgPrint("Pre orientation event callback is called [%s]\n", id);
+ orientation = widget_get_orientation(path);
+ if (orientation < 0) {
+ ErrPrint("Failed to get orientation: %X\n", orientation);
+ } else {
+ info->orientation = orientation;
}
+
+ return WIDGET_ERROR_NONE;
}
-static void pre_destroy_cb(const char *id, void *data)
+static int pre_destroy_cb(const char *id, void *data)
{
vwin_info_t info = data;
- char *path = NULL;
+ const char *path = NULL;
if (id) {
path = widget_util_uri_to_path(id);
if (path && strcmp(info->id, path)) {
/* Skip */
DbgPrint("SKIP: Pre destroy event callback is called [%s], %s\n", id, info->id);
- return;
+ return WIDGET_ERROR_INVALID_PARAMETER;
}
}
DbgPrint("Toggle manual render mode to prevent from unwanted rendering");
ecore_evas_manual_render_set(info->ee, EINA_TRUE);
}
+
+ return WIDGET_ERROR_NONE;
}
static void ecore_evas_free_cb(Ecore_Evas *ee)
#endif /* WIDGET_FEATURE_GBAR_SUPPORTED */
{
vwin_info_t info;
- Evas_Object *rect;
- const char *engine;
+ int orientation;
/**
* @TODO
* this function should returns ERROR.
*/
- if (!s_info.alloc_canvas && !s_info.alloc_canvas_with_stride && !s_info.alloc_canvas_with_pixmap) {
- s_info.alloc_canvas_with_pixmap = dlsym(RTLD_DEFAULT, "ecore_evas_gl_x11_pixmap_allocfunc_new");
- if (!s_info.alloc_canvas_with_pixmap) {
- DbgPrint("pixmap_allocfunc_new is not found\n");
- }
-
- s_info.alloc_canvas_with_stride = dlsym(RTLD_DEFAULT, "ecore_evas_buffer_allocfunc_with_stride_new");
- if (!s_info.alloc_canvas_with_stride) {
- DbgPrint("allocfunc_with_stirde_new is not found\n");
- }
-
- s_info.alloc_canvas = dlsym(RTLD_DEFAULT, "ecore_evas_buffer_allocfunc_new");
- if (!s_info.alloc_canvas) {
- ErrPrint("allocfunc_new is not found\n");
- }
-
- if (!s_info.alloc_canvas_with_stride && !s_info.alloc_canvas && !s_info.alloc_canvas_with_pixmap) {
- ErrPrint("No way to allocate canvas\n");
- return NULL;
- }
- }
-
if (!id) {
ErrPrint("Invalid parameter\n");
return NULL;
* Acquire a buffer for canvas.
*/
info->handle = widget_create_buffer(info->id, info->is_gbar,
- (widget_conf_auto_align() || !s_info.alloc_canvas_with_stride),
+ binder_widget_auto_align(),
event_handler_cb, info);
if (!info->handle) {
info->w = WIDGET_DEFAULT_WIDTH;
info->h = WIDGET_DEFAULT_HEIGHT;
- engine = elm_config_preferred_engine_get();
- DbgPrint("Preferred engine: %s (%s)\n", engine, GL_ENGINE);
- if (engine && !strcmp(engine, GL_ENGINE)) {
- if (s_info.alloc_canvas_with_pixmap) {
- info->ee = s_info.alloc_canvas_with_pixmap(NULL, 0u, 0, 0, info->w, info->h, alloc_pixmap_cb, free_pixmap_cb, info);
- if (!info->ee) {
- ErrPrint("Unable to create a ee for pixmap\n");
- }
- }
- }
-
- if (!info->ee) {
- if (!widget_conf_auto_align() && s_info.alloc_canvas_with_stride) {
- info->ee = s_info.alloc_canvas_with_stride(info->w, info->h, alloc_stride_fb, free_fb, info);
- } else if (s_info.alloc_canvas) {
- info->ee = s_info.alloc_canvas(info->w, info->h, alloc_fb, free_fb, info);
- }
- }
-
+ info->ee = binder_ecore_evas_new(info);
if (!info->ee) {
ErrPrint("Failed to create ecore_evas (%dx%d)\n", info->w, info->h);
widget_destroy_buffer(info->handle);
widget_add_pre_callback(WIDGET_PRE_DESTROY_CALLBACK, pre_destroy_cb, info);
widget_add_pre_callback(WIDGET_PRE_ORIENTATION_CALLBACK, pre_orientation_cb, info);
- info->orientation = widget_get_orientation(info->id);
+ orientation = widget_get_orientation(info->id);
+ if (orientation < 0) {
+ ErrPrint("Failed to get orientation[%s]: %X\n", info->id, orientation);
+ } else {
+ info->orientation = orientation;
+ }
return info->e;
}
#include <string.h> /* strdup */
#include <libgen.h>
#include <unistd.h> /* access */
-#define __USE_GNU
-#include <dlfcn.h>
+
+#include <Ecore_Evas.h> /* binder.h */
#include <dlog.h>
#include <widget_errno.h>
#include <widget_service_internal.h>
#include <widget_provider.h>
#include <widget_provider_buffer.h>
-#include <widget_conf.h>
#include <widget_buffer.h>
#include <widget_util.h>
+#include <widget_conf.h>
#include "debug.h"
#include "dlist.h"
#include "util.h"
#include "widget.h"
#include "widget_internal.h"
+#include "binder.h"
#define PUBLIC __attribute__((visibility("default")))
-#define FILE_SCHEMA "file://"
-
/**
* @note
* This value is configurable value.
Ecore_Timer *frame_wait_timer;
};
-/**
- * @brief These functions are defined in the data-provider-slave
- */
-static struct info {
- const char *(*find_pkgname)(const char *filename);
- int (*request_update_by_id)(const char *uri);
- int (*trigger_update_monitor)(const char *id, int is_gbar);
- int (*update_extra_info)(const char *id, const char *content, const char *title, const char *icon, const char *name);
- 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);
-
- enum load_type {
- LOAD_TYPE_UNKNOWN = -1,
- LOAD_TYPE_SLAVE = 0,
- LOAD_TYPE_APP = 1
- } type;
-
- union _updated {
- struct _slave {
- int (*send)(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);
- } slave;
-
- struct _app {
- int (*send)(widget_buffer_h handle, int idx, int x, int y, int w, int h, int gbar);
- } app;
- } binder;
-} s_info = {
- .find_pkgname = NULL,
- .request_update_by_id = NULL,
- .trigger_update_monitor = NULL,
- .update_extra_info = NULL,
- .add_pre_callback = NULL,
- .del_pre_callback = NULL,
- .orientation = NULL,
- .type = LOAD_TYPE_UNKNOWN, /* Not initialized */
- .binder = {
- .slave = {
- .send = NULL,
- },
- .app = {
- .send = NULL,
- },
- },
-};
-
-#define FUNC_PREFIX "widget_"
-#define FUNC_WIDGET_SEND_UPDATED FUNC_PREFIX "send_buffer_updated"
-#define FUNC_WIDGET_FIND_PKGNAME FUNC_PREFIX "find_pkgname"
-#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_PROVIDER_APP_UPDATED FUNC_PREFIX "provider_app_buffer_updated"
-
-#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"
-
-static inline void load_update_function(void)
-{
- /* Must to be checked the slave function first. */
- 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.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");
- }
- }
-}
-
-PUBLIC int widget_get_orientation(const char *id)
-{
- if (!s_info.orientation) {
- s_info.orientation = dlsym(RTLD_DEFAULT, FUNC_WIDGET_PROVIDER_APP_ORIENTATION);
- if (!s_info.orientation) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
- }
-
- return s_info.orientation(id);
-}
-
-PUBLIC int widget_add_pre_callback(widget_pre_callback_e type, widget_pre_callback_t cb, void *data)
-{
- if (!s_info.add_pre_callback) {
- s_info.add_pre_callback = dlsym(RTLD_DEFAULT, FUNC_WIDGET_PROVIDER_APP_ADD_PRE_CALLBACK);
- if (!s_info.add_pre_callback) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
- }
-
- return s_info.add_pre_callback(type, cb, data);
-}
-
-PUBLIC int widget_del_pre_callback(widget_pre_callback_e type, widget_pre_callback_t cb, void *data)
-{
- if (!s_info.del_pre_callback) {
- s_info.del_pre_callback = dlsym(RTLD_DEFAULT, FUNC_WIDGET_PROVIDER_APP_DEL_PRE_CALLBACK);
- if (!s_info.del_pre_callback) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
- }
-
- return s_info.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;
-
- if (s_info.type == LOAD_TYPE_UNKNOWN) {
- load_update_function();
- }
-
- if (s_info.type == LOAD_TYPE_APP) {
- 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.binder.slave.send(pkgname, id, handle, idx, x, y, w, h, gbar, descfile);
- } else {
- widget_damage_region_s region = {
- .x = x,
- .y = y,
- .w = w,
- .h = h,
- };
- ret = widget_provider_send_buffer_updated(handle, idx, ®ion, gbar, descfile);
- }
-
- return ret;
-}
-
-static char *id_to_uri(const char *id)
-{
- char *uri;
- int uri_len;
-
- uri_len = strlen(id) + strlen(FILE_SCHEMA) + 1;
-
- uri = malloc(uri_len);
- if (!uri) {
- return NULL;
- }
-
- snprintf(uri, uri_len, FILE_SCHEMA "%s", id);
- return uri;
-}
-
static inline int event_handler_wrapper(widget_buffer_h buffer, widget_buffer_event_data_t event_info, void *data)
{
const char *pkgname;
user_data->handler = handler ? handler : default_event_handler;
user_data->cbdata = data;
- uri = id_to_uri(filename);
+ uri = util_id_to_uri(filename);
if (!uri) {
ErrPrint("Heap: %d\n", errno);
free(user_data);
return NULL;
}
- if (!s_info.find_pkgname) {
- s_info.find_pkgname = dlsym(RTLD_DEFAULT, FUNC_WIDGET_FIND_PKGNAME);
- if (!s_info.find_pkgname) {
- ErrPrint("Failed to find a \"widget_find_pkgname\"\n");
- free(user_data);
- free(uri);
- return NULL;
- }
- }
-
- pkgname = s_info.find_pkgname(uri);
+ pkgname = binder_widget_find_pkgname(uri);
if (!pkgname) {
ErrPrint("Invalid Request\n");
free(user_data);
return handle;
}
-PUBLIC int widget_request_update(const char *filename)
-{
- char *uri;
- int ret;
-
- if (!filename) {
- ErrPrint("Invalid argument\n");
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- uri = id_to_uri(filename);
- if (!uri) {
- ErrPrint("Heap: %d\n", errno);
- return WIDGET_ERROR_OUT_OF_MEMORY;
- }
-
- if (!s_info.request_update_by_id) {
- s_info.request_update_by_id = dlsym(RTLD_DEFAULT, FUNC_WIDGET_REQUEST_UPDATE_BY_ID);
- if (!s_info.request_update_by_id) {
- ErrPrint("\"widget_request_update_by_id\" is not exists\n");
- free(uri);
- return WIDGET_ERROR_FAULT;
- }
- }
-
- ret = s_info.request_update_by_id(uri);
- free(uri);
- return ret;
-}
-
PUBLIC unsigned int widget_viewer_get_resource_id(widget_buffer_h handle, int idx)
{
int ret;
* manipulate the damaged region, so send update event only for the damaged region.
* to make more efficient updates
*/
- ret = send_updated(pkgname, id, handle, WIDGET_PRIMARY_BUFFER, 0, 0, w, h, user_data->is_gbar, NULL);
+ ret = binder_widget_send_updated(pkgname, id, handle, WIDGET_PRIMARY_BUFFER, 0, 0, w, h, user_data->is_gbar, NULL);
if (ret < 0) {
ErrPrint("Failed to send%supdated (%s)\n", user_data->is_gbar ? " GBAR " : " ", id);
}
ErrPrint("Failed to get size (%s)\n", id);
}
- ret = send_updated(pkgname, id, handle, idx, 0, 0, w, h, user_data->is_gbar, NULL);
+ ret = binder_widget_send_updated(pkgname, id, handle, idx, 0, 0, w, h, user_data->is_gbar, NULL);
if (ret < 0) {
ErrPrint("Failed to send%supdated (%s) %d\n", user_data->is_gbar ? " GBAR " : " ", id, idx);
}
* manipulate the damaged region, so send update event only for the damaged region.
* to make more efficient updates
*/
- ret = send_updated(pkgname, id, handle, WIDGET_PRIMARY_BUFFER, 0, 0, w, h, user_data->is_gbar, NULL);
+ ret = binder_widget_send_updated(pkgname, id, handle, WIDGET_PRIMARY_BUFFER, 0, 0, w, h, user_data->is_gbar, NULL);
if (ret < 0) {
ErrPrint("Failed to send%supdated (%s)\n", user_data->is_gbar ? " GBAR " : " ", id);
}
* manipulate the damaged region, so send update event only for the damaged region.
* to make more efficient updates
*/
- ret = send_updated(pkgname, id, handle, WIDGET_PRIMARY_BUFFER, 0, 0, w, h, user_data->is_gbar, NULL);
+ ret = binder_widget_send_updated(pkgname, id, handle, WIDGET_PRIMARY_BUFFER, 0, 0, w, h, user_data->is_gbar, NULL);
if (ret < 0) {
ErrPrint("Failed to send%supdated (%s)\n", user_data->is_gbar ? " GBAR " : " ", id);
}
return widget_provider_buffer_stride(handle);
}
-PUBLIC int widget_content_is_updated(const char *filename, int is_gbar)
-{
- if (!s_info.trigger_update_monitor) {
- s_info.trigger_update_monitor = dlsym(RTLD_DEFAULT, FUNC_WIDGET_TRIGGER_UPDATE_MONITOR);
- if (!s_info.trigger_update_monitor) {
- ErrPrint("Trigger update monitor function is not exists\n");
- return WIDGET_ERROR_FAULT;
- }
- }
-
- return s_info.trigger_update_monitor(filename, is_gbar);
-}
-
PUBLIC int widget_request_close_glance_bar(const char *pkgname, const char *id, int reason)
{
char *uri;
}
if (strncmp(id, FILE_SCHEMA, schema_len)) {
- uri = id_to_uri(id);
+ uri = util_id_to_uri(id);
if (!uri) {
ErrPrint("Heap: %d\n", errno);
return WIDGET_ERROR_OUT_OF_MEMORY;
return WIDGET_ERROR_INVALID_PARAMETER;
}
- uri = id_to_uri(id);
+ uri = util_id_to_uri(id);
if (!uri) {
ErrPrint("Heap: %d\n", errno);
return WIDGET_ERROR_OUT_OF_MEMORY;
return WIDGET_ERROR_INVALID_PARAMETER;
}
- uri = id_to_uri(id);
+ uri = util_id_to_uri(id);
if (!uri) {
ErrPrint("Heap: %d\n", errno);
return WIDGET_ERROR_OUT_OF_MEMORY;
const char *pkgname;
char *uri;
- uri = id_to_uri(id);
+ uri = util_id_to_uri(id);
if (!uri) {
ErrPrint("Heap: %d\n", errno);
return WIDGET_ERROR_OUT_OF_MEMORY;
}
- if (!s_info.find_pkgname) {
- s_info.find_pkgname = dlsym(RTLD_DEFAULT, FUNC_WIDGET_FIND_PKGNAME);
- if (!s_info.find_pkgname) {
- ErrPrint("Failed to find a \"widget_find_pkgname\"\n");
- free(uri);
- return WIDGET_ERROR_FAULT;
- }
- }
-
- pkgname = s_info.find_pkgname(uri);
+ pkgname = binder_widget_find_pkgname(uri);
if (!pkgname) {
ErrPrint("Failed to find a package (%s)\n", uri);
free(uri);
}
free(uri);
- if (!s_info.update_extra_info) {
- s_info.update_extra_info = dlsym(RTLD_DEFAULT, FUNC_WIDGET_UPDATE_EXTRA_INFO);
- if (!s_info.update_extra_info) {
- ErrPrint("Failed to find a \"widget_update_extra_info\"\n");
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
- }
-
- return s_info.update_extra_info(id, content, title, icon, name);
+ return binder_widget_update_extra_info(id, content, title, icon, name);
}
/* End of a file */