Fix the bug of livebox_get_pdsize function.
authorSung-jae Park <nicesj.park@samsung.com>
Fri, 8 Mar 2013 08:57:49 +0000 (08:57 +0000)
committerSung-jae Park <nicesj.park@samsung.com>
Fri, 8 Mar 2013 08:57:49 +0000 (08:57 +0000)
It has to returns the default PD size if the PD is not created.

Change-Id: Id8388d0b047f01cff5dd2ef82dbbbb25dbe65567

include/livebox_internal.h
packaging/liblivebox-viewer.spec
src/client.c
src/livebox.c

index a55934c..4a6b100 100644 (file)
@@ -17,6 +17,7 @@
 extern int lb_set_group(struct livebox *handler, const char *cluster, const char *category);
 extern void lb_set_size(struct livebox *handler, int w, int h);
 extern void lb_set_pdsize(struct livebox *handler, int w, int h);
+extern void lb_set_default_pdsize(struct livebox *handler, int w, int h);
 extern void lb_invoke_event_handler(struct livebox *handler, enum livebox_event_type event);
 extern void lb_invoke_fault_handler(enum livebox_fault_type type, const char *pkgname, const char *filename, const char *function);
 extern int lb_set_content(struct livebox *handler, const char *content);
@@ -117,6 +118,9 @@ struct livebox {
                int width;
                int height;
 
+               int default_width;
+               int default_height;
+
                /* For the filtering event */
                double x;
                double y;
index 55bca03..a76e45f 100644 (file)
@@ -1,6 +1,6 @@
 Name: liblivebox-viewer
 Summary: Library for developing the application.
-Version: 0.9.10
+Version: 0.9.12
 Release: 1
 Group: framework/livebox
 License: Flora License
index 7ce6147..79fca92 100644 (file)
@@ -740,6 +740,7 @@ static struct packet *master_created(pid_t pid, int handle, const struct packet
 
        handler->pd.type = pd_type;
        lb_set_pdsize(handler, pd_w, pd_h);
+       lb_set_default_pdsize(handler, pd_w, pd_h);
        switch (pd_type) {
        case _PD_TYPE_SCRIPT:
        case _PD_TYPE_BUFFER:
index 845e934..d880101 100644 (file)
@@ -1248,17 +1248,13 @@ EAPI int livebox_get_pdsize(struct livebox *handler, int *w, int *h)
        if (!h)
                h = &_h;
 
-       *w = handler->pd.width;
-       *h = handler->pd.height;
-
-       switch (handler->pd.type) {
-       case _PD_TYPE_BUFFER:
-       case _PD_TYPE_SCRIPT:
-               if (!handler->is_pd_created)
-                       DbgPrint("Buffer is not created yet [%dx%d]\n", *w, *h);
-               break;
-       default:
-               break;
+       if (!handler->is_pd_created) {
+               DbgPrint("Buffer is not created yet [%dx%d]\n", *w, *h);
+               *w = handler->pd.default_width;
+               *h = handler->pd.default_height;
+       } else {
+               *w = handler->pd.width;
+               *h = handler->pd.height;
        }
 
        return 0;
@@ -2149,6 +2145,12 @@ void lb_set_pdsize(struct livebox *handler, int w, int h)
        handler->pd.height = h;
 }
 
+void lb_set_default_pdsize(struct livebox *handler, int w, int h)
+{
+       handler->pd.default_width = w;
+       handler->pd.default_height = h;
+}
+
 void lb_invoke_fault_handler(enum livebox_fault_type event, const char *pkgname, const char *file, const char *func)
 {
        struct dlist *l;