From 97ceba117e19ba56e2b47449ba9bc824a01563da Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Sat, 23 Feb 2013 08:35:07 +0000 Subject: [PATCH] Update the resized event handler Change-Id: I33c399eeef6ef151487e5688522cb24fcdd641a5 --- packaging/liblivebox-viewer.spec | 2 +- src/client.c | 41 +++++++++++++++++++++++++++------------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/packaging/liblivebox-viewer.spec b/packaging/liblivebox-viewer.spec index 9998370..c8b397c 100644 --- a/packaging/liblivebox-viewer.spec +++ b/packaging/liblivebox-viewer.spec @@ -1,6 +1,6 @@ Name: liblivebox-viewer Summary: Library for developing the application. -Version: 0.9.6 +Version: 0.9.7 Release: 1 Group: framework/livebox License: Flora License diff --git a/src/client.c b/src/client.c index 1e14575..db76c06 100644 --- a/src/client.c +++ b/src/client.c @@ -439,13 +439,21 @@ static struct packet *master_size_changed(pid_t pid, int handle, const struct pa 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; + 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); @@ -454,11 +462,13 @@ static struct packet *master_size_changed(pid_t pid, int handle, const struct pa } 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. @@ -466,26 +476,31 @@ static struct packet *master_size_changed(pid_t pid, int handle, const struct pa * So the PD has no private resized event handler. * Notify it via global event handler. */ - lb_invoke_event_handler(handler, LB_EVENT_PD_SIZE_CHANGED); - if (status != 0) + 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); - } else { - DbgPrint("Livebox size is not changed: %dx%d, %d\n", w, h, status); - } - if (handler->size_changed_cb) { - DbgPrint("Call the size changed callback\n"); - handler->size_changed_cb(handler, status, handler->size_cbdata); + 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; + 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("Call the global size changed callback\n"); - lb_invoke_event_handler(handler, LB_EVENT_LB_SIZE_CHANGED); + DbgPrint("Livebox size is not changed: %dx%d, %d\n", w, h, status); } } -- 2.7.4