From: Sung-jae Park Date: Sun, 31 Mar 2013 09:25:03 +0000 (+0000) Subject: Add new event path & Change pixmap 24 to 32. X-Git-Tag: submit/tizen_mobile/20150527.071719~2^2~48^2~21^2~192^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5dbe021e275b0f7835071af0c4f1f31e9b05b16e;p=platform%2Fcore%2Fappfw%2Fdata-provider-master.git 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. Version updated. Change-Id: I865165b974aa32a35a58b7260cb1c046ed8f1413 --- diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index e4fd3ca..b8df0a6 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/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 cdc7823..6fc0f8b 100644 --- a/src/instance.c +++ b/src/instance.c @@ -258,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; @@ -267,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 diff --git a/src/server.c b/src/server.c index 0539b5f..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, ×tamp, &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, ×tamp, &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, ×tamp, &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, ×tamp, &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, ×tamp, &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: @@ -5771,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",