src/desc_parser.c
src/dlist.c
src/dynamicbox.c
+ src/dynamicbox_internal.c
src/file_service.c
src/master_rpc.c
src/util.c
* limitations under the License.
*/
-extern int parse_desc(struct livebox_common *common, const char *filename, int is_pd);
+extern int parse_desc(struct dynamicbox_common *common, const char *filename, int is_pd);
/* End of a file */
};
enum dynamicbox_key_event_type {
- DBOX_KEY_EVENT_KEY_MASK = 0x80000000, /**< Mask value for key event */
+ DBOX_KEY_EVENT_MASK = 0x80000000, /**< Mask value for key event */
DBOX_KEY_EVENT_GBAR_MASK = 0x10000000, /**< Mask value for Glance Bar event */
DBOX_KEY_EVENT_DBOX_MASK = 0x40000000, /**< Mask value for Dynamic Box event */
DBOX_KEY_EVENT_SET = 0x00000020, /**< Dynamic Box Key, start feeding event by master */
DBOX_KEY_EVENT_UNSET = 0x00000040, /**< Dynamic Box key, stop feeding event by master */
- DBOX_KEY_DOWN = DBOX_KEY_EVENT_KEY_MASK | DBOX_KEY_EVENT_DBOX_MASK | DBOX_KEY_EVENT_DOWN, /**< Key down on the dynamicbox */
- DBOX_KEY_UP = DBOX_KEY_EVENT_KEY_MASK | DBOX_KEY_EVENT_DBOX_MASK | DBOX_KEY_EVENT_UP, /**< Key up on the dynamicbox */
- DBOX_KEY_SET = DBOX_KEY_EVENT_KEY_MASK | DBOX_KEY_EVENT_DBOX_MASK | DBOX_KEY_EVENT_SET, /**< Key event, start feeding event by master */
- DBOX_KEY_UNSET = DBOX_KEY_EVENT_KEY_MASK | DBOX_KEY_EVENT_DBOX_MASK | DBOX_KEY_EVENT_UNSET, /**< Key event, stop feeding event by master */
- DBOX_KEY_FOCUS_IN = DBOX_KEY_EVENT_KEY_MASK | DBOX_KEY_EVENT_DBOX_MASK | DBOX_KEY_EVENT_FOCUS_IN, /**< Key event, focus in */
- DBOX_KEY_FOCUS_OUT = DBOX_KEY_EVENT_KEY_MASK | DBOX_KEY_EVENT_DBOX_MASK | DBOX_KEY_EVENT_FOCUS_OUT, /**< Key event, foucs out */
-
- DBOX_GBAR_KEY_DOWN = DBOX_KEY_EVENT_KEY_MASK | DBOX_KEY_EVENT_GBAR_MASK | DBOX_KEY_EVENT_DOWN, /**< Key down on the dynamicbox */
- DBOX_GBAR_KEY_UP = DBOX_KEY_EVENT_KEY_MASK | DBOX_KEY_EVENT_GBAR_MASK | DBOX_KEY_EVENT_UP, /**< Key up on the dynamicbox */
- DBOX_GBAR_KEY_SET = DBOX_KEY_EVENT_KEY_MASK | DBOX_KEY_EVENT_GBAR_MASK | DBOX_KEY_EVENT_SET, /**< Key event, start feeding event by master */
- DBOX_GBAR_KEY_UNSET = DBOX_KEY_EVENT_KEY_MASK | DBOX_KEY_EVENT_GBAR_MASK | DBOX_KEY_EVENT_UNSET, /**< Key event, stop feeding event by master */
- DBOX_GBAR_KEY_FOCUS_IN = DBOX_KEY_EVENT_KEY_MASK | DBOX_KEY_EVENT_GBAR_MASK | DBOX_KEY_EVENT_FOCUS_IN, /**< Key event, focus in */
- DBOX_GBAR_KEY_FOCUS_OUT = DBOX_KEY_EVENT_KEY_MASK | DBOX_KEY_EVENT_GBAR_MASK | DBOX_KEY_EVENT_FOCUS_OUT, /**< Key event, focus out */
+ DBOX_KEY_DOWN = DBOX_KEY_EVENT_MASK | DBOX_KEY_EVENT_DBOX_MASK | DBOX_KEY_EVENT_DOWN, /**< Key down on the dynamicbox */
+ DBOX_KEY_UP = DBOX_KEY_EVENT_MASK | DBOX_KEY_EVENT_DBOX_MASK | DBOX_KEY_EVENT_UP, /**< Key up on the dynamicbox */
+ DBOX_KEY_SET = DBOX_KEY_EVENT_MASK | DBOX_KEY_EVENT_DBOX_MASK | DBOX_KEY_EVENT_SET, /**< Key event, start feeding event by master */
+ DBOX_KEY_UNSET = DBOX_KEY_EVENT_MASK | DBOX_KEY_EVENT_DBOX_MASK | DBOX_KEY_EVENT_UNSET, /**< Key event, stop feeding event by master */
+ DBOX_KEY_FOCUS_IN = DBOX_KEY_EVENT_MASK | DBOX_KEY_EVENT_DBOX_MASK | DBOX_KEY_EVENT_FOCUS_IN, /**< Key event, focus in */
+ DBOX_KEY_FOCUS_OUT = DBOX_KEY_EVENT_MASK | DBOX_KEY_EVENT_DBOX_MASK | DBOX_KEY_EVENT_FOCUS_OUT, /**< Key event, foucs out */
+
+ DBOX_GBAR_KEY_DOWN = DBOX_KEY_EVENT_MASK | DBOX_KEY_EVENT_GBAR_MASK | DBOX_KEY_EVENT_DOWN, /**< Key down on the dynamicbox */
+ DBOX_GBAR_KEY_UP = DBOX_KEY_EVENT_MASK | DBOX_KEY_EVENT_GBAR_MASK | DBOX_KEY_EVENT_UP, /**< Key up on the dynamicbox */
+ DBOX_GBAR_KEY_SET = DBOX_KEY_EVENT_MASK | DBOX_KEY_EVENT_GBAR_MASK | DBOX_KEY_EVENT_SET, /**< Key event, start feeding event by master */
+ DBOX_GBAR_KEY_UNSET = DBOX_KEY_EVENT_MASK | DBOX_KEY_EVENT_GBAR_MASK | DBOX_KEY_EVENT_UNSET, /**< Key event, stop feeding event by master */
+ DBOX_GBAR_KEY_FOCUS_IN = DBOX_KEY_EVENT_MASK | DBOX_KEY_EVENT_GBAR_MASK | DBOX_KEY_EVENT_FOCUS_IN, /**< Key event, focus in */
+ DBOX_GBAR_KEY_FOCUS_OUT = DBOX_KEY_EVENT_MASK | DBOX_KEY_EVENT_GBAR_MASK | DBOX_KEY_EVENT_FOCUS_OUT, /**< Key event, focus out */
DBOX_KEY_EVENT_MAX = 0xFFFFFFFF /**< Unknown event */
};
--- /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.
+ */
+
+struct cb_info {
+ dynamicbox_ret_cb_t cb;
+ void *data;
+};
+
+extern void dbox_invoke_event_handler(struct dynamicbox *handler, enum dynamicbox_event_type event);
+extern void dbox_invoke_fault_handler(enum dynamicbox_fault_type type, const char *pkgname, const char *filename, const char *function);
+
+extern struct dynamicbox_common *dbox_find_common_handle(const char *pkgname, const char *filename);
+extern struct dynamicbox *dbox_new_dynamicbox(const char *pkgname, const char *id, double timestamp, const char *cluster, const char *category);
+extern struct dynamicbox_common *dbox_find_common_handle_by_timestamp(double timestamp);
+
+extern int dbox_set_group(struct dynamicbox_common *common, const char *cluster, const char *category);
+extern void dbox_set_size(struct dynamicbox_common *common, int w, int h);
+extern void dbox_set_gbarsize(struct dynamicbox_common *common, int w, int h);
+extern void dbox_set_default_gbarsize(struct dynamicbox_common *common, int w, int h);
+extern int dbox_set_content(struct dynamicbox_common *common, const char *content);
+extern int dbox_set_title(struct dynamicbox_common *handler, const char *title);
+extern void dbox_set_auto_launch(struct dynamicbox_common *handler, const char *auto_launch);
+extern void dbox_set_id(struct dynamicbox_common *handler, const char *id);
+extern void dbox_set_size_list(struct dynamicbox_common *handler, int size_list);
+extern void dbox_set_priority(struct dynamicbox_common *handler, double priority);
+extern int dbox_set_dbox_fb(struct dynamicbox_common *handler, const char *filename);
+extern int dbox_set_gbar_fb(struct dynamicbox_common *handler, const char *filename);
+extern struct fb_info *dbox_get_gbar_fb(struct dynamicbox_common *handler);
+extern struct fb_info *dbox_get_dbox_fb(struct dynamicbox_common *handler);
+extern void dbox_set_user(struct dynamicbox_common *handler, int user);
+extern void dbox_set_pinup(struct dynamicbox_common *handler, int pinup);
+extern void dbox_set_text_dbox(struct dynamicbox_common *handler);
+extern void dbox_set_text_gbar(struct dynamicbox_common *handler);
+extern int dbox_text_dbox(struct dynamicbox_common *handler);
+extern int dbox_text_gbar(struct dynamicbox_common *handler);
+extern void dbox_set_period(struct dynamicbox_common *handler, double period);
+extern void dbox_set_update_mode(struct dynamicbox_common *handler, int active_mode);
+extern void dbox_set_filename(struct dynamicbox_common *handler, const char *filename);
+extern void dbox_set_alt_icon(struct dynamicbox_common *handler, const char *icon);
+extern void dbox_set_alt_name(struct dynamicbox_common *handle, const char *name);
+extern int dbox_destroy_lock_file(struct dynamicbox_common *common, int is_gbar);
+extern int dbox_create_lock_file(struct dynamicbox_common *common, int is_gbar);
+extern int dbox_destroy_common_handle(struct dynamicbox_common *common);
+extern struct dynamicbox_common *dbox_create_common_handle(struct dynamicbox *handle, const char *pkgname, const char *cluster, const char *category);
+extern int dbox_sync_gbar_fb(struct dynamicbox_common *common);
+extern int dbox_sync_dbox_fb(struct dynamicbox_common *common);
+extern int dbox_common_unref(struct dynamicbox_common *common, struct dynamicbox *handle);
+extern int dbox_common_ref(struct dynamicbox_common *common, struct dynamicbox *handle);
+extern int dbox_fb_lock(int fd);
+extern int dbox_fb_unlock(int fd);
+extern struct dynamicbox_common *dbox_find_sharable_common_handle(const char *pkgname, const char *content, int w, int h, const char *cluster, const char *category);
+extern struct dynamicbox *dbox_find_dbox_in_show(struct dynamicbox_common *common);
+extern struct dynamicbox *dbox_get_dbox_nth(struct dynamicbox_common *common, int nth);
+extern void *dbox_remove_event_handler(int (*dbox_cb)(struct dynamicbox *, enum dynamicbox_event_type, void *));
+extern int dbox_add_event_handler(int (*dbox_cb)(struct dynamicbox *, enum dynamicbox_event_type, void *), void *data);
+extern int dbox_add_fault_handler(int (*dbox_cb)(enum dynamicbox_fault_type, const char *, const char *, const char *, void *), void *data);
+extern void *dbox_remove_fault_handler(int (*dbox_cb)(enum dynamicbox_fault_type, const char *, const char *, const char *, void *));
+extern struct cb_info *dbox_create_cb_info(dynamicbox_ret_cb_t cb, void *data);
+extern void dbox_destroy_cb_info(struct cb_info *info);
+
+extern struct dynamicbox *dbox_ref(struct dynamicbox *handler);
+extern struct dynamicbox *dbox_unref(struct dynamicbox *handler, int destroy_common);
+extern int dbox_send_delete(struct dynamicbox *handler, int type, dynamicbox_ret_cb_t cb, void *data);
+extern int dbox_delete_all(void);
+
+enum dbox_type { /*!< Must have to be sync with data-provider-master */
+ _DBOX_TYPE_NONE = 0x0,
+ _DBOX_TYPE_SCRIPT,
+ _DBOX_TYPE_FILE,
+ _DBOX_TYPE_TEXT,
+ _DBOX_TYPE_BUFFER,
+ _DBOX_TYPE_ELEMENTARY
+};
+
+enum gbar_type { /*!< Must have to be sync with data-provider-master */
+ _GBAR_TYPE_NONE = 0x0,
+ _GBAR_TYPE_SCRIPT,
+ _GBAR_TYPE_TEXT,
+ _GBAR_TYPE_BUFFER,
+ _GBAR_TYPE_ELEMENTARY
+};
+
+enum dynamicbox_state {
+ CREATE = 0xBEEFbeef,
+ DELETE = 0xDEADdead, /* Delete only for this client */
+ DESTROYED = 0x00DEAD00
+};
+
+struct dynamicbox_common {
+ enum dynamicbox_state state;
+
+ struct dlist *dynamicbox_list;
+ int refcnt;
+
+ char *cluster;
+ char *category;
+
+ char *pkgname;
+ char *id;
+
+ char *content;
+ char *title;
+ char *filename;
+
+ double timestamp;
+
+ struct alt_info {
+ char *icon;
+ char *name;
+ } alt;
+
+ enum dynamicbox_delete_type delete_type;
+
+ int is_user;
+ int is_gbar_created;
+ int is_pinned_up;
+ int is_active_update;
+ enum dynamicbox_visible_state visible;
+
+ struct {
+ enum dbox_type type;
+ struct fb_info *fb;
+
+ int size_list;
+
+ int width;
+ int height;
+ double priority;
+
+ char *auto_launch;
+ double period;
+ int pinup_supported;
+ int mouse_event;
+
+ /* For the filtering event */
+ double x;
+ double y;
+ char *lock;
+ int lock_fd;
+ } dbox;
+
+ struct {
+ enum gbar_type type;
+ struct fb_info *fb;
+
+ int width;
+ int height;
+
+ int default_width;
+ int default_height;
+
+ /* For the filtering event */
+ double x;
+ double y;
+ char *lock;
+ int lock_fd;
+ } gbar;
+
+ int nr_of_sizes;
+
+ struct requested_flag {
+ unsigned int created:1;
+ unsigned int deleted:1;
+ unsigned int pinup:1;
+ unsigned int group_changed:1;
+ unsigned int period_changed:1;
+ unsigned int size_changed:1;
+ unsigned int gbar_created:1;
+ unsigned int gbar_destroyed:1;
+ unsigned int update_mode:1;
+ unsigned int access_event:1;
+ unsigned int key_event:1;
+
+ /*!
+ * \note
+ * Reserved
+ */
+ unsigned int reserved:21;
+ } request;
+};
+
+struct job_item {
+ struct dynamicbox *handle;
+ dynamicbox_ret_cb_t cb;
+ int ret;
+ void *data;
+};
+
+struct dynamicbox {
+ enum dynamicbox_state state;
+
+ int refcnt;
+ int paused_updating;
+
+ enum dynamicbox_visible_state visible;
+ struct dynamicbox_common *common;
+
+ void *data;
+
+ struct callback_table {
+ struct dynamicbox_script_operators dbox_ops;
+ struct dynamicbox_script_operators gbar_ops;
+
+ struct created {
+ dynamicbox_ret_cb_t cb;
+ void *data;
+ } created;
+
+ struct deleted {
+ dynamicbox_ret_cb_t cb;
+ void *data;
+ } deleted;
+
+ struct pinup {
+ dynamicbox_ret_cb_t cb;
+ void *data;
+ } pinup;
+
+ struct group_changed {
+ dynamicbox_ret_cb_t cb;
+ void *data;
+ } group_changed;
+
+ struct period_changed {
+ dynamicbox_ret_cb_t cb;
+ void *data;
+ } period_changed;
+
+ struct size_changed {
+ dynamicbox_ret_cb_t cb;
+ void *data;
+ } size_changed;
+
+ struct gbar_created {
+ dynamicbox_ret_cb_t cb;
+ void *data;
+ } gbar_created;
+
+ struct gbar_destroyed {
+ dynamicbox_ret_cb_t cb;
+ void *data;
+ } gbar_destroyed;
+
+ struct update_mode {
+ dynamicbox_ret_cb_t cb;
+ void *data;
+ } update_mode;
+
+ struct access_event {
+ dynamicbox_ret_cb_t cb;
+ void *data;
+ } access_event;
+
+ struct key_event {
+ dynamicbox_ret_cb_t cb;
+ void *data;
+ } key_event;
+ } cbs;
+};
+
+/* End of a file */
+++ /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.
- */
-
-#ifndef __LIVEBOX_H
-#define __LIVEBOX_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @file livebox.h
- * @brief This file declares API of liblivebox-viewer library
- */
-
-/**
- * @addtogroup CAPI_LIVEBOX_VIEWER_MODULE
- * @{
- */
-
-/**
- * @brief
- * Structure for a Livebox instance.
- */
-struct livebox;
-
-/**
- * @brief Definition for a default update period for Livebox (defined in the package manifest file).
- */
-#define DEFAULT_PERIOD -1.0f
-
-/**
- * @brief Enumeration for Mouse & Key event for buffer type Livebox or PD.
- * @details Viewer should send these events to livebox.
- */
-enum content_event_type {
- CONTENT_EVENT_MOUSE_DOWN = 0x00000001, /**< LB mouse down event for livebox */
- CONTENT_EVENT_MOUSE_UP = 0x00000002, /**< LB mouse up event for livebox */
- CONTENT_EVENT_MOUSE_MOVE = 0x00000004, /**< LB mouse move event for livebox */
- CONTENT_EVENT_MOUSE_ENTER = 0x00000008, /**< LB mouse enter event for livebox */
- CONTENT_EVENT_MOUSE_LEAVE = 0x00000010, /**< LB mouse leave event for livebox */
- CONTENT_EVENT_MOUSE_SET = 0x00000020, /**< LB mouse set auto event for livebox */
- CONTENT_EVENT_MOUSE_UNSET = 0x00000040, /**< LB mouse unset auto event for livebox */
-
- CONTENT_EVENT_KEY_DOWN = 0x00000001, /**< LB key press */
- CONTENT_EVENT_KEY_UP = 0x00000002, /**< LB key release */
- CONTENT_EVENT_KEY_FOCUS_IN = 0x00000008, /**< LB key focused in */
- CONTENT_EVENT_KEY_FOCUS_OUT = 0x00000010, /**< LB key focused out */
- CONTENT_EVENT_KEY_SET = 0x00000020, /**< LB Key, start feeding event by master */
- CONTENT_EVENT_KEY_UNSET = 0x00000040, /**< LB key, stop feeding event by master */
-
- CONTENT_EVENT_ON_SCROLL = 0x00000080, /**< LB On scrolling */
- CONTENT_EVENT_ON_HOLD = 0x00000100, /**< LB On holding */
- CONTENT_EVENT_OFF_SCROLL = 0x00000200, /**< LB Stop scrolling */
- CONTENT_EVENT_OFF_HOLD = 0x00000400, /**< LB Stop holding */
-
- CONTENT_EVENT_KEY_MASK = 0x80000000, /**< Mask value for key event */
- CONTENT_EVENT_MOUSE_MASK = 0x20000000, /**< Mask value for mouse event */
- CONTENT_EVENT_PD_MASK = 0x10000000, /**< Mask value for PD event */
- CONTENT_EVENT_LB_MASK = 0x40000000, /**< Mask value for LB event */
-
- LB_MOUSE_ON_SCROLL = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_ON_SCROLL, /**< Mouse event occurs while scrolling */
- LB_MOUSE_ON_HOLD = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_ON_HOLD, /**< Mouse event occurs on holding */
- LB_MOUSE_OFF_SCROLL = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_OFF_SCROLL, /**< Scrolling stopped */
- LB_MOUSE_OFF_HOLD = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_OFF_HOLD, /**< Holding stopped */
-
- LB_MOUSE_DOWN = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_DOWN, /**< Mouse down on the livebox */
- LB_MOUSE_UP = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_UP, /**< Mouse up on the livebox */
- LB_MOUSE_MOVE = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_MOVE, /**< Move move on the livebox */
- LB_MOUSE_ENTER = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_ENTER, /**< Mouse enter to the livebox */
- LB_MOUSE_LEAVE = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_LEAVE, /**< Mouse leave from the livebox */
- LB_MOUSE_SET = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_SET, /**< Mouse event, start feeding event by master */
- LB_MOUSE_UNSET = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_UNSET, /**< Mouse event, stop feeding event by master */
-
- PD_MOUSE_ON_SCROLL = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_ON_SCROLL, /**< Mouse event occurs while scrolling */
- PD_MOUSE_ON_HOLD = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_ON_HOLD, /**< Mouse event occurs on holding */
- PD_MOUSE_OFF_SCROLL = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_OFF_SCROLL, /**< Scrolling stopped */
- PD_MOUSE_OFF_HOLD = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_OFF_HOLD, /**< Holding stopped */
-
- PD_MOUSE_DOWN = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_DOWN, /**< Mouse down on the PD */
- PD_MOUSE_UP = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_UP, /**< Mouse up on the PD */
- PD_MOUSE_MOVE = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_MOVE, /**< Mouse move on the PD */
- PD_MOUSE_ENTER = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_ENTER, /**< Mouse enter to the PD */
- PD_MOUSE_LEAVE = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_LEAVE, /**< Mouse leave from the PD */
- PD_MOUSE_SET = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_SET, /**< Mouse event, start feeding event by master */
- PD_MOUSE_UNSET = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_UNSET, /**< Mouse event, stop feeding event by master */
-
- LB_KEY_DOWN = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_DOWN, /**< Key down on the livebox */
- LB_KEY_UP = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_UP, /**< Key up on the livebox */
- LB_KEY_SET = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_SET, /**< Key event, start feeding event by master */
- LB_KEY_UNSET = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_UNSET, /**< Key event, stop feeding event by master */
- LB_KEY_FOCUS_IN = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_FOCUS_IN, /**< Key event, focus in */
- LB_KEY_FOCUS_OUT = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_FOCUS_OUT, /**< Key event, foucs out */
-
- PD_KEY_DOWN = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_DOWN, /**< Key down on the livebox */
- PD_KEY_UP = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_UP, /**< Key up on the livebox */
- PD_KEY_SET = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_SET, /**< Key event, start feeding event by master */
- PD_KEY_UNSET = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_UNSET, /**< Key event, stop feeding event by master */
- PD_KEY_FOCUS_IN = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_FOCUS_IN, /**< Key event, focus in */
- PD_KEY_FOCUS_OUT = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_FOCUS_OUT, /**< Key event, focus out */
-
- CONTENT_EVENT_MAX = 0xFFFFFFFF /**< Unknown event */
-};
-
-/**
- * @brief Enumeration for Accessibility event for buffer type Livebox or PD.
- * @details These events are sync'd with Tizen accessibility event set.
- */
-enum access_event_type {
- ACCESS_EVENT_PD_MASK = 0x10000000, /**< PD Accessibility event mask */
- ACCESS_EVENT_LB_MASK = 0x20000000, /**< LB Accessibility event mask */
-
- ACCESS_EVENT_HIGHLIGHT = 0x00000100, /**< LB accessibility: Hightlight a object */
- ACCESS_EVENT_HIGHLIGHT_NEXT = 0x00000200, /**< LB accessibility: Set highlight to next object */
- ACCESS_EVENT_HIGHLIGHT_PREV = 0x00000400, /**< LB accessibility: Set highlight to prev object */
- ACCESS_EVENT_UNHIGHLIGHT = 0x00000800, /**< LB accessibility unhighlight */
- ACCESS_EVENT_ACTIVATE = 0x00001000, /**< LB accessibility activate */
- ACCESS_EVENT_ACTION_DOWN = 0x00010000, /**< LB accessibility value changed */
- ACCESS_EVENT_ACTION_UP = 0x00020000, /**< LB accessibility value changed */
- ACCESS_EVENT_SCROLL_DOWN = 0x00100000, /**< LB accessibility scroll down */
- ACCESS_EVENT_SCROLL_MOVE = 0x00200000, /**< LB accessibility scroll move */
- ACCESS_EVENT_SCROLL_UP = 0x00400000, /**< LB accessibility scroll up */
- ACCESS_EVENT_VALUE_CHANGE = 0x00800000, /**< LB accessibility value change */
- ACCESS_EVENT_MOUSE = 0x01000000, /**< Give mouse event to highlight object */
- ACCESS_EVENT_BACK = 0x02000000, /**< Go back to a previous view ex: pop naviframe item */
- ACCESS_EVENT_OVER = 0x04000000, /**< Mouse over an object */
- ACCESS_EVENT_READ = 0x08000000, /**< Highlight an object */
- ACCESS_EVENT_ENABLE = 0x00000001, /**< Enable highlight and read ability */
- ACCESS_EVENT_DISABLE = 0x00000002, /**< Disable highlight and read ability */
-
- LB_ACCESS_HIGHLIGHT = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_HIGHLIGHT, /**< Access event - Highlight an object in the livebox */
- LB_ACCESS_HIGHLIGHT_NEXT = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_HIGHLIGHT_NEXT, /**< Access event - Move highlight to the next object in a livebox */
- LB_ACCESS_HIGHLIGHT_PREV = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_HIGHLIGHT_PREV, /**< Access event - Move highlight to the prev object in a livebox */
- LB_ACCESS_UNHIGHLIGHT = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_UNHIGHLIGHT, /**< Access event - Delete highlight from the livebox */
- LB_ACCESS_ACTIVATE = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_ACTIVATE, /**< Access event - Launch or activate the highlighted object */
- LB_ACCESS_ACTION_DOWN = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_ACTION_DOWN, /**< Access event - down */
- LB_ACCESS_ACTION_UP = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_ACTION_UP, /**< Access event - up */
- LB_ACCESS_SCROLL_DOWN = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_SCROLL_DOWN, /**< Access event - scroll down */
- LB_ACCESS_SCROLL_MOVE = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_SCROLL_MOVE, /**< Access event - scroll move */
- LB_ACCESS_SCROLL_UP = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_SCROLL_UP, /**< Access event - scroll up */
- LB_ACCESS_VALUE_CHANGE = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_VALUE_CHANGE, /**< Access event - value change */
- LB_ACCESS_MOUSE = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_MOUSE, /**< Access event - mouse */
- LB_ACCESS_BACK = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_BACK, /**< Access event - back */
- LB_ACCESS_OVER = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_OVER, /**< Access event - over */
- LB_ACCESS_READ = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_READ, /**< Access event - read */
- LB_ACCESS_ENABLE = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_ENABLE, /**< Access event - enable */
- LB_ACCESS_DISABLE = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_DISABLE, /**< Access event - disable */
-
- PD_ACCESS_HIGHLIGHT = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_HIGHLIGHT, /**< Access event - Highlight an object in the PD */
- PD_ACCESS_HIGHLIGHT_NEXT = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_HIGHLIGHT_NEXT, /**< Access event - Move highlight to the next object in a PD */
- PD_ACCESS_HIGHLIGHT_PREV = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_HIGHLIGHT_PREV, /**< Access event - Move highlight to the prev object in a PD */
- PD_ACCESS_UNHIGHLIGHT = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_UNHIGHLIGHT, /**< Access event - Delet highlight from the PD */
- PD_ACCESS_ACTIVATE = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_ACTIVATE, /**< Access event - Launch or activate the highlighted object */
- PD_ACCESS_ACTION_DOWN = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_ACTION_DOWN, /**< Access event - down */
- PD_ACCESS_ACTION_UP = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_ACTION_UP, /**< Access event - up */
- PD_ACCESS_SCROLL_DOWN = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_SCROLL_DOWN, /**< Access event - scroll down */
- PD_ACCESS_SCROLL_MOVE = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_SCROLL_MOVE, /**< Access event - scroll move */
- PD_ACCESS_SCROLL_UP = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_SCROLL_UP, /**< Access event - scroll up */
- PD_ACCESS_VALUE_CHANGE = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_VALUE_CHANGE, /**< Access event - value change */
- PD_ACCESS_MOUSE = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_MOUSE, /**< Access event - mouse */
- PD_ACCESS_BACK = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_BACK, /**< Access event - back */
- PD_ACCESS_OVER = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_OVER, /**< Access event - over */
- PD_ACCESS_READ = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_READ, /**< Access event - read */
- PD_ACCESS_ENABLE = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_ENABLE, /**< Access event - enable */
- PD_ACCESS_DISABLE = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_DISABLE /**< Access event - disable */
-};
-
-/**
- * @brief Enumeration for Livebox LB content type.
- */
-enum livebox_lb_type {
- LB_TYPE_IMAGE = 0x01, /**< Contents of a livebox is based on the image file */
- LB_TYPE_BUFFER = 0x02, /**< Contents of a livebox is based on canvas buffer(shared) */
- LB_TYPE_TEXT = 0x04, /**< Contents of a livebox is based on formatted text file */
- LB_TYPE_PIXMAP = 0x08, /**< Contens of a livebox is shared by the pixmap(depends on X) */
- LB_TYPE_ELEMENTARY = 0x10, /**< Using Elementary for sharing content & event */
- LB_TYPE_INVALID = 0xFF /**< Unknown LB type */
-};
-
-/**
- * @brief Enumeration for Livebox PD content type.
- */
-enum livebox_pd_type {
- PD_TYPE_BUFFER = 0x01, /**< Contents of a PD is based on canvas buffer(shared) */
- PD_TYPE_TEXT = 0x02, /**< Contents of a PD is based on formatted text file */
- PD_TYPE_PIXMAP = 0x04, /**< Contents of a livebox is shared by the pixmap(depends on X) */
- PD_TYPE_ELEMENTARY = 0x08, /**< Using Elementary for sharing content & event */
- PD_TYPE_INVALID = 0xFF /**< Unknown PD type */
-};
-
-/**
- * @brief Enumeration for Livebox event type.
- * @details These events will be sent from the provider.
- */
-enum livebox_event_type { /**< livebox_event_handler_set Event list */
- LB_EVENT_LB_UPDATED, /**< Contents of the given livebox is updated */
- LB_EVENT_PD_UPDATED, /**< Contents of the given pd is updated */
-
- LB_EVENT_CREATED, /**< A new livebox is created */
- LB_EVENT_DELETED, /**< A livebox is deleted */
-
- LB_EVENT_GROUP_CHANGED, /**< Group (Cluster/Sub-cluster) information is changed */
- LB_EVENT_PINUP_CHANGED, /**< PINUP status is changed */
- LB_EVENT_PERIOD_CHANGED, /**< Update period is changed */
-
- LB_EVENT_LB_SIZE_CHANGED, /**< Livebox size is changed */
- LB_EVENT_PD_SIZE_CHANGED, /**< PD size is changed */
-
- LB_EVENT_PD_CREATED, /**< If a PD is created even if you didn't call the livebox_create_pd API */
- LB_EVENT_PD_DESTROYED, /**< If a PD is destroyed even if you didn't call the livebox_destroy_pd API */
-
- LB_EVENT_HOLD_SCROLL, /**< If the screen should be freezed */
- LB_EVENT_RELEASE_SCROLL, /**< If the screen can be scrolled */
-
- LB_EVENT_LB_UPDATE_BEGIN, /**< Livebox LB content update is started */
- LB_EVENT_LB_UPDATE_END, /**< Livebox LB content update is finished */
-
- LB_EVENT_PD_UPDATE_BEGIN, /**< Livebox PD content update is started */
- LB_EVENT_PD_UPDATE_END, /**< Livebox PD content update is finished */
-
- LB_EVENT_UPDATE_MODE_CHANGED, /**< Livebox Update mode is changed */
-
- LB_EVENT_REQUEST_CLOSE_PD, /**< Livebox requests to close the PD */
-
- LB_EVENT_EXTRA_INFO_UPDATED, /**< Extra information is updated */
-
- LB_EVENT_IGNORED /**< Request is ignored */
-};
-
-/**
- * @brief Enumeration for Livebox option types.
- */
-enum livebox_option_type {
- LB_OPTION_MANUAL_SYNC, /**< Sync manually */
- LB_OPTION_FRAME_DROP_FOR_RESIZE, /**< Drop frames while resizing */
- LB_OPTION_SHARED_CONTENT, /**< Use only one real instance for multiple fake instances if user creates it using same content */
-
- LB_OPTION_ERROR = 0xFFFFFFFF /**< To specify the size of this enumeration type */
-};
-
-enum livebox_fault_type {
- LB_FAULT_DEACTIVATED, /*!< Livebox is deactivated by its fault operation */
- LB_FAULT_PROVIDER_DISCONNECTED /*!< Provider is disconnected */
-};
-
-/**
- * @brief Enumeration for Livebox visible states.
- * @details Must be sync'd with a provider.
- */
-enum livebox_visible_state {
- LB_SHOW = 0x00, /**< Livebox is shown. Default state */
- LB_HIDE = 0x01, /**< Livebox is hidden, Update timer will not be freezed. but you cannot receive any updates events. */
-
- LB_HIDE_WITH_PAUSE = 0x02, /**< Livebix is hidden, it will pause the update timer, but if a livebox updates its contents, update event will be triggered */
-
- LB_VISIBLE_ERROR = 0xFFFFFFFF /**< To specify the size of this enumeration type */
-};
-
-/**
- * @brief Structure for TEXT type livebox contents handling opertators.
- */
-struct livebox_script_operators {
- int (*update_begin)(struct livebox *handle); /**< Content parser is started */
- int (*update_end)(struct livebox *handle); /**< Content parser is finished */
-
- /* Listed functions will be called when parser meets each typed content */
- int (*update_text)(struct livebox *handle, const char *id, const char *part, const char *data); /**< Update text content */
- int (*update_image)(struct livebox *handle, const char *id, const char *part, const char *data, const char *option); /**< Update image content */
- int (*update_script)(struct livebox *handle, const char *id, const char *new_id, const char *part, const char *file, const char *group); /**< Update script content */
- int (*update_signal)(struct livebox *handle, const char *id, const char *emission, const char *signal); /**< Update signal */
- int (*update_drag)(struct livebox *handle, const char *id, const char *part, double dx, double dy); /**< Update drag info */
- int (*update_info_size)(struct livebox *handle, const char *id, int w, int h); /**< Update content size */
- int (*update_info_category)(struct livebox *handle, const char *id, const char *category); /**< Update content category info */
- int (*update_access)(struct livebox *handle, const char *id, const char *part, const char *text, const char *option); /**< Update access information */
- int (*operate_access)(struct livebox *handle, const char *id, const char *part, const char *operation, const char *option); /**< Update access operation */
- int (*update_color)(struct livebox *handle, const char *id, const char *part, const char *data); /**< Update color */
-};
-
-/**
- * @brief Called for every async function.
- * @details Prototype of the return callback of every async functions.
- * @param[in] handle Handle of the livebox instance
- * @param[in] ret Result status of operation (LB_STATUS_XXX defined from liblivebox-service)
- * @param[in] data Data for result callback
- * @return void
- * @see livebox_add()
- * @see livebox_del()
- * @see livebox_activate()
- * @see livebox_resize()
- * @see livebox_set_group()
- * @see livebox_set_period()
- * @see livebox_access_event()
- * @see livebox_set_pinup()
- * @see livebox_create_pd()
- * @see livebox_create_pd_with_position()
- * @see livebox_destroy_pd()
- * @see livebox_emit_text_signal()
- * @see livebox_acquire_pd_pixmap()
- * @see livebox_acquire_lb_pixmap()
- * @see livebox_set_update_mode()
- */
-typedef void (*ret_cb_t)(struct livebox *handle, int ret, void *data);
-
-/**
- * @brief Initializes the livebox system.
- * @remarks This API uses get/setenv APIs.
- * Those APIs are not thread-safe.
- * So you have to consider to use the livebox_init_with_options instead of this if you are developing multi-threaded viewer.
- * @param[in] disp X Display connection object (If you have X Display connection object already, you can re-use it. But you should care its life cycle.
- * It must be alive before calling livebox_fini())
- * @return int
- * @retval #LB_STATUS_SUCCESS if success
- * @see livebox_fini()
- * @see livebox_init_with_options()
- */
-extern int livebox_init(void *disp);
-
-/**
- * @brief Initializes the livebox system with some options.
- * @details livebox_init function uses environment value to initiate some configurable values.
- * But some applications do not want to use the env value.
- * For them, this API will give a chance to set default options using given arguments.
- * @param[in] disp Display (if @a disp is @c NULL, the library will try to acquire a new connection with X)
- * @param[in] prevent_overwrite Overwrite flag (when the content of an image type livebox is updated, it will be overwriten (0) or not (1))
- * @param[in] event_filter If the next event comes in this period, ignore it. It is too fast to processing it in time // need to be elaborated
- * @param[in] use_thread Use the receive thread // need to be elaborated
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int Integer, Livebox status code
- * @retval #LB_STATUS_SUCCESS if success
- * @see livebox_init()
- * @see livebox_fini()
- */
-extern int livebox_init_with_options(void *disp, int prevent_overwrite, double event_filter, int use_thread);
-
-/**
- * @brief Finalizes the livebox system.
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_SUCCES if success
- * @retval #LB_STATUS_ERROR_INVALID if livebox_init is not called
- * @see livebox_init()
- * @see livebox_init_with_options()
- */
-extern int livebox_fini(void);
-
-/**
- * @brief Notifies the status of a client ("it is paused") to the provider.
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_SUCCESS if success
- * @retval #LB_STATUS_ERROR_FAULT if it failed to send state (paused) info
- * @see livebox_client_resumed()
- */
-extern int livebox_client_paused(void);
-
-/**
- * @brief Notifies the status of client ("it is resumed") to the provider.
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_SUCCESS if success
- * @retval #LB_STATUS_ERROR_FAULT if it failed to send state (resumed) info
- * @see livebox_client_paused()
- */
-extern int livebox_client_resumed(void);
-
-/**
- * @brief Adds a new livebox.
- * @details If the screen size is "1280x720", the below size lists are used for default.
- * Or you can find the default sizes in pixel from /usr/share/data-provider-master/resolution.ini.
- * Size types are defined from the liblivebox-service package (livebox-service.h).
- *
- * Normal mode livebox
- * 1x1=175x175, #LB_SIZE_TYPE_1x1
- * 2x1=354x175, #LB_SIZE_TYPE_2x1
- * 2x2=354x354, #LB_SIZE_TYPE_2x2
- * 4x1=712x175, #LB_SIZE_TYPE_4x1
- * 4x2=712x354, #LB_SIZE_TYPE_4x2
- * 4x4=712x712, #LB_SIZE_TYPE_4x4
- *
- * Extended sizes
- * 4x3=712x533, #LB_SIZE_TYPE_4x3
- * 4x5=712x891, #LB_SIZE_TYPE_4x5
- * 4x6=712x1070, #LB_SIZE_TYPE_4x6
- *
- * Easy mode livebox
- * 21x21=224x215, #LB_SIZE_TYPE_EASY_1x1
- * 23x21=680x215, #LB_SIZE_TYPE_EASY_3x1
- * 23x23=680x653, #LB_SIZE_TYPE_EASY_3x3
- *
- * Special livebox
- * 0x0=720x1280, #LB_SIZE_TYPE_0x0
- *
- * @remarks
- * Even if you get a handle from the return value of this function, it is not a created instance.
- * So you have to consider it as a not initialized handle.
- * It can be initialized only after getting the return callback with "ret == #LB_STATUS_SUCCESS"
- * @param[in] pkgname Livebox Id
- * @param[in] content Contents that will be passed to the livebox instance
- * @param[in] cluster Main group
- * @param[in] category Sub group
- * @param[in] period Update period (@c DEFAULT_PERIOD can be used for this; this argument will be used to specify the period of updating contents of a livebox)
- * @param[in] type Size type (defined from liblivebox-service package)
- * @param[in] cb After the request is sent to the master provider, this callback will be called
- * @param[in] data This data will be passed to the callback
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return handle
- * @retval Handle Livebox handle but not yet initialized
- * @retval @c NULL if it fails to create a handle
- * @see ret_cb_t
- */
-extern struct livebox *livebox_add(const char *pkgname, const char *content, const char *cluster, const char *category, double period, int type, ret_cb_t cb, void *data);
-
-/**
- * @brief Deletes a livebox (will replace livebox_del).
- * @remarks If you call this with an uninitialized handle, the return callback will be called synchronously.
- * So before returning from this function, the return callback will be called first.
- * @param[in] handler Handler of a livebox instance
- * @param[in] type Deletion type (LB_DELETE_PERMANENTLY or LB_DELETE_TEMPORARY)
- * @param[in] cb Return callback
- * @param[in] data User data for return callback
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_BUSY Already in process
- * @retval #LB_STATUS_ERROR_FAULT Failed to create a request packet
- * @retval #LB_STATUS_SUCCESS Successfully sent, return callack will be called
- * @see ret_cb_t
- */
-extern int livebox_del(struct livebox *handler, int type, ret_cb_t cb, void *data);
-
-/**
- * @brief Sets a livebox events callback.
- * @details To get the event push from the provider, register the event callback using this function.
- * The callback will be called if there is any event from the provider.
- * @param[in] cb Event handler
- * @param[in] data User data for the event handler
- * @privlevel N/P
- * @return int
- * @retval #LB_STATUS_SUCCESS If succeed to set event handler
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_MEMORY Not enough memory
- * @see livebox_unset_event_handler()
- */
-extern int livebox_set_event_handler(int (*cb)(struct livebox *handler, enum livebox_event_type event, void *data), void *data);
-
-/**
- * @brief Unsets the livebox event handler.
- * @param[in] cb Event handler
- * @privlevel N/P
- * @return void * Event handler data
- * @retval pointer Pointer of 'data' which is used with the livebox_set_event_handler
- * @see livebox_set_event_handler()
- */
-extern void *livebox_unset_event_handler(int (*cb)(struct livebox *handler, enum livebox_event_type event, void *data));
-
-/**
- * @brief Registers the livebox fault event handler.
- * @details Argument list: event, pkgname, filename, funcname.
- * @param[in] cb Event handler
- * @param[in] data Event handler data
- * @privlevel N/P
- * @return int
- * @retval #LB_STATUS_SUCCESS If succeed to set fault event handler
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_MEMORY Not enough memory
- * @see livebox_unset_fault_handler()
- */
-extern int livebox_set_fault_handler(int (*cb)(enum livebox_fault_type, const char *, const char *, const char *, void *), void *data);
-
-/**
- * @brief Unsets the livebox fault event handler.
- * @param[in] cb Event handler
- * @privlevel N/P
- * @return void * Callback data which is set via livebox_set_fault_handler
- * @retval pointer Pointer of 'data' which is used with the livebox_set_fault_handler
- * @see livebox_set_fault_handler()
- */
-extern void *livebox_unset_fault_handler(int (*cb)(enum livebox_fault_type, const char *, const char *, const char *, void *));
-
-/**
- * @brief Activates the faulted livebox.
- * @details Request result will be returned via return callback.
- * @remarks Even though this function returns SUCCESS, it means that it just successfully sent a request to the provider.
- * So you have to check the return callback and its "ret" argument.
- * @param[in] pkgname Package name which should be activated
- * @param[in] cb Result callback
- * @param[in] data Callback data
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int type
- * @retval #LB_STATUS_SUCCESS Successfully sent a request
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_FAULT Failed to make a request
- * @see ret_cb_t
- */
-extern int livebox_activate(const char *pkgname, ret_cb_t cb, void *data);
-
-/**
- * @brief Resizes the livebox.
- * @details
- * Normal mode livebox size
- * 1x1=175x175, LB_SIZE_TYPE_1x1
- * 2x1=354x175, LB_SIZE_TYPE_2x1
- * 2x2=354x354, LB_SIZE_TYPE_2x2
- * 4x1=712x175, LB_SIZE_TYPE_4x1
- * 4x2=712x354, LB_SIZE_TYPE_4x2
- * 4x4=712x712, LB_SIZE_TYPE_4x4
- *
- * Extended livebox size
- * 4x3=712x533, LB_SIZE_TYPE_4x3
- * 4x5=712x891, LB_SIZE_TYPE_4x5
- * 4x6=712x1070, LB_SIZE_TYPE_4x6
- *
- * Easy mode livebox size
- * 21x21=224x215, LB_SIZE_TYPE_EASY_1x1
- * 23x21=680x215, LB_SIZE_TYPE_EASY_3x1
- * 23x23=680x653, LB_SIZE_TYPE_EASY_3x3
- *
- * Special mode livebox size
- * 0x0=720x1280, LB_SIZE_TYPE_0x0
- * @remarks You have to check the return callback.
- * @param[in] handler Handler of a livebox instance
- * @param[in] type Type of a livebox size (e.g., LB_SIZE_TYPE_1x1, ...)
- * @param[in] cb Result callback of the resize operation
- * @param[in] data User data for return callback
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int type
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_BUSY Previous request of resize is in progress
- * @retval #LB_STATUS_ERROR_ALREADY Already resized, there is no differences between current size and requested size
- * @retval #LB_STATUS_ERROR_PERMISSION Permission denied, you only have view the content of this box
- * @retval #LB_STATUS_ERROR_FAULT Failed to make a request
- * @see ret_cb_t
- */
-extern int livebox_resize(struct livebox *handler, int type, ret_cb_t cb, void *data);
-
-/**
- * @brief Sends the click event for a livebox.
- * @param[in] handler Handler of a livebox instance
- * @param[in] x Rational X of the content width
- * @param[in] y Rational Y of the content height
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @retval #LB_STATUS_SUCCESS Successfully done
- */
-extern int livebox_click(struct livebox *handler, double x, double y);
-
-/**
- * @brief Changes the cluster/sub-cluster name of the given livebox handler.
- * @param[in] handler Handler of a livebox instance
- * @param[in] cluster New cluster of a livebox
- * @param[in] category New category of a livebox
- * @param[in] cb Result callback for changing the cluster/category of a livebox
- * @param[in] data User data for the result callback
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_SUCCESS Request is successfully sent. the return callback will be called
- * @retval #LB_STATUS_ERROR_BUSY Previous request is not finished yet
- * @retval #LB_STATUS_ERROR_ALREADY Group name is same with current one
- * @retval #LB_STATUS_ERROR_PERMISSION You have no permission to change property of this livebox instance
- * @retval #LB_STATUS_ERROR_FAULT Failed to make a request
- * @see ret_cb_t
- */
-extern int livebox_set_group(struct livebox *handler, const char *cluster, const char *category, ret_cb_t cb, void *data);
-
-/**
- * @brief Gets the cluster and category (sub-cluster) name of the given livebox (it is not I18N format, only English).
- * @remarks You have to do not release the cluster & category.
- * It is allocated inside of a given livebox instance, so you can only read it.
- * @param[in] handler Handler of a livebox instance
- * @param[out] cluster Storage(memory) for containing the cluster name
- * @param[out] category Storage(memory) for containing the category name
- * @privlevel N/P
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_SUCCESS Successfully done
- */
-extern int livebox_get_group(struct livebox *handler, const char **cluster, const char **category);
-
-/**
- * @brief Gets the period of the livebox handler.
- * @remarks If this function returns 0.0f, it means the livebox has no update period or the handle is not valid.
- * This function only works after the return callback of livebox_create fucntion is called.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return double
- * @retval Current update period of a livebox
- * @retval 0.0f This means the box has no update period or the handles is not valid
- */
-extern double livebox_period(struct livebox *handler);
-
-/**
- * @brief Changes the update period.
- * @param[in] handler Handler of a livebox instance
- * @param[in] period New update period of a livebox
- * @param[in] cb Result callback of changing the update period of this livebox
- * @param[in] data User data for the result callback
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_SUCCESS Successfully done
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_BUSY
- * @retval #LB_STATUS_ERROR_ALREADY
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @see ret_cb_t
- */
-extern int livebox_set_period(struct livebox *handler, double period, ret_cb_t cb, void *data);
-
-/**
- * @brief Checks whether the given livebox is a text type or not.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return livebox_lb_type
- * @retval #LB_TYPE_IMAGE Contents of a livebox is based on the image file
- * @retval #LB_TYPE_BUFFER Contents of a livebox is based on canvas buffer(shared)
- * @retval #LB_TYPE_TEXT Contents of a livebox is based on formatted text file
- * @retval #LB_TYPE_PIXMAP Contens of a livebox is shared by the pixmap(depends on X)
- * @retval #LB_TYPE_INVALID
- * @see livebox_lb_type()
- */
-extern enum livebox_lb_type livebox_lb_type(struct livebox *handler);
-
-/**
- * @brief Checks if the given livebox is created by user or not.
- * @details If the livebox instance is created by a system this will return 0.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval 0 Automatically created livebox by the provider
- * @retval 1 Created by user via livebox_add()
- * @see livebox_add()
- * @see livebox_set_event_handler()
- */
-extern int livebox_is_user(struct livebox *handler);
-
-/**
- * @brief Gets content information string of the given livebox.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return const char *
- * @retval content_info Livebox content info that can be used again via content_info argument of livebox_add()
- * @see livebox_add()
- */
-extern const char *livebox_content(struct livebox *handler);
-
-/**
- * @brief Gets the sub cluster title string of the given livebox.
- * @details This API is now used for accessibility.
- * Each box should set their content as a string to be read by TTS.
- * So if the box has focused on the homescreen, the homescreen will read text using this API.
- * @remarks The title returned by this API is read by TTS.
- * But it is just recomended to a homescreen.
- * So, to read it or not depends on implementation of the homescreen.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return const char *
- * @retval sub Cluster name
- * @retval @c NULL
- */
-extern const char *livebox_category_title(struct livebox *handler);
-
-/**
- * @brief Gets the filename of the given livebox, if it is an IMAGE type livebox.
- * @details If the box is developed as image format to represent its contents, the homescreen should know its image file name.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return const char *
- * @retval filename If the livebox type is image this function will give you a abs-path of an image file (content is rendered)
- * @retval @c NULL If this has no image file or type is not image file.
- */
-extern const char *livebox_filename(struct livebox *handler);
-
-/**
- * @brief Gets the package name of the given livebox handler.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return const char *
- * @retval pkgname Package name
- * @retval @c NULL If the handler is not valid
- */
-extern const char *livebox_pkgname(struct livebox *handler);
-
-/**
- * @brief Gets the priority of a current content.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return double
- * @retval 0.0f Handler is @c NULL
- * @retval -1.0f Handler is not valid (not yet initialized)
- * @retval real Number between 0.0 and 1.0
- */
-extern double livebox_priority(struct livebox *handler);
-
-/**
- * @brief Acquires the buffer of a given livebox (only for the buffer type).
- * @param[in] handler Handler of a livebox instance
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return void *
- * @retval address Address of a FB
- * @retval @c NULL If it fails to get fb address
- */
-extern void *livebox_acquire_fb(struct livebox *handler);
-
-/**
- * @brief Releases the buffer of a livebox (only for the buffer type).
- * @param[in] buffer Buffer
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_SUCCESS Successfully done
- * @see livebox_acquire_fb()
- */
-extern int livebox_release_fb(void *buffer);
-
-/**
- * @brief Gets the reference count of Livebox buffer (only for the buffer type).
- * @param[in] buffer Buffer
- * @privlevel N/P
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @retval refcnt Positive integer including ZERO
- * @see livebox_pdfb_refcnt()
- */
-extern int livebox_fb_refcnt(void *buffer);
-
-/**
- * @brief Acquires the buffer of a PD frame (only for the buffer type).
- * @param[in] handler Handler of a livebox instance
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval @c NULL
- * @retval adress Address of a buffer of PD
- * @see livebox_release_pdfb()
- */
-extern void *livebox_acquire_pdfb(struct livebox *handler);
-
-/**
- * @brief Releases the acquired buffer of the PD Frame (only for the buffer type).
- * @param[in] buffer Buffer
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_SUCCESS Successfully done
- * @see livebox_acquire_pdfb()
- */
-extern int livebox_release_pdfb(void *buffer);
-
-/**
- * @brief Gets the reference count of a given PD buffer (only for the buffer type).
- * @param[in] buffer Buffer
- * @privlevel N/P
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @retval reference Reference count
- * @see livebox_fb_refcnt()
- */
-extern int livebox_pdfb_refcnt(void *buffer);
-
-/**
- * @brief Gets the size of the Livebox.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return int
- * @retval #LB_SIZE_TYPE_NxM
- * @retval #LB_SIZE_TYPE_INVALID
- */
-extern int livebox_size(struct livebox *handler);
-
-/**
- * @brief Gets the size of the Progressive Disclosure.
- * @param[in] handler Handler of a livebox instance
- * @param[out] w
- * @param[out] h
- * @privlevel N/P
- * @return int type
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_SUCCESS Successfully done
- */
-extern int livebox_get_pdsize(struct livebox *handler, int *w, int *h);
-
-/**
- * @brief Gets a list of the supported sizes of a given handler.
- * @param[in] handler Handler of a livebox instance
- * @param[out] cnt
- * @param[out] size_list
- * @privlevel N/P
- * @return int type
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_SUCCESS Successfully done
- */
-extern int livebox_get_supported_sizes(struct livebox *handler, int *cnt, int *size_list);
-
-/**
- * @brief Gets BUFFER SIZE of the livebox if it is a buffer type.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval size Size of livebox buffer
- */
-extern int livebox_lbfb_bufsz(struct livebox *handler);
-
-/**
- * @brief Gets BUFFER SIZE of the progiressive disclosure if it is a buffer type.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval size Size of PD buffer
- */
-extern int livebox_pdfb_bufsz(struct livebox *handler);
-
-/**
- * @brief Sends a content event (for buffer type) to the provider (livebox).
- * @param[in] handler Handler of a livebox instance
- * @param[in] type Event type
- * @param[in] x Coordinates of X axis
- * @param[in] y Coordinates of Y axis
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_BUSY Previous operation is not finished yet
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @retval #LB_STATUS_SUCCESS Successfully sent
- * @see livebox_access_event()
- * @see livebox_key_event()
- */
-extern int livebox_mouse_event(struct livebox *handler, enum content_event_type type, double x, double y);
-
-/**
- * @brief Sends an access event (for buffer type) to the provider (livebox).
- * @param[in] handler Handler of a livebox instance
- * @param[in] type Event type
- * @param[in] x Coordinates of X axsis
- * @param[in] y Coordinates of Y axsis
- * @param[in] cb Result callback function
- * @param[in] data Callback data
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_BUSY Previous operation is not finished yet
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @retval #LB_STATUS_SUCCESS Successfully sent
- * @see livebox_mouse_event()
- * @see livebox_key_event()
- */
-extern int livebox_access_event(struct livebox *handler, enum access_event_type type, double x, double y, ret_cb_t cb, void *data);
-
-/**
- * @brief Sends a key event (for buffer type) to the provider (livebox).
- * @param[in] handler Handler of a livebox instance
- * @param[in] type Key event type
- * @param[in] keycode Code of key
- * @param[in] cb Result callback
- * @param[in] data Callback data
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_BUSY Previous operation is not finished yet
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @retval #LB_STATUS_SUCCESS Successfully sent
- * @see livebox_mouse_event()
- * @see livebox_access_event()
- */
-extern int livebox_key_event(struct livebox *handler, enum content_event_type type, unsigned int keycode, ret_cb_t cb, void *data);
-
-/**
- * @brief Sets pin-up status of the given handler.
- * @details If the livebox supports the pinup feature,
- * you can freeze the update of the given livebox.
- * But it is different from pause.
- * The box will be updated and it will decide wheter update its content or not when the pinup is on.
- * @param[in] handler Handler of a livebox instance
- * @param[in] flag Pinup value
- * @param[in] cb Result callback
- * @param[in] data Callback data
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid parameters
- * @see ret_cb_t
- * @see livebox_set_visibility()
- * @see livebox_is_pinned_up()
- */
-extern int livebox_set_pinup(struct livebox *handler, int flag, ret_cb_t cb, void *data);
-
-/**
- * @brief Checks the PIN-UP status of the given handler.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid parameters
- * @retval 1 Box is pinned up
- * @retval 0 Box is not pinned up
- * @see livebox_set_pinup()
- */
-extern int livebox_is_pinned_up(struct livebox *handler);
-
-/**
- * @brief Checks the availability of the PIN-UP feature for the given handler.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval 1 If the box support Pinup feature
- * @retval 0 If the box does not support the Pinup feature
- * @see livebox_is_pinned_up()
- * @see livebox_set_pinup()
- */
-extern int livebox_has_pinup(struct livebox *handler);
-
-/**
- * @brief Checks the existence of PD for the given handler.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval 1 If the box support the PD
- * @retval 0 If the box has no PD
- */
-extern int livebox_has_pd(struct livebox *handler);
-
-/**
- * @brief Creates PD of the given handler.
- * @param[in] handler Handler of a livebox instance
- * @param[in] cb Result callback
- * @param[in] data Callback data
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_SUCCESS Successfully done
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_BUSY Previous operation is not finished yet
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @see ret_cb_t
- * @see livebox_create_pd_with_position()
- * @see livebox_move_pd()
- * @see livebox_destroy_pd()
- */
-extern int livebox_create_pd(struct livebox *handler, ret_cb_t cb, void *data);
-
-/**
- * @brief Creates PD of the given handler with the relative position from livebox.
- * @param[in] handler Handler of a livebox instance
- * @param[in] x 0.0 ~ 1.0
- * @param[in] y 0.0 ~ 1.0
- * @param[in] cb Result callback
- * @param[in] data Callback data
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_SUCCESS Successfully done
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_BUSY Previous operation is not finished yet
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @see livebox_create_pd()
- * @see livebox_destroy_pd()
- * @see livebox_move_pd()
- */
-extern int livebox_create_pd_with_position(struct livebox *handler, double x, double y, ret_cb_t cb, void *data);
-
-/**
- * @brief Updates a position of the given PD.
- * @param[in] handler Handler of a livebox instance
- * @param[in] x 0.0 ~ 1.0
- * @param[in] y 0.0 ~ 1.0
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_SUCCESS If sending a request for updating position of the PD has been done successfully
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- */
-extern int livebox_move_pd(struct livebox *handler, double x, double y);
-
-/**
- * @brief Destroys the PD of the given handler if it is created.
- * @param[in] handler Handler of a livebox instance
- * @param[in] cb
- * @param[in] data
- * @privlevel platform
- * @privilege %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @retval #LB_STATUS_SUCCESS Successfully done
- * @see ret_cb_t
- */
-extern int livebox_destroy_pd(struct livebox *handler, ret_cb_t cb, void *data);
-
-/**
- * @brief Checks the create status of the given livebox handler.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval 0 PD is not created
- * @retval 1 PD is created
- */
-extern int livebox_pd_is_created(struct livebox *handler);
-
-/**
- * @brief Checks the content type of a progressive disclosure of the given handler.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return int
- * @retval #PD_TYPE_BUFFER Contents of a PD is based on canvas buffer(shared)
- * @retval #PD_TYPE_TEXT Contents of a PD is based on formatted text file
- * @retval #PD_TYPE_PIXMAP Contents of a livebox is shared by the pixmap(depends on X)
- * @retval #PD_TYPE_INVALID
- * @see livebox_pd_type()
- */
-extern enum livebox_pd_type livebox_pd_type(struct livebox *handler);
-
-/**
- * @brief Checks the existence of a livebox about the given package name.
- * @param[in] pkgname Package name
- * @privlevel platform
- * @privileve %http://developer.samsung.com/privilege/core/dynamicbox.info
- * @return int
- * @retval 1 If the box exists
- * @retval 0 If the box does not exist
- */
-extern int livebox_is_exists(const char *pkgname);
-
-/**
- * @brief Sets a function table for parsing the text content of a livebox.
- * @param[in] handler Handler of a livebox instance
- * @param[in] ops
- * @privlevel N/P
- * @return int
- * @retval #LB_STATUS_SUCCESS Successfully done
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @see livebox_set_pd_text_handler()
- */
-extern int livebox_set_text_handler(struct livebox *handler, struct livebox_script_operators *ops);
-
-/**
- * @brief Sets a function table for parsing the text content of a Progressive Disclosure.
- * @param[in] handler Handler of a livebox instance
- * @param[in] ops
- * @privlevel N/P
- * @return int
- * @retval #LB_STATUS_SUCCESS Successfully done
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @see livebox_set_text_handler()
- */
-extern int livebox_set_pd_text_handler(struct livebox *handler, struct livebox_script_operators *ops);
-
-/**
- * @brief Emits a text signal to the given livebox only if it is a text type.
- * @param[in] handler Handler of a livebox instance
- * @param[in] emission Emission string
- * @param[in] source Source string
- * @param[in] sx Start X
- * @param[in] sy Start Y
- * @param[in] ex End X
- * @param[in] ey End Y
- * @param[in] cb Result callback
- * @param[in] data Callback data
- * @privlevel platform
- * @privileve %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid parameters
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @retval #LB_STATUS_SUCCESS Successfully emitted
- * @see ret_cb_t
- */
-extern int livebox_emit_text_signal(struct livebox *handler, const char *emission, const char *source, double sx, double sy, double ex, double ey, ret_cb_t cb, void *data);
-
-/**
- * @brief Sets a private data pointer to carry it using the given handler.
- * @param[in] handler Handler of a livebox instance
- * @param[in] data Data pointer
- * @privlevel N/P
- * @return int
- * @retval #LB_STATUS_SUCCESS Successfully registered
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @see livebox_get_data()
- */
-extern int livebox_set_data(struct livebox *handler, void *data);
-
-/**
- * @brief Gets a private data pointer which is carried by a given handler.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return void *
- * @retval data Data pointer
- * @retval @c NULL If there is no data
- * @see livebox_set_data()
- */
-extern void *livebox_get_data(struct livebox *handler);
-
-/**
- * @brief Subscribes an event for liveboxes only in a given cluster and sub-cluster.
- * @details If you wrote a view-only client,
- * you can receive the event of specific liveboxes which belong to a given cluster/category.
- * But you cannot modify their attributes (such as size, ...).
- * @param[in] cluster Cluster ("*" can be used for subscribe all cluster's liveboxes event; If you use the "*", value in the category will be ignored)
- * @param[in] category Category ("*" can be used for subscribe liveboxes events of all category(sub-cluster) in a given "cluster")
- * @privlevel platform
- * @privileve %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @retval #LB_STATUS_SUCCESS Successfully requested
- * @see livebox_unsubscribe_group()
- */
-extern int livebox_subscribe_group(const char *cluster, const char *category);
-
-/**
- * @brief Unsubscribes an event for the liveboxes, but you will receive already added liveboxes events.
- * @param[in] cluster Cluster("*" can be used for subscribe all cluster's liveboxes event; If you use the "*", value in the category will be ignored)
- * @param[in] category Category ("*" can be used for subscribe all sub-cluster's liveboxes event in a given "cluster")
- * @privlevel platform
- * @privileve %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @retval #LB_STATUS_SUCCESS Successfully requested
- * @see livebox_subscribe_group()
- */
-extern int livebox_unsubscribe_group(const char *cluster, const char *category);
-
-/**
- * @brief Refreshes the group (cluster/sub-cluser (aka. category)).
- * @details This function will trigger the update of all liveboxes in a given cluster/category group.
- * @remarks Basically, a default livebox system doesn't use the cluster/category concept.
- * But you can use it. So if you decide to use it, then you can trigger the update of all liveboxes in the given group.
- * @param[in] cluster Cluster ID
- * @param[in] category Sub-cluster ID
- * @param[in] force 1 if the boxes should be updated even if they are paused
- * @privlevel platform
- * @privileve %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @retval #LB_STATUS_SUCCESS Successfully requested
- * @see livebox_refresh()
- */
-extern int livebox_refresh_group(const char *cluster, const char *category, int force);
-
-/**
- * @brief Refreshes a livebox.
- * @param[in] handler Handler of a livebox instance
- * @param[in] force 1 if the box should be updated even if it is paused
- * @privlevel platform
- * @privileve %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @retval #LB_STATUS_SUCCESS Successfully requested
- * @see livebox_refresh_group()
- */
-extern int livebox_refresh(struct livebox *handler, int force);
-
-/**
- * @brief Gets Pixmap Id of a livebox content.
- * @details This function doesn't guarantee the life-cycle of the pixmap.
- * If the service provider destroyed the pixmap, you will not know about it.
- * So you should validate it before accessing it.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return int
- * @retval 0 If the pixmap is not created
- * @retval pixmap Pixmap Id need to be casted to (unsigned int) type
- * @see livebox_pd_pixmap()
- */
-extern int livebox_lb_pixmap(const struct livebox *handler);
-
-/**
- * @brief Gets Pixmap Id of a PD content.
- * @details This function doesn't guarantee the life-cycle of the pixmap.
- * If the service provider destroyed the pixmap, you will not know about it.
- * So you should validate it before accessing it.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return int
- * @retval 0 If the pixmap is not created
- * @retval pixmap Pixmap Id need to be casted to (unsigned int) type
- * @see livebox_lb_pixmap()
- */
-extern int livebox_pd_pixmap(const struct livebox *handler);
-
-/**
- * @brief Acquires the pixmap of PD.
- * @details After acquiring the pixmap of PD, it will not be destroyed.
- * So if the new update is comming with a new pixmap Id, you should release old pixmap manually.
- * @param[in] handler Handler of a livebox instance
- * @param[in] cb Result callback for acquiring request
- * @param[in] data Callback Data
- * @privlevel platform
- * @privileve %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_FAULT Failed to send a request to the service provider or there is critical error that is unrecoverable
- * @retval #LB_STATUS_SUCCESS Successfully requested to acquire the pixmap of PD
- * @see livebox_release_pd_pixmap()
- * @see livebox_acquire_lb_pixmap()
- * @see ret_cb_t
- */
-extern int livebox_acquire_pd_pixmap(struct livebox *handler, ret_cb_t cb, void *data);
-
-/**
- * @brief Releases the acquired pixmap ID.
- * @param[in] handler Handler of a livebox instance
- * @param[in] pixmap Pixmap Id to release it
- * @privlevel platform
- * @privileve %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @retval #LB_STATUS_SUCCESS Successfully released (request is sent)
- * @see livebox_acquire_pd_pixmap()
- * @see livebox_release_lb_pixmap()
- */
-extern int livebox_release_pd_pixmap(struct livebox *handler, int pixmap);
-
-/**
- * @brief Gets the PIXMAP of a livebox.
- * @details Even if a render process releases the pixmap, the pixmap will be kept before being released by livebox_release_lb_pixmap.
- * You should release the pixmap manually.
- * @param[in] handler Handler of a livebox instance
- * @param[in] cb Callback function which will be called with result of acquiring lb pixmap
- * @param[in] data Callback data
- * @privlevel platform
- * @privileve %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @retval #LB_STATUS_SUCCESS Successfully requested
- * @pre Livebox service system should support the PIXMAP type buffer.
- * The livebox should be designed to use the buffer (script type).
- * @see livebox_release_lb_pixmap()
- * @see livebox_acquire_pd_pixmap()
- * @see ret_cb_t
- */
-extern int livebox_acquire_lb_pixmap(struct livebox *handler, ret_cb_t cb, void *data);
-
-/**
- * @brief Releases the pixmap of a livebox.
- * @details After a client gets a new pixmap or does not need to keep the current pixmap anymore, use this function to release it.
- * If there is no user for a given pixmap, the pixmap will be destroyed.
- * @param[in] handler Handler of a livebox instance
- * @param[in] pixmap Pixmap Id of given livebox handler
- * @privlevel platform
- * @privileve %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @retval #LB_STATUS_SUCCESS Successfully done
- * @pre The pixmap should be acquired by livebox_acquire_lb_pixmap
- * @see livebox_acquire_lb_pixmap()
- * @see livebox_release_pd_pixmap()
- */
-extern int livebox_release_lb_pixmap(struct livebox *handler, int pixmap);
-
-/**
- * @brief Updates a visible state of the livebox.
- * @param[in] handler Handler of a livebox instance
- * @param[in] state Configure the current visible state of a livebox
- * @privlevel platform
- * @privileve %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_BUSY
- * @retval #LB_STATUS_ERROR_PERMISSION
- * @retval #LB_STATUS_ERROR_ALREADY
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @retval #LB_STATUS_SUCCESS Successfully done
- */
-extern int livebox_set_visibility(struct livebox *handler, enum livebox_visible_state state);
-
-/**
- * @brief Gets the current visible state of a livebox.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return livebox_visible_state
- * @retval #LB_SHOW Livebox is shown (Default state)
- * @retval #LB_HIDE Livebox is hidden, Update timer is not frozen (but a user cannot receive any updated events; a user should refresh(reload) the content of a livebox when a user make this show again)
- * @retval #LB_HIDE_WITH_PAUSE Livebox is hidden, it will pause the update timer, but if a livebox updates its contents, update event will occur
- * @retval #LB_VISIBLE_ERROR To enlarge the size of this enumeration type
- */
-extern enum livebox_visible_state livebox_visibility(struct livebox *handler);
-
-/**
- * @brief Sets an update mode of the current livebox.
- * @details If you set 1 for active update mode, you should get a buffer without updated event from provider.
- * But if it is passive mode, you have to update content of a box when you get updated events.
- * Default is Passive mode.
- * @param[in] handler Handler of a livebox instance
- * @param[in] active_update 1 means active update, 0 means passive update (default)
- * @param[in] cb Result callback function
- * @param[in] data Callback data
- * @privlevel platform
- * @privileve %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_ERROR_BUSY
- * @retval #LB_STATUS_ERROR_PERMISSION
- * @retval #LB_STATUS_ERROR_ALREADY
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @retval #LB_STATUS_SUCCESS Successfully done
- * @see ret_cb_t
- */
-extern int livebox_set_update_mode(struct livebox *handler, int active_update, ret_cb_t cb, void *data);
-
-/**
- * @brief Checks the active update mode of the given livebox.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return int
- * @retval 0 If passive mode
- * @retval 1 If active mode or error code
- */
-extern int livebox_is_active_update(struct livebox *handler);
-
-/**
- * @brief Syncs manually
- * param[in] handler Handler of a livebox instance
- * @privlevel platform
- * @privileve %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return void
- * @retval #LB_STATUS_SUCCESS If success
- * @retval #LB_STATUS_ERROR_INVALID Invalid handle
- * @see livebox_set_manual_sync()
- * @see livebox_manual_sync()
- * @see livebox_sync_lb_fb()
- */
-extern int livebox_sync_pd_fb(struct livebox *handler);
-
-/**
- * @brief Syncs manually
- * @param[in] handler Handler of a livebox instance
- * @privlevel platform
- * @privileve %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return void
- * @retval #LB_STATUS_SUCCESS If success
- * @retval #LB_STATUS_ERROR_INVALID Invalid handle
- * @see livebox_set_manual_sync()
- * @see livebox_manual_sync()
- * @see livebox_sync_pd_fb()
- */
-extern int livebox_sync_lb_fb(struct livebox *handler);
-
-/**
- * @brief Gets an alternative icon of the given livebox instance.
- * @details If the box should be represented as a shortcut icon, this function will get the alternative icon.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return const char *
- * @retval address Absolute path of an alternative icon file
- * @retval @c NULL Livebox has no alternative icon file
- * @see livebox_alt_name()
- */
-extern const char *livebox_alt_icon(struct livebox *handler);
-
-/**
- * @brief Gets an alternative name of the given livebox instance.
- * @details If the box should be represented as a shortcut name, this function will get the alternative name.
- * @param[in] handler Handler of a livebox instance
- * @privlevel N/P
- * @return const char *
- * @retval name Alternative name of a livebox
- * @retval @c NULL Livebox has no alternative name
- * @see livebox_alt_icon()
- */
-extern const char *livebox_alt_name(struct livebox *handler);
-
-/**
- * @brief Gets a lock for a frame buffer.
- * @details This function should be used to prevent from rendering to the frame buffer while reading it.
- * And the locking area should be short and must be released ASAP, or the render thread will be hanged.
- * @param[in] handler Handler of a livebox instance
- * @param[in] is_pd 1 for PD or 0
- * @privlevel platform
- * @privileve %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_SUCCESS Successfully done
- * @see livebox_release_fb_lock()
- */
-extern int livebox_acquire_fb_lock(struct livebox *handler, int is_pd);
-
-/**
- * @brief Releases a lock of the frame buffer.
- * @details This function should be called ASAP after acquiring a lock of FB, or the render process will be blocked.
- * @param[in] handler Handler of a livebox instance
- * @param[in] is_pd 1 for PD or 0
- * @privlevel platform
- * @privileve %http://developer.samsung.com/privilege/core/dynamicbox.viewer
- * @return int
- * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error occurred
- * @retval #LB_STATUS_ERROR_INVALID Invalid argument
- * @retval #LB_STATUS_SUCCESS Successfully done
- * @see livebox_acquire_fb_lock()
- */
-extern int livebox_release_fb_lock(struct livebox *handler, int is_pd);
-
-/**
- * @brief Sets options for controlling a livebox sub-system.
- * @details
- * LB_OPTION_FRAME_DROP_FOR_RESIZE
- * While resizing the box, viewer doesn't want to know the updated frames of an old size content anymore.
- * In that case, turn this on, the provider will not send the updated event to the viewer about an old content.
- * So the viewer can reduce its burden to update unnecessary frames.
- * LB_OPTION_MANUAL_SYNC
- * If you don't want to update frames automatically, or you want only reload the frames by your hands, (manually)
- * Turn this on.
- * After turnning it on, you should sync it using livebox_sync_pd_fb and livebox_sync_lb_pfb.
- * LB_OPTION_SHARED_CONTENT
- * If this option is turnned on, even though you create a new livebox,
- * if there are already added same instances that have same contents, the instance will not be created again.
- * Instead of creating a new instance, a viewer will provide an old instance with a new handle.
- * @param[in] option Option which will be affected by this call
- * @param[in] state New value for given option
- * @privlevel N/P
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Unknown option
- * @retval #LB_STATUS_ERROR_FAULT Failed to change the state of option
- * @retval #LB_STATUS_SUCCESS Successfully changed
- * @see livebox_get_option()
- * @see livebox_sync_pd_fb()
- * @see livebox_sync_lb_fb()
- */
-extern int livebox_set_option(enum livebox_option_type option, int state);
-
-/**
- * @brief Gets options of a livebox sub-system.
- * @param[in] option Type of option
- * @privlevel N/P
- * @return int
- * @retval #LB_STATUS_ERROR_INVALID Invalid option
- * @retval #LB_STATUS_ERROR_FAULT Failed to get option
- * @retval >=0 Value of given option (must be >=0)
- * @see livebox_set_option()
- */
-extern int livebox_option(enum livebox_option_type option);
-
-
-/**
- * @brief Set a handler for launching an app for auto-launch feature
- * @details If a user clicks a box, and the box uses auto-launch option, the launcher_handler will be called.
- * @param[in] launch_handler Handler for launching an app manually
- * @param[in] data Callback data which will be given a data for launch_handler
- * @privlevel N/P
- * @return int type
- * @retval #LB_STATUS_SUCCESS Succeed to set new handler. there is no other cases
- */
-extern int livebox_set_auto_launch_handler(int (*launch_handler)(struct livebox *handler, const char *appid, void *data), void *data);
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /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.
- */
-
-extern void lb_invoke_event_handler(struct livebox *handler, enum livebox_event_type event);
-extern void lb_invoke_fault_handler(enum livebox_fault_type type, const char *pkgname, const char *filename, const char *function);
-
-extern struct livebox_common *lb_find_common_handle(const char *pkgname, const char *filename);
-extern struct livebox *lb_new_livebox(const char *pkgname, const char *id, double timestamp, const char *cluster, const char *category);
-extern struct livebox_common *lb_find_common_handle_by_timestamp(double timestamp);
-
-extern int lb_set_group(struct livebox_common *common, const char *cluster, const char *category);
-extern void lb_set_size(struct livebox_common *common, int w, int h);
-extern void lb_set_pdsize(struct livebox_common *common, int w, int h);
-extern void lb_set_default_pdsize(struct livebox_common *common, int w, int h);
-extern int lb_set_content(struct livebox_common *common, const char *content);
-extern int lb_set_title(struct livebox_common *handler, const char *title);
-extern void lb_set_auto_launch(struct livebox_common *handler, const char *auto_launch);
-extern void lb_set_id(struct livebox_common *handler, const char *id);
-extern void lb_set_size_list(struct livebox_common *handler, int size_list);
-extern void lb_set_priority(struct livebox_common *handler, double priority);
-extern int lb_set_lb_fb(struct livebox_common *handler, const char *filename);
-extern int lb_set_pd_fb(struct livebox_common *handler, const char *filename);
-extern struct fb_info *lb_get_pd_fb(struct livebox_common *handler);
-extern struct fb_info *lb_get_lb_fb(struct livebox_common *handler);
-extern void lb_set_user(struct livebox_common *handler, int user);
-extern void lb_set_pinup(struct livebox_common *handler, int pinup);
-extern void lb_set_text_lb(struct livebox_common *handler);
-extern void lb_set_text_pd(struct livebox_common *handler);
-extern int lb_text_lb(struct livebox_common *handler);
-extern int lb_text_pd(struct livebox_common *handler);
-extern void lb_set_period(struct livebox_common *handler, double period);
-extern void lb_set_update_mode(struct livebox_common *handler, int active_mode);
-extern void lb_set_filename(struct livebox_common *handler, const char *filename);
-extern void lb_set_alt_icon(struct livebox_common *handler, const char *icon);
-extern void lb_set_alt_name(struct livebox_common *handle, const char *name);
-extern int lb_destroy_lock_file(struct livebox_common *common, int is_pd);
-extern int lb_create_lock_file(struct livebox_common *common, int is_pd);
-extern int lb_destroy_common_handle(struct livebox_common *common);
-extern struct livebox_common *lb_create_common_handle(struct livebox *handle, const char *pkgname, const char *cluster, const char *category);
-extern int lb_sync_pd_fb(struct livebox_common *common);
-extern int lb_sync_lb_fb(struct livebox_common *common);
-extern int lb_common_unref(struct livebox_common *common, struct livebox *handle);
-extern int lb_common_ref(struct livebox_common *common, struct livebox *handle);
-
-extern struct livebox *lb_ref(struct livebox *handler);
-extern struct livebox *lb_unref(struct livebox *handler, int destroy_common);
-extern int lb_send_delete(struct livebox *handler, int type, ret_cb_t cb, void *data);
-extern int lb_delete_all(void);
-
-enum lb_type { /*!< Must have to be sync with data-provider-master */
- _LB_TYPE_NONE = 0x0,
- _LB_TYPE_SCRIPT,
- _LB_TYPE_FILE,
- _LB_TYPE_TEXT,
- _LB_TYPE_BUFFER,
- _LB_TYPE_ELEMENTARY
-};
-
-enum pd_type { /*!< Must have to be sync with data-provider-master */
- _PD_TYPE_NONE = 0x0,
- _PD_TYPE_SCRIPT,
- _PD_TYPE_TEXT,
- _PD_TYPE_BUFFER,
- _PD_TYPE_ELEMENTARY
-};
-
-enum livebox_state {
- CREATE = 0xBEEFbeef,
- DELETE = 0xDEADdead, /* Delete only for this client */
- DESTROYED = 0x00DEAD00
-};
-
-struct livebox_common {
- enum livebox_state state;
-
- struct dlist *livebox_list;
- int refcnt;
-
- char *cluster;
- char *category;
-
- char *pkgname;
- char *id;
-
- char *content;
- char *title;
- char *filename;
-
- double timestamp;
-
- struct alt_info {
- char *icon;
- char *name;
- } alt;
-
- enum livebox_delete_type delete_type;
-
- int is_user;
- int is_pd_created;
- int is_pinned_up;
- int is_active_update;
- enum livebox_visible_state visible;
-
- struct {
- enum lb_type type;
- struct fb_info *fb;
-
- int size_list;
-
- int width;
- int height;
- double priority;
-
- char *auto_launch;
- double period;
- int pinup_supported;
- int mouse_event;
-
- /* For the filtering event */
- double x;
- double y;
- char *lock;
- int lock_fd;
- } lb;
-
- struct {
- enum pd_type type;
- struct fb_info *fb;
-
- int width;
- int height;
-
- int default_width;
- int default_height;
-
- /* For the filtering event */
- double x;
- double y;
- char *lock;
- int lock_fd;
- } pd;
-
- int nr_of_sizes;
-
- struct requested_flag {
- unsigned int created:1;
- unsigned int deleted:1;
- unsigned int pinup:1;
- unsigned int group_changed:1;
- unsigned int period_changed:1;
- unsigned int size_changed:1;
- unsigned int pd_created:1;
- unsigned int pd_destroyed:1;
- unsigned int update_mode:1;
- unsigned int access_event:1;
- unsigned int key_event:1;
-
- /*!
- * \note
- * Reserved
- */
- unsigned int reserved:21;
- } request;
-};
-
-struct job_item {
- struct livebox *handle;
- ret_cb_t cb;
- int ret;
- void *data;
-};
-
-struct livebox {
- enum livebox_state state;
-
- int refcnt;
- int paused_updating;
-
- enum livebox_visible_state visible;
- struct livebox_common *common;
-
- void *data;
-
- struct callback_table {
- struct livebox_script_operators lb_ops;
- struct livebox_script_operators pd_ops;
-
- struct created {
- ret_cb_t cb;
- void *data;
- } created;
-
- struct deleted {
- ret_cb_t cb;
- void *data;
- } deleted;
-
- struct pinup {
- ret_cb_t cb;
- void *data;
- } pinup;
-
- struct group_changed {
- ret_cb_t cb;
- void *data;
- } group_changed;
-
- struct period_changed {
- ret_cb_t cb;
- void *data;
- } period_changed;
-
- struct size_changed {
- ret_cb_t cb;
- void *data;
- } size_changed;
-
- struct pd_created {
- ret_cb_t cb;
- void *data;
- } pd_created;
-
- struct pd_destroyed {
- ret_cb_t cb;
- void *data;
- } pd_destroyed;
-
- struct update_mode {
- ret_cb_t cb;
- void *data;
- } update_mode;
-
- struct access_event {
- ret_cb_t cb;
- void *data;
- } access_event;
-
- struct key_event {
- ret_cb_t cb;
- void *data;
- } key_event;
- } cbs;
-};
-
-/* End of a file */
* limitations under the License.
*/
-extern int master_rpc_async_request(struct livebox *handler, struct packet *packet, int urgent, void (*ret_cb)(struct livebox *handler, const struct packet *result, void *data), void *data);
+extern int master_rpc_async_request(struct dynamicbox *handler, struct packet *packet, int urgent, void (*ret_cb)(struct dynamicbox *handler, const struct packet *result, void *data), void *data);
extern int master_rpc_sync_request(struct packet *packet);
extern void master_rpc_check_and_fire_consumer(void);
-extern int master_rpc_request_only(struct livebox *handler, struct packet *packet);
+extern int master_rpc_request_only(struct dynamicbox *handler, struct packet *packet);
extern int master_rpc_clear_fault_package(const char *pkgname);
extern int master_rpc_clear_all_request(void);
extern int util_check_extension(const char *filename, const char *check_ptr);
extern double util_timestamp(void);
extern const char *util_basename(const char *name);
-extern int util_validate_livebox_package(const char *pkgname);
extern const char *util_uri_to_path(const char *uri);
extern int util_unlink(const char *filename);
DbgPrint("[%s]\n", pkgname);
master_rpc_clear_fault_package(pkgname);
- lb_invoke_fault_handler(LB_FAULT_DEACTIVATED, pkgname, id, function);
+ dbox_invoke_fault_handler(DBOX_FAULT_DEACTIVATED, pkgname, id, function);
return NULL;
}
static struct packet *master_hold_scroll(pid_t pid, int handle, const struct packet *packet)
{
- struct livebox_common *common;
- struct livebox *livebox;
+ struct dynamicbox_common *common;
+ struct dynamicbox *dynamicbox;
const char *pkgname;
const char *id;
int seize;
goto out;
}
- common = lb_find_common_handle(pkgname, id);
+ common = dbox_find_common_handle(pkgname, id);
if (!common) {
ErrPrint("Instance(%s) is not exists\n", id);
goto out;
}
DbgPrint("HOLD: [%s] seize(%d)\n", id, seize);
- seize = seize ? LB_EVENT_HOLD_SCROLL : LB_EVENT_RELEASE_SCROLL;
- dlist_foreach(common->livebox_list, l, livebox) {
- lb_invoke_event_handler(livebox, seize);
+ seize = seize ? DBOX_EVENT_HOLD_SCROLL : DBOX_EVENT_RELEASE_SCROLL;
+ dlist_foreach(common->dynamicbox_list, l, dynamicbox) {
+ dbox_invoke_event_handler(dynamicbox, seize);
}
out:
const char *pkgname;
const char *id;
const char *content;
- struct livebox *handler;
+ struct dynamicbox *handler;
struct dlist *l;
struct dlist *n;
- struct livebox_common *common;
+ struct dynamicbox_common *common;
char *new_content;
int ret;
int status;
goto out;
}
- common = lb_find_common_handle(pkgname, id);
+ common = dbox_find_common_handle(pkgname, id);
if (!common) {
ErrPrint("Instance (%s) is not exists\n", id);
goto out;
common->request.pinup = 0;
- dlist_foreach_safe(common->livebox_list, l, n, handler) {
+ dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
if (handler->cbs.pinup.cb) {
- ret_cb_t cb;
+ dynamicbox_ret_cb_t cb;
void *cbdata;
/* Make sure that user can call pinup API in its result callback */
cb(handler, status, cbdata);
} else if (status == (int)DBOX_STATUS_ERROR_NONE) {
- lb_invoke_event_handler(handler, LB_EVENT_PINUP_CHANGED);
+ dbox_invoke_event_handler(handler, DBOX_EVENT_PINUP_CHANGED);
}
}
const char *pkgname;
const char *id;
double timestamp;
- struct livebox *handler;
- struct livebox_common *common;
+ struct dynamicbox *handler;
+ struct dynamicbox_common *common;
struct dlist *l;
struct dlist *n;
int reason;
}
DbgPrint("[%s]\n", pkgname);
- common = lb_find_common_handle_by_timestamp(timestamp);
+ common = dbox_find_common_handle_by_timestamp(timestamp);
if (!common) {
/*!
* \note
- * This can be happens only if the user delete a livebox
+ * This can be happens only if the user delete a dynamicbox
* right after create it before receive created event.
*/
goto out;
*/
common->state = DELETE;
- dlist_foreach_safe(common->livebox_list, l, n, handler) {
+ dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
if (handler->cbs.created.cb) {
- ret_cb_t cb;
+ dynamicbox_ret_cb_t cb;
void *cbdata;
/*!
* \note
cb(handler, reason, cbdata);
} else if (common->id) {
if (handler->cbs.deleted.cb) {
- ret_cb_t cb;
+ dynamicbox_ret_cb_t cb;
void *cbdata;
cb = handler->cbs.deleted.cb;
cb(handler, reason, cbdata);
} else {
- lb_invoke_event_handler(handler, LB_EVENT_DELETED);
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
}
}
/* Just try to delete it, if a user didn't remove it from the live box list */
- lb_unref(handler, 1);
+ dbox_unref(handler, 1);
}
out:
return NULL;
}
-static struct packet *master_lb_update_begin(pid_t pid, int handle, const struct packet *packet)
+static struct packet *master_dbox_update_begin(pid_t pid, int handle, const struct packet *packet)
{
- struct livebox *handler;
- struct livebox_common *common;
+ struct dynamicbox *handler;
+ struct dynamicbox_common *common;
const char *pkgname;
const char *id;
const char *content;
goto out;
}
- common = lb_find_common_handle(pkgname, id);
+ common = dbox_find_common_handle(pkgname, id);
if (!common) {
ErrPrint("Instance[%s] is not exists\n", id);
goto out;
goto out;
}
- lb_set_priority(common, priority);
- lb_set_content(common, content);
- lb_set_title(common, title);
+ dbox_set_priority(common, priority);
+ dbox_set_content(common, content);
+ dbox_set_title(common, title);
/*!
* \NOTE
* And if the size is changed, the provider should finish the updating first.
* And then begin updating again after change its size.
*/
- if (lb_get_lb_fb(common)) {
- (void)lb_set_lb_fb(common, fbfile);
+ if (dbox_get_dbox_fb(common)) {
+ (void)dbox_set_dbox_fb(common, fbfile);
- ret = lb_sync_lb_fb(common);
+ ret = dbox_sync_dbox_fb(common);
if (ret != (int)DBOX_STATUS_ERROR_NONE) {
ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, fbfile, ret);
} else {
struct dlist *l;
- dlist_foreach(common->livebox_list, l, handler) {
- lb_invoke_event_handler(handler, LB_EVENT_LB_UPDATE_BEGIN);
+ dlist_foreach(common->dynamicbox_list, l, handler) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DBOX_UPDATE_BEGIN);
}
}
} else {
return NULL;
}
-static struct packet *master_pd_update_begin(pid_t pid, int handle, const struct packet *packet)
+static struct packet *master_gbar_update_begin(pid_t pid, int handle, const struct packet *packet)
{
- struct livebox *handler;
- struct livebox_common *common;
+ struct dynamicbox *handler;
+ struct dynamicbox_common *common;
const char *pkgname;
const char *id;
const char *fbfile;
goto out;
}
- common = lb_find_common_handle(pkgname, id);
+ common = dbox_find_common_handle(pkgname, id);
if (!common) {
ErrPrint("Instance[%s] is not exists\n", id);
goto out;
goto out;
}
- if (lb_get_pd_fb(common)) {
- (void)lb_set_pd_fb(common, fbfile);
+ if (dbox_get_gbar_fb(common)) {
+ (void)dbox_set_gbar_fb(common, fbfile);
- ret = lb_sync_pd_fb(common);
+ ret = dbox_sync_gbar_fb(common);
if (ret != (int)DBOX_STATUS_ERROR_NONE) {
ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, fbfile, ret);
} else {
struct dlist *l;
- dlist_foreach(common->livebox_list, l, handler) {
- lb_invoke_event_handler(handler, LB_EVENT_PD_UPDATE_BEGIN);
+ dlist_foreach(common->dynamicbox_list, l, handler) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_UPDATE_BEGIN);
}
}
} else {
return NULL;
}
-static struct packet *master_lb_update_end(pid_t pid, int handle, const struct packet *packet)
+static struct packet *master_dbox_update_end(pid_t pid, int handle, const struct packet *packet)
{
- struct livebox *handler;
- struct livebox_common *common;
+ struct dynamicbox *handler;
+ struct dynamicbox_common *common;
const char *pkgname;
const char *id;
int ret;
goto out;
}
- common = lb_find_common_handle(pkgname, id);
+ common = dbox_find_common_handle(pkgname, id);
if (!common) {
ErrPrint("Instance[%s] is not exists\n", id);
goto out;
goto out;
}
- if (lb_get_lb_fb(common)) {
+ if (dbox_get_dbox_fb(common)) {
struct dlist *l;
- dlist_foreach(common->livebox_list, l, handler) {
- lb_invoke_event_handler(handler, LB_EVENT_LB_UPDATE_END);
+ dlist_foreach(common->dynamicbox_list, l, handler) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DBOX_UPDATE_END);
}
} else {
ErrPrint("Invalid request[%s]\n", id);
static struct packet *master_key_status(pid_t pid, int handle, const struct packet *packet)
{
- struct livebox *handler;
- struct livebox_common *common;
+ struct dynamicbox *handler;
+ struct dynamicbox_common *common;
struct dlist *l;
const char *pkgname;
const char *id;
goto out;
}
- common = lb_find_common_handle(pkgname, id);
+ common = dbox_find_common_handle(pkgname, id);
if (!common) {
ErrPrint("Instance[%s] is not exists\n", id);
goto out;
}
common->request.key_event = 0;
- dlist_foreach(common->livebox_list, l, handler) {
+ dlist_foreach(common->dynamicbox_list, l, handler) {
if (handler->cbs.key_event.cb) {
- ret_cb_t cb;
+ dynamicbox_ret_cb_t cb;
void *cbdata;
cb = handler->cbs.key_event.cb;
return NULL;
}
-static struct packet *master_request_close_pd(pid_t pid, int handle, const struct packet *packet)
+static struct packet *master_request_close_gbar(pid_t pid, int handle, const struct packet *packet)
{
- struct livebox *handler;
- struct livebox_common *common;
+ struct dynamicbox *handler;
+ struct dynamicbox_common *common;
struct dlist *l;
const char *pkgname;
const char *id;
goto out;
}
- common = lb_find_common_handle(pkgname, id);
+ common = dbox_find_common_handle(pkgname, id);
if (!common) {
ErrPrint("Instance[%s] is not exists\n", id);
goto out;
goto out;
}
- if (!common->is_pd_created) {
- DbgPrint("PD is not created, closing what?(%s)\n", id);
+ if (!common->is_gbar_created) {
+ DbgPrint("GBAR is not created, closing what?(%s)\n", id);
goto out;
}
DbgPrint("Reason: %d\n", reason);
- dlist_foreach(common->livebox_list, l, handler) {
- lb_invoke_event_handler(handler, LB_EVENT_REQUEST_CLOSE_PD);
+ dlist_foreach(common->dynamicbox_list, l, handler) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_REQUEST_CLOSE_GBAR);
}
out:
return NULL;
static struct packet *master_access_status(pid_t pid, int handle, const struct packet *packet)
{
- struct livebox *handler;
- struct livebox_common *common;
+ struct dynamicbox *handler;
+ struct dynamicbox_common *common;
struct dlist *l;
const char *pkgname;
const char *id;
goto out;
}
- common = lb_find_common_handle(pkgname, id);
+ common = dbox_find_common_handle(pkgname, id);
if (!common) {
ErrPrint("Instance[%s] is not exists\n", id);
goto out;
}
common->request.access_event = 0;
- dlist_foreach(common->livebox_list, l, handler) {
+ dlist_foreach(common->dynamicbox_list, l, handler) {
if (handler->cbs.access_event.cb) {
- ret_cb_t cb;
+ dynamicbox_ret_cb_t cb;
void *cbdata;
cb = handler->cbs.access_event.cb;
return NULL;
}
-static struct packet *master_pd_update_end(pid_t pid, int handle, const struct packet *packet)
+static struct packet *master_gbar_update_end(pid_t pid, int handle, const struct packet *packet)
{
- struct livebox *handler;
- struct livebox_common *common;
+ struct dynamicbox *handler;
+ struct dynamicbox_common *common;
const char *pkgname;
const char *id;
int ret;
goto out;
}
- common = lb_find_common_handle(pkgname, id);
+ common = dbox_find_common_handle(pkgname, id);
if (!common) {
ErrPrint("Instance[%s] is not exists\n", id);
goto out;
goto out;
}
- if (lb_get_lb_fb(common)) {
+ if (dbox_get_dbox_fb(common)) {
struct dlist *l;
- dlist_foreach(common->livebox_list, l, handler) {
- lb_invoke_event_handler(handler, LB_EVENT_PD_UPDATE_END);
+ dlist_foreach(common->dynamicbox_list, l, handler) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_UPDATE_END);
}
} else {
ErrPrint("Invalid request[%s]", id);
const char *name;
double priority;
int ret;
- struct livebox *handler;
- struct livebox_common *common;
+ struct dynamicbox *handler;
+ struct dynamicbox_common *common;
struct dlist *l;
struct dlist *n;
goto out;
}
- common = lb_find_common_handle(pkgname, id);
+ common = dbox_find_common_handle(pkgname, id);
if (!common) {
ErrPrint("instance(%s) is not exists\n", id);
goto out;
goto out;
}
- lb_set_priority(common, priority);
- lb_set_content(common, content);
- lb_set_title(common, title);
- lb_set_alt_icon(common, icon);
- lb_set_alt_name(common, name);
+ dbox_set_priority(common, priority);
+ dbox_set_content(common, content);
+ dbox_set_title(common, title);
+ dbox_set_alt_icon(common, icon);
+ dbox_set_alt_name(common, name);
- dlist_foreach_safe(common->livebox_list, l, n, handler) {
- lb_invoke_event_handler(handler, LB_EVENT_EXTRA_INFO_UPDATED);
+ dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_EXTRA_INFO_UPDATED);
}
out:
return NULL;
}
-static struct packet *master_lb_updated(pid_t pid, int handle, const struct packet *packet)
+static struct packet *master_dbox_updated(pid_t pid, int handle, const struct packet *packet)
{
const char *pkgname;
const char *id;
const char *fbfile;
const char *safe_file;
- struct livebox *handler;
- struct livebox_common *common;
- int lb_w;
- int lb_h;
+ struct dynamicbox *handler;
+ struct dynamicbox_common *common;
+ int dbox_w;
+ int dbox_h;
int ret;
- ret = packet_get(packet, "ssssii", &pkgname, &id, &fbfile, &safe_file, &lb_w, &lb_h);
+ ret = packet_get(packet, "ssssii", &pkgname, &id, &fbfile, &safe_file, &dbox_w, &dbox_h);
if (ret != 6) {
ErrPrint("Invalid argument\n");
goto out;
}
- common = lb_find_common_handle(pkgname, id);
+ common = dbox_find_common_handle(pkgname, id);
if (!common) {
ErrPrint("instance(%s) is not exists\n", id);
goto out;
goto out;
}
- lb_set_size(common, lb_w, lb_h);
- lb_set_filename(common, safe_file);
+ dbox_set_size(common, dbox_w, dbox_h);
+ dbox_set_filename(common, safe_file);
- if (lb_text_lb(common)) {
+ if (dbox_text_dbox(common)) {
const char *common_filename;
common_filename = common->filename ? common->filename : util_uri_to_path(common->id);
* Don't need to call global event callback in this case.
*/
goto out;
- } else if (lb_get_lb_fb(common)) {
+ } else if (dbox_get_dbox_fb(common)) {
/*!
* \todo
* replace this with "flag" instead of "callback address"
DbgPrint("Discards obsoloted update event\n");
ret = DBOX_STATUS_ERROR_BUSY;
} else {
- (void)lb_set_lb_fb(common, fbfile);
+ (void)dbox_set_dbox_fb(common, fbfile);
if (!conf_manual_sync()) {
- ret = lb_sync_lb_fb(common);
+ ret = dbox_sync_dbox_fb(common);
if (ret != (int)DBOX_STATUS_ERROR_NONE) {
ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, util_basename(util_uri_to_path(id)), ret);
}
struct dlist *l;
struct dlist *n;
- dlist_foreach_safe(common->livebox_list, l, n, handler) {
- lb_invoke_event_handler(handler, LB_EVENT_LB_UPDATED);
+ dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DBOX_UPDATED);
}
}
return NULL;
}
-static struct packet *master_pd_created(pid_t pid, int handle, const struct packet *packet)
+static struct packet *master_gbar_created(pid_t pid, int handle, const struct packet *packet)
{
- struct livebox *handler;
- struct livebox_common *common;
+ struct dynamicbox *handler;
+ struct dynamicbox_common *common;
const char *pkgname;
const char *id;
const char *buf_id;
}
DbgPrint("[%s]\n", pkgname);
- common = lb_find_common_handle(pkgname, id);
+ common = dbox_find_common_handle(pkgname, id);
if (!common) {
ErrPrint("Instance(%s) is not exists\n", id);
goto out;
goto out;
}
- if (!common->request.pd_created) {
- ErrPrint("PD create request is canceled\n");
+ if (!common->request.gbar_created) {
+ ErrPrint("GBAR create request is canceled\n");
goto out;
}
- common->is_pd_created = (status == (int)DBOX_STATUS_ERROR_NONE);
- common->request.pd_created = 0;
+ common->is_gbar_created = (status == (int)DBOX_STATUS_ERROR_NONE);
+ common->request.gbar_created = 0;
- if (common->is_pd_created) {
- lb_set_pdsize(common, width, height);
- if (lb_text_pd(common)) {
+ if (common->is_gbar_created) {
+ dbox_set_gbarsize(common, width, height);
+ if (dbox_text_gbar(common)) {
DbgPrint("Text TYPE does not need to handle this\n");
} else {
- (void)lb_set_pd_fb(common, buf_id);
+ (void)dbox_set_gbar_fb(common, buf_id);
- switch (common->pd.type) {
- case _PD_TYPE_SCRIPT:
- case _PD_TYPE_BUFFER:
- switch (fb_type(lb_get_pd_fb(common))) {
+ switch (common->gbar.type) {
+ case _GBAR_TYPE_SCRIPT:
+ case _GBAR_TYPE_BUFFER:
+ switch (fb_type(dbox_get_gbar_fb(common))) {
case BUFFER_TYPE_FILE:
case BUFFER_TYPE_SHM:
- lb_create_lock_file(common, 1);
+ dbox_create_lock_file(common, 1);
break;
case BUFFER_TYPE_PIXMAP:
case BUFFER_TYPE_ERROR:
break;
}
break;
- case _PD_TYPE_ELEMENTARY:
- case _PD_TYPE_TEXT:
+ case _GBAR_TYPE_ELEMENTARY:
+ case _GBAR_TYPE_TEXT:
default:
break;
}
- ret = lb_sync_pd_fb(common);
+ ret = dbox_sync_gbar_fb(common);
if (ret < 0) {
ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
}
}
DbgPrint("PERF_DBOX\n");
- dlist_foreach_safe(common->livebox_list, l, n, handler) {
- if (handler->cbs.pd_created.cb) {
- ret_cb_t cb;
+ dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
+ if (handler->cbs.gbar_created.cb) {
+ dynamicbox_ret_cb_t cb;
void *cbdata;
- cb = handler->cbs.pd_created.cb;
- cbdata = handler->cbs.pd_created.data;
+ cb = handler->cbs.gbar_created.cb;
+ cbdata = handler->cbs.gbar_created.data;
- handler->cbs.pd_created.cb = NULL;
- handler->cbs.pd_created.data = NULL;
+ handler->cbs.gbar_created.cb = NULL;
+ handler->cbs.gbar_created.data = NULL;
/*!
* Before call the Callback function,
- * pd_create_cb must be reset.
- * Because, in the create callback, user can call create_pd function again.
+ * gbar_create_cb must be reset.
+ * Because, in the create callback, user can call create_gbar function again.
*/
cb(handler, status, cbdata);
} else if (status == (int)DBOX_STATUS_ERROR_NONE) {
- lb_invoke_event_handler(handler, LB_EVENT_PD_CREATED);
+ dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_CREATED);
}
}
return NULL;
}
-static struct packet *master_pd_destroyed(pid_t pid, int handle, const struct packet *packet)
+static struct packet *master_gbar_destroyed(pid_t pid, int handle, const struct packet *packet)
{
- struct livebox *handler;
+ struct dynamicbox *handler;
struct dlist *l;
- struct livebox_common *common;
+ struct dynamicbox_common *common;
const char *pkgname;
const char *id;
int ret;
}
DbgPrint("[%s]\n", pkgname);
- common = lb_find_common_handle(pkgname, id);
+ common = dbox_find_common_handle(pkgname, id);
if (!common) {
ErrPrint("Instance(%s) is not exists\n", id);
goto out;
goto out;
}
- if (common->is_pd_created == 0) {
- ErrPrint("PD is not created, event is ignored\n");
+ if (common->is_gbar_created == 0) {
+ ErrPrint("GBAR is not created, event is ignored\n");
goto out;
}
- common->is_pd_created = 0;
- common->request.pd_destroyed = 0;
+ common->is_gbar_created = 0;
+ common->request.gbar_destroyed = 0;
- dlist_foreach(common->livebox_list, l, handler) {
- if (handler->cbs.pd_destroyed.cb) {
- ret_cb_t cb;
+ dlist_foreach(common->dynamicbox_list, l, handler) {
+ if (handler->cbs.gbar_destroyed.cb) {
+ dynamicbox_ret_cb_t cb;
void *cbdata;
- cb = handler->cbs.pd_destroyed.cb;
- cbdata = handler->cbs.pd_destroyed.data;
+ cb = handler->cbs.gbar_destroyed.cb;
+ cbdata = handler->cbs.gbar_destroyed.data;
- handler->cbs.pd_destroyed.cb = NULL;
- handler->cbs.pd_destroyed.data = NULL;
+ handler->cbs.gbar_destroyed.cb = NULL;
+ handler->cbs.gbar_destroyed.data = NULL;
/*!
* Before call the Callback function,
- * pd_destroyed_cb must be reset.
- * Because, in the create callback, user can call destroy_pd function again.
+ * gbar_destroyed_cb must be reset.
+ * Because, in the create callback, user can call destroy_gbar function again.
*/
cb(handler, status, cbdata);
} else if (status == (int)DBOX_STATUS_ERROR_NONE) {
- lb_invoke_event_handler(handler, LB_EVENT_PD_DESTROYED);
+ dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_DESTROYED);
}
}
* \note
* Lock file should be deleted after all callbacks are processed.
*/
- switch (common->pd.type) {
- case _PD_TYPE_SCRIPT:
- case _PD_TYPE_BUFFER:
- switch (fb_type(lb_get_pd_fb(common))) {
+ switch (common->gbar.type) {
+ case _GBAR_TYPE_SCRIPT:
+ case _GBAR_TYPE_BUFFER:
+ switch (fb_type(dbox_get_gbar_fb(common))) {
case BUFFER_TYPE_FILE:
case BUFFER_TYPE_SHM:
- lb_destroy_lock_file(common, 1);
+ dbox_destroy_lock_file(common, 1);
break;
case BUFFER_TYPE_PIXMAP:
case BUFFER_TYPE_ERROR:
break;
}
break;
- case _PD_TYPE_ELEMENTARY:
- case _PD_TYPE_TEXT:
+ case _GBAR_TYPE_ELEMENTARY:
+ case _GBAR_TYPE_TEXT:
default:
break;
}
return NULL;
}
-static struct packet *master_pd_updated(pid_t pid, int handle, const struct packet *packet)
+static struct packet *master_gbar_updated(pid_t pid, int handle, const struct packet *packet)
{
const char *pkgname;
const char *id;
const char *descfile;
const char *fbfile;
int ret;
- struct livebox *handler;
- struct livebox_common *common;
+ struct dynamicbox *handler;
+ struct dynamicbox_common *common;
struct dlist *l;
- int pd_w;
- int pd_h;
+ int gbar_w;
+ int gbar_h;
ret = packet_get(packet, "ssssii",
&pkgname, &id,
&descfile, &fbfile,
- &pd_w, &pd_h);
+ &gbar_w, &gbar_h);
if (ret != 6) {
ErrPrint("Invalid argument\n");
goto out;
}
DbgPrint("[%s]\n", pkgname);
- common = lb_find_common_handle(pkgname, id);
+ common = dbox_find_common_handle(pkgname, id);
if (!common) {
ErrPrint("Instance(%s) is not exists\n", id);
goto out;
goto out;
}
- lb_set_pdsize(common, pd_w, pd_h);
+ dbox_set_gbarsize(common, gbar_w, gbar_h);
- if (lb_text_pd(common)) {
+ if (dbox_text_gbar(common)) {
(void)parse_desc(common, descfile, 1);
} else {
if (conf_frame_drop_for_resizing() && common->request.size_changed) {
/* Just for skipping the update event callback call, After request to resize buffer, update event will be discarded */
DbgPrint("Discards obsoloted update event\n");
} else {
- (void)lb_set_pd_fb(common, fbfile);
+ (void)dbox_set_gbar_fb(common, fbfile);
if (!conf_manual_sync()) {
- ret = lb_sync_pd_fb(common);
+ ret = dbox_sync_gbar_fb(common);
if (ret < 0) {
ErrPrint("Failed to do sync FB (%s - %s), %d\n", pkgname, util_basename(util_uri_to_path(id)), ret);
} else {
- dlist_foreach(common->livebox_list, l, handler) {
- lb_invoke_event_handler(handler, LB_EVENT_PD_UPDATED);
+ dlist_foreach(common->dynamicbox_list, l, handler) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_UPDATED);
}
}
} else {
- dlist_foreach(common->livebox_list, l, handler) {
- lb_invoke_event_handler(handler, LB_EVENT_PD_UPDATED);
+ dlist_foreach(common->dynamicbox_list, l, handler) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_UPDATED);
}
}
}
static struct packet *master_update_mode(pid_t pid, int handle, const struct packet *packet)
{
- struct livebox *handler;
- struct livebox_common *common;
+ struct dynamicbox *handler;
+ struct dynamicbox_common *common;
struct dlist *l;
struct dlist *n;
const char *pkgname;
goto out;
}
- common = lb_find_common_handle(pkgname, id);
+ common = dbox_find_common_handle(pkgname, id);
if (!common) {
ErrPrint("Livebox(%s) is not found\n", id);
goto out;
}
if (status == (int)DBOX_STATUS_ERROR_NONE) {
- lb_set_update_mode(common, active_mode);
+ dbox_set_update_mode(common, active_mode);
}
common->request.update_mode = 0;
- dlist_foreach_safe(common->livebox_list, l, n, handler) {
+ dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
if (handler->cbs.update_mode.cb) {
- ret_cb_t cb;
+ dynamicbox_ret_cb_t cb;
void *cbdata;
cb = handler->cbs.update_mode.cb;
cb(handler, status, cbdata);
} else if (status == (int)DBOX_STATUS_ERROR_NONE) {
- lb_invoke_event_handler(handler, LB_EVENT_UPDATE_MODE_CHANGED);
+ dbox_invoke_event_handler(handler, DBOX_EVENT_UPDATE_MODE_CHANGED);
}
}
static struct packet *master_size_changed(pid_t pid, int handle, const struct packet *packet)
{
- struct livebox *handler;
- struct livebox_common *common;
+ struct dynamicbox *handler;
+ struct dynamicbox_common *common;
const char *pkgname;
const char *id;
const char *fbfile;
int ret;
int w;
int h;
- int is_pd;
+ int is_gbar;
if (!packet) {
ErrPrint("Invalid packet\n");
goto out;
}
- ret = packet_get(packet, "sssiiii", &pkgname, &id, &fbfile, &is_pd, &w, &h, &status);
+ ret = packet_get(packet, "sssiiii", &pkgname, &id, &fbfile, &is_gbar, &w, &h, &status);
if (ret != 7) {
ErrPrint("Invalid argument\n");
goto out;
}
- common = lb_find_common_handle(pkgname, id);
+ common = dbox_find_common_handle(pkgname, id);
if (!common) {
ErrPrint("Livebox(%s) is not found\n", id);
goto out;
}
common->request.size_changed = 0;
- if (is_pd) {
+ if (is_gbar) {
/*!
* \NOTE
- * PD is not able to resized by the client.
- * PD is only can be managed by the provider.
- * So the PD has no private resized event handler.
+ * GBAR is not able to resized by the client.
+ * GBAR is only can be managed by the provider.
+ * So the GBAR has no private resized event handler.
* Notify it via global event handler only.
*/
if (status == (int)DBOX_STATUS_ERROR_NONE) {
struct dlist *l;
- lb_set_pdsize(common, w, h);
- dlist_foreach(common->livebox_list, l, handler) {
- lb_invoke_event_handler(handler, LB_EVENT_PD_SIZE_CHANGED);
+ dbox_set_gbarsize(common, w, h);
+ dlist_foreach(common->dynamicbox_list, l, handler) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_SIZE_CHANGED);
}
} else {
- ErrPrint("This is not possible. PD Size is changed but the return value is not ZERO (%d)\n", status);
+ ErrPrint("This is not possible. GBAR Size is changed but the return value is not ZERO (%d)\n", status);
}
} else {
struct dlist *l;
struct dlist *n;
if (status == (int)DBOX_STATUS_ERROR_NONE) {
- lb_set_size(common, w, h);
+ dbox_set_size(common, w, h);
/*!
* \NOTE
- * If there is a created LB FB,
+ * If there is a created DBOX FB,
* Update it too.
*/
- if (lb_get_lb_fb(common)) {
- (void)lb_set_lb_fb(common, fbfile);
+ if (dbox_get_dbox_fb(common)) {
+ (void)dbox_set_dbox_fb(common, fbfile);
- ret = lb_sync_lb_fb(common);
+ ret = dbox_sync_dbox_fb(common);
if (ret < 0) {
ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
}
* I cannot believe client.
* So I added some log before & after call the user callback.
*/
- dlist_foreach_safe(common->livebox_list, l, n, handler) {
+ dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
if (handler->cbs.size_changed.cb) {
- ret_cb_t cb;
+ dynamicbox_ret_cb_t cb;
void *cbdata;
cb = handler->cbs.size_changed.cb;
cb(handler, status, cbdata);
} else if (status == (int)DBOX_STATUS_ERROR_NONE) {
- lb_invoke_event_handler(handler, LB_EVENT_LB_SIZE_CHANGED);
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DBOX_SIZE_CHANGED);
}
}
}
static struct packet *master_period_changed(pid_t pid, int handle, const struct packet *packet)
{
- struct livebox *handler;
- struct livebox_common *common;
+ struct dynamicbox *handler;
+ struct dynamicbox_common *common;
struct dlist *l;
struct dlist *n;
const char *pkgname;
goto out;
}
- common = lb_find_common_handle(pkgname, id);
+ common = dbox_find_common_handle(pkgname, id);
if (!common) {
ErrPrint("Livebox(%s) is not found\n", id);
goto out;
}
if (status == (int)DBOX_STATUS_ERROR_NONE) {
- lb_set_period(common, period);
+ dbox_set_period(common, period);
}
common->request.period_changed = 0;
- dlist_foreach_safe(common->livebox_list, l, n, handler) {
+ dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
if (handler->cbs.period_changed.cb) {
- ret_cb_t cb;
+ dynamicbox_ret_cb_t cb;
void *cbdata;
cb = handler->cbs.period_changed.cb;
cb(handler, status, cbdata);
} else if (status == (int)DBOX_STATUS_ERROR_NONE) {
- lb_invoke_event_handler(handler, LB_EVENT_PERIOD_CHANGED);
+ dbox_invoke_event_handler(handler, DBOX_EVENT_PERIOD_CHANGED);
}
}
static struct packet *master_group_changed(pid_t pid, int handle, const struct packet *packet)
{
- struct livebox *handler;
- struct livebox_common *common;
+ struct dynamicbox *handler;
+ struct dynamicbox_common *common;
struct dlist *l;
struct dlist *n;
const char *pkgname;
goto out;
}
- common = lb_find_common_handle(pkgname, id);
+ common = dbox_find_common_handle(pkgname, id);
if (!common) {
ErrPrint("Livebox(%s) is not exists\n", id);
goto out;
}
if (status == (int)DBOX_STATUS_ERROR_NONE) {
- (void)lb_set_group(common, cluster, category);
+ (void)dbox_set_group(common, cluster, category);
}
common->request.group_changed = 0;
- dlist_foreach_safe(common->livebox_list, l, n, handler) {
+ dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
if (handler->cbs.group_changed.cb) {
- ret_cb_t cb;
+ dynamicbox_ret_cb_t cb;
void *cbdata;
cb = handler->cbs.group_changed.cb;
cb(handler, status, cbdata);
} else if (status == (int)DBOX_STATUS_ERROR_NONE) {
- lb_invoke_event_handler(handler, LB_EVENT_GROUP_CHANGED);
+ dbox_invoke_event_handler(handler, DBOX_EVENT_GROUP_CHANGED);
}
}
static struct packet *master_created(pid_t pid, int handle, const struct packet *packet)
{
- struct livebox *handler;
- struct livebox_common *common;
+ struct dynamicbox *handler;
+ struct dynamicbox_common *common;
struct dlist *l;
- int lb_w;
- int lb_h;
- int pd_w;
- int pd_h;
+ int dbox_w;
+ int dbox_h;
+ int gbar_w;
+ int gbar_h;
const char *pkgname;
const char *id;
const char *content;
const char *cluster;
const char *category;
- const char *lb_fname;
- const char *pd_fname;
+ const char *dbox_fname;
+ const char *gbar_fname;
const char *title;
double timestamp;
int size_list;
int user;
int pinup_supported;
- enum lb_type lb_type;
- enum pd_type pd_type;
+ enum dbox_type dbox_type;
+ enum gbar_type gbar_type;
double period;
int is_pinned_up;
ret = packet_get(packet, "dsssiiiisssssdiiiiidsi",
×tamp,
&pkgname, &id, &content,
- &lb_w, &lb_h, &pd_w, &pd_h,
- &cluster, &category, &lb_fname, &pd_fname,
+ &dbox_w, &dbox_h, &gbar_w, &gbar_h,
+ &cluster, &category, &dbox_fname, &gbar_fname,
&auto_launch, &priority, &size_list, &user, &pinup_supported,
- &lb_type, &pd_type, &period, &title, &is_pinned_up);
+ &dbox_type, &gbar_type, &period, &title, &is_pinned_up);
if (ret != 22) {
ErrPrint("Invalid argument\n");
ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
ErrPrint("[%lf] pkgname: %s, id: %s, content: %s, "
- "pd_w: %d, pd_h: %d, lb_w: %d, lb_h: %d, "
- "cluster: %s, category: %s, lb_fname: \"%s\", pd_fname: \"%s\", "
+ "gbar_w: %d, gbar_h: %d, dbox_w: %d, dbox_h: %d, "
+ "cluster: %s, category: %s, dbox_fname: \"%s\", gbar_fname: \"%s\", "
"auto_launch: %s, priority: %lf, size_list: %d, user: %d, pinup: %d, "
- "lb_type: %d, pd_type: %d, period: %lf, title: [%s], is_pinned_up: %d\n",
+ "dbox_type: %d, gbar_type: %d, period: %lf, title: [%s], is_pinned_up: %d\n",
timestamp, pkgname, id, content,
- pd_w, pd_h, lb_w, lb_h,
- cluster, category, lb_fname, pd_fname,
+ gbar_w, gbar_h, dbox_w, dbox_h,
+ cluster, category, dbox_fname, gbar_fname,
auto_launch, priority, size_list, user, pinup_supported,
- lb_type, pd_type, period, title, is_pinned_up);
+ dbox_type, gbar_type, period, title, is_pinned_up);
- common = lb_find_common_handle_by_timestamp(timestamp);
+ common = dbox_find_common_handle_by_timestamp(timestamp);
if (!common) {
- handler = lb_new_livebox(pkgname, id, timestamp, cluster, category);
+ handler = dbox_new_dynamicbox(pkgname, id, timestamp, cluster, category);
if (!handler) {
- ErrPrint("Failed to create a new livebox\n");
+ ErrPrint("Failed to create a new dynamicbox\n");
ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
if (common->id) {
ErrPrint("Already created: timestamp[%lf] "
"pkgname[%s], id[%s] content[%s] "
- "cluster[%s] category[%s] lb_fname[%s] pd_fname[%s]\n",
+ "cluster[%s] category[%s] dbox_fname[%s] gbar_fname[%s]\n",
timestamp, pkgname, id,
content, cluster, category,
- lb_fname, pd_fname);
+ dbox_fname, gbar_fname);
ret = DBOX_STATUS_ERROR_ALREADY;
goto out;
}
- lb_set_id(common, id);
+ dbox_set_id(common, id);
}
common->request.created = 0;
- lb_set_size(common, lb_w, lb_h);
- common->lb.type = lb_type;
+ dbox_set_size(common, dbox_w, dbox_h);
+ common->dbox.type = dbox_type;
common->is_pinned_up = is_pinned_up;
- switch (lb_type) {
- case _LB_TYPE_ELEMENTARY:
- case _LB_TYPE_FILE:
+ switch (dbox_type) {
+ case _DBOX_TYPE_ELEMENTARY:
+ case _DBOX_TYPE_FILE:
break;
- case _LB_TYPE_SCRIPT:
- case _LB_TYPE_BUFFER:
- if (!strlen(lb_fname)) {
+ case _DBOX_TYPE_SCRIPT:
+ case _DBOX_TYPE_BUFFER:
+ if (!strlen(dbox_fname)) {
break;
}
- (void)lb_set_lb_fb(common, lb_fname);
+ (void)dbox_set_dbox_fb(common, dbox_fname);
/*!
* \note
* Even if the old_state == DELETE,
* the lock file will be deleted from deleted event callback.
*/
- switch (fb_type(lb_get_lb_fb(common))) {
+ switch (fb_type(dbox_get_dbox_fb(common))) {
case BUFFER_TYPE_FILE:
case BUFFER_TYPE_SHM:
- lb_create_lock_file(common, 0);
+ dbox_create_lock_file(common, 0);
break;
case BUFFER_TYPE_PIXMAP:
case BUFFER_TYPE_ERROR:
break;
}
- ret = lb_sync_lb_fb(common);
+ ret = dbox_sync_dbox_fb(common);
if (ret < 0) {
ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
}
break;
- case _LB_TYPE_TEXT:
- lb_set_text_lb(common);
+ case _DBOX_TYPE_TEXT:
+ dbox_set_text_dbox(common);
break;
default:
break;
}
- common->pd.type = pd_type;
- lb_set_pdsize(common, pd_w, pd_h);
- lb_set_default_pdsize(common, pd_w, pd_h);
- switch (pd_type) {
- case _PD_TYPE_SCRIPT:
- case _PD_TYPE_BUFFER:
- if (!strlen(pd_fname)) {
+ common->gbar.type = gbar_type;
+ dbox_set_gbarsize(common, gbar_w, gbar_h);
+ dbox_set_default_gbarsize(common, gbar_w, gbar_h);
+ switch (gbar_type) {
+ case _GBAR_TYPE_SCRIPT:
+ case _GBAR_TYPE_BUFFER:
+ if (!strlen(gbar_fname)) {
break;
}
- lb_set_pd_fb(common, pd_fname);
+ dbox_set_gbar_fb(common, gbar_fname);
- ret = lb_sync_pd_fb(common);
+ ret = dbox_sync_gbar_fb(common);
if (ret < 0) {
ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
}
/*!
* \brief
- * PD doesn't need to create the lock file from here.
- * Just create it from PD_CREATED event.
+ * GBAR doesn't need to create the lock file from here.
+ * Just create it from GBAR_CREATED event.
*/
break;
- case _PD_TYPE_TEXT:
- lb_set_text_pd(common);
+ case _GBAR_TYPE_TEXT:
+ dbox_set_text_gbar(common);
break;
- case _PD_TYPE_ELEMENTARY:
+ case _GBAR_TYPE_ELEMENTARY:
default:
break;
}
- lb_set_priority(common, priority);
+ dbox_set_priority(common, priority);
- lb_set_size_list(common, size_list);
- lb_set_group(common, cluster, category);
+ dbox_set_size_list(common, size_list);
+ dbox_set_group(common, cluster, category);
- lb_set_content(common, content);
- lb_set_title(common, title);
+ dbox_set_content(common, content);
+ dbox_set_title(common, title);
- lb_set_user(common, user);
+ dbox_set_user(common, user);
- lb_set_auto_launch(common, auto_launch);
- lb_set_pinup(common, pinup_supported);
+ dbox_set_auto_launch(common, auto_launch);
+ dbox_set_pinup(common, pinup_supported);
- lb_set_period(common, period);
+ dbox_set_period(common, period);
ret = 0;
if (common->state == CREATE) {
- dlist_foreach(common->livebox_list, l, handler) {
+ dlist_foreach(common->dynamicbox_list, l, handler) {
/*!
* \note
* These callback can change the handler->state.
*/
if (handler->cbs.created.cb) {
- ret_cb_t cb;
+ dynamicbox_ret_cb_t cb;
void *cbdata;
cb = handler->cbs.created.cb;
cb(handler, ret, cbdata);
} else {
- lb_invoke_event_handler(handler, LB_EVENT_CREATED);
+ dbox_invoke_event_handler(handler, DBOX_EVENT_CREATED);
}
}
}
struct dlist *n;
DbgPrint("Take place an unexpected case [%d]\n", common->refcnt);
- dlist_foreach_safe(common->livebox_list, l, n, handler) {
+ dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
if (handler->cbs.created.cb) {
if (!handler->common->request.deleted) {
- if (lb_send_delete(handler, common->delete_type, handler->cbs.created.cb, handler->cbs.created.data) < 0) {
+ if (dbox_send_delete(handler, common->delete_type, handler->cbs.created.cb, handler->cbs.created.data) < 0) {
/*!
* \note
* Already sent or something else happens.
}
} else if (handler->state != DELETE) {
handler->cbs.created.cb(handler, DBOX_STATUS_ERROR_CANCEL, handler->cbs.created.data);
- lb_unref(handler, 1);
+ dbox_unref(handler, 1);
}
} else {
- lb_invoke_event_handler(handler, LB_EVENT_DELETED);
- lb_unref(handler, 1);
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
}
}
static struct method s_table[] = {
{
- .cmd = "lb_updated", /* pkgname, id, lb_w, lb_h, priority, ret */
- .handler = master_lb_updated,
+ .cmd = "lb_updated", /* pkgname, id, dbox_w, dbox_h, priority, ret */
+ .handler = master_dbox_updated,
},
{
.cmd = "pd_updated", /* pkgname, id, descfile, pd_w, pd_h, ret */
- .handler = master_pd_updated,
+ .handler = master_gbar_updated,
},
{
.cmd = "extra_info",
},
{
.cmd = "pd_created",
- .handler = master_pd_created,
+ .handler = master_gbar_created,
},
{
.cmd = "pd_destroyed",
- .handler = master_pd_destroyed,
+ .handler = master_gbar_destroyed,
},
{
.cmd = "fault_package", /* pkgname, id, function, ret */
.handler = master_deleted,
},
{
- .cmd = "created", /* timestamp, pkgname, id, content, lb_w, lb_h, pd_w, pd_h, cluster, category, lb_file, pd_file, auto_launch, priority, size_list, is_user, pinup_supported, text_lb, text_pd, period, ret */
+ .cmd = "created", /* timestamp, pkgname, id, content, dbox_w, dbox_h, gbar_w, gbar_h, cluster, category, dbox_file, gbar_file, auto_launch, priority, size_list, is_user, pinup_supported, text_dbox, text_gbar, period, ret */
.handler = master_created,
},
{
{
.cmd = "lb_update_begin",
- .handler = master_lb_update_begin,
+ .handler = master_dbox_update_begin,
},
{
.cmd = "lb_update_end",
- .handler = master_lb_update_end,
+ .handler = master_dbox_update_end,
},
{
.cmd = "pd_update_begin",
- .handler = master_pd_update_begin,
+ .handler = master_gbar_update_begin,
},
{
.cmd = "pd_update_end",
- .handler = master_pd_update_end,
+ .handler = master_gbar_update_end,
},
{
},
{
.cmd = "close_pd",
- .handler = master_request_close_pd,
+ .handler = master_request_close_gbar,
},
{
},
};
-static void acquire_cb(struct livebox *handler, const struct packet *result, void *data)
+static void acquire_cb(struct dynamicbox *handler, const struct packet *result, void *data)
{
if (!result) {
DbgPrint("Result packet is not valid\n");
s_info.fd = -1; /*!< Disconnected */
master_rpc_clear_all_request();
- lb_invoke_fault_handler(LB_FAULT_PROVIDER_DISCONNECTED, MASTER_PKGNAME, "default", "disconnected");
+ dbox_invoke_fault_handler(DBOX_FAULT_PROVIDER_DISCONNECTED, MASTER_PKGNAME, "default", "disconnected");
- lb_delete_all();
+ dbox_delete_all();
/* Try to reconnect after 1 sec later */
if (!s_info.timer_id) {
#include <dynamicbox_service.h>
#include "debug.h"
-#include "livebox.h"
-#include "livebox_internal.h"
+#include "dynamicbox.h"
+#include "dynamicbox_internal.h"
#include "desc_parser.h"
#include "dlist.h"
#include "util.h"
const char *filename;
};
-static int update_text(struct livebox *handle, struct block *block, int is_pd)
+static int update_text(struct dynamicbox *handle, struct block *block, int is_gbar)
{
- struct livebox_script_operators *ops;
+ struct dynamicbox_script_operators *ops;
if (!block || !block->part || !block->data) {
ErrPrint("Invalid argument\n");
return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- ops = is_pd ? &handle->cbs.pd_ops : &handle->cbs.lb_ops;
+ ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (ops->update_text) {
ops->update_text(handle, (const char *)block->id, (const char *)block->part, (const char *)block->data);
}
return 0;
}
-static int update_image(struct livebox *handle, struct block *block, int is_pd)
+static int update_image(struct dynamicbox *handle, struct block *block, int is_gbar)
{
- struct livebox_script_operators *ops;
+ struct dynamicbox_script_operators *ops;
if (!block || !block->part) {
ErrPrint("Invalid argument\n");
return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- ops = is_pd ? &handle->cbs.pd_ops : &handle->cbs.lb_ops;
+ ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (ops->update_image) {
ops->update_image(handle, block->id, block->part, block->data, block->option);
}
return 0;
}
-static int update_script(struct livebox *handle, struct block *block, int is_pd)
+static int update_script(struct dynamicbox *handle, struct block *block, int is_gbar)
{
- struct livebox_script_operators *ops;
+ struct dynamicbox_script_operators *ops;
if (!block || !block->part) {
ErrPrint("Invalid argument\n");
return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- ops = is_pd ? &handle->cbs.pd_ops : &handle->cbs.lb_ops;
+ ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (ops->update_script) {
ops->update_script(handle, block->id, block->target, block->part, block->data, block->option);
}
return 0;
}
-static int update_signal(struct livebox *handle, struct block *block, int is_pd)
+static int update_signal(struct dynamicbox *handle, struct block *block, int is_gbar)
{
- struct livebox_script_operators *ops;
+ struct dynamicbox_script_operators *ops;
if (!block) {
ErrPrint("Invalid argument\n");
return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- ops = is_pd ? &handle->cbs.pd_ops : &handle->cbs.lb_ops;
+ ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (ops->update_signal) {
ops->update_signal(handle, block->id, block->data, block->part);
}
return 0;
}
-static int update_drag(struct livebox *handle, struct block *block, int is_pd)
+static int update_drag(struct dynamicbox *handle, struct block *block, int is_gbar)
{
double dx, dy;
- struct livebox_script_operators *ops;
+ struct dynamicbox_script_operators *ops;
if (!block || !block->data || !block->part) {
ErrPrint("Invalid argument\n");
return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- ops = is_pd ? &handle->cbs.pd_ops : &handle->cbs.lb_ops;
+ ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (ops->update_drag) {
ops->update_drag(handle, block->id, block->part, dx, dy);
}
return 0;
}
-static int update_info(struct livebox *handle, struct block *block, int is_pd)
+static int update_info(struct dynamicbox *handle, struct block *block, int is_gbar)
{
- struct livebox_script_operators *ops;
+ struct dynamicbox_script_operators *ops;
if (!block || !block->part || !block->data) {
ErrPrint("Invalid argument\n");
return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- ops = is_pd ? &handle->cbs.pd_ops : &handle->cbs.lb_ops;
+ ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (!strcasecmp(block->part, INFO_SIZE)) {
int w, h;
return 0;
}
-static int update_access(struct livebox *handle, struct block *block, int is_pd)
+static int update_access(struct dynamicbox *handle, struct block *block, int is_gbar)
{
- struct livebox_script_operators *ops;
+ struct dynamicbox_script_operators *ops;
if (!block) {
ErrPrint("Invalid argument\n");
return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- ops = is_pd ? &handle->cbs.pd_ops : &handle->cbs.lb_ops;
+ ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (ops->update_access) {
ops->update_access(handle, block->id, block->part, block->data, block->option);
}
return 0;
}
-static int operate_access(struct livebox *handle, struct block *block, int is_pd)
+static int operate_access(struct dynamicbox *handle, struct block *block, int is_gbar)
{
- struct livebox_script_operators *ops;
+ struct dynamicbox_script_operators *ops;
if (!block) {
ErrPrint("Invalid argument\n");
return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- ops = is_pd ? &handle->cbs.pd_ops : &handle->cbs.lb_ops;
+ ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (ops->operate_access) {
ops->operate_access(handle, block->id, block->part, block->data, block->option);
}
return 0;
}
-static int update_color(struct livebox *handle, struct block *block, int is_pd)
+static int update_color(struct dynamicbox *handle, struct block *block, int is_gbar)
{
- struct livebox_script_operators *ops;
+ struct dynamicbox_script_operators *ops;
if (!block) {
ErrPrint("Invalid argument\n");
return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- ops = is_pd ? &handle->cbs.pd_ops : &handle->cbs.lb_ops;
+ ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (ops->update_color) {
ops->update_color(handle, block->id, block->part, block->data);
}
return 0;
}
-static inline int update_begin(struct livebox *handle, int is_pd)
+static inline int update_begin(struct dynamicbox *handle, int is_gbar)
{
- struct livebox_script_operators *ops;
+ struct dynamicbox_script_operators *ops;
- ops = is_pd ? &handle->cbs.pd_ops : &handle->cbs.lb_ops;
+ ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (ops->update_begin) {
ops->update_begin(handle);
}
return 0;
}
-static inline int update_end(struct livebox *handle, int is_pd)
+static inline int update_end(struct dynamicbox *handle, int is_gbar)
{
- struct livebox_script_operators *ops;
+ struct dynamicbox_script_operators *ops;
- ops = is_pd ? &handle->cbs.pd_ops : &handle->cbs.lb_ops;
+ ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (ops->update_end) {
ops->update_end(handle);
}
free(block);
}
-static inline void consuming_parsed_block(struct livebox *handle, int is_pd, struct block *block)
+static inline void consuming_parsed_block(struct dynamicbox *handle, int is_gbar, struct block *block)
{
- typedef int (*update_function_t)(struct livebox *handle, struct block *block, int is_pd);
+ typedef int (*update_function_t)(struct dynamicbox *handle, struct block *block, int is_gbar);
static update_function_t updators[] = {
update_access,
operate_access,
};
if (block->type >= 0 || block->type < TYPE_MAX) {
- (void)updators[block->type](handle, block, is_pd);
+ (void)updators[block->type](handle, block, is_gbar);
} else {
ErrPrint("Block type[%d] is not valid\n", block->type);
}
return filebuf;
}
-int parse_desc(struct livebox_common *common, const char *filename, int is_pd)
+int parse_desc(struct dynamicbox_common *common, const char *filename, int is_gbar)
{
int type_idx = 0;
int type_len = 0;
struct dlist *l;
struct dlist *n;
struct dlist *handle_iterator;
- struct livebox *handler;
+ struct dynamicbox *handler;
enum state {
BEGIN,
FIELD,
}
ErrPrint("Begin: Set content for object\n");
- dlist_foreach(common->livebox_list, l, handler) {
- update_begin(handler, is_pd);
+ dlist_foreach(common->dynamicbox_list, l, handler) {
+ update_begin(handler, is_gbar);
}
dlist_foreach_safe(block_list, l, n, block) {
- dlist_foreach(common->livebox_list, handle_iterator, handler) {
- consuming_parsed_block(handler, is_pd, block);
+ dlist_foreach(common->dynamicbox_list, handle_iterator, handler) {
+ consuming_parsed_block(handler, is_gbar, block);
}
block_list = dlist_remove(block_list, l);
delete_block(block);
}
- dlist_foreach(common->livebox_list, l, handler) {
- update_end(handler, is_pd);
+ dlist_foreach(common->dynamicbox_list, l, handler) {
+ update_end(handler, is_gbar);
}
ErrPrint("End: Set content for object\n");
FILE *__file_log_fp;
#endif
-#define ACCESS_TYPE_DOWN 0
-#define ACCESS_TYPE_MOVE 1
-#define ACCESS_TYPE_UP 2
-#define ACCESS_TYPE_CUR 0
-#define ACCESS_TYPE_NEXT 1
-#define ACCESS_TYPE_PREV 2
-#define ACCESS_TYPE_OFF 3
-
#define EAPI __attribute__((visibility("default")))
-static struct info {
- struct dlist *livebox_list;
- struct dlist *livebox_common_list;
-
- struct dlist *event_list;
- struct dlist *fault_list;
+static int default_launch_handler(struct dynamicbox *handler, const char *appid, void *data);
+static struct info {
int init_count;
int prevent_overwrite;
- enum event_state event_state;
- enum event_state fault_state;
guint job_timer;
struct dlist *job_list;
struct launch {
- int (*handler)(struct livebox *handler, const char *appid, void *data);
+ int (*handler)(struct dynamicbox *handler, const char *appid, void *data);
void *data;
} launch;
} s_info = {
- .livebox_list = NULL,
- .event_list = NULL,
- .fault_list = NULL,
.init_count = 0,
.prevent_overwrite = 0,
- .event_state = INFO_STATE_CALLBACK_IN_IDLE,
- .fault_state = INFO_STATE_CALLBACK_IN_IDLE,
.job_timer = 0,
.job_list = NULL,
.launch = {
},
};
-struct cb_info {
- ret_cb_t cb;
- void *data;
-};
-
-struct event_info {
- int is_deleted;
- int (*handler)(struct livebox *handler, enum livebox_event_type event, void *data);
- void *user_data;
-};
-
-struct fault_info {
- int is_deleted;
- int (*handler)(enum livebox_fault_type event, const char *pkgname, const char *filename, const char *func, void *data);
- void *user_data;
-};
-
-static int default_launch_handler(struct livebox *handler, const char *appid, void *data);
-static void lb_pixmap_acquired_cb(struct livebox *handler, const struct packet *result, void *data);
-static void pd_pixmap_acquired_cb(struct livebox *handler, const struct packet *result, void *data);
+static void dbox_pixmap_acquired_cb(struct dynamicbox *handler, const struct packet *result, void *data);
+static void gbar_pixmap_acquired_cb(struct dynamicbox *handler, const struct packet *result, void *data);
-static int default_launch_handler(struct livebox *handler, const char *appid, void *data)
+static int default_launch_handler(struct dynamicbox *handler, const char *appid, void *data)
{
int ret;
/*
app_control_h service;
- DbgPrint("AUTO_LAUNCH [%s]\n", handler->common->lb.auto_launch);
+ DbgPrint("AUTO_LAUNCH [%s]\n", handler->common->dbox.auto_launch);
ret = app_control_create(&service);
if (ret == APP_CONTROL_ERROR_NONE) {
- app_control_set_package(service, handler->common->lb.auto_launch);
+ app_control_set_package(service, handler->common->dbox.auto_launch);
app_control_send_launch_request(service, NULL, NULL);
app_control_destroy(service);
} else {
- ErrPrint("Failed to launch an app %s (%d)\n", handler->common->lb.auto_launch, ret);
+ ErrPrint("Failed to launch an app %s (%d)\n", handler->common->dbox.auto_launch, ret);
}
*/
- return ret > 0 ? LB_STATUS_SUCCESS : LB_STATUS_ERROR_FAULT;
+ return ret > 0 ? DBOX_STATUS_ERROR_NONE : DBOX_STATUS_ERROR_FAULT;
}
-static inline void default_create_cb(struct livebox *handler, int ret, void *data)
+static inline void default_create_cb(struct dynamicbox *handler, int ret, void *data)
{
DbgPrint("Default created event handler: %d\n", ret);
}
-static inline void default_delete_cb(struct livebox *handler, int ret, void *data)
-{
- DbgPrint("Default deleted event handler: %d\n", ret);
-}
-
-static inline void default_pinup_cb(struct livebox *handler, int ret, void *data)
+static inline void default_pinup_cb(struct dynamicbox *handler, int ret, void *data)
{
DbgPrint("Default pinup event handler: %d\n", ret);
}
-static inline void default_group_changed_cb(struct livebox *handler, int ret, void *data)
+static inline void default_group_changed_cb(struct dynamicbox *handler, int ret, void *data)
{
DbgPrint("Default group changed event handler: %d\n", ret);
}
-static inline void default_period_changed_cb(struct livebox *handler, int ret, void *data)
+static inline void default_period_changed_cb(struct dynamicbox *handler, int ret, void *data)
{
DbgPrint("Default period changed event handler: %d\n", ret);
}
-static inline void default_pd_created_cb(struct livebox *handler, int ret, void *data)
+static inline void default_gbar_created_cb(struct dynamicbox *handler, int ret, void *data)
{
- DbgPrint("Default PD created event handler: %d\n", ret);
+ DbgPrint("Default GBAR created event handler: %d\n", ret);
}
-static inline void default_pd_destroyed_cb(struct livebox *handler, int ret, void *data)
+static inline void default_gbar_destroyed_cb(struct dynamicbox *handler, int ret, void *data)
{
- DbgPrint("Default PD destroyed event handler: %d\n", ret);
+ DbgPrint("Default GBAR destroyed event handler: %d\n", ret);
}
-static inline void default_lb_size_changed_cb(struct livebox *handler, int ret, void *data)
+static inline void default_dbox_size_changed_cb(struct dynamicbox *handler, int ret, void *data)
{
- DbgPrint("Default LB size changed event handler: %d\n", ret);
+ DbgPrint("Default DBOX size changed event handler: %d\n", ret);
}
-static inline void default_update_mode_cb(struct livebox *handler, int ret, void *data)
+static inline void default_update_mode_cb(struct dynamicbox *handler, int ret, void *data)
{
DbgPrint("Default update mode set event handler: %d\n", ret);
}
-static inline void default_access_event_cb(struct livebox *handler, int ret, void *data)
+static inline void default_access_event_cb(struct dynamicbox *handler, int ret, void *data)
{
DbgPrint("Default access event handler: %d\n", ret);
}
-static inline void default_key_event_cb(struct livebox *handler, int ret, void *data)
+static inline void default_key_event_cb(struct dynamicbox *handler, int ret, void *data)
{
DbgPrint("Default key event handler: %d\n", ret);
}
-static inline __attribute__((always_inline)) struct cb_info *create_cb_info(ret_cb_t cb, void *data)
-{
- struct cb_info *info;
-
- info = malloc(sizeof(*info));
- if (!info) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return NULL;
- }
-
- info->cb = cb;
- info->data = data;
- return info;
-}
-
-static inline void destroy_cb_info(struct cb_info *info)
-{
- free(info);
-}
-
-static int do_fb_lock(int fd)
-{
- struct flock flock;
- int ret;
-
- flock.l_type = F_RDLCK;
- flock.l_whence = SEEK_SET;
- flock.l_start = 0;
- flock.l_len = 0;
- flock.l_pid = getpid();
-
- do {
- ret = fcntl(fd, F_SETLKW, &flock);
- if (ret < 0) {
- ret = errno;
- ErrPrint("fcntl: %s\n", strerror(errno));
- }
- } while (ret == EINTR);
-
- return ret;
-}
-
-static int do_fb_unlock(int fd)
-{
- struct flock flock;
- int ret;
-
- flock.l_type = F_UNLCK;
- flock.l_whence = SEEK_SET;
- flock.l_start = 0;
- flock.l_len = 0;
- flock.l_pid = getpid();
-
- do {
- ret = fcntl(fd, F_SETLKW, &flock);
- if (ret < 0) {
- ret = errno;
- ErrPrint("fcntl: %s\n", strerror(errno));
- }
- } while (ret == EINTR);
-
- return ret;
-}
-
-int lb_destroy_lock_file(struct livebox_common *common, int is_pd)
-{
- if (is_pd) {
- if (!common->pd.lock) {
- return LB_STATUS_ERROR_INVALID;
- }
-
- if (close(common->pd.lock_fd) < 0) {
- ErrPrint("close: %s\n", strerror(errno));
- }
- common->pd.lock_fd = -1;
-
- if (unlink(common->pd.lock) < 0) {
- ErrPrint("unlink: %s\n", strerror(errno));
- }
-
- free(common->pd.lock);
- common->pd.lock = NULL;
- } else {
- if (!common->lb.lock) {
- return LB_STATUS_ERROR_INVALID;
- }
-
- if (close(common->lb.lock_fd) < 0) {
- ErrPrint("close: %s\n", strerror(errno));
- }
- common->lb.lock_fd = -1;
-
- if (unlink(common->lb.lock) < 0) {
- ErrPrint("unlink: %s\n", strerror(errno));
- }
-
- free(common->lb.lock);
- common->lb.lock = NULL;
- }
-
- return LB_STATUS_SUCCESS;
-}
-
-int lb_create_lock_file(struct livebox_common *common, int is_pd)
-{
- int len;
- char *file;
-
- len = strlen(common->id);
- file = malloc(len + 20);
- if (!file) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return LB_STATUS_ERROR_MEMORY;
- }
-
- snprintf(file, len + 20, "%s.%s.lck", util_uri_to_path(common->id), is_pd ? "pd" : "lb");
-
- if (is_pd) {
- common->pd.lock_fd = open(file, O_RDONLY);
- if (common->pd.lock_fd < 0) {
- ErrPrint("open: %s\n", strerror(errno));
- free(file);
- return LB_STATUS_ERROR_IO;
- }
-
- common->pd.lock = file;
- } else {
- common->lb.lock_fd = open(file, O_RDONLY);
- if (common->lb.lock_fd < 0) {
- ErrPrint("open: %s\n", strerror(errno));
- free(file);
- return LB_STATUS_ERROR_IO;
- }
-
- common->lb.lock = file;
- }
-
- return LB_STATUS_SUCCESS;
-}
-
-static void update_mode_cb(struct livebox *handler, const struct packet *result, void *data)
+static void update_mode_cb(struct dynamicbox *handler, const struct packet *result, void *data)
{
int ret;
if (!result) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto errout;
} else if (packet_get(result, "i", &ret) != 1) {
ErrPrint("Invalid argument\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto errout;
}
handler->cbs.update_mode.data = NULL;
handler->common->request.update_mode = 0;
- if (ret == (int)LB_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
- lb_invoke_event_handler(handler, LB_EVENT_DELETED);
- lb_unref(handler, 1);
+ if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
}
}
-static void resize_cb(struct livebox *handler, const struct packet *result, void *data)
+static void resize_cb(struct dynamicbox *handler, const struct packet *result, void *data)
{
int ret;
if (!result) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto errout;
} else if (packet_get(result, "i", &ret) != 1) {
ErrPrint("Invalid argument\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto errout;
}
/*!
* \note
* In case of resize request,
- * The livebox handler will not have resized value right after this callback,
+ * The dynamicbox handler will not have resized value right after this callback,
* It can only get the new size when it makes updates.
*
* So the user can only get the resized value(result) from the first update event
handler->cbs.size_changed.data = NULL;
handler->common->request.size_changed = 0;
- if (ret == (int)LB_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
- lb_invoke_event_handler(handler, LB_EVENT_DELETED);
- lb_unref(handler, 1);
+ if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
}
}
-static void text_signal_cb(struct livebox *handler, const struct packet *result, void *data)
+static void text_signal_cb(struct dynamicbox *handler, const struct packet *result, void *data)
{
int ret;
void *cbdata;
struct cb_info *info = data;
- ret_cb_t cb;
+ dynamicbox_ret_cb_t cb;
cbdata = info->data;
cb = info->cb;
- destroy_cb_info(info);
+ dbox_destroy_cb_info(info);
if (!result) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
ErrPrint("Invalid argument\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (cb) {
return;
}
-static void set_group_ret_cb(struct livebox *handler, const struct packet *result, void *data)
+static void set_group_ret_cb(struct dynamicbox *handler, const struct packet *result, void *data)
{
int ret;
if (!result) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto errout;
} else if (packet_get(result, "i", &ret) != 1) {
ErrPrint("Invalid argument\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto errout;
}
handler->cbs.group_changed.data = NULL;
handler->common->request.group_changed = 0;
- if (ret == (int)LB_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
- lb_invoke_event_handler(handler, LB_EVENT_DELETED);
- lb_unref(handler, 1);
+ if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
}
}
-static void period_ret_cb(struct livebox *handler, const struct packet *result, void *data)
+static void period_ret_cb(struct dynamicbox *handler, const struct packet *result, void *data)
{
int ret;
if (!result) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto errout;
} else if (packet_get(result, "i", &ret) != 1) {
ErrPrint("Invalid argument\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto errout;
}
handler->cbs.period_changed.data = NULL;
handler->common->request.period_changed = 0;
- if (ret == (int)LB_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
- lb_invoke_event_handler(handler, LB_EVENT_DELETED);
- lb_unref(handler, 1);
- }
-}
-
-static void del_ret_cb(struct livebox *handler, const struct packet *result, void *data)
-{
- struct cb_info *info = data;
- int ret;
- ret_cb_t cb;
- void *cbdata;
-
- cb = info->cb;
- cbdata = info->data;
- destroy_cb_info(info);
-
- if (!result) {
- ErrPrint("Connection lost?\n");
- ret = LB_STATUS_ERROR_FAULT;
- } else if (packet_get(result, "i", &ret) != 1) {
- ErrPrint("Invalid argument\n");
- ret = LB_STATUS_ERROR_INVALID;
- }
-
- if (ret == 0) {
- handler->cbs.deleted.cb = cb;
- handler->cbs.deleted.data = cbdata;
- } else if (cb) {
- cb(handler, ret, cbdata);
- }
-
- /*!
- * \note
- * Do not call the deleted callback from here.
- * master will send the "deleted" event.
- * Then invoke this callback.
- *
- * if (handler->cbs.deleted.cb)
- * handler->cbs.deleted.cb(handler, ret, handler->cbs.deleted.data);
- */
-}
-
-static void new_ret_cb(struct livebox *handler, const struct packet *result, void *data)
-{
- int ret;
- struct cb_info *info = data;
- ret_cb_t cb;
- void *cbdata;
-
- cb = info->cb;
- cbdata = info->data;
- destroy_cb_info(info);
-
- if (!result) {
- ret = LB_STATUS_ERROR_FAULT;
- } else if (packet_get(result, "i", &ret) != 1) {
- ret = LB_STATUS_ERROR_INVALID;
- }
-
- if (ret >= 0) {
- handler->cbs.created.cb = cb;
- handler->cbs.created.data = cbdata;
-
- /*!
- * \note
- * Don't go anymore ;)
- */
- return;
- } else if (cb) {
- /*!
- * \note
- * It means the current instance is not created,
- * so user has to know about this.
- * notice it to user using "deleted" event.
- */
- cb(handler, ret, cbdata);
+ if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
}
-
- lb_unref(handler, 1);
}
-static void pd_create_cb(struct livebox *handler, const struct packet *result, void *data)
+static void gbar_create_cb(struct dynamicbox *handler, const struct packet *result, void *data)
{
int ret;
if (!result) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto errout;
} else if (packet_get(result, "i", &ret) != 1) {
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto errout;
}
if (ret < 0) {
- ErrPrint("Failed to create a PD[%d]\n", ret);
+ ErrPrint("Failed to create a GBAR[%d]\n", ret);
goto errout;
}
return;
errout:
- handler->cbs.pd_created.cb(handler, ret, handler->cbs.pd_created.data);
- handler->cbs.pd_created.cb = NULL;
- handler->cbs.pd_created.data = NULL;
- handler->common->request.pd_created = 0;
+ handler->cbs.gbar_created.cb(handler, ret, handler->cbs.gbar_created.data);
+ handler->cbs.gbar_created.cb = NULL;
+ handler->cbs.gbar_created.data = NULL;
+ handler->common->request.gbar_created = 0;
- if (ret == (int)LB_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
- lb_invoke_event_handler(handler, LB_EVENT_DELETED);
- lb_unref(handler, 1);
+ if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
}
}
-static void activated_cb(struct livebox *handler, const struct packet *result, void *data)
+static void activated_cb(struct dynamicbox *handler, const struct packet *result, void *data)
{
int ret;
struct cb_info *info = data;
void *cbdata;
- ret_cb_t cb;
+ dynamicbox_ret_cb_t cb;
const char *pkgname = "";
cbdata = info->data;
cb = info->cb;
- destroy_cb_info(info);
+ dbox_destroy_cb_info(info);
if (!result) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
} else if (packet_get(result, "is", &ret, &pkgname) != 2) {
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (cb) {
}
}
-static void pd_destroy_cb(struct livebox *handler, const struct packet *result, void *data)
+static void gbar_destroy_cb(struct dynamicbox *handler, const struct packet *result, void *data)
{
int ret;
- ret_cb_t cb;
+ dynamicbox_ret_cb_t cb;
void *cbdata;
struct cb_info *info = data;
cbdata = info->data;
cb = info->cb;
- destroy_cb_info(info);
+ dbox_destroy_cb_info(info);
if (!result) {
ErrPrint("Result is NIL (may connection lost)\n");
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
ErrPrint("Invalid parameter\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (ret == (int)LB_STATUS_SUCCESS) {
- handler->cbs.pd_destroyed.cb = cb;
- handler->cbs.pd_destroyed.data = cbdata;
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+ handler->cbs.gbar_destroyed.cb = cb;
+ handler->cbs.gbar_destroyed.data = cbdata;
} else {
- handler->common->is_pd_created = 0;
- handler->common->request.pd_destroyed = 0;
+ handler->common->is_gbar_created = 0;
+ handler->common->request.gbar_destroyed = 0;
if (cb) {
cb(handler, ret, cbdata);
}
}
-static void delete_cluster_cb(struct livebox *handler, const struct packet *result, void *data)
+static void delete_cluster_cb(struct dynamicbox *handler, const struct packet *result, void *data)
{
struct cb_info *info = data;
int ret;
- ret_cb_t cb;
+ dynamicbox_ret_cb_t cb;
void *cbdata;
cb = info->cb;
cbdata = info->data;
- destroy_cb_info(info);
+ dbox_destroy_cb_info(info);
if (!result) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (cb) {
}
}
-static void delete_category_cb(struct livebox *handler, const struct packet *result, void *data)
+static void delete_category_cb(struct dynamicbox *handler, const struct packet *result, void *data)
{
struct cb_info *info = data;
int ret;
- ret_cb_t cb;
+ dynamicbox_ret_cb_t cb;
void *cbdata;
cb = info->cb;
cbdata = info->data;
- destroy_cb_info(info);
+ dbox_destroy_cb_info(info);
if (!result) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (cb) {
}
}
-static int lb_acquire_lb_pixmap(struct livebox *handler, ret_cb_t cb, void *data)
+static int dbox_acquire_dbox_pixmap(struct dynamicbox *handler, dynamicbox_ret_cb_t cb, void *data)
{
struct packet *packet;
struct cb_info *cbinfo;
const char *id;
int ret;
- id = fb_id(handler->common->lb.fb);
+ id = fb_id(handler->common->dbox.fb);
if (!id || strncasecmp(id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet = packet_create("lb_acquire_pixmap", "ss", handler->common->pkgname, handler->common->id);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
- cbinfo = create_cb_info(cb, data);
+ cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
packet_destroy(packet);
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
- ret = master_rpc_async_request(handler, packet, 0, lb_pixmap_acquired_cb, cbinfo);
+ ret = master_rpc_async_request(handler, packet, 0, dbox_pixmap_acquired_cb, cbinfo);
if (ret < 0) {
- destroy_cb_info(cbinfo);
+ dbox_destroy_cb_info(cbinfo);
}
return ret;
}
-static void lb_pixmap_acquired_cb(struct livebox *handler, const struct packet *result, void *data)
+static void dbox_pixmap_acquired_cb(struct dynamicbox *handler, const struct packet *result, void *data)
{
int pixmap;
- int ret = LB_STATUS_ERROR_INVALID;
- ret_cb_t cb;
+ int ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ dynamicbox_ret_cb_t cb;
void *cbdata;
struct cb_info *info = data;
cb = info->cb;
cbdata = info->data;
- destroy_cb_info(info);
+ dbox_destroy_cb_info(info);
if (!result) {
pixmap = 0; /* PIXMAP 0 means error */
pixmap = 0;
}
- if (ret == (int)LB_STATUS_ERROR_BUSY) {
- ret = lb_acquire_lb_pixmap(handler, cb, cbdata);
+ if (ret == (int)DBOX_STATUS_ERROR_BUSY) {
+ ret = dbox_acquire_dbox_pixmap(handler, cb, cbdata);
DbgPrint("Busy, Try again: %d\n", ret);
/* Try again */
- } else if (ret == (int)LB_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
+ } else if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
if (cb) {
cb(handler, pixmap, cbdata);
}
- lb_invoke_event_handler(handler, LB_EVENT_DELETED);
- lb_unref(handler, 1);
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
} else {
if (cb) {
cb(handler, pixmap, cbdata);
}
}
-static int lb_acquire_pd_pixmap(struct livebox *handler, ret_cb_t cb, void *data)
+static int dbox_acquire_gbar_pixmap(struct dynamicbox *handler, dynamicbox_ret_cb_t cb, void *data)
{
struct packet *packet;
struct cb_info *cbinfo;
const char *id;
int ret;
- id = fb_id(handler->common->pd.fb);
+ id = fb_id(handler->common->gbar.fb);
if (!id || strncasecmp(id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet = packet_create("pd_acquire_pixmap", "ss", handler->common->pkgname, handler->common->id);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
- cbinfo = create_cb_info(cb, data);
+ cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
packet_destroy(packet);
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
- ret = master_rpc_async_request(handler, packet, 0, pd_pixmap_acquired_cb, cbinfo);
+ ret = master_rpc_async_request(handler, packet, 0, gbar_pixmap_acquired_cb, cbinfo);
if (ret < 0) {
/*!
* \note
* Packet will be destroyed by master_rpc_async_request
*/
- destroy_cb_info(cbinfo);
+ dbox_destroy_cb_info(cbinfo);
}
return ret;
}
-static void pd_pixmap_acquired_cb(struct livebox *handler, const struct packet *result, void *data)
+static void gbar_pixmap_acquired_cb(struct dynamicbox *handler, const struct packet *result, void *data)
{
int pixmap;
int ret;
- ret_cb_t cb;
+ dynamicbox_ret_cb_t cb;
void *cbdata;
struct cb_info *info = data;
cb = info->cb;
cbdata = info->data;
- destroy_cb_info(info);
+ dbox_destroy_cb_info(info);
if (!result) {
pixmap = 0; /* PIXMAP 0 means error */
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
} else if (packet_get(result, "ii", &pixmap, &ret) != 2) {
pixmap = 0;
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (ret == (int)LB_STATUS_ERROR_BUSY) {
- ret = lb_acquire_pd_pixmap(handler, cb, cbdata);
+ if (ret == (int)DBOX_STATUS_ERROR_BUSY) {
+ ret = dbox_acquire_gbar_pixmap(handler, cb, cbdata);
DbgPrint("Busy, Try again: %d\n", ret);
/* Try again */
- } else if (ret == (int)LB_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
+ } else if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
if (cb) {
cb(handler, pixmap, cbdata);
}
- lb_invoke_event_handler(handler, LB_EVENT_DELETED);
- lb_unref(handler, 1);
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
} else {
if (cb) {
DbgPrint("ret: %d, pixmap: %d\n", ret, pixmap);
}
}
-static void pinup_done_cb(struct livebox *handler, const struct packet *result, void *data)
+static void pinup_done_cb(struct dynamicbox *handler, const struct packet *result, void *data)
{
int ret;
if (!result) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto errout;
} else if (packet_get(result, "i", &ret) != 1) {
goto errout;
handler->cbs.pinup.data = NULL;
handler->common->request.pinup = 0;
- if (ret == (int)LB_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
- lb_invoke_event_handler(handler, LB_EVENT_DELETED);
- lb_unref(handler, 1);
+ if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
}
}
-static void key_ret_cb(struct livebox *handler, const struct packet *result, void *data)
+static void key_ret_cb(struct dynamicbox *handler, const struct packet *result, void *data)
{
int ret;
if (!result) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
return;
}
if (packet_get(result, "i", &ret) != 1) {
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
return;
}
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto errout;
}
handler->cbs.key_event.data = NULL;
handler->common->request.key_event = 0;
- if (ret == (int)LB_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
- lb_invoke_event_handler(handler, LB_EVENT_DELETED);
- lb_unref(handler, 1);
+ if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
}
}
-static void access_ret_cb(struct livebox *handler, const struct packet *result, void *data)
+static void access_ret_cb(struct dynamicbox *handler, const struct packet *result, void *data)
{
int ret;
if (!result) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
return;
}
if (packet_get(result, "i", &ret) != 1) {
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
return;
}
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto errout;
}
handler->cbs.access_event.data = NULL;
handler->common->request.access_event = 0;
- if (ret == (int)LB_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
- lb_invoke_event_handler(handler, LB_EVENT_DELETED);
- lb_unref(handler, 1);
+ if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
}
}
-static int send_access_event(struct livebox *handler, const char *event, int x, int y, int type)
+static int send_access_event(struct dynamicbox *handler, const char *event, int x, int y, int type)
{
struct packet *packet;
double timestamp;
packet = packet_create(event, "ssdiii", handler->common->pkgname, handler->common->id, timestamp, x, y, type);
if (!packet) {
ErrPrint("Failed to build packet\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_async_request(handler, packet, 0, access_ret_cb, NULL);
}
-static int send_key_event(struct livebox *handler, const char *event, unsigned int keycode)
+static int send_key_event(struct dynamicbox *handler, const char *event, unsigned int keycode)
{
struct packet *packet;
double timestamp;
packet = packet_create(event, "ssdi", handler->common->pkgname, handler->common->id, timestamp, keycode);
if (!packet) {
ErrPrint("Failed to build packet\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_async_request(handler, packet, 0, key_ret_cb, NULL);
}
-static int send_mouse_event(struct livebox *handler, const char *event, int x, int y)
+static int send_mouse_event(struct dynamicbox *handler, const char *event, int x, int y)
{
struct packet *packet;
double timestamp;
packet = packet_create_noack(event, "ssdii", handler->common->pkgname, handler->common->id, timestamp, x, y);
if (!packet) {
ErrPrint("Failed to build param\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(handler, packet);
}
-static int initialize_livebox(void *disp, int use_thread)
+static int initialize_dynamicbox(void *disp, int use_thread)
{
int ret;
#if defined(FLOG)
__file_log_fp = fdopen(1, "w+t");
}
#endif
- ret = livebox_service_init();
- if (ret != LB_STATUS_SUCCESS) {
+ ret = dynamicbox_service_init();
+ if (ret != DBOX_STATUS_ERROR_NONE) {
return ret;
}
ret = fb_init(disp);
- if (ret != LB_STATUS_SUCCESS) {
- livebox_service_fini();
+ if (ret != DBOX_STATUS_ERROR_NONE) {
+ dynamicbox_service_fini();
return ret;
}
ret = client_init(use_thread);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
fb_fini();
- livebox_service_fini();
+ dynamicbox_service_fini();
return ret;
}
return ret;
}
-static inline char *lb_pkgname(const char *pkgname)
-{
- char *lb;
-
- lb = livebox_service_pkgname(pkgname);
- if (!lb) {
- if (util_validate_livebox_package(pkgname) == 0) {
- return strdup(pkgname);
- }
- }
-
- return lb;
-}
-
-static struct livebox_common *find_sharable_common_handle(const char *pkgname, const char *content, int w, int h, const char *cluster, const char *category)
+static inline char *dbox_pkgname(const char *pkgname)
{
- struct dlist *l;
- struct livebox_common *common;
-
- if (!conf_shared_content()) {
- /*!
- * Shared content option is turnned off.
- */
- return NULL;
- }
-
- dlist_foreach(s_info.livebox_common_list, l, common) {
- if (common->state != CREATE) {
- continue;
- }
-
- if (strcmp(common->pkgname, pkgname)) {
- continue;
- }
-
- if (strcmp(common->cluster, cluster)) {
- DbgPrint("Cluster mismatched\n");
- continue;
- }
-
- if (strcmp(common->category, category)) {
- DbgPrint("Category mismatched\n");
- continue;
- }
-
- if (common->content && content) {
- if (strcmp(common->content, content)) {
- DbgPrint("%s Content ([%s] <> [%s])\n", common->pkgname, common->content, content);
- continue;
- }
- } else {
- int c1_len;
- int c2_len;
-
- /*!
- * \note
- * We assumes "" (ZERO length string) to NULL
- */
- c1_len = common->content ? strlen(common->content) : 0;
- c2_len = content ? strlen(content) : 0;
- if (c1_len != c2_len) {
- DbgPrint("%s Content %p <> %p\n", common->pkgname, common->content, content);
- continue;
- }
- }
-
- if (common->request.size_changed) {
- DbgPrint("Changing size\n");
- /*!
- * \note
- * Do not re-use resizing instance.
- * We will not use predicted size.
- */
- continue;
- }
-
- if (common->request.created) {
- DbgPrint("Creating now but re-use it (%s)\n", common->pkgname);
- }
-
- if (common->lb.width != w || common->lb.height != h) {
- DbgPrint("Size mismatched\n");
- continue;
- }
+ char *dbox;
- DbgPrint("common handle is found: %p\n", common);
- return common;
+ dbox = dynamicbox_service_dbox_id(pkgname);
+ if (!dbox) {
+ dbox = strdup(pkgname);
}
- return NULL;
+ return dbox;
}
static gboolean job_execute_cb(void *data)
if (item) {
item->cb(item->handle, item->ret, item->data);
- lb_unref(item->handle, 1);
+ dbox_unref(item->handle, 1);
free(item);
}
return TRUE;
}
-static int job_add(struct livebox *handle, ret_cb_t job_cb, int ret, void *data)
+static int job_add(struct dynamicbox *handle, dynamicbox_ret_cb_t job_cb, int ret, void *data)
{
struct job_item *item;
if (!job_cb) {
ErrPrint("Invalid argument\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
item = malloc(sizeof(*item));
if (!item) {
ErrPrint("Heap: %s\n", strerror(errno));
- return LB_STATUS_ERROR_MEMORY;
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
}
- item->handle = lb_ref(handle);
+ item->handle = dbox_ref(handle);
item->cb = job_cb;
item->data = data;
item->ret = ret;
}
}
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
-static int create_real_instance(struct livebox *handler, ret_cb_t cb, void *data)
+static void new_ret_cb(struct dynamicbox *handler, const struct packet *result, void *data)
{
- struct cb_info *cbinfo;
- struct packet *packet;
- struct livebox_common *common;
int ret;
+ struct cb_info *info = data;
+ dynamicbox_ret_cb_t cb;
+ void *cbdata;
- common = handler->common;
-
- packet = packet_create("new", "dssssdii",
- common->timestamp, common->pkgname, common->content,
- common->cluster, common->category,
- common->lb.period, common->lb.width, common->lb.height);
- if (!packet) {
- ErrPrint("Failed to create a new packet\n");
- return LB_STATUS_ERROR_FAULT;
- }
-
- cbinfo = create_cb_info(cb, data);
- if (!cbinfo) {
- ErrPrint("Failed to create a cbinfo\n");
- packet_destroy(packet);
- return LB_STATUS_ERROR_MEMORY;
- }
-
- /*!
- * \note
- * master_rpc_async_request will destroy the packet (decrease the refcnt)
- * So be aware the packet object after return from master_rpc_async_request.
- */
- ret = master_rpc_async_request(handler, packet, 0, new_ret_cb, cbinfo);
- if (ret < 0) {
- ErrPrint("Failed to send a new packet\n");
- destroy_cb_info(cbinfo);
- return LB_STATUS_ERROR_FAULT;
- }
- handler->common->request.created = 1;
- return LB_STATUS_SUCCESS;
-}
-
-static void create_cb(struct livebox *handle, int ret, void *data)
-{
- struct cb_info *cbinfo = data;
-
- if (cbinfo->cb) {
- cbinfo->cb(handle, ret, cbinfo->data);
- }
-
- destroy_cb_info(cbinfo);
-
- /*!
- * \note
- * Forcely generate "updated" event
- */
- lb_invoke_event_handler(handle, LB_EVENT_LB_UPDATED);
-}
-
-static int create_fake_instance(struct livebox *handler, ret_cb_t cb, void *data)
-{
- struct cb_info *cbinfo;
-
- cbinfo = create_cb_info(cb, data);
- if (!cbinfo) {
- ErrPrint("Failed to create a cbinfo\n");
- return LB_STATUS_ERROR_MEMORY;
- }
-
- if (job_add(handler, create_cb, LB_STATUS_SUCCESS, cbinfo) != LB_STATUS_SUCCESS) {
- destroy_cb_info(cbinfo);
- }
-
- return LB_STATUS_SUCCESS;
-}
-
-struct livebox_common *lb_create_common_handle(struct livebox *handle, const char *pkgname, const char *cluster, const char *category)
-{
- struct livebox_common *common;
-
- common = calloc(1, sizeof(*common));
- if (!common) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return NULL;
- }
-
- common->pkgname = strdup(pkgname);
- if (!common->pkgname) {
- free(common);
- return NULL;
- }
-
- common->cluster = strdup(cluster);
- if (!common->cluster) {
- ErrPrint("Error: %s\n", strerror(errno));
- free(common->pkgname);
- free(common);
- return NULL;
- }
-
- common->category = strdup(category);
- if (!common->category) {
- ErrPrint("Error: %s\n", strerror(errno));
- free(common->cluster);
- free(common->pkgname);
- free(common);
- return NULL;
- }
-
- /* Data provider will set this */
- common->lb.type = _LB_TYPE_FILE;
- common->pd.type = _PD_TYPE_SCRIPT;
-
- /* Used for handling the mouse event on a box */
- common->lb.mouse_event = 0;
-
- /* Cluster infomration is not determined yet */
- common->nr_of_sizes = 0x01;
-
- common->timestamp = util_timestamp();
- common->is_user = 1;
- common->delete_type = LB_DELETE_PERMANENTLY;
- common->pd.lock = NULL;
- common->pd.lock_fd = -1;
- common->lb.lock = NULL;
- common->lb.lock_fd = -1;
-
- common->state = CREATE;
- common->visible = LB_SHOW;
-
- s_info.livebox_common_list = dlist_append(s_info.livebox_common_list, common);
- return common;
-}
-
-int lb_destroy_common_handle(struct livebox_common *common)
-{
- dlist_remove_data(s_info.livebox_common_list, common);
-
- common->state = DESTROYED;
+ cb = info->cb;
+ cbdata = info->data;
+ dbox_destroy_cb_info(info);
- if (common->filename) {
- (void)util_unlink(common->filename);
- }
-
- free(common->cluster);
- free(common->category);
- free(common->id);
- free(common->pkgname);
- free(common->filename);
- free(common->lb.auto_launch);
- free(common->alt.icon);
- free(common->alt.name);
-
- if (common->lb.fb) {
- fb_destroy(common->lb.fb);
- common->lb.fb = NULL;
- }
-
- if (common->pd.fb) {
- fb_destroy(common->pd.fb);
- common->pd.fb = NULL;
- }
-
- return 0;
-}
-
-int lb_common_ref(struct livebox_common *common, struct livebox *handle)
-{
- common->livebox_list = dlist_append(common->livebox_list, handle);
- common->refcnt++;
-
- return common->refcnt;
-}
-
-int lb_common_unref(struct livebox_common *common, struct livebox *handle)
-{
- int refcnt;
- dlist_remove_data(common->livebox_list, handle);
- refcnt = --common->refcnt;
-
- return refcnt;
-}
-
-static void refresh_for_paused_updating_cb(struct livebox *handle, int ret, void *data)
-{
- if (handle->paused_updating == 0) {
- DbgPrint("Paused updates are cleared\n");
- return;
- }
-
- DbgPrint("Pending updates are found\n");
- lb_invoke_event_handler(handle, LB_EVENT_LB_UPDATED);
-}
-
-static int lb_set_visibility(struct livebox *handler, enum livebox_visible_state state)
-{
- struct packet *packet;
- int need_to_add_job = 0;
- int ret;
-
- if (handler->common->visible != LB_SHOW && state == LB_SHOW) {
- need_to_add_job = !!handler->paused_updating;
- } else if (handler->common->visible == LB_SHOW && state != LB_SHOW) {
- struct dlist *l;
- struct livebox *item;
-
- dlist_foreach(handler->common->livebox_list, l, item) {
- if (item->visible == LB_SHOW) {
- DbgPrint("%s visibility is not changed\n", handler->common->pkgname);
- return LB_STATUS_SUCCESS;
- }
- }
- } else if (handler->common->visible == LB_SHOW && state == LB_SHOW && handler->paused_updating) {
- if (job_add(handler, refresh_for_paused_updating_cb, LB_STATUS_SUCCESS, NULL) < 0) {
- ErrPrint("Unable to add a new job for refreshing box\n");
- }
-
- return LB_STATUS_SUCCESS;
- } else {
- /*!
- * \brief
- * No need to send this to the master
- */
- return LB_STATUS_SUCCESS;
- }
-
- packet = packet_create_noack("change,visibility", "ssi", handler->common->pkgname, handler->common->id, (int)state);
- if (!packet) {
- ErrPrint("Failed to create a packet\n");
- return LB_STATUS_ERROR_FAULT;
- }
-
- ret = master_rpc_request_only(handler, packet);
- if (ret == (int)LB_STATUS_SUCCESS) {
- DbgPrint("[%s] visibility is changed 0x[%x]\n", handler->common->pkgname, state);
- handler->common->visible = state;
-
- if (need_to_add_job) {
- if (job_add(handler, refresh_for_paused_updating_cb, LB_STATUS_SUCCESS, NULL) < 0) {
- ErrPrint("Unable to add a new job for refreshing box\n");
- }
- }
- }
-
- return ret;
-}
-
-static void lb_update_visibility(struct livebox_common *old_common)
-{
- struct dlist *l;
- struct livebox *item;
-
- item = NULL;
- dlist_foreach(old_common->livebox_list, l, item) {
- if (item->visible == LB_SHOW) {
- break;
- }
-
- item = NULL;
- }
-
- if (!item) {
- l = dlist_nth(old_common->livebox_list, 0);
- item = dlist_data(l);
-
- if (item) {
- lb_set_visibility(item, LB_HIDE_WITH_PAUSE);
- } else {
- ErrPrint("Unable to get the valid handle from common handler\n");
- }
- } else {
- lb_set_visibility(item, LB_SHOW);
- }
-}
-
-/*!
- * \note
- * The second parameter should be the "return value",
- * But in this case, we will use it for "type of deleting instance".
- */
-static void job_del_cb(struct livebox *handle, int type, void *data)
-{
- struct cb_info *cbinfo = data;
- ret_cb_t cb;
-
- if (handle->visible == LB_SHOW) {
- lb_update_visibility(handle->common);
- }
-
- cb = cbinfo->cb;
- data = cbinfo->data;
- destroy_cb_info(cbinfo);
-
- if (handle->common->state != CREATE) {
- DbgPrint("[%s] %d\n", handle->common->pkgname, handle->refcnt);
- if (cb) {
- cb(handle, LB_STATUS_SUCCESS, data);
- }
-
- return;
- }
-
- if (handle->common->refcnt == 1) {
- handle->common->delete_type = type;
- handle->common->state = DELETE;
-
- if (!handle->common->id) {
- /*!
- * \note
- * The id is not determined yet.
- * It means a user didn't receive created event yet.
- * Then just stop to delete procedure from here.
- * Because the "created" event handle will release this.
- * By the way, if the user adds any callback for getting return status of this,
- * call it at here.
- */
- if (cb) {
- cb(handle, LB_STATUS_SUCCESS, data);
- }
- }
-
- DbgPrint("Send delete request\n");
- lb_send_delete(handle, type, cb, data);
- } else {
- if (cb) {
- cb(handle, LB_STATUS_SUCCESS, data);
- }
-
- DbgPrint("Before unref: %d\n", handle->common->refcnt);
- lb_unref(handle, 1);
- }
-}
-
-static void resize_job_cb(struct livebox *handler, int ret, void *data)
-{
- struct cb_info *info = data;
-
- if (info->cb) {
- info->cb(handler, ret, info->data);
- }
-
- free(info);
-
- /*!
- * \note
- * Forcely update the box
- */
- lb_invoke_event_handler(handler, LB_EVENT_LB_UPDATED);
-}
-
-static void turn_off_pd_destroyed_flag_cb(struct livebox *handler, int ret, void *data)
-{
- if (handler->common->request.pd_destroyed) {
- ret_cb_t cb;
- void *data;
-
- DbgPrint("pd_destroyed request is canceled\n");
- handler->common->request.pd_destroyed = 0;
- cb = handler->cbs.pd_destroyed.cb;
- data = handler->cbs.pd_destroyed.data;
- handler->cbs.pd_destroyed.cb = NULL;
- handler->cbs.pd_destroyed.data = NULL;
-
- if (cb) {
- cb(handler, ret, data);
- }
- }
-}
-
-static void turn_off_pd_created_flag_cb(struct livebox *handler, int ret, void *data)
-{
- if (handler->common->request.pd_created) {
- ret_cb_t cb;
- void *data;
-
- DbgPrint("pd_created request is canceled\n");
- handler->common->request.pd_created = 0;
- cb = handler->cbs.pd_created.cb;
- data = handler->cbs.pd_created.data;
- handler->cbs.pd_created.cb = NULL;
- handler->cbs.pd_created.data = NULL;
-
- if (cb) {
- cb(handler, ret, data);
- }
- }
-}
-
-int lb_set_group(struct livebox_common *common, const char *cluster, const char *category)
-{
- void *pc = NULL;
- void *ps = NULL;
-
- if (cluster) {
- pc = strdup(cluster);
- if (!pc) {
- ErrPrint("Heap: %s (cluster: %s)\n", strerror(errno), cluster);
- return LB_STATUS_ERROR_MEMORY;
- }
- }
-
- if (category) {
- ps = strdup(category);
- if (!ps) {
- ErrPrint("Heap: %s (category: %s)\n", strerror(errno), category);
- free(pc);
- return LB_STATUS_ERROR_MEMORY;
- }
- }
-
- if (common->cluster) {
- free(common->cluster);
- }
-
- if (common->category) {
- free(common->category);
- }
-
- common->cluster = pc;
- common->category = ps;
-
- return LB_STATUS_SUCCESS;
-}
-
-void lb_set_size(struct livebox_common *common, int w, int h)
-{
- int size_type;
-
- common->lb.width = w;
- common->lb.height = h;
-
- size_type = livebox_service_size_type(w, h);
- if (size_type != LB_SIZE_TYPE_UNKNOWN) {
- common->lb.mouse_event = livebox_service_mouse_event(common->pkgname, size_type);
- }
-}
-
-void lb_set_update_mode(struct livebox_common *common, int active_mode)
-{
- common->is_active_update = active_mode;
-}
-
-void lb_set_pdsize(struct livebox_common *common, int w, int h)
-{
- common->pd.width = w;
- common->pd.height = h;
-}
-
-void lb_set_default_pdsize(struct livebox_common *common, int w, int h)
-{
- common->pd.default_width = w;
- common->pd.default_height = h;
-}
-
-void lb_invoke_fault_handler(enum livebox_fault_type event, const char *pkgname, const char *file, const char *func)
-{
- struct dlist *l;
- struct dlist *n;
- struct fault_info *info;
-
- s_info.fault_state = INFO_STATE_CALLBACK_IN_PROCESSING;
-
- dlist_foreach_safe(s_info.fault_list, l, n, info) {
- if (!info->is_deleted && info->handler(event, pkgname, file, func, info->user_data) == EXIT_FAILURE) {
- info->is_deleted = 1;
- }
-
- if (info->is_deleted) {
- s_info.fault_list = dlist_remove(s_info.fault_list, l);
- free(info);
- }
- }
-
- s_info.fault_state &= ~INFO_STATE_CALLBACK_IN_PROCESSING;
-}
-
-void lb_invoke_event_handler(struct livebox *handler, enum livebox_event_type event)
-{
- struct dlist *l;
- struct dlist *n;
- struct event_info *info;
-
- if (event == LB_EVENT_LB_UPDATED && handler->common->refcnt > 1) {
- if (handler->visible != LB_SHOW) {
- DbgPrint("Update requested(pending) - %s\n", handler->common->pkgname);
- handler->paused_updating++;
- return;
- } else {
- handler->paused_updating = 0;
- }
- }
-
- s_info.event_state = INFO_STATE_CALLBACK_IN_PROCESSING;
-
- dlist_foreach_safe(s_info.event_list, l, n, info) {
- if (!info->is_deleted && info->handler(handler, event, info->user_data) == EXIT_FAILURE) {
- DbgPrint("Event handler returns EXIT_FAILURE\n");
- info->is_deleted = 1;
- }
-
- if (info->is_deleted) {
- s_info.event_list = dlist_remove(s_info.event_list, l);
- free(info);
- }
- }
-
- s_info.event_state &= ~INFO_STATE_CALLBACK_IN_PROCESSING;
-}
-
-struct livebox_common *lb_find_common_handle(const char *pkgname, const char *id)
-{
- struct dlist *l;
- struct livebox_common *common;
-
- dlist_foreach(s_info.livebox_common_list, l, common) {
- if (!common->id) {
- continue;
- }
-
- if (!strcmp(common->pkgname, pkgname) && !strcmp(common->id, id)) {
- return common;
- }
- }
-
- return NULL;
-}
-
-struct livebox_common *lb_find_common_handle_by_timestamp(double timestamp)
-{
- struct dlist *l;
- struct livebox_common *common;
-
- dlist_foreach(s_info.livebox_common_list, l, common) {
- if (common->timestamp == timestamp) {
- return common;
- }
- }
-
- return NULL;
-}
-
-struct livebox *lb_new_livebox(const char *pkgname, const char *id, double timestamp, const char *cluster, const char *category)
-{
- struct livebox *handler;
-
- handler = calloc(1, sizeof(*handler));
- if (!handler) {
- ErrPrint("Failed to create a new livebox\n");
- return NULL;
- }
-
- handler->common = lb_create_common_handle(handler, pkgname, cluster, category);
- if (!handler->common) {
- ErrPrint("Heap: %s\n", strerror(errno));
- free(handler);
- return NULL;
- }
-
- lb_common_ref(handler->common, handler);
- lb_set_id(handler->common, id);
- handler->common->timestamp = timestamp;
- handler->common->state = CREATE;
- handler->visible = LB_SHOW;
- s_info.livebox_list = dlist_append(s_info.livebox_list, handler);
-
- return lb_ref(handler);
-}
-
-int lb_delete_all(void)
-{
- struct dlist *l;
- struct dlist *n;
- struct livebox *handler;
-
- dlist_foreach_safe(s_info.livebox_list, l, n, handler) {
- lb_invoke_event_handler(handler, LB_EVENT_DELETED);
- lb_unref(handler, 1);
- }
-
- return LB_STATUS_SUCCESS;
-}
-
-int lb_set_content(struct livebox_common *common, const char *content)
-{
- char *pc = NULL;
-
- if (content) {
- pc = strdup(content);
- if (!pc) {
- ErrPrint("heap: %s [%s]\n", strerror(errno), content);
- return LB_STATUS_ERROR_MEMORY;
- }
- }
-
- free(common->content);
- common->content = pc;
- return LB_STATUS_SUCCESS;
-}
-
-int lb_set_title(struct livebox_common *common, const char *title)
-{
- char *pt = NULL;
-
- if (title) {
- pt = strdup(title);
- if (!pt) {
- ErrPrint("heap: %s [%s]\n", strerror(errno), title);
- return LB_STATUS_ERROR_MEMORY;
- }
- }
-
- free(common->title);
- common->title = pt;
- return LB_STATUS_SUCCESS;
-}
-
-void lb_set_size_list(struct livebox_common *common, int size_list)
-{
- common->lb.size_list = size_list;
-}
-
-void lb_set_auto_launch(struct livebox_common *common, const char *auto_launch)
-{
- char *pa = NULL;
-
- if (!auto_launch || !strlen(auto_launch)) {
- return;
- }
-
- pa = strdup(auto_launch);
- if (!pa) {
- ErrPrint("heap: %s, [%s]\n", strerror(errno), auto_launch);
- return;
- }
-
- free(common->lb.auto_launch);
- common->lb.auto_launch = pa;
-}
-
-void lb_set_priority(struct livebox_common *common, double priority)
-{
- common->lb.priority = priority;
-}
-
-void lb_set_id(struct livebox_common *common, const char *id)
-{
- char *pi = NULL;
-
- if (id) {
- pi = strdup(id);
- if (!pi) {
- ErrPrint("heap: %s [%s]\n", strerror(errno), pi);
- return;
- }
- }
-
- free(common->id);
- common->id = pi;
-}
-
-void lb_set_filename(struct livebox_common *common, const char *filename)
-{
- if (common->filename) {
- if (common->lb.type == _LB_TYPE_FILE || common->lb.type == _LB_TYPE_TEXT) {
- if (common->filename[0] && unlink(common->filename) < 0) {
- ErrPrint("unlink: %s (%s)\n", strerror(errno), common->filename);
- }
- }
-
- free(common->filename);
- }
-
- common->filename = strdup(filename);
- if (!common->filename) {
- ErrPrint("Heap: %s\n", strerror(errno));
- }
-}
-
-void lb_set_alt_icon(struct livebox_common *common, const char *icon)
-{
- char *_icon = NULL;
-
- if (icon && strlen(icon)) {
- _icon = strdup(icon);
- if (!_icon) {
- ErrPrint("Heap: %s\n", strerror(errno));
- }
- }
-
- free(common->alt.icon);
- common->alt.icon = _icon;
-}
-
-void lb_set_alt_name(struct livebox_common *common, const char *name)
-{
- char *_name = NULL;
-
- if (name && strlen(name)) {
- _name = strdup(name);
- if (!_name) {
- ErrPrint("Heap: %s\n", strerror(errno));
- }
- }
-
- free(common->alt.name);
- common->alt.name = _name;
-}
-
-int lb_set_lb_fb(struct livebox_common *common, const char *filename)
-{
- struct fb_info *fb;
-
- if (!common) {
- return LB_STATUS_ERROR_INVALID;
- }
-
- fb = common->lb.fb;
- if (fb && !strcmp(fb_id(fb), filename)) { /*!< BUFFER is not changed, */
- return LB_STATUS_SUCCESS;
- }
-
- common->lb.fb = NULL;
-
- if (!filename || filename[0] == '\0') {
- if (fb) {
- fb_destroy(fb);
- }
- return LB_STATUS_SUCCESS;
- }
-
- common->lb.fb = fb_create(filename, common->lb.width, common->lb.height);
- if (!common->lb.fb) {
- ErrPrint("Faield to create a FB\n");
- if (fb) {
- fb_destroy(fb);
- }
- return LB_STATUS_ERROR_FAULT;
+ if (!result) {
+ ret = DBOX_STATUS_ERROR_FAULT;
+ } else if (packet_get(result, "i", &ret) != 1) {
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (fb) {
- fb_destroy(fb);
+ if (ret >= 0) {
+ handler->cbs.created.cb = cb;
+ handler->cbs.created.data = cbdata;
+
+ /*!
+ * \note
+ * Don't go anymore ;)
+ */
+ return;
+ } else if (cb) {
+ /*!
+ * \note
+ * It means the current instance is not created,
+ * so user has to know about this.
+ * notice it to user using "deleted" event.
+ */
+ cb(handler, ret, cbdata);
}
- return LB_STATUS_SUCCESS;
+ dbox_unref(handler, 1);
}
-int lb_set_pd_fb(struct livebox_common *common, const char *filename)
+static int create_real_instance(struct dynamicbox *handler, dynamicbox_ret_cb_t cb, void *data)
{
- struct fb_info *fb;
-
- if (!common || common->state != CREATE) {
- return LB_STATUS_ERROR_INVALID;
- }
+ struct cb_info *cbinfo;
+ struct packet *packet;
+ struct dynamicbox_common *common;
+ int ret;
- fb = common->pd.fb;
- if (fb && !strcmp(fb_id(fb), filename)) {
- /* BUFFER is not changed, just update the content */
- return LB_STATUS_ERROR_EXIST;
- }
- common->pd.fb = NULL;
+ common = handler->common;
- if (!filename || filename[0] == '\0') {
- if (fb) {
- fb_destroy(fb);
- }
- return LB_STATUS_SUCCESS;
+ packet = packet_create("new", "dssssdii",
+ common->timestamp, common->pkgname, common->content,
+ common->cluster, common->category,
+ common->dbox.period, common->dbox.width, common->dbox.height);
+ if (!packet) {
+ ErrPrint("Failed to create a new packet\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
- common->pd.fb = fb_create(filename, common->pd.width, common->pd.height);
- if (!common->pd.fb) {
- ErrPrint("Failed to create a FB\n");
- if (fb) {
- fb_destroy(fb);
- }
- return LB_STATUS_ERROR_FAULT;
+ cbinfo = dbox_create_cb_info(cb, data);
+ if (!cbinfo) {
+ ErrPrint("Failed to create a cbinfo\n");
+ packet_destroy(packet);
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
}
- if (fb) {
- fb_destroy(fb);
+ /*!
+ * \note
+ * master_rpc_async_request will destroy the packet (decrease the refcnt)
+ * So be aware the packet object after return from master_rpc_async_request.
+ */
+ ret = master_rpc_async_request(handler, packet, 0, new_ret_cb, cbinfo);
+ if (ret < 0) {
+ ErrPrint("Failed to send a new packet\n");
+ dbox_destroy_cb_info(cbinfo);
+ return DBOX_STATUS_ERROR_FAULT;
}
- return LB_STATUS_SUCCESS;
-}
-
-struct fb_info *lb_get_lb_fb(struct livebox_common *common)
-{
- return common->lb.fb;
+ handler->common->request.created = 1;
+ return DBOX_STATUS_ERROR_NONE;
}
-struct fb_info *lb_get_pd_fb(struct livebox_common *common)
+static void create_cb(struct dynamicbox *handle, int ret, void *data)
{
- return common->pd.fb;
-}
+ struct cb_info *cbinfo = data;
-void lb_set_user(struct livebox_common *common, int user)
-{
- common->is_user = user;
-}
+ if (cbinfo->cb) {
+ cbinfo->cb(handle, ret, cbinfo->data);
+ }
-void lb_set_pinup(struct livebox_common *common, int pinup_supported)
-{
- common->lb.pinup_supported = pinup_supported;
-}
+ dbox_destroy_cb_info(cbinfo);
-void lb_set_text_lb(struct livebox_common *common)
-{
- common->lb.type = _LB_TYPE_TEXT;
+ /*!
+ * \note
+ * Forcely generate "updated" event
+ */
+ dbox_invoke_event_handler(handle, DBOX_EVENT_DBOX_UPDATED);
}
-void lb_set_text_pd(struct livebox_common *common)
+static int create_fake_instance(struct dynamicbox *handler, dynamicbox_ret_cb_t cb, void *data)
{
- common->pd.type = _PD_TYPE_TEXT;
-}
+ struct cb_info *cbinfo;
-int lb_text_lb(struct livebox_common *common)
-{
- return common->lb.type == _LB_TYPE_TEXT;
-}
+ cbinfo = dbox_create_cb_info(cb, data);
+ if (!cbinfo) {
+ ErrPrint("Failed to create a cbinfo\n");
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
-int lb_text_pd(struct livebox_common *common)
-{
- return common->pd.type == _PD_TYPE_TEXT;
-}
+ if (job_add(handler, create_cb, DBOX_STATUS_ERROR_NONE, cbinfo) != DBOX_STATUS_ERROR_NONE) {
+ dbox_destroy_cb_info(cbinfo);
+ }
-void lb_set_period(struct livebox_common *common, double period)
-{
- common->lb.period = period;
+ return DBOX_STATUS_ERROR_NONE;
}
-struct livebox *lb_ref(struct livebox *handler)
+static void refresh_for_paused_updating_cb(struct dynamicbox *handle, int ret, void *data)
{
- if (!handler) {
- return NULL;
+ if (handle->paused_updating == 0) {
+ DbgPrint("Paused updates are cleared\n");
+ return;
}
- handler->refcnt++;
- return handler;
+ DbgPrint("Pending updates are found\n");
+ dbox_invoke_event_handler(handle, DBOX_EVENT_DBOX_UPDATED);
}
-struct livebox *lb_unref(struct livebox *handler, int destroy_common)
+static int dbox_set_visibility(struct dynamicbox *handler, enum dynamicbox_visible_state state)
{
- if (!handler) {
- return NULL;
- }
+ struct packet *packet;
+ int need_to_add_job = 0;
+ int ret;
- handler->refcnt--;
- if (handler->refcnt > 0) {
- return handler;
- }
+ if (handler->common->visible != DBOX_SHOW && state == DBOX_SHOW) {
+ need_to_add_job = !!handler->paused_updating;
+ } else if (handler->common->visible == DBOX_SHOW && state != DBOX_SHOW) {
+ if (!!dbox_find_dbox_in_show(handler->common)) {
+ return DBOX_STATUS_ERROR_NONE;
+ }
+ } else if (handler->common->visible == DBOX_SHOW && state == DBOX_SHOW && handler->paused_updating) {
+ if (job_add(handler, refresh_for_paused_updating_cb, DBOX_STATUS_ERROR_NONE, NULL) < 0) {
+ ErrPrint("Unable to add a new job for refreshing box\n");
+ }
- if (handler->cbs.created.cb) {
- handler->cbs.created.cb(handler, LB_STATUS_ERROR_FAULT, handler->cbs.created.data);
- handler->cbs.created.cb = NULL;
- handler->cbs.created.data = NULL;
+ return DBOX_STATUS_ERROR_NONE;
+ } else {
+ /*!
+ * \brief
+ * No need to send this to the master
+ */
+ return DBOX_STATUS_ERROR_NONE;
}
- if (handler->cbs.deleted.cb) {
- handler->cbs.deleted.cb(handler, LB_STATUS_ERROR_FAULT, handler->cbs.deleted.data);
- handler->cbs.deleted.cb = NULL;
- handler->cbs.deleted.data = NULL;
+ packet = packet_create_noack("change,visibility", "ssi", handler->common->pkgname, handler->common->id, (int)state);
+ if (!packet) {
+ ErrPrint("Failed to create a packet\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
- if (handler->cbs.pinup.cb) {
- handler->cbs.pinup.cb(handler, LB_STATUS_ERROR_FAULT, handler->cbs.pinup.data);
- handler->cbs.pinup.cb = NULL;
- handler->cbs.pinup.data = NULL;
- }
+ ret = master_rpc_request_only(handler, packet);
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+ DbgPrint("[%s] visibility is changed 0x[%x]\n", handler->common->pkgname, state);
+ handler->common->visible = state;
- if (handler->cbs.group_changed.cb) {
- handler->cbs.group_changed.cb(handler, LB_STATUS_ERROR_FAULT, handler->cbs.group_changed.data);
- handler->cbs.group_changed.cb = NULL;
- handler->cbs.group_changed.data = NULL;
+ if (need_to_add_job) {
+ if (job_add(handler, refresh_for_paused_updating_cb, DBOX_STATUS_ERROR_NONE, NULL) < 0) {
+ ErrPrint("Unable to add a new job for refreshing box\n");
+ }
+ }
}
- if (handler->cbs.period_changed.cb) {
- handler->cbs.period_changed.cb(handler, LB_STATUS_ERROR_FAULT, handler->cbs.period_changed.data);
- handler->cbs.period_changed.cb = NULL;
- handler->cbs.period_changed.data = NULL;
- }
+ return ret;
+}
- if (handler->cbs.size_changed.cb) {
- handler->cbs.size_changed.cb(handler, LB_STATUS_ERROR_FAULT, handler->cbs.size_changed.data);
- handler->cbs.size_changed.cb = NULL;
- handler->cbs.size_changed.data = NULL;
- }
+static void dbox_update_visibility(struct dynamicbox_common *old_common)
+{
+ struct dynamicbox *item;
- if (handler->cbs.pd_created.cb) {
- handler->cbs.pd_created.cb(handler, LB_STATUS_ERROR_FAULT, handler->cbs.pd_created.data);
- handler->cbs.pd_created.cb = NULL;
- handler->cbs.pd_created.data = NULL;
+ item = dbox_find_dbox_in_show(old_common);
+ if (!item) {
+ item = dbox_get_dbox_nth(old_common, 0);
+ if (item) {
+ dbox_set_visibility(item, DBOX_HIDE_WITH_PAUSE);
+ } else {
+ ErrPrint("Unable to get the valid handle from common handler\n");
+ }
+ } else {
+ dbox_set_visibility(item, DBOX_SHOW);
}
+}
- if (handler->cbs.pd_destroyed.cb) {
- handler->cbs.pd_destroyed.cb(handler, LB_STATUS_ERROR_FAULT, handler->cbs.pd_destroyed.data);
- handler->cbs.pd_destroyed.cb = NULL;
- handler->cbs.pd_destroyed.data = NULL;
- }
+/*!
+ * \note
+ * The second parameter should be the "return value",
+ * But in this case, we will use it for "type of deleting instance".
+ */
+static void job_del_cb(struct dynamicbox *handle, int type, void *data)
+{
+ struct cb_info *cbinfo = data;
+ dynamicbox_ret_cb_t cb;
- if (handler->cbs.update_mode.cb) {
- handler->cbs.update_mode.cb(handler, LB_STATUS_ERROR_FAULT, handler->cbs.update_mode.data);
- handler->cbs.update_mode.cb = NULL;
- handler->cbs.update_mode.data = NULL;
+ if (handle->visible == DBOX_SHOW) {
+ dbox_update_visibility(handle->common);
}
- if (handler->cbs.access_event.cb) {
- handler->cbs.access_event.cb(handler, LB_ACCESS_STATUS_ERROR, handler->cbs.access_event.data);
- handler->cbs.access_event.cb = NULL;
- handler->cbs.access_event.data = NULL;
- }
+ cb = cbinfo->cb;
+ data = cbinfo->data;
+ dbox_destroy_cb_info(cbinfo);
+
+ if (handle->common->state != CREATE) {
+ DbgPrint("[%s] %d\n", handle->common->pkgname, handle->refcnt);
+ if (cb) {
+ cb(handle, DBOX_STATUS_ERROR_NONE, data);
+ }
- if (handler->cbs.key_event.cb) {
- handler->cbs.key_event.cb(handler, LB_KEY_STATUS_ERROR, handler->cbs.key_event.data);
- handler->cbs.key_event.cb = NULL;
- handler->cbs.key_event.data = NULL;
+ return;
}
- dlist_remove_data(s_info.livebox_list, handler);
+ if (handle->common->refcnt == 1) {
+ handle->common->delete_type = type;
+ handle->common->state = DELETE;
- handler->state = DESTROYED;
- if (lb_common_unref(handler->common, handler) == 0) {
- if (destroy_common) {
+ if (!handle->common->id) {
/*!
* \note
- * Lock file should be deleted after all callbacks are processed.
+ * The id is not determined yet.
+ * It means a user didn't receive created event yet.
+ * Then just stop to delete procedure from here.
+ * Because the "created" event handle will release this.
+ * By the way, if the user adds any callback for getting return status of this,
+ * call it at here.
*/
- lb_destroy_lock_file(handler->common, 0);
- lb_destroy_common_handle(handler->common);
+ if (cb) {
+ cb(handle, DBOX_STATUS_ERROR_NONE, data);
+ }
}
- }
- free(handler);
- DbgPrint("Handler is released\n");
- return NULL;
-}
-
-int lb_send_delete(struct livebox *handler, int type, ret_cb_t cb, void *data)
-{
- struct packet *packet;
- struct cb_info *cbinfo;
- int ret;
- if (handler->common->request.deleted) {
- ErrPrint("Already in-progress\n");
+ DbgPrint("Send delete request\n");
+ dbox_send_delete(handle, type, cb, data);
+ } else {
if (cb) {
- cb(handler, LB_STATUS_SUCCESS, data);
+ cb(handle, DBOX_STATUS_ERROR_NONE, data);
}
- return LB_STATUS_ERROR_BUSY;
- }
- if (!cb) {
- cb = default_delete_cb;
+ DbgPrint("Before unref: %d\n", handle->common->refcnt);
+ dbox_unref(handle, 1);
}
+}
- packet = packet_create("delete", "ssid", handler->common->pkgname, handler->common->id, type, handler->common->timestamp);
- if (!packet) {
- ErrPrint("Failed to build a param\n");
- if (cb) {
- cb(handler, LB_STATUS_ERROR_FAULT, data);
- }
+static void resize_job_cb(struct dynamicbox *handler, int ret, void *data)
+{
+ struct cb_info *info = data;
- return LB_STATUS_ERROR_FAULT;
+ if (info->cb) {
+ info->cb(handler, ret, info->data);
}
- cbinfo = create_cb_info(cb, data);
- if (!cbinfo) {
- packet_destroy(packet);
- ErrPrint("Failed to create cbinfo\n");
- if (cb) {
- cb(handler, LB_STATUS_ERROR_FAULT, data);
- }
+ free(info);
- return LB_STATUS_ERROR_FAULT;
- }
+ /*!
+ * \note
+ * Forcely update the box
+ */
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DBOX_UPDATED);
+}
- ret = master_rpc_async_request(handler, packet, 0, del_ret_cb, cbinfo);
- if (ret < 0) {
- /*!
- * Packet is destroyed by master_rpc_async_request.
- */
- destroy_cb_info(cbinfo);
+static void turn_off_gbar_destroyed_flag_cb(struct dynamicbox *handler, int ret, void *data)
+{
+ if (handler->common->request.gbar_destroyed) {
+ dynamicbox_ret_cb_t cb;
+ void *data;
+
+ DbgPrint("gbar_destroyed request is canceled\n");
+ handler->common->request.gbar_destroyed = 0;
+ cb = handler->cbs.gbar_destroyed.cb;
+ data = handler->cbs.gbar_destroyed.data;
+ handler->cbs.gbar_destroyed.cb = NULL;
+ handler->cbs.gbar_destroyed.data = NULL;
if (cb) {
- cb(handler, LB_STATUS_ERROR_FAULT, data);
+ cb(handler, ret, data);
}
- } else {
- handler->common->request.deleted = 1;
}
-
- return ret;
}
-int lb_sync_lb_fb(struct livebox_common *common)
+static void turn_off_gbar_created_flag_cb(struct dynamicbox *handler, int ret, void *data)
{
- int ret;
-
- if (fb_type(lb_get_lb_fb(common)) == BUFFER_TYPE_FILE && common->lb.lock_fd >= 0) {
- (void)do_fb_lock(common->lb.lock_fd);
- ret = fb_sync(lb_get_lb_fb(common));
- (void)do_fb_unlock(common->lb.lock_fd);
- } else {
- ret = fb_sync(lb_get_lb_fb(common));
- }
-
- return ret;
-}
+ if (handler->common->request.gbar_created) {
+ dynamicbox_ret_cb_t cb;
+ void *data;
-int lb_sync_pd_fb(struct livebox_common *common)
-{
- int ret;
+ DbgPrint("gbar_created request is canceled\n");
+ handler->common->request.gbar_created = 0;
+ cb = handler->cbs.gbar_created.cb;
+ data = handler->cbs.gbar_created.data;
+ handler->cbs.gbar_created.cb = NULL;
+ handler->cbs.gbar_created.data = NULL;
- if (fb_type(lb_get_pd_fb(common)) == BUFFER_TYPE_FILE && common->pd.lock_fd >= 0) {
- (void)do_fb_lock(common->pd.lock_fd);
- ret = fb_sync(lb_get_pd_fb(common));
- (void)do_fb_unlock(common->pd.lock_fd);
- } else {
- ret = fb_sync(lb_get_pd_fb(common));
+ if (cb) {
+ cb(handler, ret, data);
+ }
}
-
- return ret;
}
EAPI int dynamicbox_init(void *disp, int prevent_overwrite, double event_filter, int use_thread)
{
if (s_info.init_count > 0) {
s_info.init_count++;
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
/*!
s_info.prevent_overwrite = prevent_overwrite;
conf_set_event_filter(event_filter);
- return initialize_livebox(disp, use_thread);
+ return initialize_dynamicbox(disp, use_thread);
}
EAPI int dynamicbox_fini(void)
{
if (s_info.init_count <= 0) {
ErrPrint("Doesn't initialized\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
s_info.init_count--;
if (s_info.init_count > 0) {
ErrPrint("init count : %d\n", s_info.init_count);
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
client_fini();
fb_fini();
- livebox_service_fini();
- return LB_STATUS_SUCCESS;
+ dynamicbox_service_fini();
+ return DBOX_STATUS_ERROR_NONE;
}
EAPI struct dynamicbox *dynamicbox_add(const char *pkgname, const char *content, const char *cluster, const char *category, double period, int type, dynamicbox_ret_cb_t cb, void *data)
{
- char *lbid;
- struct livebox *handler;
+ char *dboxid;
+ struct dynamicbox *handler;
int w = 0;
int h = 0;
return NULL;
}
- lbid = lb_pkgname(pkgname);
- if (!lbid) {
+ dboxid = dbox_pkgname(pkgname);
+ if (!dboxid) {
ErrPrint("Invalid package: %s\n", pkgname);
return NULL;
}
- if (livebox_service_is_enabled(lbid) == 0) {
- DbgPrint("Livebox [%s](%s) is disabled package\n", lbid, pkgname);
- free(lbid);
+ if (dynamicbox_service_is_enabled(dboxid) == 0) {
+ DbgPrint("Livebox [%s](%s) is disabled package\n", dboxid, pkgname);
+ free(dboxid);
return NULL;
}
- if (type != LB_SIZE_TYPE_UNKNOWN) {
- (void)livebox_service_get_size(type, &w, &h);
+ if (type != DBOX_SIZE_TYPE_UNKNOWN) {
+ (void)dynamicbox_service_get_size(type, &w, &h);
}
handler = calloc(1, sizeof(*handler));
if (!handler) {
ErrPrint("Error: %s\n", strerror(errno));
- free(lbid);
+ free(dboxid);
return NULL;
}
cb = default_create_cb;
}
- handler->common = find_sharable_common_handle(lbid, content, w, h, cluster, category);
+ handler->common = dbox_find_sharable_common_handle(dboxid, content, w, h, cluster, category);
if (!handler->common) {
- handler->common = lb_create_common_handle(handler, lbid, cluster, category);
- free(lbid);
+ handler->common = dbox_create_common_handle(handler, dboxid, cluster, category);
+ free(dboxid);
if (!handler->common) {
ErrPrint("Failed to find common handle\n");
free(handler);
* \note
* I know the content should not be modified. use it temporarly without "const"
*/
- pc = livebox_service_content(handler->common->pkgname);
- lb_set_content(handler->common, pc);
+ pc = dynamicbox_service_content(handler->common->pkgname);
+ dbox_set_content(handler->common, pc);
free(pc);
} else {
- lb_set_content(handler->common, content);
+ dbox_set_content(handler->common, content);
}
- lb_set_period(handler->common, period);
- lb_set_size(handler->common, w, h);
- lb_common_ref(handler->common, handler);
+ dbox_set_period(handler->common, period);
+ dbox_set_size(handler->common, w, h);
+ dbox_common_ref(handler->common, handler);
if (create_real_instance(handler, cb, data) < 0) {
- if (lb_common_unref(handler->common, handler) == 0) {
+ if (dbox_common_unref(handler->common, handler) == 0) {
/*!
* Delete common
*/
- lb_destroy_common_handle(handler->common);
+ dbox_destroy_common_handle(handler->common);
handler->common = NULL;
}
free(handler);
return NULL;
}
} else {
- free(lbid);
+ free(dboxid);
- lb_common_ref(handler->common, handler);
+ dbox_common_ref(handler->common, handler);
if (handler->common->request.created) {
/*!
* or fire the fake created_event
*/
if (create_fake_instance(handler, cb, data) < 0) {
- if (lb_common_unref(handler->common, handler) == 0) {
+ if (dbox_common_unref(handler->common, handler) == 0) {
/*!
* Delete common
*/
- lb_destroy_common_handle(handler->common);
+ dbox_destroy_common_handle(handler->common);
}
free(handler);
return NULL;
}
}
- handler->visible = LB_SHOW;
+ handler->visible = DBOX_SHOW;
handler->state = CREATE;
- handler = lb_ref(handler);
+ handler = dbox_ref(handler);
- if (handler->common->visible != LB_SHOW) {
- lb_set_visibility(handler, LB_SHOW);
+ if (handler->common->visible != DBOX_SHOW) {
+ dbox_set_visibility(handler, DBOX_SHOW);
}
return handler;
return 0.0f;
}
- return handler->common->lb.period;
+ return handler->common->dbox.period;
}
EAPI int dynamicbox_set_period(struct dynamicbox *handler, double period, dynamicbox_ret_cb_t cb, void *data)
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Invalid handle\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (handler->common->request.period_changed) {
ErrPrint("Previous request for changing period is not finished\n");
- return LB_STATUS_ERROR_BUSY;
+ return DBOX_STATUS_ERROR_BUSY;
}
if (!handler->common->is_user) {
ErrPrint("CA Livebox is not able to change the period\n");
- return LB_STATUS_ERROR_PERMISSION;
+ return DBOX_STATUS_ERROR_PERMISSION_DENIED;
}
- if (handler->common->lb.period == period) {
+ if (handler->common->dbox.period == period) {
DbgPrint("No changes\n");
- return LB_STATUS_ERROR_ALREADY;
+ return DBOX_STATUS_ERROR_ALREADY;
}
packet = packet_create("set_period", "ssd", handler->common->pkgname, handler->common->id, period);
if (!packet) {
ErrPrint("Failed to build a packet %s\n", handler->common->pkgname);
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
if (!cb) {
}
ret = master_rpc_async_request(handler, packet, 0, period_ret_cb, NULL);
- if (ret == (int)LB_STATUS_SUCCESS) {
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
handler->cbs.period_changed.cb = cb;
handler->cbs.period_changed.data = data;
handler->common->request.period_changed = 1;
if (!handler) {
ErrPrint("Handler is NIL\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (handler->state != CREATE) {
ErrPrint("Handler is already deleted\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
handler->state = DELETE;
- cbinfo = create_cb_info(cb, data);
+ cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
ErrPrint("Failed to create a cbinfo\n");
- return LB_STATUS_ERROR_MEMORY;
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
}
- if (job_add(handler, job_del_cb, type, cbinfo) != LB_STATUS_SUCCESS) {
+ if (job_add(handler, job_del_cb, type, cbinfo) != DBOX_STATUS_ERROR_NONE) {
ErrPrint("Failed to add a new job\n");
- destroy_cb_info(cbinfo);
- return LB_STATUS_ERROR_FAULT;
+ dbox_destroy_cb_info(cbinfo);
+ return DBOX_STATUS_ERROR_FAULT;
}
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
EAPI int dynamicbox_set_fault_handler(int (*dbox_cb)(enum dynamicbox_fault_type, const char *, const char *, const char *, void *), void *data)
{
- struct fault_info *info;
-
- if (!cb) {
- return LB_STATUS_ERROR_INVALID;
- }
-
- info = malloc(sizeof(*info));
- if (!info) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return LB_STATUS_ERROR_MEMORY;
+ if (!dbox_cb) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- info->handler = cb;
- info->user_data = data;
- info->is_deleted = 0;
-
- s_info.fault_list = dlist_append(s_info.fault_list, info);
- return LB_STATUS_SUCCESS;
+ return dbox_add_fault_handler(dbox_cb, data);
}
EAPI void *dynamicbox_unset_fault_handler(int (*dbox_cb)(enum dynamicbox_fault_type, const char *, const char *, const char *, void *))
{
- struct fault_info *info;
- struct dlist *l;
-
- dlist_foreach(s_info.fault_list, l, info) {
- if (info->handler == cb) {
- void *data;
-
- data = info->user_data;
-
- if (s_info.fault_state == INFO_STATE_CALLBACK_IN_PROCESSING) {
- info->is_deleted = 1;
- } else {
- s_info.fault_list = dlist_remove(s_info.fault_list, l);
- free(info);
- }
-
- return data;
- }
+ if (!dbox_cb) {
+ return NULL;
}
- return NULL;
+ return dbox_remove_fault_handler(dbox_cb);
}
EAPI int dynamicbox_set_event_handler(int (*dbox_cb)(struct dynamicbox *, enum dynamicbox_event_type, void *), void *data)
{
- struct event_info *info;
-
- if (!cb) {
- ErrPrint("Invalid argument cb is nil\n");
- return LB_STATUS_ERROR_INVALID;
- }
-
- info = malloc(sizeof(*info));
- if (!info) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return LB_STATUS_ERROR_MEMORY;
+ if (!dbox_cb) {
+ ErrPrint("Invalid argument dbox_cb is nil\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- info->handler = cb;
- info->user_data = data;
- info->is_deleted = 0;
-
- s_info.event_list = dlist_append(s_info.event_list, info);
- return LB_STATUS_SUCCESS;
+ return dbox_add_event_handler(dbox_cb, data);
}
EAPI void *dynamicbox_unset_event_handler(int (*dbox_cb)(struct dynamicbox *, enum dynamicbox_event_type, void *))
{
- struct event_info *info;
- struct dlist *l;
-
- dlist_foreach(s_info.event_list, l, info) {
- if (info->handler == cb) {
- void *data;
-
- data = info->user_data;
-
- if (s_info.event_state == INFO_STATE_CALLBACK_IN_PROCESSING) {
- info->is_deleted = 1;
- } else {
- s_info.event_list = dlist_remove(s_info.event_list, l);
- free(info);
- }
-
- return data;
- }
+ if (!dbox_cb) {
+ return NULL;
}
- return NULL;
+ return dbox_remove_event_handler(dbox_cb);
}
EAPI int dynamicbox_set_update_mode(struct dynamicbox *handler, int active_update, dynamicbox_ret_cb_t cb, void *data)
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is Invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is Invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Handler is Invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (handler->common->request.update_mode) {
ErrPrint("Previous update_mode cb is not finished yet\n");
- return LB_STATUS_ERROR_BUSY;
+ return DBOX_STATUS_ERROR_BUSY;
}
if (handler->common->is_active_update == active_update) {
- return LB_STATUS_ERROR_ALREADY;
+ return DBOX_STATUS_ERROR_ALREADY;
}
if (!handler->common->is_user) {
- return LB_STATUS_ERROR_PERMISSION;
+ return DBOX_STATUS_ERROR_PERMISSION_DENIED;
}
packet = packet_create("update_mode", "ssi", handler->common->pkgname, handler->common->id, active_update);
if (!packet) {
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
if (!cb) {
}
ret = master_rpc_async_request(handler, packet, 0, update_mode_cb, NULL);
- if (ret == (int)LB_STATUS_SUCCESS) {
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
handler->cbs.update_mode.cb = cb;
handler->cbs.update_mode.data = data;
handler->common->request.update_mode = 1;
{
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is Invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is Invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return handler->common->is_active_update;
EAPI int dynamicbox_resize(struct dynamicbox *handler, int type, dynamicbox_ret_cb_t cb, void *data)
{
- struct livebox_common *common;
+ struct dynamicbox_common *common;
int w;
int h;
int ret;
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Invalid handle\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
/*!
*/
if (handler->cbs.size_changed.cb) {
ErrPrint("Previous resize request is not finished yet\n");
- return LB_STATUS_ERROR_BUSY;
+ return DBOX_STATUS_ERROR_BUSY;
}
- if (livebox_service_get_size(type, &w, &h) != 0) {
+ if (dynamicbox_service_get_size(type, &w, &h) != 0) {
ErrPrint("Invalid size type\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (handler->common->lb.width == w && handler->common->lb.height == h) {
+ if (handler->common->dbox.width == w && handler->common->dbox.height == h) {
DbgPrint("No changes\n");
- return LB_STATUS_ERROR_ALREADY;
+ return DBOX_STATUS_ERROR_ALREADY;
}
if (!handler->common->is_user) {
ErrPrint("CA Livebox is not able to be resized\n");
- return LB_STATUS_ERROR_PERMISSION;
+ return DBOX_STATUS_ERROR_PERMISSION_DENIED;
}
if (handler->common->refcnt <= 1) {
packet = packet_create("resize", "ssii", handler->common->pkgname, handler->common->id, w, h);
if (!packet) {
ErrPrint("Failed to build param\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
if (!cb) {
- cb = default_lb_size_changed_cb;
+ cb = default_dbox_size_changed_cb;
}
ret = master_rpc_async_request(handler, packet, 0, resize_cb, NULL);
- if (ret == (int)LB_STATUS_SUCCESS) {
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
handler->cbs.size_changed.cb = cb;
handler->cbs.size_changed.data = data;
handler->common->request.size_changed = 1;
}
} else {
- common = find_sharable_common_handle(handler->common->pkgname, handler->common->content, w, h, handler->common->cluster, handler->common->category);
+ common = dbox_find_sharable_common_handle(handler->common->pkgname, handler->common->content, w, h, handler->common->cluster, handler->common->category);
if (!common) {
- struct livebox_common *old_common;
+ struct dynamicbox_common *old_common;
/*!
* \note
* If the common handler is in resizing,
old_common = handler->common;
- common = lb_create_common_handle(handler, old_common->pkgname, old_common->cluster, old_common->category);
+ common = dbox_create_common_handle(handler, old_common->pkgname, old_common->cluster, old_common->category);
if (!common) {
ErrPrint("Failed to create common handle\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
- lb_set_size(common, w, h);
- lb_set_content(common, old_common->content);
- lb_set_period(common, old_common->lb.period);
+ dbox_set_size(common, w, h);
+ dbox_set_content(common, old_common->content);
+ dbox_set_period(common, old_common->dbox.period);
/*!
* \note
* Disconnecting from old one.
*/
- if (lb_common_unref(old_common, handler) == 0) {
+ if (dbox_common_unref(old_common, handler) == 0) {
/*!
* \note
* Impossible
ErrPrint("Common has no associated handler\n");
}
- lb_common_ref(common, handler);
+ dbox_common_ref(common, handler);
/*!
* Connect to a new one
*/
ret = create_real_instance(handler, cb, data);
if (ret < 0) {
- lb_common_unref(common, handler);
- lb_destroy_common_handle(common);
+ dbox_common_unref(common, handler);
+ dbox_destroy_common_handle(common);
- lb_common_ref(old_common, handler);
+ dbox_common_ref(old_common, handler);
handler->common = old_common;
} else {
/*!
- * In this case, we should update visibility of old_common's liveboxes
+ * In this case, we should update visibility of old_common's dynamicboxes
*/
- if (handler->visible == LB_SHOW) {
- lb_update_visibility(old_common);
+ if (handler->visible == DBOX_SHOW) {
+ dbox_update_visibility(old_common);
}
}
} else {
struct cb_info *cbinfo;
- cbinfo = create_cb_info(cb, data);
+ cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
ErrPrint("Failed to create a cbinfo\n");
- ret = LB_STATUS_ERROR_MEMORY;
+ ret = DBOX_STATUS_ERROR_OUT_OF_MEMORY;
} else {
- ret = job_add(handler, resize_job_cb, LB_STATUS_SUCCESS, cbinfo);
- if (ret == (int)LB_STATUS_SUCCESS) {
- struct livebox_common *old_common;
+ ret = job_add(handler, resize_job_cb, DBOX_STATUS_ERROR_NONE, cbinfo);
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+ struct dynamicbox_common *old_common;
old_common = handler->common;
- if (lb_common_unref(handler->common, handler) == 0) {
+ if (dbox_common_unref(handler->common, handler) == 0) {
ErrPrint("Old common has no associated handler\n");
}
- lb_common_ref(common, handler);
+ dbox_common_ref(common, handler);
handler->common = common;
- if (handler->visible == LB_SHOW) {
- lb_update_visibility(old_common); /* To update visibility: Show --> Paused */
- lb_update_visibility(common); /* To update visibility: Paused --> Show */
+ if (handler->visible == DBOX_SHOW) {
+ dbox_update_visibility(old_common); /* To update visibility: Show --> Paused */
+ dbox_update_visibility(common); /* To update visibility: Paused --> Show */
}
} else {
- destroy_cb_info(cbinfo);
+ dbox_destroy_cb_info(cbinfo);
}
}
}
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (handler->common->lb.auto_launch) {
+ if (handler->common->dbox.auto_launch) {
if (s_info.launch.handler) {
- ret = s_info.launch.handler(handler, handler->common->lb.auto_launch, s_info.launch.data);
+ ret = s_info.launch.handler(handler, handler->common->dbox.auto_launch, s_info.launch.data);
if (ret < 0) {
- ErrPrint("launch handler app %s (%d)\n", handler->common->lb.auto_launch, ret);
+ ErrPrint("launch handler app %s (%d)\n", handler->common->dbox.auto_launch, ret);
}
}
}
packet = packet_create_noack("clicked", "sssddd", handler->common->pkgname, handler->common->id, "clicked", timestamp, x, y);
if (!packet) {
ErrPrint("Failed to build param\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
ret = master_rpc_request_only(handler, packet);
- if (!handler->common->lb.mouse_event && (handler->common->lb.type == _LB_TYPE_BUFFER || handler->common->lb.type == _LB_TYPE_SCRIPT)) {
+ if (!handler->common->dbox.mouse_event && (handler->common->dbox.type == _DBOX_TYPE_BUFFER || handler->common->dbox.type == _DBOX_TYPE_SCRIPT)) {
int ret; /* Shadow variable */
- ret = send_mouse_event(handler, "lb_mouse_down", x * handler->common->lb.width, y * handler->common->lb.height);
+ ret = send_mouse_event(handler, "lb_mouse_down", x * handler->common->dbox.width, y * handler->common->dbox.height);
if (ret < 0) {
ErrPrint("Failed to send Down: %d\n", ret);
}
- ret = send_mouse_event(handler, "lb_mouse_move", x * handler->common->lb.width, y * handler->common->lb.height);
+ ret = send_mouse_event(handler, "lb_mouse_move", x * handler->common->dbox.width, y * handler->common->dbox.height);
if (ret < 0) {
ErrPrint("Failed to send Move: %d\n", ret);
}
- ret = send_mouse_event(handler, "lb_mouse_up", x * handler->common->lb.width, y * handler->common->lb.height);
+ ret = send_mouse_event(handler, "lb_mouse_up", x * handler->common->dbox.width, y * handler->common->dbox.height);
if (ret < 0) {
ErrPrint("Failed to send Up: %d\n", ret);
}
return ret;
}
-EAPI int dynamicbox_has_pd(struct dynamicbox *handler)
+EAPI int dynamicbox_has_gbar(struct dynamicbox *handler)
{
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- return !!handler->common->pd.fb;
+ return !!handler->common->gbar.fb;
}
EAPI int dynamicbox_glance_bar_is_created(struct dynamicbox *handler)
{
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (!handler->common->pd.fb || !handler->common->id) {
+ if (!handler->common->gbar.fb || !handler->common->id) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- return handler->common->is_pd_created;
+ return handler->common->is_gbar_created;
}
EAPI int dynamicbox_create_glance_bar(struct dynamicbox *handler, double x, double y, dynamicbox_ret_cb_t cb, void *data)
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (!handler->common->pd.fb || !handler->common->id) {
+ if (!handler->common->gbar.fb || !handler->common->id) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
/*!
* \note
- * Only one handler can have a PD
+ * Only one handler can have a GBAR
*/
- if (handler->common->is_pd_created) {
- DbgPrint("PD is already created\n");
- return LB_STATUS_SUCCESS;
+ if (handler->common->is_gbar_created) {
+ DbgPrint("GBAR is already created\n");
+ return DBOX_STATUS_ERROR_NONE;
}
- if (handler->common->request.pd_created) {
+ if (handler->common->request.gbar_created) {
ErrPrint("Previous request is not completed yet\n");
- return LB_STATUS_ERROR_BUSY;
+ return DBOX_STATUS_ERROR_BUSY;
}
/*!
* \note
- * Turn off the pd_destroyed request flag
+ * Turn off the gbar_destroyed request flag
*/
- if (handler->common->request.pd_destroyed) {
- if (job_add(handler, turn_off_pd_destroyed_flag_cb, LB_STATUS_ERROR_CANCEL, NULL) < 0) {
- ErrPrint("Failed to add pd_destroyed job\n");
+ if (handler->common->request.gbar_destroyed) {
+ if (job_add(handler, turn_off_gbar_destroyed_flag_cb, DBOX_STATUS_ERROR_CANCEL, NULL) < 0) {
+ ErrPrint("Failed to add gbar_destroyed job\n");
}
}
packet = packet_create("create_pd", "ssdd", handler->common->pkgname, handler->common->id, x, y);
if (!packet) {
ErrPrint("Failed to build param\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
if (!cb) {
- cb = default_pd_created_cb;
+ cb = default_gbar_created_cb;
}
DbgPrint("PERF_DBOX\n");
- ret = master_rpc_async_request(handler, packet, 0, pd_create_cb, NULL);
- if (ret == (int)LB_STATUS_SUCCESS) {
- handler->cbs.pd_created.cb = cb;
- handler->cbs.pd_created.data = data;
- handler->common->request.pd_created = 1;
+ ret = master_rpc_async_request(handler, packet, 0, gbar_create_cb, NULL);
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+ handler->cbs.gbar_created.cb = cb;
+ handler->cbs.gbar_created.data = data;
+ handler->common->request.gbar_created = 1;
}
return ret;
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (!handler->common->pd.fb || !handler->common->id) {
+ if (!handler->common->gbar.fb || !handler->common->id) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (!handler->common->is_pd_created) {
- ErrPrint("PD is not created\n");
- return LB_STATUS_ERROR_INVALID;
+ if (!handler->common->is_gbar_created) {
+ ErrPrint("GBAR is not created\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet = packet_create_noack("pd_move", "ssdd", handler->common->pkgname, handler->common->id, x, y);
if (!packet) {
ErrPrint("Failed to build param\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(handler, packet);
int ret;
if (!pkgname) {
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet = packet_create("activate_package", "s", pkgname);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
- cbinfo = create_cb_info(cb, data);
+ cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
ErrPrint("Unable to create cbinfo\n");
packet_destroy(packet);
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
ret = master_rpc_async_request(NULL, packet, 0, activated_cb, cbinfo);
if (ret < 0) {
- destroy_cb_info(cbinfo);
+ dbox_destroy_cb_info(cbinfo);
}
return ret;
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (!handler->common->pd.fb || !handler->common->id) {
+ if (!handler->common->gbar.fb || !handler->common->id) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
/*!
* Use the flag instead of callback.
* the flag should be in the ADT "common"
*/
- if (!handler->common->is_pd_created && !handler->common->request.pd_created) {
- ErrPrint("PD is not created\n");
- return LB_STATUS_ERROR_INVALID;
+ if (!handler->common->is_gbar_created && !handler->common->request.gbar_created) {
+ ErrPrint("GBAR is not created\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (handler->common->request.pd_destroyed) {
- ErrPrint("PD destroy request is already sent\n");
- return LB_STATUS_ERROR_ALREADY;
+ if (handler->common->request.gbar_destroyed) {
+ ErrPrint("GBAR destroy request is already sent\n");
+ return DBOX_STATUS_ERROR_ALREADY;
}
/*!
* \note
- * Disable the pd_created request flag
+ * Disable the gbar_created request flag
*/
- if (handler->common->request.pd_created) {
- if (job_add(handler, turn_off_pd_created_flag_cb, LB_STATUS_ERROR_CANCEL, NULL) < 0) {
+ if (handler->common->request.gbar_created) {
+ if (job_add(handler, turn_off_gbar_created_flag_cb, DBOX_STATUS_ERROR_CANCEL, NULL) < 0) {
ErrPrint("Failed to add a new job\n");
}
}
packet = packet_create("destroy_pd", "ss", handler->common->pkgname, handler->common->id);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
if (!cb) {
- cb = default_pd_destroyed_cb;
+ cb = default_gbar_destroyed_cb;
}
- cbinfo = create_cb_info(cb, data);
+ cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
packet_destroy(packet);
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
- ret = master_rpc_async_request(handler, packet, 0, pd_destroy_cb, cbinfo);
+ ret = master_rpc_async_request(handler, packet, 0, gbar_destroy_cb, cbinfo);
if (ret < 0) {
- destroy_cb_info(cbinfo);
+ dbox_destroy_cb_info(cbinfo);
} else {
- handler->common->request.pd_destroyed = 1;
+ handler->common->request.gbar_destroyed = 1;
}
return ret;
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (handler->common->request.access_event) {
ErrPrint("Previous access event is not yet done\n");
- return LB_STATUS_ERROR_BUSY;
+ return DBOX_STATUS_ERROR_BUSY;
}
- if (type & ACCESS_EVENT_PD_MASK) {
- if (!handler->common->is_pd_created) {
- ErrPrint("PD is not created\n");
- return LB_STATUS_ERROR_INVALID;
+ if (type & DBOX_ACCESS_EVENT_GBAR_MASK) {
+ if (!handler->common->is_gbar_created) {
+ ErrPrint("GBAR is not created\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
*ptr++ = 'p';
*ptr++ = 'd';
- w = handler->common->pd.width;
- h = handler->common->pd.height;
- } else if (type & ACCESS_EVENT_LB_MASK) {
+ w = handler->common->gbar.width;
+ h = handler->common->gbar.height;
+ } else if (type & DBOX_ACCESS_EVENT_DBOX_MASK) {
*ptr++ = 'l';
*ptr++ = 'b';
- w = handler->common->lb.width;
- h = handler->common->lb.height;
+ w = handler->common->dbox.width;
+ h = handler->common->dbox.height;
} else {
ErrPrint("Invalid event type\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- switch (type & ~(ACCESS_EVENT_PD_MASK | ACCESS_EVENT_LB_MASK)) {
- case ACCESS_EVENT_HIGHLIGHT:
- strcpy(ptr, "_access_hl");
- ret = ACCESS_TYPE_CUR;
- break;
- case ACCESS_EVENT_HIGHLIGHT_NEXT:
- strcpy(ptr, "_access_hl");
- ret = ACCESS_TYPE_NEXT;
- break;
- case ACCESS_EVENT_HIGHLIGHT_PREV:
- strcpy(ptr, "_access_hl");
- ret = ACCESS_TYPE_PREV;
- break;
- case ACCESS_EVENT_UNHIGHLIGHT:
+ switch (type & ~(DBOX_ACCESS_EVENT_GBAR_MASK | DBOX_ACCESS_EVENT_DBOX_MASK)) {
+ case DBOX_ACCESS_EVENT_HIGHLIGHT:
strcpy(ptr, "_access_hl");
- ret = ACCESS_TYPE_OFF;
+ ret = (int)info->type;
break;
- case ACCESS_EVENT_ACTIVATE:
+ case DBOX_ACCESS_EVENT_ACTIVATE:
strcpy(ptr, "_access_activate");
break;
- case ACCESS_EVENT_ACTION_DOWN:
- strcpy(ptr, "_access_action");
- ret = ACCESS_TYPE_DOWN;
- break;
- case ACCESS_EVENT_ACTION_UP:
+ case DBOX_ACCESS_EVENT_ACTION:
strcpy(ptr, "_access_action");
- ret = ACCESS_TYPE_UP;
- break;
- case ACCESS_EVENT_SCROLL_DOWN:
- strcpy(ptr, "_access_scroll");
- ret = ACCESS_TYPE_DOWN;
- break;
- case ACCESS_EVENT_SCROLL_MOVE:
- strcpy(ptr, "_access_scroll");
- ret = ACCESS_TYPE_MOVE;
+ ret = (int)info->type;
break;
- case ACCESS_EVENT_SCROLL_UP:
+ case DBOX_ACCESS_EVENT_SCROLL:
strcpy(ptr, "_access_scroll");
- ret = ACCESS_TYPE_UP;
+ ret = (int)info->type;
break;
- case ACCESS_EVENT_VALUE_CHANGE:
+ case DBOX_ACCESS_EVENT_VALUE_CHANGE:
strcpy(ptr, "_access_value_change");
break;
- case ACCESS_EVENT_MOUSE:
+ case DBOX_ACCESS_EVENT_MOUSE:
strcpy(ptr, "_access_mouse");
+ ret = (int)info->type;
break;
- case ACCESS_EVENT_BACK:
+ case DBOX_ACCESS_EVENT_BACK:
strcpy(ptr, "_access_back");
break;
- case ACCESS_EVENT_OVER:
+ case DBOX_ACCESS_EVENT_OVER:
strcpy(ptr, "_access_over");
break;
- case ACCESS_EVENT_READ:
+ case DBOX_ACCESS_EVENT_READ:
strcpy(ptr, "_access_read");
break;
- case ACCESS_EVENT_ENABLE:
- strcpy(ptr, "_access_enable");
- ret = 1;
- break;
- case ACCESS_EVENT_DISABLE:
+ case DBOX_ACCESS_EVENT_ENABLE:
strcpy(ptr, "_access_enable");
- ret = 0;
+ ret = info->type;
break;
default:
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!cb) {
cb = default_access_event_cb;
}
- ret = send_access_event(handler, cmd, x * w, y * h, ret);
- if (ret == (int)LB_STATUS_SUCCESS) {
+ ret = send_access_event(handler, cmd, info->x * w, info->y * h, ret);
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
handler->cbs.access_event.cb = cb;
handler->cbs.access_event.data = data;
handler->common->request.access_event = 1;
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (!(type & CONTENT_EVENT_MOUSE_MASK)) {
+ if (!(type & DBOX_MOUSE_EVENT_MASK)) {
ErrPrint("Invalid content event is used\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (type & CONTENT_EVENT_PD_MASK) {
+ if (type & DBOX_MOUSE_EVENT_GBAR_MASK) {
int flag = 1;
- if (!handler->common->is_pd_created) {
- ErrPrint("PD is not created\n");
- return LB_STATUS_ERROR_INVALID;
+ if (!handler->common->is_gbar_created) {
+ ErrPrint("GBAR is not created\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (!handler->common->pd.fb) {
+ if (!handler->common->gbar.fb) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (type & CONTENT_EVENT_MOUSE_MOVE) {
- if (fabs(x - handler->common->pd.x) < conf_event_filter() && fabs(y - handler->common->pd.y) < conf_event_filter()) {
- return LB_STATUS_ERROR_BUSY;
+ if (type & DBOX_MOUSE_EVENT_MOVE) {
+ if (fabs(info->x - handler->common->gbar.x) < conf_event_filter() && fabs(info->y - handler->common->gbar.y) < conf_event_filter()) {
+ return DBOX_STATUS_ERROR_BUSY;
}
- } else if (type & CONTENT_EVENT_MOUSE_SET) {
+ } else if (type & DBOX_MOUSE_EVENT_SET) {
flag = 0;
}
if (flag) {
- w = handler->common->pd.width;
- h = handler->common->pd.height;
- handler->common->pd.x = x;
- handler->common->pd.y = y;
+ w = handler->common->gbar.width;
+ h = handler->common->gbar.height;
+ handler->common->gbar.x = info->x;
+ handler->common->gbar.y = info->y;
}
*ptr++ = 'p';
*ptr++ = 'd';
- } else if (type & CONTENT_EVENT_LB_MASK) {
+ } else if (type & DBOX_MOUSE_EVENT_DBOX_MASK) {
int flag = 1;
- if (!handler->common->lb.mouse_event) {
- return LB_STATUS_ERROR_INVALID;
+ if (!handler->common->dbox.mouse_event) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (!handler->common->lb.fb) {
+ if (!handler->common->dbox.fb) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (type & CONTENT_EVENT_MOUSE_MOVE) {
- if (fabs(x - handler->common->lb.x) < conf_event_filter() && fabs(y - handler->common->lb.y) < conf_event_filter()) {
- return LB_STATUS_ERROR_BUSY;
+ if (type & DBOX_MOUSE_EVENT_MOVE) {
+ if (fabs(info->x - handler->common->dbox.x) < conf_event_filter() && fabs(info->y - handler->common->dbox.y) < conf_event_filter()) {
+ return DBOX_STATUS_ERROR_BUSY;
}
- } else if (type & CONTENT_EVENT_MOUSE_SET) {
+ } else if (type & DBOX_MOUSE_EVENT_SET) {
flag = 0;
}
if (flag) {
- w = handler->common->lb.width;
- h = handler->common->lb.height;
- handler->common->lb.x = x;
- handler->common->lb.y = y;
+ w = handler->common->dbox.width;
+ h = handler->common->dbox.height;
+ handler->common->dbox.x = info->x;
+ handler->common->dbox.y = info->y;
}
*ptr++ = 'l';
*ptr++ = 'b';
} else {
ErrPrint("Invalid event type\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
/*!
* Must be shorter than 29 bytes.
*/
- switch ((type & ~(CONTENT_EVENT_PD_MASK | CONTENT_EVENT_LB_MASK))) {
- case CONTENT_EVENT_MOUSE_ENTER | CONTENT_EVENT_MOUSE_MASK:
+ switch ((type & ~(DBOX_MOUSE_EVENT_GBAR_MASK | DBOX_MOUSE_EVENT_DBOX_MASK))) {
+ case DBOX_MOUSE_EVENT_ENTER | DBOX_MOUSE_EVENT_MASK:
strcpy(ptr, "_mouse_enter");
break;
- case CONTENT_EVENT_MOUSE_LEAVE | CONTENT_EVENT_MOUSE_MASK:
+ case DBOX_MOUSE_EVENT_LEAVE | DBOX_MOUSE_EVENT_MASK:
strcpy(ptr, "_mouse_leave");
break;
- case CONTENT_EVENT_MOUSE_UP | CONTENT_EVENT_MOUSE_MASK:
+ case DBOX_MOUSE_EVENT_UP | DBOX_MOUSE_EVENT_MASK:
strcpy(ptr, "_mouse_up");
break;
- case CONTENT_EVENT_MOUSE_DOWN | CONTENT_EVENT_MOUSE_MASK:
+ case DBOX_MOUSE_EVENT_DOWN | DBOX_MOUSE_EVENT_MASK:
strcpy(ptr, "_mouse_down");
break;
- case CONTENT_EVENT_MOUSE_MOVE | CONTENT_EVENT_MOUSE_MASK:
+ case DBOX_MOUSE_EVENT_MOVE | DBOX_MOUSE_EVENT_MASK:
strcpy(ptr, "_mouse_move");
break;
- case CONTENT_EVENT_MOUSE_SET | CONTENT_EVENT_MOUSE_MASK:
+ case DBOX_MOUSE_EVENT_SET | DBOX_MOUSE_EVENT_MASK:
strcpy(ptr, "_mouse_set");
break;
- case CONTENT_EVENT_MOUSE_UNSET | CONTENT_EVENT_MOUSE_MASK:
+ case DBOX_MOUSE_EVENT_UNSET | DBOX_MOUSE_EVENT_MASK:
strcpy(ptr, "_mouse_unset");
break;
- case CONTENT_EVENT_ON_SCROLL | CONTENT_EVENT_MOUSE_MASK:
+ case DBOX_MOUSE_EVENT_ON_SCROLL | DBOX_MOUSE_EVENT_MASK:
strcpy(ptr, "_mouse_on_scroll");
break;
- case CONTENT_EVENT_ON_HOLD | CONTENT_EVENT_MOUSE_MASK:
+ case DBOX_MOUSE_EVENT_ON_HOLD | DBOX_MOUSE_EVENT_MASK:
strcpy(ptr, "_mouse_on_hold");
break;
- case CONTENT_EVENT_OFF_SCROLL | CONTENT_EVENT_MOUSE_MASK:
+ case DBOX_MOUSE_EVENT_OFF_SCROLL | DBOX_MOUSE_EVENT_MASK:
strcpy(ptr, "_mouse_off_scroll");
break;
- case CONTENT_EVENT_OFF_HOLD | CONTENT_EVENT_MOUSE_MASK:
+ case DBOX_MOUSE_EVENT_OFF_HOLD | DBOX_MOUSE_EVENT_MASK:
strcpy(ptr, "_mouse_off_hold");
break;
default:
ErrPrint("Invalid event type\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- return send_mouse_event(handler, cmd, x * w, y * h);
+ return send_mouse_event(handler, cmd, info->x * w, info->y * h);
}
EAPI int dynamicbox_feed_key_event(struct dynamicbox *handler, enum dynamicbox_key_event_type type, struct dynamicbox_key_event_info *info, dynamicbox_ret_cb_t cb, void *data)
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (!(type & CONTENT_EVENT_KEY_MASK)) {
+ if (!(type & DBOX_KEY_EVENT_MASK)) {
ErrPrint("Invalid key event is used\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (handler->common->request.key_event) {
ErrPrint("Previous key event is not completed yet\n");
- return LB_STATUS_ERROR_BUSY;
+ return DBOX_STATUS_ERROR_BUSY;
}
- if (type & CONTENT_EVENT_PD_MASK) {
- if (!handler->common->is_pd_created) {
- ErrPrint("PD is not created\n");
- return LB_STATUS_ERROR_INVALID;
+ if (type & DBOX_MOUSE_EVENT_GBAR_MASK) {
+ if (!handler->common->is_gbar_created) {
+ ErrPrint("GBAR is not created\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (!handler->common->pd.fb) {
+ if (!handler->common->gbar.fb) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (type & CONTENT_EVENT_KEY_DOWN) {
+ if (type & DBOX_KEY_EVENT_DOWN) {
/*!
* \TODO
* filtering the reproduced events if it is too fast
*/
- } else if (type & CONTENT_EVENT_KEY_SET) {
+ } else if (type & DBOX_KEY_EVENT_SET) {
/*!
* \TODO
* What can I do for this case?
*ptr++ = 'p';
*ptr++ = 'd';
- } else if (type & CONTENT_EVENT_LB_MASK) {
- if (!handler->common->lb.mouse_event) {
- return LB_STATUS_ERROR_INVALID;
+ } else if (type & DBOX_MOUSE_EVENT_DBOX_MASK) {
+ if (!handler->common->dbox.mouse_event) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (!handler->common->lb.fb) {
+ if (!handler->common->dbox.fb) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (type & CONTENT_EVENT_KEY_DOWN) {
+ if (type & DBOX_KEY_EVENT_DOWN) {
/*!
* \TODO
* filtering the reproduced events if it is too fast
*/
- } else if (type & CONTENT_EVENT_KEY_SET) {
+ } else if (type & DBOX_KEY_EVENT_SET) {
/*!
* What can I do for this case?
*/
*ptr++ = 'b';
} else {
ErrPrint("Invalid event type\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
/*!
* Must be short than 29 bytes.
*/
- switch ((type & ~(CONTENT_EVENT_PD_MASK | CONTENT_EVENT_LB_MASK))) {
- case CONTENT_EVENT_KEY_FOCUS_IN | CONTENT_EVENT_KEY_MASK:
+ switch ((type & ~(DBOX_MOUSE_EVENT_GBAR_MASK | DBOX_MOUSE_EVENT_DBOX_MASK))) {
+ case DBOX_KEY_EVENT_FOCUS_IN | DBOX_KEY_EVENT_MASK:
strcpy(ptr, "_key_focus_in");
break;
- case CONTENT_EVENT_KEY_FOCUS_OUT | CONTENT_EVENT_KEY_MASK:
+ case DBOX_KEY_EVENT_FOCUS_OUT | DBOX_KEY_EVENT_MASK:
strcpy(ptr, "_key_focus_out");
break;
- case CONTENT_EVENT_KEY_UP | CONTENT_EVENT_KEY_MASK:
+ case DBOX_KEY_EVENT_UP | DBOX_KEY_EVENT_MASK:
strcpy(ptr, "_key_up");
break;
- case CONTENT_EVENT_KEY_DOWN | CONTENT_EVENT_KEY_MASK:
+ case DBOX_KEY_EVENT_DOWN | DBOX_KEY_EVENT_MASK:
strcpy(ptr, "_key_down");
break;
- case CONTENT_EVENT_KEY_SET | CONTENT_EVENT_KEY_MASK:
+ case DBOX_KEY_EVENT_SET | DBOX_KEY_EVENT_MASK:
strcpy(ptr, "_key_set");
break;
- case CONTENT_EVENT_KEY_UNSET | CONTENT_EVENT_KEY_MASK:
+ case DBOX_KEY_EVENT_UNSET | DBOX_KEY_EVENT_MASK:
strcpy(ptr, "_key_unset");
break;
default:
ErrPrint("Invalid event type\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!cb) {
cb = default_key_event_cb;
}
- ret = send_key_event(handler, cmd, keycode);
- if (ret == (int)LB_STATUS_SUCCESS) {
+ ret = send_key_event(handler, cmd, info->keycode);
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
handler->cbs.key_event.cb = cb;
handler->cbs.key_event.data = data;
handler->common->request.key_event = 1;
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!w) {
h = &_h;
}
- if (!handler->common->is_pd_created) {
- *w = handler->common->pd.default_width;
- *h = handler->common->pd.default_height;
+ if (!handler->common->is_gbar_created) {
+ *w = handler->common->gbar.default_width;
+ *h = handler->common->gbar.default_height;
} else {
- *w = handler->common->pd.width;
- *h = handler->common->pd.height;
+ *w = handler->common->gbar.width;
+ *h = handler->common->gbar.height;
}
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
EAPI int dynamicbox_size(struct dynamicbox *handler)
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- w = handler->common->lb.width;
- h = handler->common->lb.height;
+ w = handler->common->dbox.width;
+ h = handler->common->dbox.height;
- switch (handler->common->lb.type) {
- case _LB_TYPE_BUFFER:
- case _LB_TYPE_SCRIPT:
- if (!fb_is_created(handler->common->lb.fb)) {
+ switch (handler->common->dbox.type) {
+ case _DBOX_TYPE_BUFFER:
+ case _DBOX_TYPE_SCRIPT:
+ if (!fb_is_created(handler->common->dbox.fb)) {
w = 0;
h = 0;
}
break;
}
- return livebox_service_size_type(w, h);
+ return dynamicbox_service_size_type(w, h);
}
EAPI int dynamicbox_set_group(struct dynamicbox *handler, const char *cluster, const char *category, dynamicbox_ret_cb_t cb, void *data)
if (!handler) {
ErrPrint("Handler is NIL\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!cluster || !category || handler->state != CREATE) {
ErrPrint("Invalid argument\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Invalid argument\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Invalid argument\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (handler->common->request.group_changed) {
ErrPrint("Previous group changing request is not finished yet\n");
- return LB_STATUS_ERROR_BUSY;
+ return DBOX_STATUS_ERROR_BUSY;
}
if (!handler->common->is_user) {
ErrPrint("CA Livebox is not able to change the group\n");
- return LB_STATUS_ERROR_PERMISSION;
+ return DBOX_STATUS_ERROR_PERMISSION_DENIED;
}
if (!strcmp(handler->common->cluster, cluster) && !strcmp(handler->common->category, category)) {
DbgPrint("No changes\n");
- return LB_STATUS_ERROR_ALREADY;
+ return DBOX_STATUS_ERROR_ALREADY;
}
packet = packet_create("change_group", "ssss", handler->common->pkgname, handler->common->id, cluster, category);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
if (!cb) {
}
ret = master_rpc_async_request(handler, packet, 0, set_group_ret_cb, NULL);
- if (ret == (int)LB_STATUS_SUCCESS) {
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
handler->cbs.group_changed.cb = cb;
handler->cbs.group_changed.data = data;
handler->common->request.group_changed = 1;
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!cluster || !category || handler->state != CREATE) {
ErrPrint("Invalid argument\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Invalid argument\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Invalid argument\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
*cluster = handler->common->cluster;
*category = handler->common->category;
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
EAPI int dynamicbox_get_supported_sizes(struct dynamicbox *handler, int *cnt, int *size_list)
if (!handler || !size_list) {
ErrPrint("Invalid argument, handler(%p), size_list(%p)\n", handler, size_list);
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!cnt || handler->state != CREATE) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- for (j = i = 0; i < NR_OF_SIZE_LIST; i++) {
- if (handler->common->lb.size_list & (0x01 << i)) {
+ for (j = i = 0; i < DBOX_NR_OF_SIZE_LIST; i++) {
+ if (handler->common->dbox.size_list & (0x01 << i)) {
if (j == *cnt) {
break;
}
}
*cnt = j;
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
EAPI const char *dynamicbox_pkgname(struct dynamicbox *handler)
return -1.0f;
}
- return handler->common->lb.priority;
+ return handler->common->dbox.priority;
}
EAPI int dynamicbox_delete_cluster(const char *cluster, dynamicbox_ret_cb_t cb, void *data)
packet = packet_create("delete_cluster", "s", cluster);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
- cbinfo = create_cb_info(cb, data);
+ cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
packet_destroy(packet);
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
ret = master_rpc_async_request(NULL, packet, 0, delete_cluster_cb, cbinfo);
if (ret < 0) {
- destroy_cb_info(cbinfo);
+ dbox_destroy_cb_info(cbinfo);
}
return ret;
packet = packet_create("delete_category", "ss", cluster, category);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
- cbinfo = create_cb_info(cb, data);
+ cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
packet_destroy(packet);
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
ret = master_rpc_async_request(NULL, packet, 0, delete_category_cb, cbinfo);
if (ret < 0) {
- destroy_cb_info(cbinfo);
+ dbox_destroy_cb_info(cbinfo);
}
return ret;
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return PD_TYPE_INVALID;
+ return DBOX_TYPE_INVALID;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return PD_TYPE_INVALID;
+ return DBOX_TYPE_INVALID;
}
if (!handler->common->id) {
ErrPrint("Handler is not valid\n");
- return PD_TYPE_INVALID;
+ return DBOX_TYPE_INVALID;
}
if (gbar) {
- switch (handler->common->pd.type) {
- case _PD_TYPE_TEXT:
- return PD_TYPE_TEXT;
- case _PD_TYPE_BUFFER:
- case _PD_TYPE_SCRIPT:
+ switch (handler->common->gbar.type) {
+ case _GBAR_TYPE_TEXT:
+ return DBOX_TYPE_TEXT;
+ case _GBAR_TYPE_BUFFER:
+ case _GBAR_TYPE_SCRIPT:
{
const char *id;
- id = fb_id(handler->common->pd.fb);
+ id = fb_id(handler->common->gbar.fb);
if (id && !strncasecmp(id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
- return PD_TYPE_PIXMAP;
+ return DBOX_TYPE_RESOURCE_ID;
}
}
- return PD_TYPE_BUFFER;
- case _PD_TYPE_ELEMENTARY:
- return PD_TYPE_ELEMENTARY;
+ return DBOX_TYPE_BUFFER;
+ case _GBAR_TYPE_ELEMENTARY:
+ return DBOX_TYPE_UIFW;
default:
break;
}
- return PD_TYPE_INVALID;
+ return DBOX_TYPE_INVALID;
} else {
- switch (handler->common->lb.type) {
- case _LB_TYPE_FILE:
- return LB_TYPE_IMAGE;
- case _LB_TYPE_BUFFER:
- case _LB_TYPE_SCRIPT:
+ switch (handler->common->dbox.type) {
+ case _DBOX_TYPE_FILE:
+ return DBOX_TYPE_IMAGE;
+ case _DBOX_TYPE_BUFFER:
+ case _DBOX_TYPE_SCRIPT:
{
const char *id;
- id = fb_id(handler->common->lb.fb);
+ id = fb_id(handler->common->dbox.fb);
if (id && !strncasecmp(id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
- return LB_TYPE_PIXMAP;
+ return DBOX_TYPE_RESOURCE_ID;
}
}
- return LB_TYPE_BUFFER;
- case _LB_TYPE_TEXT:
- return LB_TYPE_TEXT;
- case _LB_TYPE_ELEMENTARY:
- return LB_TYPE_ELEMENTARY;
+ return DBOX_TYPE_BUFFER;
+ case _DBOX_TYPE_TEXT:
+ return DBOX_TYPE_TEXT;
+ case _DBOX_TYPE_ELEMENTARY:
+ return DBOX_TYPE_UIFW;
default:
break;
}
- return LB_TYPE_INVALID;
+ return DBOX_TYPE_INVALID;
}
return type;
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (handler->state != CREATE) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (gbar) {
- memcpy(&handler->cbs.pd_ops, ops, sizeof(*ops));
+ memcpy(&handler->cbs.gbar_ops, ops, sizeof(*ops));
} else {
- memcpy(&handler->cbs.lb_ops, ops, sizeof(*ops));
+ memcpy(&handler->cbs.dbox_ops, ops, sizeof(*ops));
}
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
EAPI unsigned int dynamicbox_acquire_resource_id(struct dynamicbox *handler, int gbar, dynamicbox_ret_cb_t cb, void *data)
if (gbar) {
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Invalid handle\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (handler->common->pd.type != _PD_TYPE_SCRIPT && handler->common->pd.type != _PD_TYPE_BUFFER) {
+ if (handler->common->gbar.type != _GBAR_TYPE_SCRIPT && handler->common->gbar.type != _GBAR_TYPE_BUFFER) {
ErrPrint("Handler is not valid type\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- return lb_acquire_pd_pixmap(handler, cb, data);
+ return dbox_acquire_gbar_pixmap(handler, cb, data);
} else {
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Invalid handle\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (handler->common->lb.type != _LB_TYPE_SCRIPT && handler->common->lb.type != _LB_TYPE_BUFFER) {
+ if (handler->common->dbox.type != _DBOX_TYPE_SCRIPT && handler->common->dbox.type != _DBOX_TYPE_BUFFER) {
ErrPrint("Handler is not valid type\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- return lb_acquire_lb_pixmap(handler, cb, data);
+ return dbox_acquire_dbox_pixmap(handler, cb, data);
}
}
struct packet *packet;
const char *pkgname;
const char *id;
+ const char *cmd;
- if (pixmap == 0 /* || handler->state != CREATE */) {
- ErrPrint("Pixmap is invalid [%d]\n", pixmap);
- return LB_STATUS_ERROR_INVALID;
+ if (resource_id == 0 /* || handler->state != CREATE */) {
+ ErrPrint("Pixmap is invalid [%d]\n", resource_id);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (gbar) {
/*!
* \note
* Even though the handler is NULL, we should send the release request to the master.
- * Because the pixmap resource can be released after the handler is destroyed.
- * Pixmap resource is used by client. and it cannot be guaranteed to release pixmap.
- * In some cases, the pixmap can be released after the handler is deleted.
+ * Because the resource_id resource can be released after the handler is destroyed.
+ * Pixmap resource is used by client. and it cannot be guaranteed to release resource_id.
+ * In some cases, the resource_id can be released after the handler is deleted.
*
* Its implementation is up to the viewer app.
* But we cannot force it to use only with valid handler.
id = NULL;
/*!
* \note
- * Master will try to find the buffer handler using given pixmap. if the pkgname and id is not valid.
+ * Master will try to find the buffer handler using given resource_id. if the pkgname and id is not valid.
*/
} else {
if (!handler->common /* || handler-common->state != CREATE */) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Invalid handle\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (handler->common->pd.type != _PD_TYPE_SCRIPT && handler->common->pd.type != _PD_TYPE_BUFFER) {
+ if (handler->common->gbar.type != _GBAR_TYPE_SCRIPT && handler->common->gbar.type != _GBAR_TYPE_BUFFER) {
ErrPrint("Handler is not valid type\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
pkgname = handler->common->pkgname;
id = handler->common->id;
}
- packet = packet_create_noack("pd_release_pixmap", "ssi", pkgname, id, pixmap);
- if (!packet) {
- ErrPrint("Failed to build a param\n");
- return LB_STATUS_ERROR_FAULT;
- }
+ cmd = "pd_release_pixmap";
} else {
if (!handler) {
/*!
* \note
* Even though the handler is NULL, we should send the release request to the master.
- * Because the pixmap resource can be released after the handler is destroyed.
- * Pixmap resource is used by client. and it cannot be guaranteed to release pixmap.
- * In some cases, the pixmap can be released after the handler is deleted.
+ * Because the resource_id resource can be released after the handler is destroyed.
+ * Pixmap resource is used by client. and it cannot be guaranteed to release resource_id.
+ * In some cases, the resource_id can be released after the handler is deleted.
*
* Its implementation is up to the viewer app.
* But we cannot force it to use only with valid handler.
id = NULL;
/*!
* \note
- * Master will try to find the buffer handler using given pixmap. if the pkgname and id is not valid.
+ * Master will try to find the buffer handler using given resource_id. if the pkgname and id is not valid.
*/
} else {
if (!handler->common /* || handler->common->state != CREATE */) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Invalid handle\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (handler->common->lb.type != _LB_TYPE_SCRIPT && handler->common->lb.type != _LB_TYPE_BUFFER) {
+ if (handler->common->dbox.type != _DBOX_TYPE_SCRIPT && handler->common->dbox.type != _DBOX_TYPE_BUFFER) {
ErrPrint("Handler is not valid type\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
pkgname = handler->common->pkgname;
id = handler->common->id;
}
- packet = packet_create_noack("lb_release_pixmap", "ssi", pkgname, id, pixmap);
- if (!packet) {
- ErrPrint("Failed to build a param\n");
- return LB_STATUS_ERROR_INVALID;
- }
+ cmd = "lb_release_pixmap";
+ }
+ packet = packet_create_noack(cmd, "ssi", pkgname, id, resource_id);
+ if (!packet) {
+ ErrPrint("Failed to build a param\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(handler, packet);
return 0;
}
- if (handler->common->pd.type != _PD_TYPE_SCRIPT && handler->common->pd.type != _PD_TYPE_BUFFER) {
+ if (handler->common->gbar.type != _GBAR_TYPE_SCRIPT && handler->common->gbar.type != _GBAR_TYPE_BUFFER) {
ErrPrint("Invalid handler\n");
return 0;
}
- id = fb_id(handler->common->pd.fb);
+ id = fb_id(handler->common->gbar.fb);
if (id && sscanf(id, SCHEMA_PIXMAP "%u", (unsigned int *)&pixmap) != 1) {
ErrPrint("PIXMAP Id is not valid\n");
return 0;
return 0;
}
- if (handler->common->lb.type != _LB_TYPE_SCRIPT && handler->common->lb.type != _LB_TYPE_BUFFER) {
+ if (handler->common->dbox.type != _DBOX_TYPE_SCRIPT && handler->common->dbox.type != _DBOX_TYPE_BUFFER) {
ErrPrint("Invalid handler\n");
return 0;
}
- id = fb_id(handler->common->lb.fb);
+ id = fb_id(handler->common->dbox.fb);
if (id && sscanf(id, SCHEMA_PIXMAP "%u", (unsigned int *)&pixmap) != 1) {
ErrPrint("PIXMAP Id is not valid\n");
return 0;
return NULL;
}
- if (handler->common->pd.type != _PD_TYPE_SCRIPT && handler->common->pd.type != _PD_TYPE_BUFFER) {
+ if (handler->common->gbar.type != _GBAR_TYPE_SCRIPT && handler->common->gbar.type != _GBAR_TYPE_BUFFER) {
ErrPrint("Handler is not valid type\n");
return NULL;
}
- return fb_acquire_buffer(handler->common->pd.fb);
+ return fb_acquire_buffer(handler->common->gbar.fb);
} else {
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
return NULL;
}
- if (handler->common->lb.type != _LB_TYPE_SCRIPT && handler->common->lb.type != _LB_TYPE_BUFFER) {
+ if (handler->common->dbox.type != _DBOX_TYPE_SCRIPT && handler->common->dbox.type != _DBOX_TYPE_BUFFER) {
ErrPrint("Handler is not valid type\n");
return NULL;
}
- return fb_acquire_buffer(handler->common->lb.fb);
+ return fb_acquire_buffer(handler->common->dbox.fb);
}
}
{
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Invalid handler\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (gbar) {
- return fb_size(handler->common->pd.fb);
+ return fb_size(handler->common->gbar.fb);
} else {
- return fb_size(handler->common->lb.fb);
+ return fb_size(handler->common->dbox.fb);
}
}
{
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Invalid handler\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return handler->common->is_user;
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Invalid handler\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (handler->common->request.pinup) {
ErrPrint("Previous pinup request is not finished\n");
- return LB_STATUS_ERROR_BUSY;
+ return DBOX_STATUS_ERROR_BUSY;
}
if (handler->common->is_pinned_up == flag) {
DbgPrint("No changes\n");
- return LB_STATUS_ERROR_ALREADY;
+ return DBOX_STATUS_ERROR_ALREADY;
}
packet = packet_create("pinup_changed", "ssi", handler->common->pkgname, handler->common->id, flag);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
if (!cb) {
}
ret = master_rpc_async_request(handler, packet, 0, pinup_done_cb, NULL);
- if (ret == (int)LB_STATUS_SUCCESS) {
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
handler->cbs.pinup.cb = cb;
handler->cbs.pinup.data = data;
handler->common->request.pinup = 1;
{
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Invalid handler\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return handler->common->is_pinned_up;
{
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Invalid handler\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- return handler->common->lb.pinup_supported;
+ return handler->common->dbox.pinup_supported;
}
EAPI int dynamicbox_set_data(struct dynamicbox *handler, void *data)
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
handler->data = data;
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
EAPI void *dynamicbox_data(struct dynamicbox *handler)
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if ((handler->common->lb.type != _LB_TYPE_TEXT && handler->common->pd.type != _PD_TYPE_TEXT) || !handler->common->id) {
+ if ((handler->common->dbox.type != _DBOX_TYPE_TEXT && handler->common->gbar.type != _GBAR_TYPE_TEXT) || !handler->common->id) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!emission) {
handler->common->pkgname, handler->common->id, emission, source, sx, sy, ex, ey);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
- cbinfo = create_cb_info(cb, data);
+ cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
packet_destroy(packet);
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
ret = master_rpc_async_request(handler, packet, 0, text_signal_cb, cbinfo);
if (ret < 0) {
- destroy_cb_info(cbinfo);
+ dbox_destroy_cb_info(cbinfo);
}
return ret;
packet = packet_create_noack("subscribe", "ss", cluster ? cluster : "", category ? category : "");
if (!packet) {
ErrPrint("Failed to create a packet\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(NULL, packet);
packet = packet_create_noack("unsubscribe", "ss", cluster ? cluster : "", category ? category : "");
if (!packet) {
ErrPrint("Failed to create a packet\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(NULL, packet);
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet = packet_create_noack("update", "ssi", handler->common->pkgname, handler->common->id, force);
if (!packet) {
ErrPrint("Failed to create a packet\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(handler, packet);
if (!cluster || !category) {
ErrPrint("Invalid argument\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet = packet_create_noack("refresh_group", "ssi", cluster, category, force);
if (!packet) {
ErrPrint("Failed to create a packet\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(NULL, packet);
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->is_user) {
- /* System cluster livebox cannot be changed its visible states */
- if (state == LB_HIDE_WITH_PAUSE) {
+ /* System cluster dynamicbox cannot be changed its visible states */
+ if (state == DBOX_HIDE_WITH_PAUSE) {
ErrPrint("CA Livebox is not able to change the visibility\n");
- return LB_STATUS_ERROR_PERMISSION;
+ return DBOX_STATUS_ERROR_PERMISSION_DENIED;
}
}
if (handler->visible == state) {
DbgPrint("%s has no changes\n", handler->common->pkgname);
- return LB_STATUS_ERROR_ALREADY;
+ return DBOX_STATUS_ERROR_ALREADY;
}
old_state = handler->visible;
handler->visible = state;
- ret = lb_set_visibility(handler, state);
+ ret = dbox_set_visibility(handler, state);
if (ret < 0) {
handler->visible = old_state;
}
{
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return LB_VISIBLE_ERROR;
+ return DBOX_VISIBLE_ERROR;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is not valid\n");
- return LB_VISIBLE_ERROR;
+ return DBOX_VISIBLE_ERROR;
}
if (!handler->common->id) {
ErrPrint("Handler is not valid\n");
- return LB_VISIBLE_ERROR;
+ return DBOX_VISIBLE_ERROR;
}
return handler->visible;
packet = packet_create_noack("client_paused", "d", util_timestamp());
if (!packet) {
ErrPrint("Failed to create a pause packet\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(NULL, packet);
packet = packet_create_noack("client_resumed", "d", util_timestamp());
if (!packet) {
ErrPrint("Failed to create a resume packet\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(NULL, packet);
{
if (!handler || handler->state != CREATE) {
ErrPrint("Invalid handle\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Invalid handle\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Invalid handle\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (gbar) {
- return lb_sync_pd_fb(handler->common);
+ return dbox_sync_gbar_fb(handler->common);
} else {
- return lb_sync_lb_fb(handler->common);
+ return dbox_sync_dbox_fb(handler->common);
}
}
return handler->common->alt.name;
}
-EAPI int dynamicbox_acquire_fb_lock(struct dynamicbox *handler, int gbar)
+EAPI int dynamicbox_acquire_fb_lock(struct dynamicbox *handler, int is_gbar)
{
- int ret = LB_STATUS_SUCCESS;
+ int ret = DBOX_STATUS_ERROR_NONE;
int fd;
if (!handler || handler->state != CREATE) {
ErrPrint("Handler is not valid[%p]\n", handler);
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Handler is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Handler is not valid[%p]\n", handler);
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (is_pd) {
- if (!handler->common->pd.lock || handler->common->pd.lock_fd < 0) {
- DbgPrint("Lock: %s (%d)\n", handler->common->pd.lock, handler->common->pd.lock_fd);
- return LB_STATUS_ERROR_INVALID;
+ if (is_gbar) {
+ if (!handler->common->gbar.lock || handler->common->gbar.lock_fd < 0) {
+ DbgPrint("Lock: %s (%d)\n", handler->common->gbar.lock, handler->common->gbar.lock_fd);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (fb_type(lb_get_pd_fb(handler->common)) == BUFFER_TYPE_FILE) {
- return LB_STATUS_SUCCESS;
+ if (fb_type(dbox_get_gbar_fb(handler->common)) == BUFFER_TYPE_FILE) {
+ return DBOX_STATUS_ERROR_NONE;
}
- fd = handler->common->pd.lock_fd;
+ fd = handler->common->gbar.lock_fd;
} else {
- if (!handler->common->lb.lock || handler->common->lb.lock_fd < 0) {
- DbgPrint("Lock: %s (%d)\n", handler->common->lb.lock, handler->common->lb.lock_fd);
- return LB_STATUS_ERROR_INVALID;
+ if (!handler->common->dbox.lock || handler->common->dbox.lock_fd < 0) {
+ DbgPrint("Lock: %s (%d)\n", handler->common->dbox.lock, handler->common->dbox.lock_fd);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (fb_type(lb_get_lb_fb(handler->common)) == BUFFER_TYPE_FILE) {
- return LB_STATUS_SUCCESS;
+ if (fb_type(dbox_get_dbox_fb(handler->common)) == BUFFER_TYPE_FILE) {
+ return DBOX_STATUS_ERROR_NONE;
}
- fd = handler->common->lb.lock_fd;
+ fd = handler->common->dbox.lock_fd;
}
- ret = do_fb_lock(fd);
+ ret = dbox_fb_lock(fd);
- return ret == 0 ? LB_STATUS_SUCCESS : LB_STATUS_ERROR_FAULT;
+ return ret == 0 ? DBOX_STATUS_ERROR_NONE : DBOX_STATUS_ERROR_FAULT;
}
-EAPI int dynamicbox_release_fb_lock(struct dynamicbox *handler, int gbar)
+EAPI int dynamicbox_release_fb_lock(struct dynamicbox *handler, int is_gbar)
{
- int ret = LB_STATUS_SUCCESS;
+ int ret = DBOX_STATUS_ERROR_NONE;
int fd;
if (!handler || handler->state != CREATE) {
ErrPrint("Invalid handle\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != CREATE) {
ErrPrint("Invalid handle\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
ErrPrint("Handler is not valid[%p]\n", handler);
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (is_pd) {
- if (!handler->common->pd.lock || handler->common->pd.lock_fd < 0) {
- DbgPrint("Unlock: %s (%d)\n", handler->common->pd.lock, handler->common->pd.lock_fd);
- return LB_STATUS_ERROR_INVALID;
+ if (is_gbar) {
+ if (!handler->common->gbar.lock || handler->common->gbar.lock_fd < 0) {
+ DbgPrint("Unlock: %s (%d)\n", handler->common->gbar.lock, handler->common->gbar.lock_fd);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (fb_type(lb_get_pd_fb(handler->common)) == BUFFER_TYPE_FILE) {
- return LB_STATUS_SUCCESS;
+ if (fb_type(dbox_get_gbar_fb(handler->common)) == BUFFER_TYPE_FILE) {
+ return DBOX_STATUS_ERROR_NONE;
}
- fd = handler->common->pd.lock_fd;
+ fd = handler->common->gbar.lock_fd;
} else {
- if (!handler->common->lb.lock || handler->common->lb.lock_fd < 0) {
- DbgPrint("Unlock: %s (%d)\n", handler->common->lb.lock, handler->common->lb.lock_fd);
- return LB_STATUS_ERROR_INVALID;
+ if (!handler->common->dbox.lock || handler->common->dbox.lock_fd < 0) {
+ DbgPrint("Unlock: %s (%d)\n", handler->common->dbox.lock, handler->common->dbox.lock_fd);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- if (fb_type(lb_get_lb_fb(handler->common)) == BUFFER_TYPE_FILE) {
- return LB_STATUS_SUCCESS;
+ if (fb_type(dbox_get_dbox_fb(handler->common)) == BUFFER_TYPE_FILE) {
+ return DBOX_STATUS_ERROR_NONE;
}
- fd = handler->common->lb.lock_fd;
+ fd = handler->common->dbox.lock_fd;
}
- ret = do_fb_unlock(fd);
+ ret = dbox_fb_unlock(fd);
- return ret == 0 ? LB_STATUS_SUCCESS : LB_STATUS_ERROR_FAULT;
+ return ret == 0 ? DBOX_STATUS_ERROR_NONE : DBOX_STATUS_ERROR_FAULT;
}
EAPI int dynamicbox_set_option(enum dynamicbox_option_type option, int state)
{
- int ret = LB_STATUS_SUCCESS;
+ int ret = DBOX_STATUS_ERROR_NONE;
switch (option) {
- case LB_OPTION_MANUAL_SYNC:
+ case DBOX_OPTION_MANUAL_SYNC:
conf_set_manual_sync(state);
break;
- case LB_OPTION_FRAME_DROP_FOR_RESIZE:
+ case DBOX_OPTION_FRAME_DROP_FOR_RESIZE:
conf_set_frame_drop_for_resizing(state);
break;
- case LB_OPTION_SHARED_CONTENT:
+ case DBOX_OPTION_SHARED_CONTENT:
conf_set_shared_content(state);
break;
default:
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
break;
}
int ret;
switch (option) {
- case LB_OPTION_MANUAL_SYNC:
+ case DBOX_OPTION_MANUAL_SYNC:
ret = conf_manual_sync();
break;
- case LB_OPTION_FRAME_DROP_FOR_RESIZE:
+ case DBOX_OPTION_FRAME_DROP_FOR_RESIZE:
ret = conf_frame_drop_for_resizing();
break;
- case LB_OPTION_SHARED_CONTENT:
+ case DBOX_OPTION_SHARED_CONTENT:
ret = conf_shared_content();
break;
default:
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
break;
}
EAPI int dynamicbox_set_auto_launch_handler(int (*dbox_launch_handler)(struct dynamicbox *handler, const char *appid, void *data), void *data)
{
- s_info.launch.handler = launch_handler;
+ s_info.launch.handler = dbox_launch_handler;
s_info.launch.data = data;
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
/* End of a file */
--- /dev/null
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <fcntl.h>
+
+#include <dlog.h>
+
+#include <dynamicbox_errno.h>
+#include <dynamicbox_service.h>
+
+#include <packet.h>
+
+#include "dlist.h"
+#include "debug.h"
+#include "dynamicbox.h"
+#include "dynamicbox_internal.h"
+#include "fb.h"
+#include "conf.h"
+#include "util.h"
+#include "master_rpc.h"
+
+int errno;
+
+enum event_state {
+ INFO_STATE_CALLBACK_IN_IDLE = 0x00,
+ INFO_STATE_CALLBACK_IN_PROCESSING = 0x01
+};
+
+struct event_info {
+ int is_deleted;
+ int (*handler)(struct dynamicbox *handler, enum dynamicbox_event_type event, void *data);
+ void *user_data;
+};
+
+struct fault_info {
+ int is_deleted;
+ int (*handler)(enum dynamicbox_fault_type event, const char *pkgname, const char *filename, const char *func, void *data);
+ void *user_data;
+};
+
+static struct info {
+ struct dlist *dynamicbox_common_list;
+ struct dlist *dynamicbox_list;
+ struct dlist *event_list;
+ struct dlist *fault_list;
+ enum event_state event_state;
+ enum event_state fault_state;
+} s_info = {
+ .dynamicbox_common_list = NULL,
+ .dynamicbox_list = NULL,
+ .event_list = NULL,
+ .fault_list = NULL,
+ .event_state = INFO_STATE_CALLBACK_IN_IDLE,
+ .fault_state = INFO_STATE_CALLBACK_IN_IDLE,
+};
+
+static inline void default_delete_cb(struct dynamicbox *handler, int ret, void *data)
+{
+ DbgPrint("Default deleted event handler: %d\n", ret);
+}
+
+static void del_ret_cb(struct dynamicbox *handler, const struct packet *result, void *data)
+{
+ struct cb_info *info = data;
+ int ret;
+ dynamicbox_ret_cb_t cb;
+ void *cbdata;
+
+ cb = info->cb;
+ cbdata = info->data;
+ dbox_destroy_cb_info(info);
+
+ if (!result) {
+ ErrPrint("Connection lost?\n");
+ ret = DBOX_STATUS_ERROR_FAULT;
+ } else if (packet_get(result, "i", &ret) != 1) {
+ ErrPrint("Invalid argument\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ if (ret == 0) {
+ handler->cbs.deleted.cb = cb;
+ handler->cbs.deleted.data = cbdata;
+ } else if (cb) {
+ cb(handler, ret, cbdata);
+ }
+
+ /*!
+ * \note
+ * Do not call the deleted callback from here.
+ * master will send the "deleted" event.
+ * Then invoke this callback.
+ *
+ * if (handler->cbs.deleted.cb)
+ * handler->cbs.deleted.cb(handler, ret, handler->cbs.deleted.data);
+ */
+}
+
+int dbox_destroy_lock_file(struct dynamicbox_common *common, int is_gbar)
+{
+ if (is_gbar) {
+ if (!common->gbar.lock) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ if (close(common->gbar.lock_fd) < 0) {
+ ErrPrint("close: %s\n", strerror(errno));
+ }
+ common->gbar.lock_fd = -1;
+
+ if (unlink(common->gbar.lock) < 0) {
+ ErrPrint("unlink: %s\n", strerror(errno));
+ }
+
+ free(common->gbar.lock);
+ common->gbar.lock = NULL;
+ } else {
+ if (!common->dbox.lock) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ if (close(common->dbox.lock_fd) < 0) {
+ ErrPrint("close: %s\n", strerror(errno));
+ }
+ common->dbox.lock_fd = -1;
+
+ if (unlink(common->dbox.lock) < 0) {
+ ErrPrint("unlink: %s\n", strerror(errno));
+ }
+
+ free(common->dbox.lock);
+ common->dbox.lock = NULL;
+ }
+
+ return DBOX_STATUS_ERROR_NONE;
+}
+
+int dbox_create_lock_file(struct dynamicbox_common *common, int is_gbar)
+{
+ int len;
+ char *file;
+
+ len = strlen(common->id);
+ file = malloc(len + 20);
+ if (!file) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
+
+ snprintf(file, len + 20, "%s.%s.lck", util_uri_to_path(common->id), is_gbar ? "pd" : "lb");
+
+ if (is_gbar) {
+ common->gbar.lock_fd = open(file, O_RDONLY);
+ if (common->gbar.lock_fd < 0) {
+ ErrPrint("open: %s\n", strerror(errno));
+ free(file);
+ return DBOX_STATUS_ERROR_IO_ERROR;
+ }
+
+ common->gbar.lock = file;
+ } else {
+ common->dbox.lock_fd = open(file, O_RDONLY);
+ if (common->dbox.lock_fd < 0) {
+ ErrPrint("open: %s\n", strerror(errno));
+ free(file);
+ return DBOX_STATUS_ERROR_IO_ERROR;
+ }
+
+ common->dbox.lock = file;
+ }
+
+ return DBOX_STATUS_ERROR_NONE;
+}
+
+struct dynamicbox_common *dbox_create_common_handle(struct dynamicbox *handle, const char *pkgname, const char *cluster, const char *category)
+{
+ struct dynamicbox_common *common;
+
+ common = calloc(1, sizeof(*common));
+ if (!common) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return NULL;
+ }
+
+ common->pkgname = strdup(pkgname);
+ if (!common->pkgname) {
+ free(common);
+ return NULL;
+ }
+
+ common->cluster = strdup(cluster);
+ if (!common->cluster) {
+ ErrPrint("Error: %s\n", strerror(errno));
+ free(common->pkgname);
+ free(common);
+ return NULL;
+ }
+
+ common->category = strdup(category);
+ if (!common->category) {
+ ErrPrint("Error: %s\n", strerror(errno));
+ free(common->cluster);
+ free(common->pkgname);
+ free(common);
+ return NULL;
+ }
+
+ /* Data provider will set this */
+ common->dbox.type = _DBOX_TYPE_FILE;
+ common->gbar.type = _GBAR_TYPE_SCRIPT;
+
+ /* Used for handling the mouse event on a box */
+ common->dbox.mouse_event = 0;
+
+ /* Cluster infomration is not determined yet */
+ common->nr_of_sizes = 0x01;
+
+ common->timestamp = util_timestamp();
+ common->is_user = 1;
+ common->delete_type = DBOX_DELETE_PERMANENTLY;
+ common->gbar.lock = NULL;
+ common->gbar.lock_fd = -1;
+ common->dbox.lock = NULL;
+ common->dbox.lock_fd = -1;
+
+ common->state = CREATE;
+ common->visible = DBOX_SHOW;
+
+ s_info.dynamicbox_common_list = dlist_append(s_info.dynamicbox_common_list, common);
+ return common;
+}
+
+int dbox_destroy_common_handle(struct dynamicbox_common *common)
+{
+ dlist_remove_data(s_info.dynamicbox_common_list, common);
+
+ common->state = DESTROYED;
+
+ if (common->filename) {
+ (void)util_unlink(common->filename);
+ }
+
+ free(common->cluster);
+ free(common->category);
+ free(common->id);
+ free(common->pkgname);
+ free(common->filename);
+ free(common->dbox.auto_launch);
+ free(common->alt.icon);
+ free(common->alt.name);
+
+ if (common->dbox.fb) {
+ fb_destroy(common->dbox.fb);
+ common->dbox.fb = NULL;
+ }
+
+ if (common->gbar.fb) {
+ fb_destroy(common->gbar.fb);
+ common->gbar.fb = NULL;
+ }
+
+ return 0;
+}
+
+int dbox_common_ref(struct dynamicbox_common *common, struct dynamicbox *handle)
+{
+ common->dynamicbox_list = dlist_append(common->dynamicbox_list, handle);
+ common->refcnt++;
+
+ return common->refcnt;
+}
+
+int dbox_common_unref(struct dynamicbox_common *common, struct dynamicbox *handle)
+{
+ int refcnt;
+ dlist_remove_data(common->dynamicbox_list, handle);
+ refcnt = --common->refcnt;
+
+ return refcnt;
+}
+
+int dbox_set_group(struct dynamicbox_common *common, const char *cluster, const char *category)
+{
+ void *pc = NULL;
+ void *ps = NULL;
+
+ if (cluster) {
+ pc = strdup(cluster);
+ if (!pc) {
+ ErrPrint("Heap: %s (cluster: %s)\n", strerror(errno), cluster);
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
+ }
+
+ if (category) {
+ ps = strdup(category);
+ if (!ps) {
+ ErrPrint("Heap: %s (category: %s)\n", strerror(errno), category);
+ free(pc);
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
+ }
+
+ if (common->cluster) {
+ free(common->cluster);
+ }
+
+ if (common->category) {
+ free(common->category);
+ }
+
+ common->cluster = pc;
+ common->category = ps;
+
+ return DBOX_STATUS_ERROR_NONE;
+}
+
+void dbox_set_size(struct dynamicbox_common *common, int w, int h)
+{
+ int size_type;
+
+ common->dbox.width = w;
+ common->dbox.height = h;
+
+ size_type = dynamicbox_service_size_type(w, h);
+ if (size_type != DBOX_SIZE_TYPE_UNKNOWN) {
+ common->dbox.mouse_event = dynamicbox_service_mouse_event(common->pkgname, size_type);
+ }
+}
+
+void dbox_set_update_mode(struct dynamicbox_common *common, int active_mode)
+{
+ common->is_active_update = active_mode;
+}
+
+void dbox_set_gbarsize(struct dynamicbox_common *common, int w, int h)
+{
+ common->gbar.width = w;
+ common->gbar.height = h;
+}
+
+void dbox_set_default_gbarsize(struct dynamicbox_common *common, int w, int h)
+{
+ common->gbar.default_width = w;
+ common->gbar.default_height = h;
+}
+
+void dbox_invoke_fault_handler(enum dynamicbox_fault_type event, const char *pkgname, const char *file, const char *func)
+{
+ struct dlist *l;
+ struct dlist *n;
+ struct fault_info *info;
+
+ s_info.fault_state = INFO_STATE_CALLBACK_IN_PROCESSING;
+
+ dlist_foreach_safe(s_info.fault_list, l, n, info) {
+ if (!info->is_deleted && info->handler(event, pkgname, file, func, info->user_data) == EXIT_FAILURE) {
+ info->is_deleted = 1;
+ }
+
+ if (info->is_deleted) {
+ s_info.fault_list = dlist_remove(s_info.fault_list, l);
+ free(info);
+ }
+ }
+
+ s_info.fault_state &= ~INFO_STATE_CALLBACK_IN_PROCESSING;
+}
+
+void dbox_invoke_event_handler(struct dynamicbox *handler, enum dynamicbox_event_type event)
+{
+ struct dlist *l;
+ struct dlist *n;
+ struct event_info *info;
+
+ if (event == DBOX_EVENT_DBOX_UPDATED && handler->common->refcnt > 1) {
+ if (handler->visible != DBOX_SHOW) {
+ DbgPrint("Update requested(pending) - %s\n", handler->common->pkgname);
+ handler->paused_updating++;
+ return;
+ } else {
+ handler->paused_updating = 0;
+ }
+ }
+
+ s_info.event_state = INFO_STATE_CALLBACK_IN_PROCESSING;
+
+ dlist_foreach_safe(s_info.event_list, l, n, info) {
+ if (!info->is_deleted && info->handler(handler, event, info->user_data) == EXIT_FAILURE) {
+ DbgPrint("Event handler returns EXIT_FAILURE\n");
+ info->is_deleted = 1;
+ }
+
+ if (info->is_deleted) {
+ s_info.event_list = dlist_remove(s_info.event_list, l);
+ free(info);
+ }
+ }
+
+ s_info.event_state &= ~INFO_STATE_CALLBACK_IN_PROCESSING;
+}
+
+struct dynamicbox_common *dbox_find_common_handle(const char *pkgname, const char *id)
+{
+ struct dlist *l;
+ struct dynamicbox_common *common;
+
+ dlist_foreach(s_info.dynamicbox_common_list, l, common) {
+ if (!common->id) {
+ continue;
+ }
+
+ if (!strcmp(common->pkgname, pkgname) && !strcmp(common->id, id)) {
+ return common;
+ }
+ }
+
+ return NULL;
+}
+
+struct dynamicbox_common *dbox_find_common_handle_by_timestamp(double timestamp)
+{
+ struct dlist *l;
+ struct dynamicbox_common *common;
+
+ dlist_foreach(s_info.dynamicbox_common_list, l, common) {
+ if (common->timestamp == timestamp) {
+ return common;
+ }
+ }
+
+ return NULL;
+}
+
+struct dynamicbox *dbox_new_dynamicbox(const char *pkgname, const char *id, double timestamp, const char *cluster, const char *category)
+{
+ struct dynamicbox *handler;
+
+ handler = calloc(1, sizeof(*handler));
+ if (!handler) {
+ ErrPrint("Failed to create a new dynamicbox\n");
+ return NULL;
+ }
+
+ handler->common = dbox_create_common_handle(handler, pkgname, cluster, category);
+ if (!handler->common) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ free(handler);
+ return NULL;
+ }
+
+ dbox_common_ref(handler->common, handler);
+ dbox_set_id(handler->common, id);
+ handler->common->timestamp = timestamp;
+ handler->common->state = CREATE;
+ handler->visible = DBOX_SHOW;
+ s_info.dynamicbox_list = dlist_append(s_info.dynamicbox_list, handler);
+
+ return dbox_ref(handler);
+}
+
+int dbox_delete_all(void)
+{
+ struct dlist *l;
+ struct dlist *n;
+ struct dynamicbox *handler;
+
+ dlist_foreach_safe(s_info.dynamicbox_list, l, n, handler) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
+ }
+
+ return DBOX_STATUS_ERROR_NONE;
+}
+
+int dbox_set_content(struct dynamicbox_common *common, const char *content)
+{
+ char *pc = NULL;
+
+ if (content) {
+ pc = strdup(content);
+ if (!pc) {
+ ErrPrint("heap: %s [%s]\n", strerror(errno), content);
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
+ }
+
+ free(common->content);
+ common->content = pc;
+ return DBOX_STATUS_ERROR_NONE;
+}
+
+int dbox_set_title(struct dynamicbox_common *common, const char *title)
+{
+ char *pt = NULL;
+
+ if (title) {
+ pt = strdup(title);
+ if (!pt) {
+ ErrPrint("heap: %s [%s]\n", strerror(errno), title);
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
+ }
+
+ free(common->title);
+ common->title = pt;
+ return DBOX_STATUS_ERROR_NONE;
+}
+
+void dbox_set_size_list(struct dynamicbox_common *common, int size_list)
+{
+ common->dbox.size_list = size_list;
+}
+
+void dbox_set_auto_launch(struct dynamicbox_common *common, const char *auto_launch)
+{
+ char *pa = NULL;
+
+ if (!auto_launch || !strlen(auto_launch)) {
+ return;
+ }
+
+ pa = strdup(auto_launch);
+ if (!pa) {
+ ErrPrint("heap: %s, [%s]\n", strerror(errno), auto_launch);
+ return;
+ }
+
+ free(common->dbox.auto_launch);
+ common->dbox.auto_launch = pa;
+}
+
+void dbox_set_priority(struct dynamicbox_common *common, double priority)
+{
+ common->dbox.priority = priority;
+}
+
+void dbox_set_id(struct dynamicbox_common *common, const char *id)
+{
+ char *pi = NULL;
+
+ if (id) {
+ pi = strdup(id);
+ if (!pi) {
+ ErrPrint("heap: %s [%s]\n", strerror(errno), pi);
+ return;
+ }
+ }
+
+ free(common->id);
+ common->id = pi;
+}
+
+void dbox_set_filename(struct dynamicbox_common *common, const char *filename)
+{
+ if (common->filename) {
+ if (common->dbox.type == _DBOX_TYPE_FILE || common->dbox.type == _DBOX_TYPE_TEXT) {
+ if (common->filename[0] && unlink(common->filename) < 0) {
+ ErrPrint("unlink: %s (%s)\n", strerror(errno), common->filename);
+ }
+ }
+
+ free(common->filename);
+ }
+
+ common->filename = strdup(filename);
+ if (!common->filename) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+}
+
+void dbox_set_alt_icon(struct dynamicbox_common *common, const char *icon)
+{
+ char *_icon = NULL;
+
+ if (icon && strlen(icon)) {
+ _icon = strdup(icon);
+ if (!_icon) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+ }
+
+ free(common->alt.icon);
+ common->alt.icon = _icon;
+}
+
+void dbox_set_alt_name(struct dynamicbox_common *common, const char *name)
+{
+ char *_name = NULL;
+
+ if (name && strlen(name)) {
+ _name = strdup(name);
+ if (!_name) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+ }
+
+ free(common->alt.name);
+ common->alt.name = _name;
+}
+
+int dbox_set_dbox_fb(struct dynamicbox_common *common, const char *filename)
+{
+ struct fb_info *fb;
+
+ if (!common) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ fb = common->dbox.fb;
+ if (fb && !strcmp(fb_id(fb), filename)) { /*!< BUFFER is not changed, */
+ return DBOX_STATUS_ERROR_NONE;
+ }
+
+ common->dbox.fb = NULL;
+
+ if (!filename || filename[0] == '\0') {
+ if (fb) {
+ fb_destroy(fb);
+ }
+ return DBOX_STATUS_ERROR_NONE;
+ }
+
+ common->dbox.fb = fb_create(filename, common->dbox.width, common->dbox.height);
+ if (!common->dbox.fb) {
+ ErrPrint("Faield to create a FB\n");
+ if (fb) {
+ fb_destroy(fb);
+ }
+ return DBOX_STATUS_ERROR_FAULT;
+ }
+
+ if (fb) {
+ fb_destroy(fb);
+ }
+
+ return DBOX_STATUS_ERROR_NONE;
+}
+
+int dbox_set_gbar_fb(struct dynamicbox_common *common, const char *filename)
+{
+ struct fb_info *fb;
+
+ if (!common || common->state != CREATE) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ fb = common->gbar.fb;
+ if (fb && !strcmp(fb_id(fb), filename)) {
+ /* BUFFER is not changed, just update the content */
+ return DBOX_STATUS_ERROR_EXIST;
+ }
+ common->gbar.fb = NULL;
+
+ if (!filename || filename[0] == '\0') {
+ if (fb) {
+ fb_destroy(fb);
+ }
+ return DBOX_STATUS_ERROR_NONE;
+ }
+
+ common->gbar.fb = fb_create(filename, common->gbar.width, common->gbar.height);
+ if (!common->gbar.fb) {
+ ErrPrint("Failed to create a FB\n");
+ if (fb) {
+ fb_destroy(fb);
+ }
+ return DBOX_STATUS_ERROR_FAULT;
+ }
+
+ if (fb) {
+ fb_destroy(fb);
+ }
+ return DBOX_STATUS_ERROR_NONE;
+}
+
+struct fb_info *dbox_get_dbox_fb(struct dynamicbox_common *common)
+{
+ return common->dbox.fb;
+}
+
+struct fb_info *dbox_get_gbar_fb(struct dynamicbox_common *common)
+{
+ return common->gbar.fb;
+}
+
+void dbox_set_user(struct dynamicbox_common *common, int user)
+{
+ common->is_user = user;
+}
+
+void dbox_set_pinup(struct dynamicbox_common *common, int pinup_supported)
+{
+ common->dbox.pinup_supported = pinup_supported;
+}
+
+void dbox_set_text_dbox(struct dynamicbox_common *common)
+{
+ common->dbox.type = _DBOX_TYPE_TEXT;
+}
+
+void dbox_set_text_gbar(struct dynamicbox_common *common)
+{
+ common->gbar.type = _GBAR_TYPE_TEXT;
+}
+
+int dbox_text_dbox(struct dynamicbox_common *common)
+{
+ return common->dbox.type == _DBOX_TYPE_TEXT;
+}
+
+int dbox_text_gbar(struct dynamicbox_common *common)
+{
+ return common->gbar.type == _GBAR_TYPE_TEXT;
+}
+
+void dbox_set_period(struct dynamicbox_common *common, double period)
+{
+ common->dbox.period = period;
+}
+
+struct dynamicbox *dbox_ref(struct dynamicbox *handler)
+{
+ if (!handler) {
+ return NULL;
+ }
+
+ handler->refcnt++;
+ return handler;
+}
+
+struct dynamicbox *dbox_unref(struct dynamicbox *handler, int destroy_common)
+{
+ if (!handler) {
+ return NULL;
+ }
+
+ handler->refcnt--;
+ if (handler->refcnt > 0) {
+ return handler;
+ }
+
+ if (handler->cbs.created.cb) {
+ handler->cbs.created.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.created.data);
+ handler->cbs.created.cb = NULL;
+ handler->cbs.created.data = NULL;
+ }
+
+ if (handler->cbs.deleted.cb) {
+ handler->cbs.deleted.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.deleted.data);
+ handler->cbs.deleted.cb = NULL;
+ handler->cbs.deleted.data = NULL;
+ }
+
+ if (handler->cbs.pinup.cb) {
+ handler->cbs.pinup.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.pinup.data);
+ handler->cbs.pinup.cb = NULL;
+ handler->cbs.pinup.data = NULL;
+ }
+
+ if (handler->cbs.group_changed.cb) {
+ handler->cbs.group_changed.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.group_changed.data);
+ handler->cbs.group_changed.cb = NULL;
+ handler->cbs.group_changed.data = NULL;
+ }
+
+ if (handler->cbs.period_changed.cb) {
+ handler->cbs.period_changed.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.period_changed.data);
+ handler->cbs.period_changed.cb = NULL;
+ handler->cbs.period_changed.data = NULL;
+ }
+
+ if (handler->cbs.size_changed.cb) {
+ handler->cbs.size_changed.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.size_changed.data);
+ handler->cbs.size_changed.cb = NULL;
+ handler->cbs.size_changed.data = NULL;
+ }
+
+ if (handler->cbs.gbar_created.cb) {
+ handler->cbs.gbar_created.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.gbar_created.data);
+ handler->cbs.gbar_created.cb = NULL;
+ handler->cbs.gbar_created.data = NULL;
+ }
+
+ if (handler->cbs.gbar_destroyed.cb) {
+ handler->cbs.gbar_destroyed.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.gbar_destroyed.data);
+ handler->cbs.gbar_destroyed.cb = NULL;
+ handler->cbs.gbar_destroyed.data = NULL;
+ }
+
+ if (handler->cbs.update_mode.cb) {
+ handler->cbs.update_mode.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.update_mode.data);
+ handler->cbs.update_mode.cb = NULL;
+ handler->cbs.update_mode.data = NULL;
+ }
+
+ if (handler->cbs.access_event.cb) {
+ handler->cbs.access_event.cb(handler, DBOX_ACCESS_STATUS_ERROR, handler->cbs.access_event.data);
+ handler->cbs.access_event.cb = NULL;
+ handler->cbs.access_event.data = NULL;
+ }
+
+ if (handler->cbs.key_event.cb) {
+ handler->cbs.key_event.cb(handler, DBOX_KEY_STATUS_ERROR, handler->cbs.key_event.data);
+ handler->cbs.key_event.cb = NULL;
+ handler->cbs.key_event.data = NULL;
+ }
+
+ dlist_remove_data(s_info.dynamicbox_list, handler);
+
+ handler->state = DESTROYED;
+ if (dbox_common_unref(handler->common, handler) == 0) {
+ if (destroy_common) {
+ /*!
+ * \note
+ * Lock file should be deleted after all callbacks are processed.
+ */
+ dbox_destroy_lock_file(handler->common, 0);
+ dbox_destroy_common_handle(handler->common);
+ }
+ }
+ free(handler);
+ DbgPrint("Handler is released\n");
+ return NULL;
+}
+
+int dbox_send_delete(struct dynamicbox *handler, int type, dynamicbox_ret_cb_t cb, void *data)
+{
+ struct packet *packet;
+ struct cb_info *cbinfo;
+ int ret;
+
+ if (handler->common->request.deleted) {
+ ErrPrint("Already in-progress\n");
+ if (cb) {
+ cb(handler, DBOX_STATUS_ERROR_NONE, data);
+ }
+ return DBOX_STATUS_ERROR_BUSY;
+ }
+
+ if (!cb) {
+ cb = default_delete_cb;
+ }
+
+ packet = packet_create("delete", "ssid", handler->common->pkgname, handler->common->id, type, handler->common->timestamp);
+ if (!packet) {
+ ErrPrint("Failed to build a param\n");
+ if (cb) {
+ cb(handler, DBOX_STATUS_ERROR_FAULT, data);
+ }
+
+ return DBOX_STATUS_ERROR_FAULT;
+ }
+
+ cbinfo = dbox_create_cb_info(cb, data);
+ if (!cbinfo) {
+ packet_destroy(packet);
+ ErrPrint("Failed to create cbinfo\n");
+ if (cb) {
+ cb(handler, DBOX_STATUS_ERROR_FAULT, data);
+ }
+
+ return DBOX_STATUS_ERROR_FAULT;
+ }
+
+ ret = master_rpc_async_request(handler, packet, 0, del_ret_cb, cbinfo);
+ if (ret < 0) {
+ /*!
+ * Packet is destroyed by master_rpc_async_request.
+ */
+ dbox_destroy_cb_info(cbinfo);
+
+ if (cb) {
+ cb(handler, DBOX_STATUS_ERROR_FAULT, data);
+ }
+ } else {
+ handler->common->request.deleted = 1;
+ }
+
+ return ret;
+}
+
+int dbox_sync_dbox_fb(struct dynamicbox_common *common)
+{
+ int ret;
+
+ if (fb_type(dbox_get_dbox_fb(common)) == BUFFER_TYPE_FILE && common->dbox.lock_fd >= 0) {
+ (void)dbox_fb_lock(common->dbox.lock_fd);
+ ret = fb_sync(dbox_get_dbox_fb(common));
+ (void)dbox_fb_unlock(common->dbox.lock_fd);
+ } else {
+ ret = fb_sync(dbox_get_dbox_fb(common));
+ }
+
+ return ret;
+}
+
+int dbox_sync_gbar_fb(struct dynamicbox_common *common)
+{
+ int ret;
+
+ if (fb_type(dbox_get_gbar_fb(common)) == BUFFER_TYPE_FILE && common->gbar.lock_fd >= 0) {
+ (void)dbox_fb_lock(common->gbar.lock_fd);
+ ret = fb_sync(dbox_get_gbar_fb(common));
+ (void)dbox_fb_unlock(common->gbar.lock_fd);
+ } else {
+ ret = fb_sync(dbox_get_gbar_fb(common));
+ }
+
+ return ret;
+}
+
+int dbox_fb_lock(int fd)
+{
+ struct flock flock;
+ int ret;
+
+ flock.l_type = F_RDLCK;
+ flock.l_whence = SEEK_SET;
+ flock.l_start = 0;
+ flock.l_len = 0;
+ flock.l_pid = getpid();
+
+ do {
+ ret = fcntl(fd, F_SETLKW, &flock);
+ if (ret < 0) {
+ ret = errno;
+ ErrPrint("fcntl: %s\n", strerror(errno));
+ }
+ } while (ret == EINTR);
+
+ return ret;
+}
+
+int dbox_fb_unlock(int fd)
+{
+ struct flock flock;
+ int ret;
+
+ flock.l_type = F_UNLCK;
+ flock.l_whence = SEEK_SET;
+ flock.l_start = 0;
+ flock.l_len = 0;
+ flock.l_pid = getpid();
+
+ do {
+ ret = fcntl(fd, F_SETLKW, &flock);
+ if (ret < 0) {
+ ret = errno;
+ ErrPrint("fcntl: %s\n", strerror(errno));
+ }
+ } while (ret == EINTR);
+
+ return ret;
+}
+
+struct dynamicbox_common *dbox_find_sharable_common_handle(const char *pkgname, const char *content, int w, int h, const char *cluster, const char *category)
+{
+ struct dlist *l;
+ struct dynamicbox_common *common;
+
+ if (!conf_shared_content()) {
+ /*!
+ * Shared content option is turnned off.
+ */
+ return NULL;
+ }
+
+ dlist_foreach(s_info.dynamicbox_common_list, l, common) {
+ if (common->state != CREATE) {
+ continue;
+ }
+
+ if (strcmp(common->pkgname, pkgname)) {
+ continue;
+ }
+
+ if (strcmp(common->cluster, cluster)) {
+ DbgPrint("Cluster mismatched\n");
+ continue;
+ }
+
+ if (strcmp(common->category, category)) {
+ DbgPrint("Category mismatched\n");
+ continue;
+ }
+
+ if (common->content && content) {
+ if (strcmp(common->content, content)) {
+ DbgPrint("%s Content ([%s] <> [%s])\n", common->pkgname, common->content, content);
+ continue;
+ }
+ } else {
+ int c1_len;
+ int c2_len;
+
+ /*!
+ * \note
+ * We assumes "" (ZERO length string) to NULL
+ */
+ c1_len = common->content ? strlen(common->content) : 0;
+ c2_len = content ? strlen(content) : 0;
+ if (c1_len != c2_len) {
+ DbgPrint("%s Content %p <> %p\n", common->pkgname, common->content, content);
+ continue;
+ }
+ }
+
+ if (common->request.size_changed) {
+ DbgPrint("Changing size\n");
+ /*!
+ * \note
+ * Do not re-use resizing instance.
+ * We will not use predicted size.
+ */
+ continue;
+ }
+
+ if (common->request.created) {
+ DbgPrint("Creating now but re-use it (%s)\n", common->pkgname);
+ }
+
+ if (common->dbox.width != w || common->dbox.height != h) {
+ DbgPrint("Size mismatched\n");
+ continue;
+ }
+
+ DbgPrint("common handle is found: %p\n", common);
+ return common;
+ }
+
+ return NULL;
+}
+
+struct dynamicbox *dbox_find_dbox_in_show(struct dynamicbox_common *common)
+{
+ struct dlist *l;
+ struct dynamicbox *item;
+
+ dlist_foreach(common->dynamicbox_list, l, item) {
+ if (item->visible == DBOX_SHOW) {
+ DbgPrint("%s visibility is not changed\n", common->pkgname);
+ return item;
+ }
+ }
+
+ return NULL;
+}
+
+struct dynamicbox *dbox_get_dbox_nth(struct dynamicbox_common *common, int nth)
+{
+ struct dynamicbox *item;
+ struct dlist *l;
+
+ l = dlist_nth(common->dynamicbox_list, nth);
+ item = dlist_data(l);
+
+ return item;
+}
+
+int dbox_add_event_handler(int (*dbox_cb)(struct dynamicbox *, enum dynamicbox_event_type, void *), void *data)
+{
+ struct event_info *info;
+ info = malloc(sizeof(*info));
+ if (!info) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
+
+ info->handler = dbox_cb;
+ info->user_data = data;
+ info->is_deleted = 0;
+
+ s_info.event_list = dlist_append(s_info.event_list, info);
+ return DBOX_STATUS_ERROR_NONE;
+}
+
+void *dbox_remove_event_handler(int (*dbox_cb)(struct dynamicbox *, enum dynamicbox_event_type, void *))
+{
+ struct event_info *info;
+ struct dlist *l;
+
+ dlist_foreach(s_info.event_list, l, info) {
+ if (info->handler == dbox_cb) {
+ void *data;
+
+ data = info->user_data;
+
+ if (s_info.event_state == INFO_STATE_CALLBACK_IN_PROCESSING) {
+ info->is_deleted = 1;
+ } else {
+ s_info.event_list = dlist_remove(s_info.event_list, l);
+ free(info);
+ }
+
+ return data;
+ }
+ }
+
+ return NULL;
+}
+
+int dbox_add_fault_handler(int (*dbox_cb)(enum dynamicbox_fault_type, const char *, const char *, const char *, void *), void *data)
+{
+ struct fault_info *info;
+ info = malloc(sizeof(*info));
+ if (!info) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
+
+ info->handler = dbox_cb;
+ info->user_data = data;
+ info->is_deleted = 0;
+
+ s_info.fault_list = dlist_append(s_info.fault_list, info);
+ return DBOX_STATUS_ERROR_NONE;
+}
+
+void *dbox_remove_fault_handler(int (*dbox_cb)(enum dynamicbox_fault_type, const char *, const char *, const char *, void *))
+{
+ struct fault_info *info;
+ struct dlist *l;
+
+ dlist_foreach(s_info.fault_list, l, info) {
+ if (info->handler == dbox_cb) {
+ void *data;
+
+ data = info->user_data;
+
+ if (s_info.fault_state == INFO_STATE_CALLBACK_IN_PROCESSING) {
+ info->is_deleted = 1;
+ } else {
+ s_info.fault_list = dlist_remove(s_info.fault_list, l);
+ free(info);
+ }
+
+ return data;
+ }
+ }
+
+ return NULL;
+}
+
+struct cb_info *dbox_create_cb_info(dynamicbox_ret_cb_t cb, void *data)
+{
+ struct cb_info *info;
+
+ info = malloc(sizeof(*info));
+ if (!info) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return NULL;
+ }
+
+ info->cb = cb;
+ info->data = data;
+ return info;
+}
+
+void dbox_destroy_cb_info(struct cb_info *info)
+{
+ free(info);
+}
+
+/* End of a file */
buffer = info->buffer;
if (!buffer) { /* Ignore this sync request */
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
if (buffer->state != CREATED) {
ErrPrint("Invalid state of a FB\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (buffer->type != BUFFER_TYPE_FILE) {
ErrPrint("Invalid buffer\n");
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
fd = open(util_uri_to_path(info->id), O_RDONLY);
*
* and then update it after it gots update events
*/
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
if (read(fd, buffer->data, info->bufsz) != info->bufsz) {
*
* and then update it after it gots update events
*/
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
if (close(fd) < 0) {
ErrPrint("close: %s\n", strerror(errno));
}
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
int fb_sync(struct fb_info *info)
{
if (!info) {
ErrPrint("FB Handle is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!info->id || info->id[0] == '\0') {
DbgPrint("Ingore sync\n");
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
} else if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
} else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) {
/* No need to do sync */
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
struct fb_info *fb_create(const char *id, int w, int h)
free(info);
return NULL;
} else {
- info->handle = LB_STATUS_ERROR_INVALID;
+ info->handle = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
info->bufsz = 0;
{
if (!info) {
ErrPrint("Handle is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (info->buffer) {
free(info->id);
free(info);
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
int fb_is_created(struct fb_info *info)
if (!data) {
ErrPrint("buffer data == NIL\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
buffer = container_of(data, struct buffer, data);
if (buffer->state != CREATED) {
ErrPrint("Invalid handle\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
switch (buffer->type) {
break;
}
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
int fb_refcnt(void *data)
int ret;
if (!data) {
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
buffer = container_of(data, struct buffer, data);
if (buffer->state != CREATED) {
ErrPrint("Invalid handle\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
switch (buffer->type) {
case BUFFER_TYPE_SHM:
if (shmctl(buffer->refcnt, IPC_STAT, &buf) < 0) {
ErrPrint("Error: %s\n", strerror(errno));
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
ret = buf.shm_nattch;
break;
case BUFFER_TYPE_PIXMAP:
default:
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
break;
}
{
if (!info) {
ErrPrint("Handle is not valid\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
*w = info->w;
*h = info->h;
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
int fb_size(struct fb_info *info)
#include "debug.h"
#include "dlist.h"
-#include "livebox.h"
-#include "livebox_internal.h"
+#include "dynamicbox.h"
+#include "dynamicbox_internal.h"
#include "master_rpc.h"
#include "client.h"
#include "util.h"
struct command {
int ttl;
struct packet *packet;
- struct livebox *handler;
- void (*ret_cb)(struct livebox *handler, const struct packet *result, void *data);
+ struct dynamicbox *handler;
+ void (*ret_cb)(struct dynamicbox *handler, const struct packet *result, void *data);
void *data;
enum {
TYPE_ACK,
return command;
}
-static inline struct command *create_command(struct livebox *handler, struct packet *packet)
+static inline struct command *create_command(struct dynamicbox *handler, struct packet *packet)
{
struct command *command;
return NULL;
}
- command->handler = lb_ref(handler);
+ command->handler = dbox_ref(handler);
command->packet = packet_ref(packet);
return command;
}
static inline void destroy_command(struct command *command)
{
packet_unref(command->packet);
- lb_unref(command->handler, 1);
+ dbox_unref(command->handler, 1);
free(command);
}
* \note
* "handler" could be NULL
*/
-int master_rpc_async_request(struct livebox *handler, struct packet *packet, int urgent, void (*ret_cb)(struct livebox *handler, const struct packet *result, void *data), void *data)
+int master_rpc_async_request(struct dynamicbox *handler, struct packet *packet, int urgent, void (*ret_cb)(struct dynamicbox *handler, const struct packet *result, void *data), void *data)
{
struct command *command;
return DBOX_STATUS_ERROR_NONE;
}
-int master_rpc_request_only(struct livebox *handler, struct packet *packet)
+int master_rpc_request_only(struct dynamicbox *handler, struct packet *packet)
{
struct command *command;
return length <= 0 ? name : name + length + (name[length] == '/');
}
-static inline int check_native_livebox(const char *pkgname)
-{
- int len;
- char *path;
-
- len = strlen(pkgname) * 2;
- len += strlen("/opt/usr/live/%s/libexec/liblive-%s.so");
-
- path = malloc(len + 1);
- if (!path) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- }
-
- snprintf(path, len, "/opt/usr/live/%s/libexec/liblive-%s.so", pkgname, pkgname);
- if (access(path, F_OK | R_OK) != 0) {
- ErrPrint("%s is not a valid package\n", pkgname);
- free(path);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- free(path);
- return 0;
-}
-
-static inline int check_web_livebox(const char *pkgname)
-{
- int len;
- char *path;
-
- len = strlen(pkgname) * 2;
- len += strlen("/opt/usr/apps/%s/res/wgt/livebox/index.html");
-
- path = malloc(len + 1);
- if (!path) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- }
-
- snprintf(path, len, "/opt/usr/apps/%s/res/wgt/livebox/index.html", pkgname);
- if (access(path, F_OK | R_OK) != 0) {
- ErrPrint("%s is not a valid package\n", pkgname);
- free(path);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- free(path);
- return 0;
-}
-
-int util_validate_livebox_package(const char *pkgname)
-{
- if (!pkgname) {
- ErrPrint("Invalid argument\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- if (!check_native_livebox(pkgname) || !check_web_livebox(pkgname)) {
- return 0;
- }
-
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
-}
-
const char *util_uri_to_path(const char *uri)
{
int len;