X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fclient.c;h=db76c06456683ebd5224bed85cf063b9ee289cc3;hb=e74ddc0aafa37e7e12ef4c3e9695ea438d4026d1;hp=93dceaf1f576e81c7d1e76a8f4e2e19b0cb71074;hpb=4d74367f70160f9ef31a6e8f1bf2769fa19fdf1f;p=platform%2Fframework%2Fweb%2Flivebox-viewer.git diff --git a/src/client.c b/src/client.c index 93dceaf..db76c06 100644 --- a/src/client.c +++ b/src/client.c @@ -241,7 +241,7 @@ static struct packet *master_lb_updated(pid_t pid, int handle, const struct pack if (lb_text_lb(handler)) { lb_set_size(handler, lb_w, lb_h); - ret = parse_desc(handler, util_uri_to_path(id), 0); + ret = parse_desc(handler, livebox_filename(handler), 0); /*! * \note * DESC parser will call the "text event callback". @@ -428,6 +428,86 @@ out: return NULL; } +static struct packet *master_size_changed(pid_t pid, int handle, const struct packet *packet) +{ + struct livebox *handler; + const char *pkgname; + const char *id; + int status; + int ret; + int w; + int h; + int is_pd; + + if (!packet) { + ErrPrint("Invalid packet\n"); + ret = -EINVAL; + goto out; + } + + ret = packet_get(packet, "ssiiii", &pkgname, &id, &is_pd, &w, &h, &status); + if (ret != 6) { + ErrPrint("Invalid argument\n"); + ret = -EINVAL; + goto out; + } + + DbgPrint("Size is changed: %dx%d (%s)\n", w, h, id); + + handler = lb_find_livebox(pkgname, id); + if (!handler) { + ErrPrint("Livebox(%s - %s) is not found\n", pkgname, id); + ret = -ENOENT; + goto out; + } + + if (handler->state != CREATE) { + ErrPrint("Hander is not created yet\n"); + ret = -EPERM; + goto out; + } + + if (is_pd) { + DbgPrint("PD is resized\n"); + /*! + * \NOTE + * PD is not able to resized by the client. + * PD is only can be managed by the provider. + * So the PD has no private resized event handler. + * Notify it via global event handler. + */ + if (status == 0) { + lb_set_pdsize(handler, w, h); + lb_invoke_event_handler(handler, LB_EVENT_PD_SIZE_CHANGED); + } else { + ErrPrint("This is not possible. PD Size is changed but the return value is not ZERO\n"); + } + } else { + DbgPrint("LB is resized\n"); + if (status == 0) { + DbgPrint("Livebox size is updated (%dx%d)\n", w, h); + lb_set_size(handler, w, h); + + if (handler->size_changed_cb) { + DbgPrint("Call the size changed callback\n"); + handler->size_changed_cb(handler, status, handler->size_cbdata); + + handler->size_changed_cb = NULL; + handler->size_cbdata = NULL; + } else { + DbgPrint("Call the global size changed callback\n"); + lb_invoke_event_handler(handler, LB_EVENT_LB_SIZE_CHANGED); + DbgPrint("Size changed callback done\n"); + } + } else { + DbgPrint("Livebox size is not changed: %dx%d, %d\n", w, h, status); + } + } + +out: + return NULL; +} + static struct packet *master_period_changed(pid_t pid, int handle, const struct packet *packet) { struct livebox *handler; @@ -765,6 +845,10 @@ static struct method s_table[] = { .handler = master_period_changed, }, { + .cmd = "size_changed", + .handler = master_size_changed, + }, + { .cmd = "pinup", .handler = master_pinup, },