return NULL;
}
+static struct packet *client_pd_key_down(pid_t pid, int handle, const struct packet *packet)
+{
+ struct client_node *client;
+ const char *pkgname;
+ const char *id;
+ int ret;
+ int w;
+ int h;
+ double timestamp;
+ double x;
+ double 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 = -ENOENT;
+ goto out;
+ }
+
+ ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, ×tamp, &x, &y);
+ if (ret != 7) {
+ ErrPrint("Invalid parameter\n");
+ ret = -EINVAL;
+ 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 = -ENOENT;
+ goto out;
+ }
+
+ pkg = instance_package(inst);
+ if (!pkg) {
+ ErrPrint("Package[%s] info is not found\n", pkgname);
+ ret = -EFAULT;
+ 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 = -EFAULT;
+ } 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 = -EFAULT;
+ goto out;
+ }
+
+ slave = package_slave(pkg);
+ if (!slave) {
+ ErrPrint("Package[%s] has no slave\n", pkgname);
+ ret = -EINVAL;
+ 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 = -EFAULT;
+ 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 = -EFAULT;
+ goto out;
+ }
+
+ e = script_handler_evas(script);
+ if (!e) {
+ ret = -EFAULT;
+ goto out;
+ }
+
+ script_handler_update_pointer(script, x, y, -1);
+ /*!
+ * \TODO: Push up the KEY_DOWN event
+ */
+ ret = 0;
+ } else {
+ ErrPrint("Unsupported package\n");
+ ret = -EINVAL;
+ }
+
+out:
+ /*! \note No reply packet */
+ return NULL;
+}
+
+static struct packet *client_pd_key_up(pid_t pid, int handle, const struct packet *packet)
+{
+ struct client_node *client;
+ const char *pkgname;
+ const char *id;
+ int ret;
+ int w;
+ int h;
+ double timestamp;
+ double x;
+ double 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 = -ENOENT;
+ goto out;
+ }
+
+ ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, ×tamp, &x, &y);
+ if (ret != 7) {
+ ErrPrint("Invalid parameter\n");
+ ret = -EINVAL;
+ 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 = -ENOENT;
+ goto out;
+ }
+
+ pkg = instance_package(inst);
+ if (!pkg) {
+ ErrPrint("Package[%s] info is not found\n", pkgname);
+ ret = -EFAULT;
+ 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 = -EFAULT;
+ } 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 = -EFAULT;
+ goto out;
+ }
+
+ slave = package_slave(pkg);
+ if (!slave) {
+ ErrPrint("Package[%s] has no slave\n", pkgname);
+ ret = -EINVAL;
+ 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 = -EFAULT;
+ 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 = -EFAULT;
+ goto out;
+ }
+
+ e = script_handler_evas(script);
+ if (!e) {
+ ret = -EFAULT;
+ goto out;
+ }
+
+ script_handler_update_pointer(script, x, y, -1);
+ /*!
+ * \TODO: Push up the KEY_UP event
+ */
+ ret = 0;
+ } else {
+ ErrPrint("Unsupported package\n");
+ ret = -EINVAL;
+ }
+
+out:
+ /*! \note No reply packet */
+ return NULL;
+}
+
static struct packet *client_lb_access_read(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
return NULL;
}
+static struct packet *client_lb_key_down(pid_t pid, int handle, const struct packet *packet)
+{
+ struct client_node *client;
+ const char *pkgname;
+ const char *id;
+ int ret;
+ int w;
+ int h;
+ double timestamp;
+ double x;
+ double 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 = -ENOENT;
+ goto out;
+ }
+
+ ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, ×tamp, &x, &y);
+ if (ret != 7) {
+ ErrPrint("Parameter is not matched\n");
+ ret = -EINVAL;
+ 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 = -ENOENT;
+ goto out;
+ }
+
+ pkg = instance_package(inst);
+ if (!pkg) {
+ ErrPrint("Package[%s] info is not exists\n", pkgname);
+ ret = -EFAULT;
+ 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 = -EFAULT;
+ } else if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
+ struct buffer_info *buffer;
+ struct slave_node *slave;
+ //struct packet *packet;
+
+ buffer = instance_lb_buffer(inst);
+ if (!buffer) {
+ ErrPrint("Instance[%s] has no buffer\n", id);
+ ret = -EFAULT;
+ goto out;
+ }
+
+ slave = package_slave(pkg);
+ if (!slave) {
+ ErrPrint("Package[%s] has no slave\n", pkgname);
+ ret = -EINVAL;
+ goto out;
+ }
+
+ /*
+ packet = packet_create_noack("lb_mouse_leave", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+ if (!packet) {
+ ErrPrint("Failed to create a packet[%s]\n", pkgname);
+ ret = -EFAULT;
+ goto out;
+ }
+ */
+
+ packet_ref((struct packet *)packet);
+ ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+ } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
+ struct script_info *script;
+ Evas *e;
+
+ script = instance_lb_script(inst);
+ if (!script) {
+ ret = -EFAULT;
+ goto out;
+ }
+
+ e = script_handler_evas(script);
+ if (!e) {
+ ret = -EFAULT;
+ goto out;
+ }
+
+ script_handler_update_pointer(script, x, y, -1);
+
+ /*!
+ * \TODO: Feed up this KEY_DOWN event
+ */
+ ret = 0;
+ } else {
+ ErrPrint("Unsupported package\n");
+ ret = -EINVAL;
+ }
+
+out:
+ /*! \note No reply packet */
+ return NULL;
+}
+
+static struct packet *client_lb_key_up(pid_t pid, int handle, const struct packet *packet)
+{
+ struct client_node *client;
+ const char *pkgname;
+ const char *id;
+ int ret;
+ int w;
+ int h;
+ double timestamp;
+ double x;
+ double 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 = -ENOENT;
+ goto out;
+ }
+
+ ret = packet_get(packet, "ssiiddd", &pkgname, &id, &w, &h, ×tamp, &x, &y);
+ if (ret != 7) {
+ ErrPrint("Parameter is not matched\n");
+ ret = -EINVAL;
+ 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 = -ENOENT;
+ goto out;
+ }
+
+ pkg = instance_package(inst);
+ if (!pkg) {
+ ErrPrint("Package[%s] info is not exists\n", pkgname);
+ ret = -EFAULT;
+ 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 = -EFAULT;
+ } else if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
+ struct buffer_info *buffer;
+ struct slave_node *slave;
+ //struct packet *packet;
+
+ buffer = instance_lb_buffer(inst);
+ if (!buffer) {
+ ErrPrint("Instance[%s] has no buffer\n", id);
+ ret = -EFAULT;
+ goto out;
+ }
+
+ slave = package_slave(pkg);
+ if (!slave) {
+ ErrPrint("Package[%s] has no slave\n", pkgname);
+ ret = -EINVAL;
+ goto out;
+ }
+
+ /*
+ packet = packet_create_noack("lb_mouse_leave", "ssiiddd", pkgname, id, w, h, timestamp, x, y);
+ if (!packet) {
+ ErrPrint("Failed to create a packet[%s]\n", pkgname);
+ ret = -EFAULT;
+ goto out;
+ }
+ */
+
+ packet_ref((struct packet *)packet);
+ ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+ } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
+ struct script_info *script;
+ Evas *e;
+
+ script = instance_lb_script(inst);
+ if (!script) {
+ ret = -EFAULT;
+ goto out;
+ }
+
+ e = script_handler_evas(script);
+ if (!e) {
+ ret = -EFAULT;
+ goto out;
+ }
+
+ script_handler_update_pointer(script, x, y, -1);
+
+ /*!
+ * \TODO: Feed up this KEY_UP event
+ */
+ ret = 0;
+ } else {
+ ErrPrint("Unsupported package\n");
+ ret = -EINVAL;
+ }
+
+out:
+ /*! \note No reply packet */
+ return NULL;
+}
+
static int release_pixmap_cb(struct client_node *client, void *canvas)
{
DbgPrint("Forcely unref the \"buffer\"\n");
},
{
+ .cmd = "lb_key_down",
+ .handler = client_lb_key_down,
+ },
+ {
+ .cmd = "lb_key_up",
+ .handler = client_lb_key_up,
+ },
+
+ {
+ .cmd = "pd_key_down",
+ .handler = client_pd_key_down,
+ },
+ {
+ .cmd = "pd_key_up",
+ .handler = client_pd_key_up,
+ },
+
+ {
.cmd = NULL,
.handler = NULL,
},