summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2013-03-31 23:23:58 +0000
committerSung-jae Park <nicesj.park@samsung.com>2013-03-31 23:23:58 +0000
commit17d49beef5649d4535fb8938920c75bab7e29f56 (patch)
tree8eb7b608341a45ac7f9c07f22b61733b90122163
parentc39e4f9636874bfaebdb38a32fbbd2c5a5aceecd (diff)
downloaddata-provider-master-17d49beef5649d4535fb8938920c75bab7e29f56.tar.gz
data-provider-master-17d49beef5649d4535fb8938920c75bab7e29f56.tar.bz2
data-provider-master-17d49beef5649d4535fb8938920c75bab7e29f56.zip
Sync to I865165b974aa32a35a58b7260cb1c046ed8f1413
Add new event path & Change pixmap 24 to 32. Fix the bug of size_changed event. It has to send the fbid to the client to update its buffer info from viewer side. Separating slaves(using net option), 0x0 size box 1. Separate the slave process using network option. If a box requires network connection to update their contents, Load it from specific slave which designed to use the network. Currently, we use only one package for loading boxes. So we just launch another slave process for separating boxes using network attributes. 2. 0x0 box size is added. 0x0 is supported for inhouse/commercialization version only. Its size is defined 720x1280 (depends on the screen size) Add new event path for holding scroller of viewer Viewer should holds the scroller when it gets this event. This hold scroll event is used for get request of boxes. Change-Id: I3a8b8c75e5a5229aef5f15394308d9bb3f1d770e
-rw-r--r--data/resolution.ini1
-rw-r--r--include/instance.h1
-rw-r--r--include/slave_life.h7
-rw-r--r--packaging/data-provider-master.spec2
-rw-r--r--pkgmgr_livebox/livebox.xml2
-rw-r--r--pkgmgr_livebox/src/service_register.c14
-rw-r--r--src/buffer_handler.c2
-rw-r--r--src/instance.c32
-rw-r--r--src/package.c4
-rw-r--r--src/server.c575
-rw-r--r--src/slave_life.c24
11 files changed, 583 insertions, 81 deletions
diff --git a/data/resolution.ini b/data/resolution.ini
index cf4275f..6e031ac 100644
--- a/data/resolution.ini
+++ b/data/resolution.ini
@@ -8,3 +8,4 @@
21x21=207x207
23x21=645x207
23x23=645x645
+0x0=720x1280
diff --git a/include/instance.h b/include/instance.h
index 2da38f5..dc50fc1 100644
--- a/include/instance.h
+++ b/include/instance.h
@@ -154,6 +154,7 @@ 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);
extern int instance_set_period(struct inst_info *inst, double period);
extern int instance_clicked(struct inst_info *inst, const char *event, double timestamp, double x, double y);
extern int instance_text_signal_emit(struct inst_info *inst, const char *emission, const char *source, double sx, double sy, double ex, double ey);
diff --git a/include/slave_life.h b/include/slave_life.h
index 7ff8996..5c43895 100644
--- a/include/slave_life.h
+++ b/include/slave_life.h
@@ -82,7 +82,7 @@ extern const int const slave_refcnt(struct slave_node *slave);
* \param[in] period
* \return slave_node
*/
-extern struct slave_node *slave_create(const char *name, int is_secured, const char *abi, const char *pkgname);
+extern struct slave_node *slave_create(const char *name, int is_secured, const char *abi, const char *pkgname, int network);
/*!
* \brief
@@ -156,7 +156,7 @@ extern int slave_set_pid(struct slave_node *slave, pid_t pid);
extern void slave_load_package(struct slave_node *slave);
extern void slave_unload_package(struct slave_node *slave);
extern int const slave_loaded_package(struct slave_node *slave);
-extern struct slave_node *slave_find_available(const char *abi, int secured);
+extern struct slave_node *slave_find_available(const char *abi, int secured, int network);
extern double const slave_ttl(const struct slave_node *slave);
@@ -190,4 +190,7 @@ extern void slave_set_reactivate_instances(struct slave_node *slave, int reactiv
extern void slave_set_reactivation(struct slave_node *slave, int flag);
extern int slave_need_to_reactivate(struct slave_node *slave);
+extern int slave_network(const struct slave_node *slave);
+extern void slave_set_network(struct slave_node *slave, int network);
+
/* End of a file */
diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec
index a89ea1c..4381b68 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.19.1
+Version: 0.20.0
Release: 1
Group: HomeTF/Livebox
License: Flora License
diff --git a/pkgmgr_livebox/livebox.xml b/pkgmgr_livebox/livebox.xml
index 3c258ec..0ab09af 100644
--- a/pkgmgr_livebox/livebox.xml
+++ b/pkgmgr_livebox/livebox.xml
@@ -26,6 +26,8 @@
<size preview="ABSPATH">23x21</size>
<size>23x23</size>
+ <!-- Only supported for special livebox - inhouse / commercialization target only -->
+ <size>0x0</size>
<script src="/opt/usr/apps/org.tizen.myapp/res/script/my.edj" group="my_group" />
</box>
diff --git a/pkgmgr_livebox/src/service_register.c b/pkgmgr_livebox/src/service_register.c
index 2537280..5e212ae 100644
--- a/pkgmgr_livebox/src/service_register.c
+++ b/pkgmgr_livebox/src/service_register.c
@@ -177,7 +177,7 @@ struct livebox {
xmlChar *lb_group;
int size_list; /* 1x1, 2x1, 2x2, 4x1, 4x2, 4x3, 4x4 */
- xmlChar *preview[10];
+ xmlChar *preview[11];
enum pd_type pd_type;
xmlChar *pd_src;
@@ -1494,6 +1494,7 @@ static inline int livebox_destroy(struct livebox *livebox)
xmlFree(livebox->preview[7]); /* 21x21 */
xmlFree(livebox->preview[8]); /* 23x21 */
xmlFree(livebox->preview[9]); /* 23x23 */
+ xmlFree(livebox->preview[10]); /* 0x0 */
dlist_foreach_safe(livebox->i18n_list, l, n, i18n) {
livebox->i18n_list = dlist_remove(livebox->i18n_list, l);
@@ -1825,6 +1826,11 @@ static inline void update_box(struct livebox *livebox, xmlNodePtr node)
if (xmlHasProp(node, (const xmlChar *)"preview")) {
livebox->preview[9] = xmlGetProp(node, (const xmlChar *)"preview");
}
+ } 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");
+ }
} else {
ErrPrint("Invalid size tag (%s)\n", size);
}
@@ -2165,6 +2171,12 @@ static inline int db_insert_livebox(struct livebox *livebox, const char *appid)
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]);
+ if (ret < 0)
+ goto errout;
+ }
+
dlist_foreach(livebox->group_list, l, group) {
/* group ID "id" */
id = db_get_group_id((char *)group->cluster, (char *)group->category);
diff --git a/src/buffer_handler.c b/src/buffer_handler.c
index dedf13d..dba3e79 100644
--- a/src/buffer_handler.c
+++ b/src/buffer_handler.c
@@ -1144,7 +1144,7 @@ static inline int sync_for_pixmap(struct buffer *buffer)
* \NOTE
* XCreatePixmap can only uses 24 bits depth only.
*/
- xim = XShmCreateImage(disp, visual, 24 /* (gem->depth << 3) */, ZPixmap, NULL, &si, gem->w, gem->h);
+ xim = XShmCreateImage(disp, visual, (gem->depth << 3), ZPixmap, NULL, &si, gem->w, gem->h);
if (xim == NULL) {
if (shmdt(si.shmaddr) < 0)
ErrPrint("shmdt: %s\n", strerror(errno));
diff --git a/src/instance.c b/src/instance.c
index 32bc3bd..6fc0f8b 100644
--- a/src/instance.c
+++ b/src/instance.c
@@ -94,6 +94,7 @@ struct inst_info {
char *title;
int is_pinned_up;
double sleep_at;
+ int scroll_locked;
enum livebox_visible_state visible;
@@ -257,6 +258,7 @@ static inline int instance_recover_visible_state(struct inst_info *inst)
static inline void instance_send_resized_event(struct inst_info *inst, int is_pd, int w, int h, int status)
{
struct packet *packet;
+ enum lb_type lb_type;
const char *pkgname;
const char *id;
@@ -266,11 +268,18 @@ static inline void instance_send_resized_event(struct inst_info *inst, int is_pd
}
pkgname = package_name(inst->info);
- id = inst->id;
+
+ lb_type = package_lb_type(inst->info);
+ if (lb_type == LB_TYPE_SCRIPT)
+ id = fb_id(script_handler_fb(inst->lb.canvas.script));
+ else if (lb_type == LB_TYPE_BUFFER)
+ id = buffer_handler_id(inst->lb.canvas.buffer);
+ else
+ id = "";
DbgPrint("Size is changed to %dx%d (%s) %s\n", w, h, id, is_pd ? "pd" : "lb");
- packet = packet_create_noack("size_changed", "ssiiii", pkgname, id, is_pd, w, h, status);
+ packet = packet_create_noack("size_changed", "sssiiii", pkgname, inst->id, id, is_pd, w, h, status);
if (packet)
CLIENT_SEND_EVENT(inst, packet);
else
@@ -1506,6 +1515,25 @@ HAPI void instance_lb_updated_by_instance(struct inst_info *inst)
(void)CLIENT_SEND_EVENT(inst, packet);
}
+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);
+ 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");
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ inst->scroll_locked = hold;
+ return CLIENT_SEND_EVENT(inst, packet);
+}
+
HAPI void instance_pd_updated_by_instance(struct inst_info *inst, const char *descfile)
{
struct packet *packet;
diff --git a/src/package.c b/src/package.c
index 435853f..6d14eb8 100644
--- a/src/package.c
+++ b/src/package.c
@@ -1050,7 +1050,7 @@ static inline int assign_new_slave(struct pkg_info *info)
}
DbgPrint("New slave name is %s, it is assigned for livebox %s (using %s)\n", s_name, info->pkgname, s_pkgname);
- info->slave = slave_create(s_name, info->secured, info->abi, s_pkgname);
+ info->slave = slave_create(s_name, info->secured, info->abi, s_pkgname, info->network);
DbgFree(s_name);
DbgFree(s_pkgname);
@@ -1075,7 +1075,7 @@ static inline int assign_new_slave(struct pkg_info *info)
HAPI int package_add_instance(struct pkg_info *info, struct inst_info *inst)
{
if (!info->inst_list) {
- info->slave = slave_find_available(info->abi, info->secured);
+ info->slave = slave_find_available(info->abi, info->secured, info->network);
if (!info->slave) {
int ret;
diff --git a/src/server.c b/src/server.c
index 10047d7..b6a6f43 100644
--- a/src/server.c
+++ b/src/server.c
@@ -256,8 +256,6 @@ static struct packet *client_acquire(pid_t pid, int handle, const struct packet
goto out;
}
- DbgPrint("Acquired %lf\n", timestamp);
-
ret = 0;
/*!
* \note
@@ -2186,7 +2184,235 @@ out:
return NULL;
}
-static struct packet *client_pd_access_read(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_pd_access_value_change(pid_t pid, int handle, const struct packet *packet)
+{
+ 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);
+ /*!
+ * \TODO: Push up the ACCESS_VALUE_CHANGE event
+ */
+ ret = 0;
+ } else {
+ ErrPrint("Unsupported package\n");
+ ret = LB_STATUS_ERROR_INVALID;
+ }
+
+out:
+ /*! \note No reply packet */
+ return NULL;
+}
+
+static struct packet *client_pd_access_scroll(pid_t pid, int handle, const struct packet *packet)
+{
+ 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);
+ /*!
+ * \TODO: Push up the ACCESS_SCROLL event
+ */
+ ret = 0;
+ } else {
+ ErrPrint("Unsupported package\n");
+ ret = LB_STATUS_ERROR_INVALID;
+ }
+
+out:
+ /*! \note No reply packet */
+ return NULL;
+}
+
+static struct packet *client_pd_access_hl(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -2287,7 +2513,7 @@ static struct packet *client_pd_access_read(pid_t pid, int handle, const struct
script_handler_update_pointer(script, x, y, -1);
/*!
- * \TODO: Push up the ACCESS_READ event
+ * \TODO: Push up the ACCESS_HIGHLIGHT event
*/
ret = 0;
} else {
@@ -2300,7 +2526,7 @@ out:
return NULL;
}
-static struct packet *client_pd_access_read_prev(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_pd_access_hl_prev(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -2401,7 +2627,7 @@ static struct packet *client_pd_access_read_prev(pid_t pid, int handle, const st
script_handler_update_pointer(script, x, y, -1);
/*!
- * \TODO: Push up the ACCESS_READ_PREV event
+ * \TODO: Push up the ACCESS_HIGHLIGHT_PREV event
*/
ret = 0;
} else {
@@ -2414,7 +2640,7 @@ out:
return NULL;
}
-static struct packet *client_pd_access_read_next(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_pd_access_hl_next(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -2515,7 +2741,7 @@ static struct packet *client_pd_access_read_next(pid_t pid, int handle, const st
script_handler_update_pointer(script, x, y, -1);
/*!
- * \TODO: Push up the ACCESS_READ_NEXT event
+ * \TODO: Push up the ACCESS_HIGHLIGHT_NEXT event
*/
ret = 0;
} else {
@@ -2629,7 +2855,7 @@ 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_READ_ACTIVATE event
+ * \TODO: Push up the ACCESS_ACTIVATE event
*/
ret = 0;
} else {
@@ -2928,7 +3154,7 @@ out:
return NULL;
}
-static struct packet *client_lb_access_read(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_lb_access_hl(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -3030,7 +3256,7 @@ static struct packet *client_lb_access_read(pid_t pid, int handle, const struct
script_handler_update_pointer(script, x, y, -1);
/*!
- * \TODO: Feed up this ACCESS_READ event
+ * \TODO: Feed up this ACCESS_HIGHLIGHT event
*/
ret = 0;
} else {
@@ -3043,7 +3269,7 @@ out:
return NULL;
}
-static struct packet *client_lb_access_read_prev(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_lb_access_hl_prev(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -3145,7 +3371,7 @@ static struct packet *client_lb_access_read_prev(pid_t pid, int handle, const st
script_handler_update_pointer(script, x, y, -1);
/*!
- * \TODO: Feed up this ACCESS_READ_PREV event
+ * \TODO: Feed up this ACCESS_HIGHLIGHT_PREV event
*/
ret = 0;
} else {
@@ -3158,7 +3384,7 @@ out:
return NULL;
}
-static struct packet *client_lb_access_read_next(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_lb_access_hl_next(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -3260,7 +3486,7 @@ static struct packet *client_lb_access_read_next(pid_t pid, int handle, const st
script_handler_update_pointer(script, x, y, -1);
/*!
- * \TODO: Feed up this ACCESS_READ_NEXT event
+ * \TODO: Feed up this ACCESS_HIGHLIGHT_NEXT event
*/
ret = 0;
} else {
@@ -3273,6 +3499,184 @@ out:
return NULL;
}
+static struct packet *client_lb_access_value_change(pid_t pid, int handle, const struct packet *packet)
+{
+ 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);
+ goto out;
+ }
+
+ ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+ if (ret != 5) {
+ ErrPrint("Invalid argument\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("Package[%s] info is not exists\n", pkgname);
+ goto out;
+ }
+
+ if (package_is_fault(pkg)) {
+ } 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);
+ goto out;
+ }
+
+ slave = package_slave(pkg);
+ if (!slave) {
+ ErrPrint("Slave is not exists\n");
+ 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");
+ goto out;
+ }
+
+ e = script_handler_evas(script);
+ if (!e) {
+ ErrPrint("Script has no evas\n");
+ goto out;
+ }
+
+ // script_handler_update_pointer(script, x, y, -1);
+
+ /*!
+ * \TODO: Feed up this VALUE_CHANGE event
+ */
+ } else {
+ ErrPrint("Unsupported package\n");
+ }
+
+out:
+ return NULL;
+}
+
+static struct packet *client_lb_access_scroll(pid_t pid, int handle, const struct packet *packet)
+{
+ 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);
+ goto out;
+ }
+
+ ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+ if (ret != 5) {
+ ErrPrint("Invalid argument\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("Package[%s] info is not exists\n", pkgname);
+ goto out;
+ }
+
+ if (package_is_fault(pkg)) {
+ } 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);
+ goto out;
+ }
+
+ slave = package_slave(pkg);
+ if (!slave) {
+ ErrPrint("Slave is not exists\n");
+ 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");
+ goto out;
+ }
+
+ e = script_handler_evas(script);
+ if (!e) {
+ ErrPrint("Instance has no evas\n");
+ goto out;
+ }
+
+ script_handler_update_pointer(script, x, y, -1);
+
+ /*!
+ * \TODO: Feed up this ACCESS_SCROLL event
+ */
+ } else {
+ ErrPrint("Unsupported package\n");
+ }
+
+out:
+ return NULL;
+}
+
static struct packet *client_lb_access_activate(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
@@ -3295,7 +3699,6 @@ static struct packet *client_lb_access_activate(pid_t pid, int handle, const str
ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
if (ret != 7) {
ErrPrint("Parameter is not matched\n");
- ret = LB_STATUS_ERROR_INVALID;
goto out;
}
@@ -3307,14 +3710,12 @@ static struct packet *client_lb_access_activate(pid_t pid, int handle, const str
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;
}
@@ -3325,7 +3726,6 @@ static struct packet *client_lb_access_activate(pid_t pid, int handle, const str
* 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_lb_type(pkg) == LB_TYPE_BUFFER) {
struct buffer_info *buffer;
struct slave_node *slave;
@@ -3334,14 +3734,12 @@ static struct packet *client_lb_access_activate(pid_t pid, int handle, const str
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("Package[%s] has no slave\n", pkgname);
- ret = LB_STATUS_ERROR_INVALID;
goto out;
}
@@ -3362,13 +3760,13 @@ static struct packet *client_lb_access_activate(pid_t pid, int handle, const str
script = instance_lb_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ErrPrint("Instance has no script\n");
goto out;
}
e = script_handler_evas(script);
if (!e) {
- ret = LB_STATUS_ERROR_FAULT;
+ ErrPrint("Script has no Evas\n");
goto out;
}
@@ -3377,10 +3775,8 @@ static struct packet *client_lb_access_activate(pid_t pid, int handle, const str
/*!
* \TODO: Feed up this ACCESS_ACTIVATE event
*/
- ret = 0;
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
}
out:
@@ -4521,13 +4917,13 @@ static struct packet *slave_hello(pid_t pid, int handle, const struct packet *pa
DbgPrint("Slave pkgname is invalid, ABI is replaced with '%s'(default)\n", abi);
}
- slave = slave_create(slavename, 1, abi, pkgname);
+ slave = slave_create(slavename, 1, abi, pkgname, 0);
if (!slave) {
ErrPrint("Failed to create a new slave for %s\n", slavename);
goto out;
}
- DbgPrint("New slave is created\n");
+ DbgPrint("New slave is created (net: 0)\n");
} else {
DbgPrint("Registered slave is replaced with this new one\n");
abi = slave_abi(slave);
@@ -4578,7 +4974,6 @@ static struct packet *slave_faulted(pid_t pid, int handle, const struct packet *
{
struct slave_node *slave;
struct inst_info *inst;
- const char *slavename;
const char *pkgname;
const char *id;
const char *func;
@@ -4590,14 +4985,14 @@ static struct packet *slave_faulted(pid_t pid, int handle, const struct packet *
goto out;
}
- ret = packet_get(packet, "ssss", &slavename, &pkgname, &id, &func);
- if (ret != 4) {
+ ret = packet_get(packet, "sss", &pkgname, &id, &func);
+ if (ret != 3) {
ErrPrint("Parameter is not matched\n");
goto out;
}
ret = fault_info_set(slave, pkgname, id, func);
- DbgPrint("Slave Faulted: %s (%d)\n", slavename, ret);
+ DbgPrint("Slave Faulted: %s (%d)\n", slave_name(slave), ret);
inst = package_find_instance_by_id(pkgname, id);
if (!inst) {
@@ -4616,7 +5011,6 @@ out:
static struct packet *slave_call(pid_t pid, int handle, const struct packet *packet) /* slave_name, pkgname, filename, function, ret */
{
struct slave_node *slave;
- const char *slavename;
const char *pkgname;
const char *id;
const char *func;
@@ -4628,8 +5022,8 @@ static struct packet *slave_call(pid_t pid, int handle, const struct packet *pac
goto out;
}
- ret = packet_get(packet, "ssss", &slavename, &pkgname, &id, &func);
- if (ret != 4) {
+ ret = packet_get(packet, "sss", &pkgname, &id, &func);
+ if (ret != 3) {
ErrPrint("Parameter is not matched\n");
goto out;
}
@@ -4644,7 +5038,6 @@ out:
static struct packet *slave_ret(pid_t pid, int handle, const struct packet *packet) /* slave_name, pkgname, filename, function, ret */
{
struct slave_node *slave;
- const char *slavename;
const char *pkgname;
const char *id;
const char *func;
@@ -4656,8 +5049,8 @@ static struct packet *slave_ret(pid_t pid, int handle, const struct packet *pack
goto out;
}
- ret = packet_get(packet, "ssss", &slavename, &pkgname, &id, &func);
- if (ret != 4) {
+ ret = packet_get(packet, "sss", &pkgname, &id, &func);
+ if (ret != 3) {
ErrPrint("Parameter is not matched\n");
goto out;
}
@@ -4672,7 +5065,6 @@ out:
static struct packet *slave_updated(pid_t pid, int handle, const struct packet *packet) /* slave_name, pkgname, filename, width, height, priority, ret */
{
struct slave_node *slave;
- const char *slavename;
const char *pkgname;
const char *id;
const char *content_info;
@@ -4689,10 +5081,10 @@ static struct packet *slave_updated(pid_t pid, int handle, const struct packet *
goto out;
}
- ret = packet_get(packet, "sssiidss", &slavename, &pkgname, &id,
+ ret = packet_get(packet, "ssiidss", &pkgname, &id,
&w, &h, &priority,
&content_info, &title);
- if (ret != 8) {
+ if (ret != 7) {
ErrPrint("Parameter is not matched\n");
goto out;
}
@@ -4737,10 +5129,45 @@ out:
return NULL;
}
+static struct packet *slave_hold_scroll(pid_t pid, int handle, const struct packet *packet)
+{
+ struct slave_node *slave;
+ struct inst_info *inst;
+ const char *pkgname;
+ const char *id;
+ int seize;
+ 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, &seize);
+ if (ret != 3) {
+ ErrPrint("Parameter is not matched\n");
+ goto out;
+ }
+
+ inst = package_find_instance_by_id(pkgname, id);
+ if (!inst) {
+ ErrPrint("No such instance(%s)\n", id);
+ } else if (package_is_fault(instance_package(inst))) {
+ ErrPrint("Faulted instance cannot seize the screen\n");
+ } else if (instance_state(inst) == INST_DESTROYED) {
+ ErrPrint("Instance(%s) is already destroyed\n", id);
+ } else {
+ (void)instance_hold_scroll(inst, seize);
+ }
+
+out:
+ return NULL;
+}
+
static struct packet *slave_desc_updated(pid_t pid, int handle, const struct packet *packet) /* slave_name, pkgname, filename, decsfile, ret */
{
struct slave_node *slave;
- const char *slavename;
const char *pkgname;
const char *id;
const char *descfile;
@@ -4753,8 +5180,8 @@ static struct packet *slave_desc_updated(pid_t pid, int handle, const struct pac
goto out;
}
- ret = packet_get(packet, "ssss", &slavename, &pkgname, &id, &descfile);
- if (ret != 4) {
+ ret = packet_get(packet, "sss", &pkgname, &id, &descfile);
+ if (ret != 3) {
ErrPrint("Parameter is not matched\n");
goto out;
}
@@ -4793,7 +5220,6 @@ out:
static struct packet *slave_deleted(pid_t pid, int handle, const struct packet *packet) /* slave_name, pkgname, id, ret */
{
struct slave_node *slave;
- const char *slavename;
const char *pkgname;
const char *id;
int ret;
@@ -4805,8 +5231,8 @@ static struct packet *slave_deleted(pid_t pid, int handle, const struct packet *
goto out;
}
- ret = packet_get(packet, "sss", &slavename, &pkgname, &id);
- if (ret != 3) {
+ ret = packet_get(packet, "ss", &pkgname, &id);
+ if (ret != 2) {
ErrPrint("Parameter is not matched\n");
goto out;
}
@@ -4829,7 +5255,6 @@ out:
static struct packet *slave_acquire_buffer(pid_t pid, int handle, const struct packet *packet) /* type, id, w, h, size */
{
enum target_type target;
- const char *slavename;
const char *pkgname;
const char *id;
int w;
@@ -4849,8 +5274,8 @@ static struct packet *slave_acquire_buffer(pid_t pid, int handle, const struct p
goto out;
}
- ret = packet_get(packet, "isssiii", &target, &slavename, &pkgname, &id, &w, &h, &pixel_size);
- if (ret != 7) {
+ ret = packet_get(packet, "issiii", &target, &pkgname, &id, &w, &h, &pixel_size);
+ if (ret != 6) {
ErrPrint("Invalid argument\n");
id = "";
ret = LB_STATUS_ERROR_INVALID;
@@ -4961,7 +5386,6 @@ static struct packet *slave_resize_buffer(pid_t pid, int handle, const struct pa
struct slave_node *slave;
struct packet *result;
enum target_type type;
- const char *slavename;
const char *pkgname;
const char *id;
int w;
@@ -4985,8 +5409,8 @@ static struct packet *slave_resize_buffer(pid_t pid, int handle, const struct pa
goto out;
}
- ret = packet_get(packet, "isssii", &type, &slavename, &pkgname, &id, &w, &h);
- if (ret != 6) {
+ ret = packet_get(packet, "issii", &type, &pkgname, &id, &w, &h);
+ if (ret != 5) {
ErrPrint("Invalid argument\n");
ret = LB_STATUS_ERROR_INVALID;
id = "";
@@ -5066,7 +5490,6 @@ out:
static struct packet *slave_release_buffer(pid_t pid, int handle, const struct packet *packet)
{
enum target_type type;
- const char *slavename;
const char *pkgname;
const char *id;
struct packet *result;
@@ -5081,7 +5504,7 @@ static struct packet *slave_release_buffer(pid_t pid, int handle, const struct p
goto out;
}
- if (packet_get(packet, "isss", &type, &slavename, &pkgname, &id) != 4) {
+ if (packet_get(packet, "iss", &type, &pkgname, &id) != 3) {
ErrPrint("Inavlid argument\n");
ret = LB_STATUS_ERROR_INVALID;
goto out;
@@ -5744,38 +6167,54 @@ static struct method s_client_table[] = {
},
{
- .cmd = "pd_access_read",
- .handler = client_pd_access_read,
+ .cmd = "pd_access_hl",
+ .handler = client_pd_access_hl,
},
{
- .cmd = "pd_access_read_prev",
- .handler = client_pd_access_read_prev,
+ .cmd = "pd_access_hl_prev",
+ .handler = client_pd_access_hl_prev,
},
{
- .cmd = "pd_access_read_next",
- .handler = client_pd_access_read_next,
+ .cmd = "pd_access_hl_next",
+ .handler = client_pd_access_hl_next,
},
{
.cmd = "pd_access_activate",
.handler = client_pd_access_activate,
},
+ {
+ .cmd = "pd_access_value_change",
+ .handler = client_pd_access_value_change,
+ },
+ {
+ .cmd = "pd_access_scroll",
+ .handler = client_pd_access_scroll,
+ },
{
- .cmd = "lb_access_read",
- .handler = client_lb_access_read,
+ .cmd = "lb_access_hl",
+ .handler = client_lb_access_hl,
},
{
- .cmd = "lb_access_read_prev",
- .handler = client_lb_access_read_prev,
+ .cmd = "lb_access_hl_prev",
+ .handler = client_lb_access_hl_prev,
},
{
- .cmd = "lb_access_read_next",
- .handler = client_lb_access_read_next,
+ .cmd = "lb_access_hl_next",
+ .handler = client_lb_access_hl_next,
},
{
.cmd = "lb_access_activate",
.handler = client_lb_access_activate,
},
+ {
+ .cmd = "lb_access_value_change",
+ .handler = client_lb_access_value_change,
+ },
+ {
+ .cmd = "lb_access_scroll",
+ .handler = client_lb_access_scroll,
+ },
{
.cmd = "lb_key_down",
@@ -5871,6 +6310,10 @@ static struct method s_slave_table[] = {
.handler = slave_faulted, /* slave_name, pkgname, id, funcname */
},
{
+ .cmd = "scroll",
+ .handler = slave_hold_scroll, /* slave_name, pkgname, id, seize */
+ },
+ {
.cmd = NULL,
.handler = NULL,
},
diff --git a/src/slave_life.c b/src/slave_life.c
index ad7a87a..0b20b15 100644
--- a/src/slave_life.c
+++ b/src/slave_life.c
@@ -55,6 +55,7 @@ struct slave_node {
int fault_count;
int critical_fault_count;
enum slave_state state;
+ int network;
int loaded_instance;
int loaded_package;
@@ -130,7 +131,7 @@ static inline int xmonitor_resume_cb(void *data)
return LB_STATUS_SUCCESS;
}
-static inline struct slave_node *create_slave_node(const char *name, int is_secured, const char *abi, const char *pkgname)
+static inline struct slave_node *create_slave_node(const char *name, int is_secured, const char *abi, const char *pkgname, int network)
{
struct slave_node *slave;
@@ -167,6 +168,7 @@ static inline struct slave_node *create_slave_node(const char *name, int is_secu
slave->secured = is_secured;
slave->pid = (pid_t)-1;
slave->state = SLAVE_TERMINATED;
+ slave->network = network;
xmonitor_add_event_callback(XMONITOR_PAUSED, xmonitor_pause_cb, slave);
xmonitor_add_event_callback(XMONITOR_RESUMED, xmonitor_resume_cb, slave);
@@ -305,7 +307,7 @@ HAPI const int const slave_refcnt(struct slave_node *slave)
return slave->refcnt;
}
-HAPI struct slave_node *slave_create(const char *name, int is_secured, const char *abi, const char *pkgname)
+HAPI struct slave_node *slave_create(const char *name, int is_secured, const char *abi, const char *pkgname, int network)
{
struct slave_node *slave;
@@ -316,7 +318,7 @@ HAPI struct slave_node *slave_create(const char *name, int is_secured, const cha
return slave;
}
- slave = create_slave_node(name, is_secured, abi, pkgname);
+ slave = create_slave_node(name, is_secured, abi, pkgname, network);
if (!slave)
return NULL;
@@ -909,7 +911,7 @@ HAPI struct slave_node *slave_find_by_name(const char *name)
return NULL;
}
-HAPI struct slave_node *slave_find_available(const char *abi, int secured)
+HAPI struct slave_node *slave_find_available(const char *abi, int secured, int network)
{
Eina_List *l;
struct slave_node *slave;
@@ -938,8 +940,8 @@ HAPI struct slave_node *slave_find_available(const char *abi, int secured)
DbgPrint("Found secured slave - has no instances (%s)\n", slave_name(slave));
if (slave->loaded_package == 0)
return slave;
- } else {
- DbgPrint("slave[%s] %d\n", slave_name(slave), slave->loaded_package);
+ } else if (slave->network == network) {
+ DbgPrint("slave[%s] %d (net: %d)\n", slave_name(slave), slave->loaded_package, slave->network);
if (!strcasecmp(abi, DEFAULT_ABI)) {
if (slave->loaded_package < SLAVE_MAX_LOAD)
return slave;
@@ -1290,4 +1292,14 @@ HAPI int slave_need_to_reactivate(struct slave_node *slave)
return slave->reactivate_slave;
}
+HAPI int slave_network(const struct slave_node *slave)
+{
+ return slave->network;
+}
+
+HAPI void slave_set_network(struct slave_node *slave, int network)
+{
+ slave->network = network;
+}
+
/* End of a file */