summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/instance.h29
-rw-r--r--include/script_handler.h1
-rw-r--r--packaging/data-provider-master.spec2
-rw-r--r--pkgmgr_livebox/livebox.xml14
-rw-r--r--pkgmgr_livebox/src/service_register.c185
-rw-r--r--src/instance.c277
-rw-r--r--src/script_handler.c63
-rw-r--r--src/server.c783
-rw-r--r--util_liveinfo/src/liveinfo.c2
9 files changed, 1130 insertions, 226 deletions
diff --git a/include/instance.h b/include/instance.h
index dc50fc1..a391d1e 100644
--- a/include/instance.h
+++ b/include/instance.h
@@ -144,14 +144,6 @@ extern int instance_need_slave(struct inst_info *inst);
extern void instance_set_lb_info(struct inst_info *inst, int w, int h, double priority, const char *content, const char *title);
extern void instance_set_pd_info(struct inst_info *inst, int w, int h);
-extern void instance_pd_updated(const char *pkgname, const char *id, const char *descfile);
-extern void instance_lb_updated(const char *pkgname, const char *id);
-extern void instance_lb_updated_by_instance(struct inst_info *inst);
-extern void instance_pd_updated_by_instance(struct inst_info *inst, const char *descfile);
-
-extern int instance_client_pd_destroyed(struct inst_info *inst, int status);
-extern int instance_client_pd_created(struct inst_info *inst, int status);
-
extern int instance_set_pinup(struct inst_info *inst, int pinup);
extern int instance_resize(struct inst_info *inst, int w, int h);
extern int instance_hold_scroll(struct inst_info *inst, int seize);
@@ -162,6 +154,8 @@ extern int instance_signal_emit(struct inst_info *inst, const char *emission, co
extern int instance_change_group(struct inst_info *inst, const char *cluster, const char *category);
extern int instance_set_visible_state(struct inst_info *inst, enum livebox_visible_state state);
extern enum livebox_visible_state instance_visible_state(struct inst_info *inst);
+extern int instance_set_update_mode(struct inst_info *inst, int active_update);
+extern int instance_active_update(struct inst_info *inst);
/*!
* \note
@@ -207,6 +201,25 @@ extern int instance_slave_close_pd(struct inst_info *inst, struct client_node *c
extern int instance_freeze_updator(struct inst_info *inst);
extern int instance_thaw_updator(struct inst_info *inst);
+extern int instance_send_access_event(struct inst_info *inst, int status);
+
+extern int instance_lb_update_begin(struct inst_info *inst, double priority, const char *content, const char *title);
+extern int instance_lb_update_end(struct inst_info *inst);
+
+extern int instance_pd_update_begin(struct inst_info *inst);
+extern int instance_pd_update_end(struct inst_info *inst);
+
+extern void instance_pd_updated(const char *pkgname, const char *id, const char *descfile);
+extern void instance_lb_updated(const char *pkgname, const char *id);
+extern void instance_lb_updated_by_instance(struct inst_info *inst);
+extern void instance_pd_updated_by_instance(struct inst_info *inst, const char *descfile);
+
+extern int instance_client_pd_destroyed(struct inst_info *inst, int status);
+extern int instance_client_pd_created(struct inst_info *inst, int status);
+
+extern int instance_send_access_status(struct inst_info *inst, int status);
+extern int instance_forward_packet(struct inst_info *inst, struct packet *packet);
+
/*!
* Multiple viewer
*/
diff --git a/include/script_handler.h b/include/script_handler.h
index ee6ec8b..d3d6adf 100644
--- a/include/script_handler.h
+++ b/include/script_handler.h
@@ -25,6 +25,7 @@ extern int script_handler_parse_desc(const char *pkgname, const char *filename,
extern int script_handler_unload(struct script_info *info, int is_pd);
extern int script_handler_load(struct script_info *info, int is_pd);
extern int script_handler_is_loaded(struct script_info *info);
+extern int script_handler_feed_event(struct script_info *info, int event, double timestamp);
extern int script_init(void);
extern int script_fini(void);
diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec
index 4381b68..47b1f3f 100644
--- a/packaging/data-provider-master.spec
+++ b/packaging/data-provider-master.spec
@@ -1,6 +1,6 @@
Name: data-provider-master
Summary: Master service provider for liveboxes.
-Version: 0.20.0
+Version: 0.21.0
Release: 1
Group: HomeTF/Livebox
License: Flora License
diff --git a/pkgmgr_livebox/livebox.xml b/pkgmgr_livebox/livebox.xml
index 0ab09af..e14cdea 100644
--- a/pkgmgr_livebox/livebox.xml
+++ b/pkgmgr_livebox/livebox.xml
@@ -12,14 +12,14 @@
<setup>org.tizen.nicesj</setup>
- <box type="image" mouse_event="false" touch_effect="true">
- <size preview="ABSPATH">1x1</size>
- <size preview="ABSPATH">2x1</size>
- <size>2x2</size>
+ <box type="image" mouse_event="false">
+ <size touch_effect="true" preview="ABSPATH">1x1</size>
+ <size touch_effect="true" preview="ABSPATH">2x1</size>
+ <size touch_effect="true" need_frame="true">2x2</size>
<size>4x1</size>
- <size>4x2</size>
- <size>4x3</size>
- <size>4x4</size>
+ <size need_frame="true">4x2</size>
+ <size touch_effect="false" need_frame="true">4x3</size>
+ <size touch_effect="false">4x4</size>
<!-- Easy home -->
<size>21x21</size>
diff --git a/pkgmgr_livebox/src/service_register.c b/pkgmgr_livebox/src/service_register.c
index 5e212ae..c97464b 100644
--- a/pkgmgr_livebox/src/service_register.c
+++ b/pkgmgr_livebox/src/service_register.c
@@ -66,12 +66,12 @@
*
*
* client
- * +-------+------+---------+-------------+---------+---------+-----------+-------+-------------+--------------+
- * | pkgid | Icon | Name | auto_launch | pd_size | content | nodisplay | setup | mouse_event | touch_effect |
- * +-------+------+---------+-------------+---------+---------+-----------+-------+-------------+--------------+
- * | - | - | - | - | - | - | - | - | - } - |
- * +-------+------+---------+-------------+---------+---------+-----------+-------+-------------+--------------+
- * CREATE TABLE client ( pkgid TEXT PRIMARY KEY NOT NULL, icon TEXT, name TEXT, auto_launch TEXT, pd_size TEXT, content TEXT DEFAULT "default", nodisplay INTEGER, setup TEXT, mouse_event INTEGER, touch_effect INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) )
+ * +-------+------+---------+-------------+---------+---------+-----------+-------+-------------+
+ * | pkgid | Icon | Name | auto_launch | pd_size | content | nodisplay | setup | mouse_event |
+ * +-------+------+---------+-------------+---------+---------+-----------+-------+-------------+
+ * | - | - | - | - | - | - | - | - | - }
+ * +-------+------+---------+-------------+---------+---------+-----------+-------+-------------+
+ * CREATE TABLE client ( pkgid TEXT PRIMARY KEY NOT NULL, icon TEXT, name TEXT, auto_launch TEXT, pd_size TEXT, content TEXT DEFAULT "default", nodisplay INTEGER, setup TEXT, mouse_event, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) )
*
* = auto_launch = UI-APPID
* = pd_size = WIDTHxHEIGHT
@@ -87,12 +87,12 @@
*
*
* box_size
- * +-------+-----------+---------+
- * | pkgid | size_type | preview |
- * +-------+-----------+---------+
- * | - | - | - |
- * +-------+-----------+---------+
- * CREATE TABLE box_size ( pkgid TEXT NOT NULL, size_type INTEGER, preview TEXT, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) )
+ * +-------+-----------+---------+--------------+------------+
+ * | pkgid | size_type | preview | touch_effect | need_frame |
+ * +-------+-----------+---------+--------------+------------+
+ * | - | - | - | - | - |
+ * +-------+-----------+---------+--------------+------------+
+ * CREATE TABLE box_size ( pkgid TEXT NOT NULL, size_type INTEGER, preview TEXT, INTEGER, touch_effect INTEGER, need_frame INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) )
*
* = box_size_list = { WIDTHxHEIGHT; WIDTHxHEIGHT; ... }
*
@@ -170,7 +170,6 @@ struct livebox {
int primary; /* Is this primary livebox? */
int nodisplay;
int mouse_event; /* Mouse event processing option for livebox */
- int touch_effect; /* Touch effect of a livebox */
enum lb_type lb_type;
xmlChar *lb_src;
@@ -178,6 +177,8 @@ struct livebox {
int size_list; /* 1x1, 2x1, 2x2, 4x1, 4x2, 4x3, 4x4 */
xmlChar *preview[11];
+ int touch_effect[11]; /* Touch effect of a livebox */
+ int need_frame[11]; /* Box needs frame which should be cared by viewer */
enum pd_type pd_type;
xmlChar *pd_src;
@@ -601,7 +602,7 @@ static inline int db_create_client(void)
ddl = "CREATE TABLE client (" \
"pkgid TEXT PRIMARY KEY NOT NULL, icon TEXT, name TEXT, " \
- "auto_launch TEXT, pd_size TEXT, content TEXT DEFAULT 'default', nodisplay INTEGER, setup TEXT, mouse_event INTEGER, touch_effect INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE)";
+ "auto_launch TEXT, pd_size TEXT, content TEXT DEFAULT 'default', nodisplay INTEGER, setup TEXT, mouse_event INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE)";
if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) {
ErrPrint("Failed to execute the DDL (%s)\n", err);
return -EIO;
@@ -619,7 +620,7 @@ static inline int db_insert_client(struct livebox *livebox)
int ret;
sqlite3_stmt *stmt;
- dml = "INSERT INTO client ( pkgid, icon, name, auto_launch, pd_size, content, nodisplay, setup, mouse_event, touch_effect ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+ dml = "INSERT INTO client ( pkgid, icon, name, auto_launch, pd_size, content, nodisplay, setup, mouse_event ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL);
if (ret != SQLITE_OK) {
DbgPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
@@ -689,13 +690,6 @@ static inline int db_insert_client(struct livebox *livebox)
goto out;
}
- ret = sqlite3_bind_int(stmt, 10, livebox->touch_effect);
- if (ret != SQLITE_OK) {
- DbgPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
- ret = -EIO;
- goto out;
- }
-
ret = 0;
if (sqlite3_step(stmt) != SQLITE_DONE) {
DbgPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
@@ -1258,7 +1252,7 @@ static inline int db_create_box_size(void)
char *err;
static const char *ddl;
- ddl = "CREATE TABLE box_size ( pkgid TEXT NOT NULL, size_type INTEGER, preview TEXT, " \
+ ddl = "CREATE TABLE box_size ( pkgid TEXT NOT NULL, size_type INTEGER, preview TEXT, touch_effect INTEGER, need_frame INTEGER, " \
"FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE)";
if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) {
ErrPrint("Failed to execute the DDL (%s)\n", err);
@@ -1271,14 +1265,14 @@ static inline int db_create_box_size(void)
return 0;
}
-static inline int db_insert_box_size(const char *pkgid, int size_type, const char *preview)
+static inline int db_insert_box_size(const char *pkgid, int size_type, const char *preview, int touch_effect, int need_frame)
{
static const char *dml;
int ret;
sqlite3_stmt *stmt;
DbgPrint("box size: %s - %d (%s) is added\n", pkgid, size_type, preview);
- dml = "INSERT INTO box_size ( pkgid, size_type, preview ) VALUES (?, ?, ?)";
+ dml = "INSERT INTO box_size ( pkgid, size_type, preview, touch_effect, need_frame ) VALUES (?, ?, ?, ?, ?)";
ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL);
if (ret != SQLITE_OK) {
DbgPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
@@ -1306,6 +1300,20 @@ static inline int db_insert_box_size(const char *pkgid, int size_type, const cha
goto out;
}
+ ret = sqlite3_bind_int(stmt, 4, touch_effect);
+ if (ret != SQLITE_OK) {
+ DbgPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
+ ret = -EIO;
+ goto out;
+ }
+
+ ret = sqlite3_bind_int(stmt, 5, need_frame);
+ if (ret != SQLITE_OK) {
+ DbgPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
+ ret = -EIO;
+ goto out;
+ }
+
ret = 0;
if (sqlite3_step(stmt) != SQLITE_DONE) {
DbgPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
@@ -1676,6 +1684,41 @@ static inline void update_content(struct livebox *livebox, xmlNodePtr node)
}
}
+static inline void update_size_info(struct livebox *livebox, int idx, xmlNodePtr node)
+{
+ if (xmlHasProp(node, (const xmlChar *)"preview")) {
+ livebox->preview[idx] = xmlGetProp(node, (const xmlChar *)"preview");
+ }
+
+ if (xmlHasProp(node, (const xmlChar *)"need_frame")) {
+ xmlChar *need_frame;
+
+ need_frame = xmlGetProp(node, (const xmlChar *)"need_frame");
+ if (need_frame) {
+ livebox->need_frame[idx] = !xmlStrcasecmp(need_frame, (const xmlChar *)"true");
+ xmlFree(need_frame);
+ } else {
+ livebox->need_frame[idx] = 0;
+ }
+ } else {
+ livebox->need_frame[idx] = 0;
+ }
+
+ if (xmlHasProp(node, (const xmlChar *)"touch_effect")) {
+ xmlChar *touch_effect;
+
+ touch_effect = xmlGetProp(node, (const xmlChar *)"touch_effect");
+ if (touch_effect) {
+ livebox->touch_effect[idx] = !xmlStrcasecmp(touch_effect, (const xmlChar *)"true");
+ xmlFree(touch_effect);
+ } else {
+ livebox->touch_effect[idx] = 1;
+ }
+ } else {
+ livebox->touch_effect[idx] = 1;
+ }
+}
+
static inline void update_box(struct livebox *livebox, xmlNodePtr node)
{
if (!xmlHasProp(node, (const xmlChar *)"type")) {
@@ -1716,20 +1759,6 @@ static inline void update_box(struct livebox *livebox, xmlNodePtr node)
}
}
- if (!xmlHasProp(node, (const xmlChar *)"touch_effect")) {
- livebox->touch_effect = 1;
- } else {
- xmlChar *touch_effect;
- touch_effect = xmlGetProp(node, (const xmlChar *)"touch_effect");
- if (!touch_effect) {
- ErrPrint("touch_effect is NIL\n");
- livebox->touch_effect = 1;
- } else {
- livebox->touch_effect = !xmlStrcasecmp(touch_effect, (const xmlChar *)"true");
- xmlFree(touch_effect);
- }
- }
-
for (node = node->children; node; node = node->next) {
if (!xmlStrcasecmp(node->name, (const xmlChar *)"size")) {
xmlChar *size;
@@ -1754,83 +1783,55 @@ static inline void update_box(struct livebox *livebox, xmlNodePtr node)
if (!xmlStrcasecmp(size, (const xmlChar *)"1x1")) {
if (is_easy) {
livebox->size_list |= LB_SIZE_TYPE_EASY_1x1;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[7] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 7, node);
} else {
livebox->size_list |= LB_SIZE_TYPE_1x1;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[0] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 0, node);
}
} else if (!xmlStrcasecmp(size, (const xmlChar *)"3x1")) {
if (is_easy) {
livebox->size_list |= LB_SIZE_TYPE_EASY_3x1;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[8] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 8, node);
} else {
ErrPrint("Invalid size tag (%s)\n", size);
}
} else if (!xmlStrcasecmp(size, (const xmlChar *)"3x3")) {
if (is_easy) {
livebox->size_list |= LB_SIZE_TYPE_EASY_3x3;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[9] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 9, node);
} else {
ErrPrint("Invalid size tag (%s)\n", size);
}
} else if (!xmlStrcasecmp(size, (const xmlChar *)"2x1")) {
livebox->size_list |= LB_SIZE_TYPE_2x1;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[1] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 1, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"2x2")) {
livebox->size_list |= LB_SIZE_TYPE_2x2;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[2] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 2, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"4x1")) {
livebox->size_list |= LB_SIZE_TYPE_4x1;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[3] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 3, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"4x2")) {
livebox->size_list |= LB_SIZE_TYPE_4x2;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[4] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 4, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"4x3")) {
livebox->size_list |= LB_SIZE_TYPE_4x3;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[5] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 5, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"4x4")) {
livebox->size_list |= LB_SIZE_TYPE_4x4;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[6] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 6, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"21x21")) {
livebox->size_list |= LB_SIZE_TYPE_EASY_1x1;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[7] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 7, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"23x21")) {
livebox->size_list |= LB_SIZE_TYPE_EASY_3x1;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[8] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 8, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"23x23")) {
livebox->size_list |= LB_SIZE_TYPE_EASY_3x3;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[9] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 9, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"0x0")) {
livebox->size_list |= LB_SIZE_TYPE_0x0;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[10] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 10, node);
} else {
ErrPrint("Invalid size tag (%s)\n", size);
}
@@ -2112,67 +2113,67 @@ static inline int db_insert_livebox(struct livebox *livebox, const char *appid)
}
if (livebox->size_list & LB_SIZE_TYPE_1x1) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_1x1, (char *)livebox->preview[0]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_1x1, (char *)livebox->preview[0], livebox->touch_effect[0], livebox->need_frame[0]);
if (ret < 0)
goto errout;
}
if (livebox->size_list & LB_SIZE_TYPE_2x1) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_2x1, (char *)livebox->preview[1]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_2x1, (char *)livebox->preview[1], livebox->touch_effect[1], livebox->need_frame[1]);
if (ret < 0)
goto errout;
}
if (livebox->size_list & LB_SIZE_TYPE_2x2) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_2x2, (char *)livebox->preview[2]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_2x2, (char *)livebox->preview[2], livebox->touch_effect[2], livebox->need_frame[2]);
if (ret < 0)
goto errout;
}
if (livebox->size_list & LB_SIZE_TYPE_4x1) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x1, (char *)livebox->preview[3]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x1, (char *)livebox->preview[3], livebox->touch_effect[3], livebox->need_frame[3]);
if (ret < 0)
goto errout;
}
if (livebox->size_list & LB_SIZE_TYPE_4x2) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x2, (char *)livebox->preview[4]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x2, (char *)livebox->preview[4], livebox->touch_effect[4], livebox->need_frame[4]);
if (ret < 0)
goto errout;
}
if (livebox->size_list & LB_SIZE_TYPE_4x3) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x3, (char *)livebox->preview[5]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x3, (char *)livebox->preview[5], livebox->touch_effect[5], livebox->need_frame[5]);
if (ret < 0)
goto errout;
}
if (livebox->size_list & LB_SIZE_TYPE_4x4) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x4, (char *)livebox->preview[6]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x4, (char *)livebox->preview[6], livebox->touch_effect[6], livebox->need_frame[6]);
if (ret < 0)
goto errout;
}
if (livebox->size_list & LB_SIZE_TYPE_EASY_1x1) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_EASY_1x1, (char *)livebox->preview[7]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_EASY_1x1, (char *)livebox->preview[7], livebox->touch_effect[7], livebox->need_frame[7]);
if (ret < 0)
goto errout;
}
if (livebox->size_list & LB_SIZE_TYPE_EASY_3x1) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_EASY_3x1, (char *)livebox->preview[8]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_EASY_3x1, (char *)livebox->preview[8], livebox->touch_effect[8], livebox->need_frame[8]);
if (ret < 0)
goto errout;
}
if (livebox->size_list & LB_SIZE_TYPE_EASY_3x3) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_EASY_3x3, (char *)livebox->preview[9]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_EASY_3x3, (char *)livebox->preview[9], livebox->touch_effect[9], livebox->need_frame[9]);
if (ret < 0)
goto errout;
}
if (livebox->size_list & LB_SIZE_TYPE_0x0) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_0x0, (char *)livebox->preview[10]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_0x0, (char *)livebox->preview[10], livebox->touch_effect[10], livebox->need_frame[10]);
if (ret < 0)
goto errout;
}
diff --git a/src/instance.c b/src/instance.c
index 6fc0f8b..18e8c51 100644
--- a/src/instance.c
+++ b/src/instance.c
@@ -62,6 +62,11 @@ struct resize_cbdata {
int h;
};
+struct update_mode_cbdata {
+ struct inst_info *inst;
+ int active_update;
+};
+
struct change_group_cbdata {
struct inst_info *inst;
char *cluster;
@@ -94,7 +99,8 @@ struct inst_info {
char *title;
int is_pinned_up;
double sleep_at;
- int scroll_locked;
+ int scroll_locked; /*!< Scroller which is in viewer is locked. */
+ int active_update; /*!< Viewer will reload the buffer by itself, so the provider doesn't need to send the updated event */
enum livebox_visible_state visible;
@@ -255,6 +261,25 @@ static inline int instance_recover_visible_state(struct inst_info *inst)
return ret;
}
+static inline void instance_send_update_mode_event(struct inst_info *inst, int active_mode, int status)
+{
+ struct packet *packet;
+ const char *pkgname;
+
+ if (!inst->info) {
+ ErrPrint("Instance info is not ready to use\n");
+ return;
+ }
+
+ pkgname = package_name(inst->info);
+
+ packet = packet_create_noack("update_mode", "ssii", pkgname, inst->id, status, active_mode);
+ if (packet)
+ CLIENT_SEND_EVENT(inst, packet);
+ else
+ ErrPrint("Failed to send update mode event\n");
+}
+
static inline void instance_send_resized_event(struct inst_info *inst, int is_pd, int w, int h, int status)
{
struct packet *packet;
@@ -286,6 +311,36 @@ static inline void instance_send_resized_event(struct inst_info *inst, int is_pd
ErrPrint("Failed to send size changed event\n");
}
+static void update_mode_cb(struct slave_node *slave, const struct packet *packet, void *data)
+{
+ struct update_mode_cbdata *cbdata = data;
+ int ret;
+
+ if (!packet) {
+ ErrPrint("Invalid packet\n");
+ instance_send_update_mode_event(cbdata->inst, cbdata->active_update, LB_STATUS_ERROR_FAULT);
+ instance_unref(cbdata->inst);
+ DbgFree(cbdata);
+ return;
+ }
+
+ if (packet_get(packet, "i", &ret) != 1) {
+ ErrPrint("Invalid parameters\n");
+ instance_send_update_mode_event(cbdata->inst, cbdata->active_update, LB_STATUS_ERROR_INVALID);
+ instance_unref(cbdata->inst);
+ DbgFree(cbdata);
+ return;
+ }
+
+ if (ret == LB_STATUS_SUCCESS)
+ cbdata->inst->active_update = cbdata->active_update;
+
+ instance_send_update_mode_event(cbdata->inst, cbdata->active_update, ret);
+
+ instance_unref(cbdata->inst);
+ DbgFree(cbdata);
+}
+
HAPI int instance_unicast_created_event(struct inst_info *inst, struct client_node *client)
{
struct packet *packet;
@@ -1354,7 +1409,7 @@ HAPI int instance_reactivate(struct inst_info *inst)
break;
}
- packet = packet_create("renew", "sssiidssiis",
+ packet = packet_create("renew", "sssiidssiisii",
package_name(inst->info),
inst->id,
inst->content,
@@ -1364,7 +1419,9 @@ HAPI int instance_reactivate(struct inst_info *inst)
inst->cluster,
inst->category,
inst->lb.width, inst->lb.height,
- package_abi(inst->info));
+ package_abi(inst->info),
+ inst->scroll_locked,
+ inst->active_update);
if (!packet) {
ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
return LB_STATUS_ERROR_FAULT;
@@ -1459,6 +1516,156 @@ HAPI int instance_activate(struct inst_info *inst)
return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, activate_cb, instance_ref(inst), 1);
}
+HAPI int instance_lb_update_begin(struct inst_info *inst, double priority, const char *content, const char *title)
+{
+ struct packet *packet;
+ const char *fbfile;
+
+ if (!inst->active_update) {
+ ErrPrint("Invalid request [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ switch (package_lb_type(inst->info)) {
+ case LB_TYPE_BUFFER:
+ if (!inst->lb.canvas.buffer) {
+ ErrPrint("Buffer is null [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+ fbfile = buffer_handler_id(inst->lb.canvas.buffer);
+ break;
+ case LB_TYPE_SCRIPT:
+ if (!inst->lb.canvas.script) {
+ ErrPrint("Script is null [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+ fbfile = fb_id(script_handler_fb(inst->lb.canvas.script));
+ break;
+ default:
+ ErrPrint("Invalid request[%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ packet = packet_create_noack("lb_update_begin", "ssdsss", package_name(inst->info), inst->id, priority, content, title, fbfile);
+ if (!packet) {
+ ErrPrint("Unable to create a packet\n");
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ return CLIENT_SEND_EVENT(inst, packet);
+}
+
+HAPI int instance_lb_update_end(struct inst_info *inst)
+{
+ struct packet *packet;
+
+ if (!inst->active_update) {
+ ErrPrint("Invalid request [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ switch (package_lb_type(inst->info)) {
+ case LB_TYPE_BUFFER:
+ if (!inst->lb.canvas.buffer) {
+ ErrPrint("Buffer is null [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+ break;
+ case LB_TYPE_SCRIPT:
+ if (!inst->lb.canvas.script) {
+ ErrPrint("Script is null [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+ break;
+ default:
+ ErrPrint("Invalid request[%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ packet = packet_create_noack("lb_update_end", "ss", package_name(inst->info), inst->id);
+ if (!packet) {
+ ErrPrint("Unable to create a packet\n");
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ return CLIENT_SEND_EVENT(inst, packet);
+}
+
+HAPI int instance_pd_update_begin(struct inst_info *inst)
+{
+ struct packet *packet;
+ const char *fbfile;
+
+ if (!inst->active_update) {
+ ErrPrint("Invalid request [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ switch (package_pd_type(inst->info)) {
+ case PD_TYPE_BUFFER:
+ if (!inst->pd.canvas.buffer) {
+ ErrPrint("Buffer is null [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+ fbfile = buffer_handler_id(inst->pd.canvas.buffer);
+ break;
+ case PD_TYPE_SCRIPT:
+ if (!inst->pd.canvas.script) {
+ ErrPrint("Script is null [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+ fbfile = fb_id(script_handler_fb(inst->pd.canvas.script));
+ break;
+ default:
+ ErrPrint("Invalid request[%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ packet = packet_create_noack("pd_update_begin", "sss", package_name(inst->info), inst->id, fbfile);
+ if (!packet) {
+ ErrPrint("Unable to create a packet\n");
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ return CLIENT_SEND_EVENT(inst, packet);
+}
+
+HAPI int instance_pd_update_end(struct inst_info *inst)
+{
+ struct packet *packet;
+
+ if (!inst->active_update) {
+ ErrPrint("Invalid request [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ switch (package_pd_type(inst->info)) {
+ case PD_TYPE_BUFFER:
+ if (!inst->pd.canvas.buffer) {
+ ErrPrint("Buffer is null [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+ break;
+ case PD_TYPE_SCRIPT:
+ if (!inst->pd.canvas.script) {
+ ErrPrint("Script is null [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+ break;
+ default:
+ ErrPrint("Invalid request[%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ packet = packet_create_noack("pd_update_end", "ss", package_name(inst->info), inst->id);
+ if (!packet) {
+ ErrPrint("Unable to create a packet\n");
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ return CLIENT_SEND_EVENT(inst, packet);
+}
+
HAPI void instance_lb_updated(const char *pkgname, const char *id)
{
struct inst_info *inst;
@@ -1520,16 +1727,17 @@ HAPI int instance_hold_scroll(struct inst_info *inst, int hold)
struct packet *packet;
if (inst->scroll_locked == hold) {
- DbgPrint("There is changes for hold state: %d\n", hold);
+ DbgPrint("[HOLD] There is changes for hold state: %d\n", hold);
return LB_STATUS_ERROR_ALREADY;
}
packet = packet_create_noack("scroll", "ssi", package_name(inst->info), inst->id, hold);
if (!packet) {
- ErrPrint("Failed to build a packet\n");
+ ErrPrint("[HOLD] Failed to build a packet\n");
return LB_STATUS_ERROR_FAULT;
}
+ DbgPrint("[HOLD] (%s) %d\n", inst->id, hold);
inst->scroll_locked = hold;
return CLIENT_SEND_EVENT(inst, packet);
}
@@ -1600,6 +1808,47 @@ HAPI void instance_pd_updated(const char *pkgname, const char *id, const char *d
instance_pd_updated_by_instance(inst, descfile);
}
+HAPI int instance_set_update_mode(struct inst_info *inst, int active_update)
+{
+ struct packet *packet;
+ struct update_mode_cbdata *cbdata;
+
+ if (package_is_fault(inst->info)) {
+ DbgPrint("Fault package [%s]\n", package_name(inst->info));
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ if (inst->active_update == active_update) {
+ DbgPrint("Active update is not changed: %d\n", inst->active_update);
+ return LB_STATUS_ERROR_ALREADY;
+ }
+
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return LB_STATUS_ERROR_MEMORY;
+ }
+
+ cbdata->inst = instance_ref(inst);
+ cbdata->active_update = active_update;
+
+ /* NOTE: param is resued from here */
+ packet = packet_create("update_mode", "ssi", package_name(inst->info), inst->id, active_update);
+ if (!packet) {
+ ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, update_mode_cb, cbdata, 0);
+}
+
+HAPI int instance_active_update(struct inst_info *inst)
+{
+ return inst->active_update;
+}
+
HAPI void instance_set_lb_info(struct inst_info *inst, int w, int h, double priority, const char *content, const char *title)
{
char *_content = NULL;
@@ -2509,6 +2758,24 @@ HAPI int instance_need_slave(struct inst_info *inst)
return ret;
}
+HAPI int instance_forward_packet(struct inst_info *inst, struct packet *packet)
+{
+ return CLIENT_SEND_EVENT(inst, packet);
+}
+
+HAPI int instance_send_access_status(struct inst_info *inst, int status)
+{
+ struct packet *packet;
+
+ packet = packet_create_noack("access_status", "ssi", package_name(inst->info), inst->id, status);
+ if (!packet) {
+ ErrPrint("Failed to build a packet\n");
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ return CLIENT_SEND_EVENT(inst, packet);
+}
+
HAPI void instance_slave_set_pd_pos(struct inst_info *inst, double x, double y)
{
inst->pd.x = x;
diff --git a/src/script_handler.c b/src/script_handler.c
index b9536d6..69c9217 100644
--- a/src/script_handler.c
+++ b/src/script_handler.c
@@ -50,6 +50,8 @@
#define TYPE_SIGNAL "signal"
#define TYPE_INFO "info"
#define TYPE_DRAG "drag"
+#define TYPE_ACCESS "access"
+
#define INFO_SIZE "size"
#define INFO_CATEGORY "category"
#define ADDEND 256
@@ -71,11 +73,13 @@ struct script_port {
int (*update_color)(void *handle, Evas *e, const char *id, const char *part, const char *rgba);
int (*update_text)(void *handle, Evas *e, const char *id, const char *part, const char *text);
int (*update_image)(void *handle, Evas *e, const char *id, const char *part, const char *path, const char *option);
+ int (*update_access)(void *handle, Evas *e, const char *id, const char *part, const char *text, const char *option);
int (*update_script)(void *handle, Evas *e, const char *src_id, const char *target_id, const char *part, const char *path, const char *option);
int (*update_signal)(void *handle, Evas *e, const char *id, const char *part, const char *signal);
int (*update_drag)(void *handle, Evas *e, const char *id, const char *part, double x, double y);
int (*update_size)(void *handle, Evas *e, const char *id, int w, int h);
int (*update_category)(void *handle, Evas *e, const char *id, const char *category);
+ int (*feed_event)(void *handle, Evas *e, int event_type, int x, int y, double timestamp);
void *(*create)(const char *file, const char *option);
int (*destroy)(void *handle);
@@ -494,6 +498,35 @@ static int update_script_image(struct inst_info *inst, struct block *block, int
return LB_STATUS_SUCCESS;
}
+static int update_access(struct inst_info *inst, struct block *block, int is_pd)
+{
+ struct script_info *info;
+ Evas *e;
+
+ if (!block || !block->part || !block->data) {
+ ErrPrint("Block or block->part or block->data is NIL\n");
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ info = is_pd ? instance_pd_script(inst) : instance_lb_script(inst);
+ if (!info) {
+ ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ if (!info->port) {
+ ErrPrint("info->port is NIL\n");
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ e = script_handler_evas(info);
+ if (e)
+ info->port->update_access(info->port_data, e, block->id, block->part, block->data, block->option);
+ else
+ ErrPrint("Evas: (nil) id[%s] part[%s] data[%s]\n", block->id, block->part, block->data);
+ return LB_STATUS_SUCCESS;
+}
+
static int update_script_script(struct inst_info *inst, struct block *block, int is_pd)
{
struct script_info *info;
@@ -742,6 +775,10 @@ HAPI int script_handler_parse_desc(const char *pkgname, const char *id, const ch
.handler = update_info,
},
{
+ .type = TYPE_ACCESS,
+ .handler = update_access,
+ },
+ {
.type = NULL,
.handler = NULL,
},
@@ -1213,6 +1250,10 @@ HAPI int script_init(void)
if (!item->update_image)
goto errout;
+ item->update_access = dlsym(item->handle, "script_update_access");
+ if (!item->update_access)
+ goto errout;
+
item->update_script = dlsym(item->handle, "script_update_script");
if (!item->update_script)
goto errout;
@@ -1257,6 +1298,10 @@ HAPI int script_init(void)
if (!item->fini)
goto errout;
+ item->feed_event = dlsym(item->handle, "script_feed_event");
+ if (!item->feed_event)
+ goto errout;
+
if (item->init() < 0) {
ErrPrint("Failed to initialize script engine\n");
goto errout;
@@ -1307,4 +1352,22 @@ HAPI int script_handler_update_pointer(struct script_info *info, int x, int y, i
return LB_STATUS_SUCCESS;
}
+HAPI int script_handler_feed_event(struct script_info *info, int event, double timestamp)
+{
+ Evas *e;
+
+ if (!info->port) {
+ ErrPrint("info->port is NIL\n");
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ e = script_handler_evas(info);
+ if (!e) {
+ ErrPrint("Evas is not exists\n");
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ return info->port->feed_event(info->port_data, e, event, info->x, info->y, timestamp);
+}
+
/* End of a file */
diff --git a/src/server.c b/src/server.c
index b6a6f43..77c45ee 100644
--- a/src/server.c
+++ b/src/server.c
@@ -27,6 +27,7 @@
#include <packet.h>
#include <com-core_packet.h>
#include <livebox-errno.h>
+#include <livebox-service.h>
#include "conf.h"
#include "debug.h"
@@ -68,11 +69,30 @@ enum target_type {
TYPE_ERROR,
};
+struct access_cbdata {
+ int status;
+ struct inst_info *inst;
+};
+
struct deleted_item {
struct client_node *client;
struct inst_info *inst;
};
+static Eina_Bool lazy_access_status_cb(void *data)
+{
+ struct access_cbdata *cbdata = data;
+
+ if (instance_unref(cbdata->inst))
+ instance_send_access_status(cbdata->inst, cbdata->status);
+ /*!
+ * If instance_unref returns NULL,
+ * The instance is destroyed. it means, we don't need to send event to the viewer
+ */
+ free(cbdata);
+ return ECORE_CALLBACK_CANCEL;
+}
+
static int event_lb_route_cb(enum event_state state, struct event_data *event_info, void *data)
{
struct inst_info *inst = data;
@@ -135,17 +155,15 @@ static int event_lb_consume_cb(enum event_state state, struct event_data *event_
switch (state) {
case EVENT_STATE_ACTIVATE:
script_handler_update_pointer(script, event_info->x, event_info->y, 1);
- evas_event_feed_mouse_move(e, event_info->x, event_info->y, timestamp, NULL);
- evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, timestamp + 0.01f, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_DOWN, timestamp);
break;
case EVENT_STATE_ACTIVATED:
script_handler_update_pointer(script, event_info->x, event_info->y, -1);
- evas_event_feed_mouse_move(e, event_info->x, event_info->y, timestamp, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_MOVE, timestamp);
break;
case EVENT_STATE_DEACTIVATE:
script_handler_update_pointer(script, event_info->x, event_info->y, 0);
- evas_event_feed_mouse_move(e, event_info->x, event_info->y, timestamp, NULL);
- evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, timestamp + 0.1f, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_UP, timestamp);
break;
default:
break;
@@ -218,17 +236,15 @@ static int event_pd_consume_cb(enum event_state state, struct event_data *event_
switch (state) {
case EVENT_STATE_ACTIVATE:
script_handler_update_pointer(script, event_info->x, event_info->y, 1);
- evas_event_feed_mouse_move(e, event_info->x, event_info->y, timestamp, NULL);
- evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, timestamp + 0.01f, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_DOWN, timestamp);
break;
case EVENT_STATE_ACTIVATED:
script_handler_update_pointer(script, event_info->x, event_info->y, -1);
- evas_event_feed_mouse_move(e, event_info->x, event_info->y, timestamp, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_MOVE, timestamp);
break;
case EVENT_STATE_DEACTIVATE:
script_handler_update_pointer(script, event_info->x, event_info->y, 0);
- evas_event_feed_mouse_move(e, event_info->x, event_info->y, timestamp, NULL);
- evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, timestamp + 0.1f, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_UP, timestamp);
break;
default:
break;
@@ -315,14 +331,12 @@ static struct packet *client_clicked(pid_t pid, int handle, const struct packet
client = client_find_by_pid(pid);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
goto out;
}
ret = packet_get(packet, "sssddd", &pkgname, &id, &event, &timestamp, &x, &y);
if (ret != 6) {
ErrPrint("Parameter is not matched\n");
- ret = LB_STATUS_ERROR_INVALID;
goto out;
}
@@ -335,17 +349,64 @@ static struct packet *client_clicked(pid_t pid, int handle, const struct packet
*/
inst = package_find_instance_by_id(pkgname, id);
if (!inst)
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ErrPrint("Instance is not exists\n");
else if (package_is_fault(instance_package(inst)))
- ret = LB_STATUS_ERROR_FAULT;
+ ErrPrint("Fault package\n");
else
- ret = instance_clicked(inst, event, timestamp, x, y);
+ (void)instance_clicked(inst, event, timestamp, x, y);
out:
/*! \note No reply packet */
return NULL;
}
+static struct packet *client_update_mode(pid_t pid, int handle, const struct packet *packet)
+{
+ struct packet *result;
+ struct client_node *client;
+ int active_update;
+ const char *pkgname;
+ const char *id;
+ int ret;
+ struct inst_info *inst;
+
+ client = client_find_by_pid(pid);
+ if (!client) {
+ ErrPrint("Client %d is not exists\n", pid);
+ ret = LB_STATUS_ERROR_INVALID;
+ goto out;
+ }
+
+ ret = packet_get(packet, "ssi", &pkgname, &id, &active_update);
+ if (ret != 3) {
+ ErrPrint("Invalid argument\n");
+ ret = LB_STATUS_ERROR_INVALID;
+ goto out;
+ }
+
+ inst = package_find_instance_by_id(pkgname, id);
+ if (!inst) {
+ ErrPrint("Instance is not exists\n");
+ ret = LB_STATUS_ERROR_NOT_EXIST;
+ } else if (package_is_fault(instance_package(inst))) {
+ ErrPrint("Fault package\n");
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ /*!
+ * \note
+ * Send change update mode request to a slave
+ */
+ ret = instance_set_update_mode(inst, active_update);
+ }
+
+out:
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a packet\n");
+
+ return result;
+}
+
/* pid, pkgname, filename, emission, source, s, sy, ex, ey, ret */
static struct packet *client_text_signal(pid_t pid, int handle, const struct packet *packet)
{
@@ -464,7 +525,6 @@ static struct packet *client_delete(pid_t pid, int handle, const struct packet *
ErrPrint("Heap: %s\n", strerror(errno));
ret = LB_STATUS_ERROR_MEMORY;
} else {
- ret = 0;
/*!
* \NOTE:
* Send DELETED EVENT to the client.
@@ -483,6 +543,8 @@ static struct packet *client_delete(pid_t pid, int handle, const struct packet *
instance_unref(inst);
DbgFree(item);
ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
}
}
} else {
@@ -877,7 +939,7 @@ static struct packet *client_pd_mouse_enter(pid_t pid, int handle, const struct
}
script_handler_update_pointer(script, x, y, -1);
- evas_event_feed_mouse_in(e, timestamp, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_IN, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
@@ -989,7 +1051,7 @@ static struct packet *client_pd_mouse_leave(pid_t pid, int handle, const struct
}
script_handler_update_pointer(script, x, y, -1);
- evas_event_feed_mouse_out(e, timestamp, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_OUT, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
@@ -1103,8 +1165,7 @@ static struct packet *client_pd_mouse_down(pid_t pid, int handle, const struct p
}
script_handler_update_pointer(script, x, y, 1);
- evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
- evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, timestamp + 0.01f, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_DOWN, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
@@ -1217,8 +1278,7 @@ static struct packet *client_pd_mouse_up(pid_t pid, int handle, const struct pac
}
script_handler_update_pointer(script, x, y, 0);
- evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
- evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, timestamp + 0.1f, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_UP, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
@@ -1331,7 +1391,7 @@ static struct packet *client_pd_mouse_move(pid_t pid, int handle, const struct p
}
script_handler_update_pointer(script, x, y, -1);
- evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_MOVE, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
@@ -1442,7 +1502,7 @@ static struct packet *client_lb_mouse_move(pid_t pid, int handle, const struct p
}
script_handler_update_pointer(script, x, y, -1);
- evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_MOVE, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
@@ -1834,7 +1894,7 @@ static struct packet *client_lb_mouse_enter(pid_t pid, int handle, const struct
}
script_handler_update_pointer(script, x, y, -1);
- evas_event_feed_mouse_in(e, timestamp, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_IN, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
@@ -1946,7 +2006,7 @@ static struct packet *client_lb_mouse_leave(pid_t pid, int handle, const struct
}
script_handler_update_pointer(script, x, y, -1);
- evas_event_feed_mouse_out(e, timestamp, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_OUT, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
@@ -2058,8 +2118,7 @@ static struct packet *client_lb_mouse_down(pid_t pid, int handle, const struct p
}
script_handler_update_pointer(script, x, y, 1);
- evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
- evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, timestamp + 0.01f, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_DOWN, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
@@ -2171,8 +2230,7 @@ static struct packet *client_lb_mouse_up(pid_t pid, int handle, const struct pac
}
script_handler_update_pointer(script, x, y, 0);
- evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
- evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, timestamp + 0.1f, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_UP, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
@@ -2186,6 +2244,7 @@ out:
static struct packet *client_pd_access_value_change(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
@@ -2284,22 +2343,42 @@ static struct packet *client_pd_access_value_change(pid_t pid, int handle, const
}
script_handler_update_pointer(script, x, y, -1);
- /*!
- * \TODO: Push up the ACCESS_VALUE_CHANGE event
- */
- ret = 0;
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_VALUE_CHANGE, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
+
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
ret = LB_STATUS_ERROR_INVALID;
}
out:
- /*! \note No reply packet */
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_pd_access_scroll(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
@@ -2398,22 +2477,42 @@ static struct packet *client_pd_access_scroll(pid_t pid, int handle, const struc
}
script_handler_update_pointer(script, x, y, -1);
- /*!
- * \TODO: Push up the ACCESS_SCROLL event
- */
- ret = 0;
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_SCROLL, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
+
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
ret = LB_STATUS_ERROR_INVALID;
}
out:
- /*! \note No reply packet */
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_pd_access_hl(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
@@ -2512,22 +2611,42 @@ static struct packet *client_pd_access_hl(pid_t pid, int handle, const struct pa
}
script_handler_update_pointer(script, x, y, -1);
- /*!
- * \TODO: Push up the ACCESS_HIGHLIGHT event
- */
- ret = 0;
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_HIGHLIGHT, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
+
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
ret = LB_STATUS_ERROR_INVALID;
}
out:
- /*! \note No reply packet */
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_pd_access_hl_prev(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
@@ -2626,22 +2745,42 @@ static struct packet *client_pd_access_hl_prev(pid_t pid, int handle, const stru
}
script_handler_update_pointer(script, x, y, -1);
- /*!
- * \TODO: Push up the ACCESS_HIGHLIGHT_PREV event
- */
- ret = 0;
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_HIGHLIGHT_PREV, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
+
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
ret = LB_STATUS_ERROR_INVALID;
}
out:
- /*! \note No reply packet */
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_pd_access_hl_next(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
@@ -2740,22 +2879,42 @@ static struct packet *client_pd_access_hl_next(pid_t pid, int handle, const stru
}
script_handler_update_pointer(script, x, y, -1);
- /*!
- * \TODO: Push up the ACCESS_HIGHLIGHT_NEXT event
- */
- ret = 0;
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_HIGHLIGHT_NEXT, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
+
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
ret = LB_STATUS_ERROR_INVALID;
}
out:
- /*! \note No reply packet */
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_pd_access_activate(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
@@ -2854,18 +3013,37 @@ static struct packet *client_pd_access_activate(pid_t pid, int handle, const str
}
script_handler_update_pointer(script, x, y, -1);
- /*!
- * \TODO: Push up the ACCESS_ACTIVATE event
- */
- ret = 0;
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_ACTIVATE, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
+
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
ret = LB_STATUS_ERROR_INVALID;
}
out:
- /*! \note No reply packet */
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_pd_key_down(pid_t pid, int handle, const struct packet *packet)
@@ -3019,15 +3197,13 @@ static struct packet *client_resume_request(pid_t pid, int handle, const struct
client = client_find_by_pid(pid);
if (!client) {
- ErrPrint("Client %d is paused - manually reported\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ErrPrint("Client %d is not exists\n", pid);
goto out;
}
ret = packet_get(packet, "d", &timestamp);
if (ret != 1) {
ErrPrint("Invalid parameter\n");
- ret = LB_STATUS_ERROR_INVALID;
goto out;
}
@@ -3156,6 +3332,7 @@ out:
static struct packet *client_lb_access_hl(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
@@ -3254,23 +3431,42 @@ static struct packet *client_lb_access_hl(pid_t pid, int handle, const struct pa
}
script_handler_update_pointer(script, x, y, -1);
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_HIGHLIGHT, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
- /*!
- * \TODO: Feed up this ACCESS_HIGHLIGHT event
- */
- ret = 0;
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
ret = LB_STATUS_ERROR_INVALID;
}
out:
- /*! \note No reply packet */
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_lb_access_hl_prev(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
@@ -3369,23 +3565,42 @@ static struct packet *client_lb_access_hl_prev(pid_t pid, int handle, const stru
}
script_handler_update_pointer(script, x, y, -1);
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_HIGHLIGHT_PREV, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
- /*!
- * \TODO: Feed up this ACCESS_HIGHLIGHT_PREV event
- */
- ret = 0;
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
ret = LB_STATUS_ERROR_INVALID;
}
out:
- /*! \note No reply packet */
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_lb_access_hl_next(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
@@ -3484,23 +3699,42 @@ static struct packet *client_lb_access_hl_next(pid_t pid, int handle, const stru
}
script_handler_update_pointer(script, x, y, -1);
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_HIGHLIGHT_NEXT, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
- /*!
- * \TODO: Feed up this ACCESS_HIGHLIGHT_NEXT event
- */
- ret = 0;
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
ret = LB_STATUS_ERROR_INVALID;
}
out:
- /*! \note No reply packet */
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_lb_access_value_change(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
@@ -3575,21 +3809,42 @@ static struct packet *client_lb_access_value_change(pid_t pid, int handle, const
goto out;
}
- // script_handler_update_pointer(script, x, y, -1);
+ script_handler_update_pointer(script, x, y, -1);
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_VALUE_CHANGE, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
- /*!
- * \TODO: Feed up this VALUE_CHANGE event
- */
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
}
out:
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_lb_access_scroll(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
@@ -3665,20 +3920,41 @@ static struct packet *client_lb_access_scroll(pid_t pid, int handle, const struc
}
script_handler_update_pointer(script, x, y, -1);
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_SCROLL, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
- /*!
- * \TODO: Feed up this ACCESS_SCROLL event
- */
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
}
out:
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_lb_access_activate(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
@@ -3771,17 +4047,36 @@ static struct packet *client_lb_access_activate(pid_t pid, int handle, const str
}
script_handler_update_pointer(script, x, y, -1);
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_ACTIVATE, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
- /*!
- * \TODO: Feed up this ACCESS_ACTIVATE event
- */
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
}
out:
- /*! \note No reply packet */
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_lb_key_down(pid_t pid, int handle, const struct packet *packet)
@@ -4282,21 +4577,22 @@ out:
static Eina_Bool lazy_pd_created_cb(void *data)
{
- int ret;
-
- ret = instance_client_pd_created(data, LB_STATUS_SUCCESS);
- DbgPrint("Send PD Create event (%d)\n", ret);
+ if (instance_unref(data)) {
+ int ret;
+ ret = instance_client_pd_created(data, LB_STATUS_SUCCESS);
+ DbgPrint("Send PD Create event (%d)\n", ret);
+ }
- instance_unref(data);
return ECORE_CALLBACK_CANCEL;
}
static Eina_Bool lazy_pd_destroyed_cb(void *data)
{
- DbgPrint("Send PD Destroy event\n");
- instance_client_pd_destroyed(data, LB_STATUS_SUCCESS);
+ if (instance_unref(data)) {
+ DbgPrint("Send PD Destroy event\n");
+ instance_client_pd_destroyed(data, LB_STATUS_SUCCESS);
+ }
- instance_unref(data);
return ECORE_CALLBACK_CANCEL;
}
@@ -4527,10 +4823,15 @@ static struct packet *client_destroy_pd(pid_t pid, int handle, const struct pack
* \note
* Send the destroyed PD event to the client
*/
- if (ret == 0) {
+ if (ret == LB_STATUS_SUCCESS) {
inst = instance_ref(inst);
- if (!ecore_timer_add(DELAY_TIME, lazy_pd_destroyed_cb, inst))
+ if (!ecore_timer_add(DELAY_TIME, lazy_pd_destroyed_cb, inst)) {
instance_unref(inst);
+ /*!
+ * How can we handle this?
+ */
+ ret = LB_STATUS_ERROR_FAULT;
+ }
}
} else {
ErrPrint("Invalid PD TYPE\n");
@@ -5008,6 +5309,238 @@ out:
return NULL;
}
+static struct packet *slave_lb_update_begin(pid_t pid, int handle, const struct packet *packet)
+{
+ struct slave_node *slave;
+ struct inst_info *inst;
+ struct pkg_info *pkg;
+ const char *pkgname;
+ const char *id;
+ double priority;
+ const char *content;
+ const char *title;
+ int ret;
+
+ slave = slave_find_by_pid(pid);
+ if (!slave) {
+ ErrPrint("Slave %d is not exists\n", pid);
+ goto out;
+ }
+
+ ret = packet_get(packet, "ssdss", &pkgname, &id, &priority, &content, &title);
+ if (ret != 5) {
+ ErrPrint("Invalid parameters\n");
+ goto out;
+ }
+
+ inst = package_find_instance_by_id(pkgname, id);
+ if (!inst) {
+ ErrPrint("Instance(%s) is not exists\n", id);
+ goto out;
+ } else if (instance_state(inst) == INST_DESTROYED) {
+ ErrPrint("Instance(%s) is already destroyed\n", id);
+ goto out;
+ }
+
+ pkg = instance_package(inst);
+ if (!pkg) {
+ ErrPrint("Invalid instance\n");
+ } else if (package_is_fault(pkg)) {
+ ErrPrint("Faulted instance %s.\n", id);
+ } else if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
+ ret = instance_lb_update_begin(inst, priority, content, title);
+ if (ret == LB_STATUS_SUCCESS)
+ slave_freeze_ttl(slave);
+ } else {
+ ErrPrint("Invalid request[%s]\n", id);
+ }
+
+out:
+ return NULL;
+}
+
+static struct packet *slave_lb_update_end(pid_t pid, int handle, const struct packet *packet)
+{
+ struct slave_node *slave;
+ struct inst_info *inst;
+ struct pkg_info *pkg;
+ const char *pkgname;
+ const char *id;
+ int ret;
+
+ slave = slave_find_by_pid(pid);
+ if (!slave) {
+ ErrPrint("Slave %d is not exists\n", pid);
+ goto out;
+ }
+
+ ret = packet_get(packet, "ss", &pkgname, &id);
+ if (ret != 2) {
+ ErrPrint("Invalid parameters\n");
+ goto out;
+ }
+
+ inst = package_find_instance_by_id(pkgname, id);
+ if (!inst) {
+ ErrPrint("Instance[%s] is not exists\n", id);
+ goto out;
+ } else if (instance_state(inst) == INST_DESTROYED) {
+ ErrPrint("Instance[%s] is already destroyed\n", id);
+ goto out;
+ }
+
+ pkg = instance_package(inst);
+ if (!pkg) {
+ ErrPrint("Invalid instance\n");
+ } else if (package_is_fault(pkg)) {
+ ErrPrint("Faulted instance %s\n", id);
+ } else if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
+ ret = instance_lb_update_end(inst);
+ if (ret == LB_STATUS_SUCCESS)
+ slave_thaw_ttl(slave);
+ } else {
+ ErrPrint("Invalid request[%s]\n", id);
+ }
+
+out:
+ return NULL;
+}
+
+static struct packet *slave_pd_update_begin(pid_t pid, int handle, const struct packet *packet)
+{
+ struct slave_node *slave;
+ struct pkg_info *pkg;
+ struct inst_info *inst;
+ const char *pkgname;
+ const char *id;
+ int ret;
+
+ slave = slave_find_by_pid(pid);
+ if (!slave) {
+ ErrPrint("Slave %d is not exists\n", pid);
+ goto out;
+ }
+
+ ret = packet_get(packet, "ss", &pkgname, &id);
+ if (ret != 2) {
+ ErrPrint("Invalid parameters\n");
+ goto out;
+ }
+
+ inst = package_find_instance_by_id(pkgname, id);
+ if (!inst) {
+ ErrPrint("Instance[%s] is not exists\n", id);
+ goto out;
+ }
+
+ pkg = instance_package(inst);
+ if (!pkg) {
+ ErrPrint("Invalid package\n");
+ } else if (package_is_fault(pkg)) {
+ ErrPrint("Faulted instance %s\n", id);
+ } else if (instance_state(inst) == INST_DESTROYED) {
+ ErrPrint("Instance[%s] is already destroyed\n", id);
+ } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
+ (void)instance_pd_update_begin(inst);
+ } else {
+ ErrPrint("Invalid request[%s]\n", id);
+ }
+
+out:
+ return NULL;
+}
+
+static struct packet *slave_access_status(pid_t pid, int handle, const struct packet *packet)
+{
+ struct slave_node *slave;
+ struct pkg_info *pkg;
+ struct inst_info *inst;
+ const char *pkgname;
+ const char *id;
+ int status;
+ int ret;
+
+ slave = slave_find_by_pid(pid);
+ if (!slave) {
+ ErrPrint("Slave %d is not exists\n", pid);
+ goto out;
+ }
+
+ ret = packet_get(packet, "ssi", &pkgname, &id, &status);
+ if (ret != 3) {
+ ErrPrint("Invalid parameters\n");
+ goto out;
+ }
+
+ inst = package_find_instance_by_id(pkgname, id);
+ if (!inst) {
+ ErrPrint("Instance[%s] is not exists\n", id);
+ goto out;
+ }
+
+ pkg = instance_package(inst);
+ if (!pkg) {
+ ErrPrint("Invalid package\n");
+ } else if (package_is_fault(pkg)) {
+ ErrPrint("Faulted instance %s\n", id);
+ } else if (instance_state(inst) == INST_DESTROYED) {
+ ErrPrint("Instance[%s] is already destroyed\n", id);
+ } else {
+ /*!
+ * \note
+ * Forward packet to client
+ */
+ (void)instance_forward_packet(inst, packet_ref((struct packet *)packet));
+ }
+
+out:
+ return NULL;
+}
+
+static struct packet *slave_pd_update_end(pid_t pid, int handle, const struct packet *packet)
+{
+ struct slave_node *slave;
+ struct pkg_info *pkg;
+ struct inst_info *inst;
+ const char *pkgname;
+ const char *id;
+ int ret;
+
+ slave = slave_find_by_pid(pid);
+ if (!slave) {
+ ErrPrint("Slave %d is not exists\n", pid);
+ goto out;
+ }
+
+ ret = packet_get(packet, "ss", &pkgname, &id);
+ if (ret != 2) {
+ ErrPrint("Invalid parameters\n");
+ goto out;
+ }
+
+ inst = package_find_instance_by_id(pkgname, id);
+ if (!inst) {
+ ErrPrint("Instance[%s] is not exists\n", id);
+ goto out;
+ }
+
+ pkg = instance_package(inst);
+ if (!pkg) {
+ ErrPrint("Invalid package\n");
+ } else if (package_is_fault(pkg)) {
+ ErrPrint("Faulted instance %s\n", id);
+ } else if (instance_state(inst) == INST_DESTROYED) {
+ ErrPrint("Instance[%s] is already destroyed\n", id);
+ } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
+ (void)instance_pd_update_end(inst);
+ } else {
+ ErrPrint("Invalid request[%s]\n", id);
+ }
+
+out:
+ return NULL;
+}
+
static struct packet *slave_call(pid_t pid, int handle, const struct packet *packet) /* slave_name, pkgname, filename, function, ret */
{
struct slave_node *slave;
@@ -6244,6 +6777,11 @@ static struct method s_client_table[] = {
},
{
+ .cmd = "update_mode",
+ .handler = client_update_mode,
+ },
+
+ {
.cmd = NULL,
.handler = NULL,
},
@@ -6313,6 +6851,29 @@ static struct method s_slave_table[] = {
.cmd = "scroll",
.handler = slave_hold_scroll, /* slave_name, pkgname, id, seize */
},
+
+ {
+ .cmd = "lb_update_begin",
+ .handler = slave_lb_update_begin,
+ },
+ {
+ .cmd = "lb_update_end",
+ .handler = slave_lb_update_end,
+ },
+ {
+ .cmd = "pd_update_begin",
+ .handler = slave_pd_update_begin,
+ },
+ {
+ .cmd = "pd_update_end",
+ .handler = slave_pd_update_end,
+ },
+
+ {
+ .cmd = "access_status",
+ .handler = slave_access_status,
+ },
+
{
.cmd = NULL,
.handler = NULL,
diff --git a/util_liveinfo/src/liveinfo.c b/util_liveinfo/src/liveinfo.c
index 0247b8b..856f9ac 100644
--- a/util_liveinfo/src/liveinfo.c
+++ b/util_liveinfo/src/liveinfo.c
@@ -643,8 +643,6 @@ static inline int do_stat(const char *cmd)
i = livebox_service_mouse_event(node_name(node));
printf("Mouse event: %s\n", i ? "enabled" : "disabled");
- i = livebox_service_touch_effect(node_name(node));
- printf("Touch effect: %s\n", i ? "enabled" : "disabled");
break;
case PROVIDER:
printf("Not supported yet\n");