summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2013-04-18 13:57:18 +0900
committerSung-jae Park <nicesj.park@samsung.com>2013-04-18 13:57:18 +0900
commitb2c85d7a612198a6fd86c7f7d8e4e172a3734e20 (patch)
tree6bccc8ee0828e8551282abf098ff329aea4a8efc
parent55e101fa5948cbab8e73bc42f451696649273ec2 (diff)
downloaddata-provider-master-b2c85d7a612198a6fd86c7f7d8e4e172a3734e20.tar.gz
data-provider-master-b2c85d7a612198a6fd86c7f7d8e4e172a3734e20.tar.bz2
data-provider-master-b2c85d7a612198a6fd86c7f7d8e4e172a3734e20.zip
Various patchset applied.
Clear the pixmap right after allocate it. If the slave is faulted, Every package in that slave should be faulted too. Then the user can re-activate it. Supporting the 4x5,4x6 liveboxes Update accessibility scroll event Add more log for fs free size calculation. Change-Id: I8b5ecfffca79e4f0cd17e11bda201e36a16ffe10
-rw-r--r--data/resolution.ini2
-rw-r--r--packaging/data-provider-master.spec2
-rw-r--r--pkgmgr_livebox/src/service_register.c97
-rw-r--r--src/buffer_handler.c17
-rw-r--r--src/package.c10
-rw-r--r--src/script_handler.c4
-rw-r--r--src/server.c544
-rw-r--r--src/util.c4
8 files changed, 643 insertions, 37 deletions
diff --git a/data/resolution.ini b/data/resolution.ini
index 6e031ac..7f4c1a2 100644
--- a/data/resolution.ini
+++ b/data/resolution.ini
@@ -5,6 +5,8 @@
4x2=712x354
4x3=712x533
4x4=712x712
+4x5=712x891
+4x6=712x1070
21x21=207x207
23x21=645x207
23x23=645x645
diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec
index db10fc3..c459cfe 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.21.2
+Version: 0.21.4
Release: 1
Group: HomeTF/Livebox
License: Flora License
diff --git a/pkgmgr_livebox/src/service_register.c b/pkgmgr_livebox/src/service_register.c
index c97464b..2828476 100644
--- a/pkgmgr_livebox/src/service_register.c
+++ b/pkgmgr_livebox/src/service_register.c
@@ -171,14 +171,17 @@ struct livebox {
int nodisplay;
int mouse_event; /* Mouse event processing option for livebox */
+ int default_touch_effect;
+ int default_need_frame;
+
enum lb_type lb_type;
xmlChar *lb_src;
xmlChar *lb_group;
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 */
+ xmlChar *preview[NR_OF_SIZE_LIST];
+ int touch_effect[NR_OF_SIZE_LIST]; /* Touch effect of a livebox */
+ int need_frame[NR_OF_SIZE_LIST]; /* Box needs frame which should be cared by viewer */
enum pd_type pd_type;
xmlChar *pd_src;
@@ -1499,10 +1502,12 @@ static inline int livebox_destroy(struct livebox *livebox)
xmlFree(livebox->preview[4]); /* 4x2 */
xmlFree(livebox->preview[5]); /* 4x3 */
xmlFree(livebox->preview[6]); /* 4x4 */
- xmlFree(livebox->preview[7]); /* 21x21 */
- xmlFree(livebox->preview[8]); /* 23x21 */
- xmlFree(livebox->preview[9]); /* 23x23 */
- xmlFree(livebox->preview[10]); /* 0x0 */
+ xmlFree(livebox->preview[7]); /* 4x5 */
+ xmlFree(livebox->preview[8]); /* 4x6 */
+ xmlFree(livebox->preview[9]); /* easy 1x1 */
+ xmlFree(livebox->preview[10]); /* easy 3x1 */
+ xmlFree(livebox->preview[11]); /* easy 3x3 */
+ xmlFree(livebox->preview[12]); /* full */
dlist_foreach_safe(livebox->i18n_list, l, n, i18n) {
livebox->i18n_list = dlist_remove(livebox->i18n_list, l);
@@ -1698,10 +1703,10 @@ static inline void update_size_info(struct livebox *livebox, int idx, xmlNodePtr
livebox->need_frame[idx] = !xmlStrcasecmp(need_frame, (const xmlChar *)"true");
xmlFree(need_frame);
} else {
- livebox->need_frame[idx] = 0;
+ livebox->need_frame[idx] = livebox->default_need_frame;
}
} else {
- livebox->need_frame[idx] = 0;
+ livebox->need_frame[idx] = livebox->default_need_frame;
}
if (xmlHasProp(node, (const xmlChar *)"touch_effect")) {
@@ -1712,10 +1717,10 @@ static inline void update_size_info(struct livebox *livebox, int idx, xmlNodePtr
livebox->touch_effect[idx] = !xmlStrcasecmp(touch_effect, (const xmlChar *)"true");
xmlFree(touch_effect);
} else {
- livebox->touch_effect[idx] = 1;
+ livebox->touch_effect[idx] = livebox->default_touch_effect;
}
} else {
- livebox->touch_effect[idx] = 1;
+ livebox->touch_effect[idx] = livebox->default_touch_effect;
}
}
@@ -1759,6 +1764,36 @@ static inline void update_box(struct livebox *livebox, xmlNodePtr node)
}
}
+ if (!xmlHasProp(node, (const xmlChar *)"touch_effect")) {
+ livebox->default_touch_effect = 1;
+ } else {
+ xmlChar *touch_effect;
+
+ touch_effect = xmlGetProp(node, (const xmlChar *)"touch_effect");
+ if (!touch_effect) {
+ ErrPrint("default touch_effect is NIL\n");
+ livebox->default_touch_effect = 1;
+ } else {
+ livebox->default_touch_effect = !xmlStrcasecmp(touch_effect, (const xmlChar *)"true");
+ xmlFree(touch_effect);
+ }
+ }
+
+ if (!xmlHasProp(node, (const xmlChar *)"need_frame")) {
+ livebox->default_need_frame = 0;
+ } else {
+ xmlChar *need_frame;
+
+ need_frame = xmlGetProp(node, (const xmlChar *)"need_frame");
+ if (!need_frame) {
+ ErrPrint("default need_frame is NIL\n");
+ livebox->default_need_frame = 0;
+ } else {
+ livebox->default_need_frame = !xmlStrcasecmp(need_frame, (const xmlChar *)"true");
+ xmlFree(need_frame);
+ }
+ }
+
for (node = node->children; node; node = node->next) {
if (!xmlStrcasecmp(node->name, (const xmlChar *)"size")) {
xmlChar *size;
@@ -1783,7 +1818,7 @@ 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;
- update_size_info(livebox, 7, node);
+ update_size_info(livebox, 9, node);
} else {
livebox->size_list |= LB_SIZE_TYPE_1x1;
update_size_info(livebox, 0, node);
@@ -1791,14 +1826,14 @@ static inline void update_box(struct livebox *livebox, xmlNodePtr node)
} else if (!xmlStrcasecmp(size, (const xmlChar *)"3x1")) {
if (is_easy) {
livebox->size_list |= LB_SIZE_TYPE_EASY_3x1;
- update_size_info(livebox, 8, node);
+ update_size_info(livebox, 10, 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;
- update_size_info(livebox, 9, node);
+ update_size_info(livebox, 11, node);
} else {
ErrPrint("Invalid size tag (%s)\n", size);
}
@@ -1820,18 +1855,24 @@ static inline void update_box(struct livebox *livebox, xmlNodePtr node)
} else if (!xmlStrcasecmp(size, (const xmlChar *)"4x4")) {
livebox->size_list |= LB_SIZE_TYPE_4x4;
update_size_info(livebox, 6, node);
+ } else if (!xmlStrcasecmp(size, (const xmlChar *)"4x5")) {
+ livebox->size_list |= LB_SIZE_TYPE_4x5;
+ update_size_info(livebox, 7, node);
+ } else if (!xmlStrcasecmp(size, (const xmlChar *)"4x6")) {
+ livebox->size_list |= LB_SIZE_TYPE_4x6;
+ update_size_info(livebox, 8, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"21x21")) {
livebox->size_list |= LB_SIZE_TYPE_EASY_1x1;
- update_size_info(livebox, 7, node);
+ update_size_info(livebox, 9, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"23x21")) {
livebox->size_list |= LB_SIZE_TYPE_EASY_3x1;
- update_size_info(livebox, 8, node);
+ update_size_info(livebox, 10, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"23x23")) {
livebox->size_list |= LB_SIZE_TYPE_EASY_3x3;
- update_size_info(livebox, 9, node);
+ update_size_info(livebox, 11, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"0x0")) {
livebox->size_list |= LB_SIZE_TYPE_0x0;
- update_size_info(livebox, 10, node);
+ update_size_info(livebox, 12, node);
} else {
ErrPrint("Invalid size tag (%s)\n", size);
}
@@ -2154,26 +2195,38 @@ static inline int db_insert_livebox(struct livebox *livebox, const char *appid)
goto errout;
}
+ if (livebox->size_list & LB_SIZE_TYPE_4x5) {
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x5, (char *)livebox->preview[7], livebox->touch_effect[7], livebox->need_frame[7]);
+ if (ret < 0)
+ goto errout;
+ }
+
+ if (livebox->size_list & LB_SIZE_TYPE_4x6) {
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x6, (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_1x1) {
- 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]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_EASY_1x1, (char *)livebox->preview[9], livebox->touch_effect[9], livebox->need_frame[9]);
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], livebox->touch_effect[8], livebox->need_frame[8]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_EASY_3x1, (char *)livebox->preview[10], livebox->touch_effect[10], livebox->need_frame[10]);
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], livebox->touch_effect[9], livebox->need_frame[9]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_EASY_3x3, (char *)livebox->preview[11], livebox->touch_effect[11], livebox->need_frame[11]);
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], livebox->touch_effect[10], livebox->need_frame[10]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_0x0, (char *)livebox->preview[12], livebox->touch_effect[12], livebox->need_frame[12]);
if (ret < 0)
goto errout;
}
diff --git a/src/buffer_handler.c b/src/buffer_handler.c
index dba3e79..b410a82 100644
--- a/src/buffer_handler.c
+++ b/src/buffer_handler.c
@@ -171,6 +171,8 @@ static inline struct buffer *create_pixmap(struct buffer_info *info)
struct buffer *buffer;
Display *disp;
Window parent;
+ XGCValues gcv;
+ GC gc;
disp = ecore_x_display_get();
if (!disp)
@@ -210,7 +212,20 @@ static inline struct buffer *create_pixmap(struct buffer_info *info)
return NULL;
}
- XSync(disp, False);
+ /*!
+ * \note
+ * Clear pixmap
+ */
+ memset(&gcv, 0, sizeof(gcv));
+ gc = XCreateGC(disp, gem->pixmap, GCForeground, &gcv);
+ if (gc) {
+ XFillRectangle(disp, gem->pixmap, gc, 0, 0, info->w, info->h);
+ XSync(disp, False);
+ XFreeGC(disp, gc);
+ } else {
+ XSync(disp, False);
+ ErrPrint("Unable to clear the pixmap\n");
+ }
DbgPrint("Pixmap:0x%X is created\n", gem->pixmap);
return buffer;
diff --git a/src/package.c b/src/package.c
index 6d14eb8..21c6ce1 100644
--- a/src/package.c
+++ b/src/package.c
@@ -168,7 +168,15 @@ static int slave_fault_cb(struct slave_node *slave, void *data)
struct inst_info *inst;
struct pkg_info *info = (struct pkg_info *)data;
- DbgPrint("Slave %s has critical fault. destroy all instances\n", slave_name(slave));
+ if (package_is_fault(info)) {
+ ErrPrint("Already faulted package: %s\n", package_name(info));
+ return 0;
+ }
+
+ package_set_fault_info(info, util_timestamp(), slave_name(slave), __func__);
+ fault_broadcast_info(package_name(info), slave_name(slave), __func__);
+
+ DbgPrint("Slave critical fault - package: %s (by slave fault %s\n", package_name(info), slave_name(slave));
EINA_LIST_FOREACH_SAFE(info->inst_list, l, n, inst) {
DbgPrint("Destroy instance %p\n", inst);
instance_destroyed(inst);
diff --git a/src/script_handler.c b/src/script_handler.c
index 9fbef11..a0a2427 100644
--- a/src/script_handler.c
+++ b/src/script_handler.c
@@ -79,7 +79,7 @@ struct script_port {
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);
+ int (*feed_event)(void *handle, Evas *e, int event_type, int x, int y, int down, double timestamp);
void *(*create)(const char *file, const char *option);
int (*destroy)(void *handle);
@@ -1367,7 +1367,7 @@ HAPI int script_handler_feed_event(struct script_info *info, int event, double t
return LB_STATUS_ERROR_FAULT;
}
- return info->port->feed_event(info->port_data, e, event, info->x, info->y, timestamp);
+ return info->port->feed_event(info->port_data, e, event, info->x, info->y, info->down, timestamp);
}
/* End of a file */
diff --git a/src/server.c b/src/server.c
index 4932f7f..a19a5cc 100644
--- a/src/server.c
+++ b/src/server.c
@@ -2379,7 +2379,141 @@ out:
return result;
}
-static struct packet *client_pd_access_scroll(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_pd_access_scroll_down(pid_t pid, int handle, const struct packet *packet)
+{
+ struct packet *result;
+ struct client_node *client;
+ const char *pkgname;
+ const char *id;
+ int ret;
+ double timestamp;
+ int x;
+ int y;
+ struct inst_info *inst;
+ const struct pkg_info *pkg;
+
+ 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, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+ if (ret != 5) {
+ ErrPrint("Invalid parameter\n");
+ ret = LB_STATUS_ERROR_INVALID;
+ goto out;
+ }
+
+ /*!
+ * \NOTE:
+ * Trust the package name which are sent by the client.
+ * The package has to be a livebox package name.
+ */
+ inst = package_find_instance_by_id(pkgname, id);
+ if (!inst) {
+ ErrPrint("Instance[%s] is not exists\n", id);
+ ret = LB_STATUS_ERROR_NOT_EXIST;
+ goto out;
+ }
+
+ pkg = instance_package(inst);
+ if (!pkg) {
+ ErrPrint("Package[%s] info is not found\n", pkgname);
+ ret = LB_STATUS_ERROR_FAULT;
+ goto out;
+ }
+
+ if (package_is_fault(pkg)) {
+ /*!
+ * \note
+ * If the package is registered as fault module,
+ * slave has not load it, so we don't need to do anything at here!
+ */
+ DbgPrint("Package[%s] is faulted\n", pkgname);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
+ struct buffer_info *buffer;
+ struct slave_node *slave;
+ // struct packet *packet;
+
+ buffer = instance_pd_buffer(inst);
+ if (!buffer) {
+ ErrPrint("Instance[%s] has no buffer\n", id);
+ ret = LB_STATUS_ERROR_FAULT;
+ goto out;
+ }
+
+ slave = package_slave(pkg);
+ if (!slave) {
+ ErrPrint("Package[%s] has no slave\n", pkgname);
+ ret = LB_STATUS_ERROR_INVALID;
+ goto out;
+ }
+
+ /*
+ packet = packet_create_noack("pd_mouse_enter", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+ if (!packet) {
+ ErrPrint("Failed to create a packet[%s]\n", pkgname);
+ ret = LB_STATUS_ERROR_FAULT;
+ goto out;
+ }
+ */
+
+ packet_ref((struct packet *)packet);
+ ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+ } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
+ struct script_info *script;
+ Evas *e;
+
+ script = instance_pd_script(inst);
+ if (!script) {
+ ret = LB_STATUS_ERROR_FAULT;
+ goto out;
+ }
+
+ e = script_handler_evas(script);
+ if (!e) {
+ ret = LB_STATUS_ERROR_FAULT;
+ goto out;
+ }
+
+ 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;
+
+ 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:
+ 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_move(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
struct client_node *client;
@@ -2513,6 +2647,140 @@ out:
return result;
}
+static struct packet *client_pd_access_scroll_up(pid_t pid, int handle, const struct packet *packet)
+{
+ struct packet *result;
+ struct client_node *client;
+ const char *pkgname;
+ const char *id;
+ int ret;
+ double timestamp;
+ int x;
+ int y;
+ struct inst_info *inst;
+ const struct pkg_info *pkg;
+
+ 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, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+ if (ret != 5) {
+ ErrPrint("Invalid parameter\n");
+ ret = LB_STATUS_ERROR_INVALID;
+ goto out;
+ }
+
+ /*!
+ * \NOTE:
+ * Trust the package name which are sent by the client.
+ * The package has to be a livebox package name.
+ */
+ inst = package_find_instance_by_id(pkgname, id);
+ if (!inst) {
+ ErrPrint("Instance[%s] is not exists\n", id);
+ ret = LB_STATUS_ERROR_NOT_EXIST;
+ goto out;
+ }
+
+ pkg = instance_package(inst);
+ if (!pkg) {
+ ErrPrint("Package[%s] info is not found\n", pkgname);
+ ret = LB_STATUS_ERROR_FAULT;
+ goto out;
+ }
+
+ if (package_is_fault(pkg)) {
+ /*!
+ * \note
+ * If the package is registered as fault module,
+ * slave has not load it, so we don't need to do anything at here!
+ */
+ DbgPrint("Package[%s] is faulted\n", pkgname);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
+ struct buffer_info *buffer;
+ struct slave_node *slave;
+ // struct packet *packet;
+
+ buffer = instance_pd_buffer(inst);
+ if (!buffer) {
+ ErrPrint("Instance[%s] has no buffer\n", id);
+ ret = LB_STATUS_ERROR_FAULT;
+ goto out;
+ }
+
+ slave = package_slave(pkg);
+ if (!slave) {
+ ErrPrint("Package[%s] has no slave\n", pkgname);
+ ret = LB_STATUS_ERROR_INVALID;
+ goto out;
+ }
+
+ /*
+ packet = packet_create_noack("pd_mouse_enter", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+ if (!packet) {
+ ErrPrint("Failed to create a packet[%s]\n", pkgname);
+ ret = LB_STATUS_ERROR_FAULT;
+ goto out;
+ }
+ */
+
+ packet_ref((struct packet *)packet);
+ ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+ } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
+ struct script_info *script;
+ Evas *e;
+
+ script = instance_pd_script(inst);
+ if (!script) {
+ ret = LB_STATUS_ERROR_FAULT;
+ goto out;
+ }
+
+ e = script_handler_evas(script);
+ if (!e) {
+ ret = LB_STATUS_ERROR_FAULT;
+ goto out;
+ }
+
+ script_handler_update_pointer(script, x, y, 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:
+ 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_unhighlight(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
@@ -4121,7 +4389,127 @@ out:
return result;
}
-static struct packet *client_lb_access_scroll(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_lb_access_scroll_down(pid_t pid, int handle, const struct packet *packet)
+{
+ struct packet *result;
+ struct client_node *client;
+ const char *pkgname;
+ const char *id;
+ int ret;
+ double timestamp;
+ struct inst_info *inst;
+ const struct pkg_info *pkg;
+ int x;
+ int y;
+
+ client = client_find_by_pid(pid);
+ if (!client) {
+ ErrPrint("Client %d is not exist\n", pid);
+ ret = LB_STATUS_ERROR_NOT_EXIST;
+ goto out;
+ }
+
+ ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+ if (ret != 5) {
+ ErrPrint("Parameter is not matched\n");
+ ret = LB_STATUS_ERROR_INVALID;
+ goto out;
+ }
+
+ inst = package_find_instance_by_id(pkgname, id);
+ if (!inst) {
+ ErrPrint("Instance[%s] is not exists\n", id);
+ ret = LB_STATUS_ERROR_NOT_EXIST;
+ goto out;
+ }
+
+ pkg = instance_package(inst);
+ if (!pkg) {
+ ErrPrint("Package[%s] info is not exists\n", pkgname);
+ ret = LB_STATUS_ERROR_FAULT;
+ goto out;
+ }
+
+ if (package_is_fault(pkg)) {
+ ret = LB_STATUS_ERROR_FAULT;
+ } else if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
+ struct buffer_info *buffer;
+ struct slave_node *slave;
+
+ buffer = instance_lb_buffer(inst);
+ if (!buffer) {
+ ErrPrint("Instance[%s] has no buffer\n", id);
+ ret = LB_STATUS_ERROR_FAULT;
+ goto out;
+ }
+
+ slave = package_slave(pkg);
+ if (!slave) {
+ ErrPrint("Slave is not exists\n");
+ ret = LB_STATUS_ERROR_INVALID;
+ goto out;
+ }
+
+ packet_ref((struct packet *)packet);
+ ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+ /*!
+ * Enen if it fails to send packet,
+ * The packet will be unref'd
+ * So we don't need to check the ret value.
+ */
+ } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
+ struct script_info *script;
+ Evas *e;
+
+ script = instance_lb_script(inst);
+ if (!script) {
+ ErrPrint("Instance has no script\n");
+ ret = LB_STATUS_ERROR_FAULT;
+ goto out;
+ }
+
+ e = script_handler_evas(script);
+ if (!e) {
+ ErrPrint("Instance has no evas\n");
+ ret = LB_STATUS_ERROR_INVALID;
+ goto out;
+ }
+
+ 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;
+
+ 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:
+ 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_move(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
struct client_node *client;
@@ -4241,6 +4629,126 @@ out:
return result;
}
+static struct packet *client_lb_access_scroll_up(pid_t pid, int handle, const struct packet *packet)
+{
+ struct packet *result;
+ struct client_node *client;
+ const char *pkgname;
+ const char *id;
+ int ret;
+ double timestamp;
+ struct inst_info *inst;
+ const struct pkg_info *pkg;
+ int x;
+ int y;
+
+ client = client_find_by_pid(pid);
+ if (!client) {
+ ErrPrint("Client %d is not exist\n", pid);
+ ret = LB_STATUS_ERROR_NOT_EXIST;
+ goto out;
+ }
+
+ ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+ if (ret != 5) {
+ ErrPrint("Parameter is not matched\n");
+ ret = LB_STATUS_ERROR_INVALID;
+ goto out;
+ }
+
+ inst = package_find_instance_by_id(pkgname, id);
+ if (!inst) {
+ ErrPrint("Instance[%s] is not exists\n", id);
+ ret = LB_STATUS_ERROR_NOT_EXIST;
+ goto out;
+ }
+
+ pkg = instance_package(inst);
+ if (!pkg) {
+ ErrPrint("Package[%s] info is not exists\n", pkgname);
+ ret = LB_STATUS_ERROR_FAULT;
+ goto out;
+ }
+
+ if (package_is_fault(pkg)) {
+ ret = LB_STATUS_ERROR_FAULT;
+ } else if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
+ struct buffer_info *buffer;
+ struct slave_node *slave;
+
+ buffer = instance_lb_buffer(inst);
+ if (!buffer) {
+ ErrPrint("Instance[%s] has no buffer\n", id);
+ ret = LB_STATUS_ERROR_FAULT;
+ goto out;
+ }
+
+ slave = package_slave(pkg);
+ if (!slave) {
+ ErrPrint("Slave is not exists\n");
+ ret = LB_STATUS_ERROR_INVALID;
+ goto out;
+ }
+
+ packet_ref((struct packet *)packet);
+ ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+ /*!
+ * Enen if it fails to send packet,
+ * The packet will be unref'd
+ * So we don't need to check the ret value.
+ */
+ } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
+ struct script_info *script;
+ Evas *e;
+
+ script = instance_lb_script(inst);
+ if (!script) {
+ ErrPrint("Instance has no script\n");
+ ret = LB_STATUS_ERROR_FAULT;
+ goto out;
+ }
+
+ e = script_handler_evas(script);
+ if (!e) {
+ ErrPrint("Instance has no evas\n");
+ ret = LB_STATUS_ERROR_INVALID;
+ goto out;
+ }
+
+ script_handler_update_pointer(script, x, y, 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:
+ 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;
@@ -7031,13 +7539,21 @@ static struct method s_client_table[] = {
.handler = client_pd_access_value_change,
},
{
- .cmd = "pd_access_scroll",
- .handler = client_pd_access_scroll,
- },
- {
.cmd = "pd_access_unhighlight",
.handler = client_pd_access_unhighlight,
},
+ {
+ .cmd = "pd_access_scroll_down",
+ .handler = client_pd_access_scroll_down,
+ },
+ {
+ .cmd = "pd_access_scroll_move",
+ .handler = client_pd_access_scroll_move,
+ },
+ {
+ .cmd = "pd_access_scroll_up",
+ .handler = client_pd_access_scroll_up,
+ },
{
.cmd = "lb_access_hl",
@@ -7060,13 +7576,21 @@ static struct method s_client_table[] = {
.handler = client_lb_access_value_change,
},
{
- .cmd = "lb_access_scroll",
- .handler = client_lb_access_scroll,
- },
- {
.cmd = "lb_access_unhighlight",
.handler = client_lb_access_unhighlight,
},
+ {
+ .cmd = "lb_access_scroll_down",
+ .handler = client_lb_access_scroll_down,
+ },
+ {
+ .cmd = "lb_access_scroll_move",
+ .handler = client_lb_access_scroll_move,
+ },
+ {
+ .cmd = "lb_access_scroll_up",
+ .handler = client_lb_access_scroll_up,
+ },
{
.cmd = "lb_key_down",
diff --git a/src/util.c b/src/util.c
index ad36896..194c762 100644
--- a/src/util.c
+++ b/src/util.c
@@ -146,6 +146,9 @@ HAPI int util_unlink(const char *filename)
int desclen;
int ret;
+ if (!filename)
+ return LB_STATUS_ERROR_INVALID;
+
desclen = strlen(filename) + 6; /* .desc */
descfile = malloc(desclen);
if (!descfile) {
@@ -199,6 +202,7 @@ HAPI unsigned long util_free_space(const char *path)
}
space = st.f_bsize * st.f_bfree;
+ DbgPrint("Available size: %lu, f_bsize: %lu, f_bfree: %lu\n", space, st.f_bsize, st.f_bfree);
/*!
* \note
* Must have to check the overflow