Sync with the private repository
[platform/framework/web/livebox-viewer.git] / src / client.c
index 93dceaf..b9da06a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2012  Samsung Electronics Co., Ltd
+ * Copyright 2013  Samsung Electronics Co., Ltd
  *
  * Licensed under the Flora License, Version 1.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -26,6 +26,7 @@
 #include <packet.h>
 #include <com-core.h>
 #include <com-core_packet.h>
+#include <livebox-errno.h>
 
 #include "debug.h"
 #include "client.h"
@@ -65,6 +66,33 @@ static struct packet *master_fault_package(pid_t pid, int handle, const struct p
        return NULL;
 }
 
+static struct packet *master_hold_scroll(pid_t pid, int handle, const struct packet *packet)
+{
+       struct livebox *handler;
+       const char *pkgname;
+       const char *id;
+       int seize;
+       int ret;
+
+       ret = packet_get(packet, "ssi", &pkgname, &id, &seize);
+       if (ret != 3) {
+               ErrPrint("Invalid argument\n");
+               goto out;
+       }
+
+       handler = lb_find_livebox(pkgname, id);
+       if (!handler) {
+               ErrPrint("Instance(%s) is not exists\n", id);
+               goto out;
+       }
+
+       DbgPrint("[HOLD] %s %d\n", id, seize);
+       lb_invoke_event_handler(handler, seize ? LB_EVENT_HOLD_SCROLL : LB_EVENT_RELEASE_SCROLL);
+
+out:
+       return NULL;
+}
+
 static struct packet *master_pinup(pid_t pid, int handle, const struct packet *packet)
 {
        const char *pkgname;
@@ -78,13 +106,12 @@ static struct packet *master_pinup(pid_t pid, int handle, const struct packet *p
        ret = packet_get(packet, "iisss", &ret, &pinup, &pkgname, &id, &content);
        if (ret != 5) {
                ErrPrint("Invalid argument\n");
-               ret = -EINVAL;
                goto out;
        }
 
        handler = lb_find_livebox(pkgname, id);
        if (!handler) {
-               ret = -ENOENT;
+               ErrPrint("Instance (%s) is not exists\n", id);
                goto out;
        }
 
@@ -96,7 +123,7 @@ static struct packet *master_pinup(pid_t pid, int handle, const struct packet *p
                        handler->is_pinned_up = pinup;
                } else {
                        ErrPrint("Heap: %s\n", strerror(errno));
-                       ret = -ENOMEM;
+                       ret = LB_STATUS_ERROR_MEMORY;
                }
        }
 
@@ -105,11 +132,10 @@ static struct packet *master_pinup(pid_t pid, int handle, const struct packet *p
 
                handler->pinup_cb = NULL; /*!< Reset pinup cb */
                handler->pinup_cbdata = NULL;
-       } else {
+       } else if (ret == 0) {
                lb_invoke_event_handler(handler, LB_EVENT_PINUP_CHANGED);
        }
 
-       ret = 0;
 out:
        return NULL;
 }
@@ -169,14 +195,14 @@ static struct packet *master_deleted(pid_t pid, int handle, const struct packet
                        handler->deleted_cbdata = NULL;
                }
 
-               DbgPrint("Call the created cb with -ECANCELED\n");
-               handler->created_cb(handler, -ECANCELED, handler->created_cbdata);
+               DbgPrint("Call the created cb with LB_STATUS_ERROR_CANCEL\n");
+               handler->created_cb(handler, LB_STATUS_ERROR_CANCEL, handler->created_cbdata);
                handler->created_cb = NULL;
                handler->created_cbdata = NULL;
        } else if (handler->id) {
                if (handler->deleted_cb) {
                        DbgPrint("Call the deleted cb\n");
-                       handler->deleted_cb(handler, 0, handler->deleted_cbdata);
+                       handler->deleted_cb(handler, LB_STATUS_SUCCESS, handler->deleted_cbdata);
 
                        handler->deleted_cb = NULL;
                        handler->deleted_cbdata = NULL;
@@ -195,6 +221,208 @@ out:
        return NULL;
 }
 
+static struct packet *master_lb_update_begin(pid_t pid, int handle, const struct packet *packet)
+{
+       struct livebox *handler;
+       const char *pkgname;
+       const char *id;
+       const char *content;
+       const char *title;
+       const char *fbfile;
+       double priority;
+       int ret;
+
+       ret = packet_get(packet, "ssdsss", &pkgname, &id, &priority, &content, &title, &fbfile);
+       if (ret != 6) {
+               ErrPrint("Invalid argument\n");
+               goto out;
+       }
+
+       handler = lb_find_livebox(pkgname, id);
+       if (!handler) {
+               ErrPrint("Instance[%s] is not exists\n", id);
+               goto out;
+       }
+
+       if (handler->state != CREATE) {
+               DbgPrint("(%s) is not created\n", id);
+               goto out;
+       }
+
+       lb_set_priority(handler, priority);
+       lb_set_content(handler, content);
+       lb_set_title(handler, title);
+
+       /*!
+        * \NOTE
+        * Width & Height is not changed in this case.
+        * If the active update is began, the size should not be changed,
+        * And if the size is changed, the provider should finish the updating first.
+        * And then begin updating again after change its size.
+        */
+       if (lb_get_lb_fb(handler)) {
+               lb_set_lb_fb(handler, fbfile);
+
+               ret = fb_sync(lb_get_lb_fb(handler));
+               if (ret != LB_STATUS_SUCCESS)
+                       ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, fbfile, ret);
+               else
+                       lb_invoke_event_handler(handler, LB_EVENT_LB_UPDATE_BEGIN);
+       } else {
+               ErrPrint("Invalid request[%s], %s\n", id, fbfile);
+       }
+
+out:
+       return NULL;
+}
+
+static struct packet *master_pd_update_begin(pid_t pid, int handle, const struct packet *packet)
+{
+       struct livebox *handler;
+       const char *pkgname;
+       const char *id;
+       const char *fbfile;
+       int ret;
+
+       ret = packet_get(packet, "sss", &pkgname, &id, &fbfile);
+       if (ret != 2) {
+               ErrPrint("Invalid argument\n");
+               goto out;
+       }
+
+       handler = lb_find_livebox(pkgname, id);
+       if (!handler) {
+               ErrPrint("Instance[%s] is not exists\n", id);
+               goto out;
+       }
+
+       if (handler->state != CREATE) {
+               DbgPrint("[%s] is not created\n", id);
+               goto out;
+       }
+
+       if (lb_get_pd_fb(handler)) {
+               lb_set_lb_fb(handler, fbfile);
+
+               ret = fb_sync(lb_get_lb_fb(handler));
+               if (ret != LB_STATUS_SUCCESS)
+                       ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, fbfile, ret);
+               else
+                       lb_invoke_event_handler(handler, LB_EVENT_PD_UPDATE_BEGIN);
+       } else {
+               ErrPrint("Invalid request[%s], %s\n", id, fbfile);
+       }
+
+out:
+       return NULL;
+}
+
+static struct packet *master_lb_update_end(pid_t pid, int handle, const struct packet *packet)
+{
+       struct livebox *handler;
+       const char *pkgname;
+       const char *id;
+       int ret;
+
+       ret = packet_get(packet, "ss", &pkgname, &id);
+       if (ret != 2) {
+               ErrPrint("Invalid argument\n");
+               goto out;
+       }
+
+       handler = lb_find_livebox(pkgname, id);
+       if (!handler) {
+               ErrPrint("Instance[%s] is not exists\n", id);
+               goto out;
+       }
+
+       if (handler->state != CREATE) {
+               DbgPrint("[%s] is not created\n", id);
+               goto out;
+       }
+
+       if (lb_get_lb_fb(handler)) {
+               lb_invoke_event_handler(handler, LB_EVENT_LB_UPDATE_END);
+       } else {
+               ErrPrint("Invalid request[%s]\n", id);
+       }
+
+out:
+       return NULL;
+}
+
+static struct packet *master_access_status(pid_t pid, int handle, const struct packet *packet)
+{
+       struct livebox *handler;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       int status;
+
+       ret = packet_get(packet, "ssi", &pkgname, &id, &status);
+       if (ret != 3) {
+               ErrPrint("Invalid argument\n");
+               goto out;
+       }
+
+       handler = lb_find_livebox(pkgname, id);
+       if (!handler) {
+               ErrPrint("Instance[%s] is not exists\n", id);
+               goto out;
+       }
+
+       if (handler->state != CREATE) {
+               DbgPrint("[%s] is not created\n", id);
+               goto out;
+       }
+
+       DbgPrint("Access status: %d\n", status);
+
+       if (handler->access_event_cb) {
+               handler->access_event_cb(handler, status, handler->access_event_cbdata);
+               handler->access_event_cb = NULL;
+               handler->access_event_cbdata = NULL;
+       } else {
+               ErrPrint("Invalid event[%s]\n", id);
+       }
+out:
+       return NULL;
+}
+
+static struct packet *master_pd_update_end(pid_t pid, int handle, const struct packet *packet)
+{
+       struct livebox *handler;
+       const char *pkgname;
+       const char *id;
+       int ret;
+
+       ret = packet_get(packet, "ss", &pkgname, &id);
+       if (ret != 2) {
+               ErrPrint("Invalid argument\n");
+               goto out;
+       }
+
+       handler = lb_find_livebox(pkgname, id);
+       if (!handler) {
+               ErrPrint("Instance[%s] is not exists\n", id);
+               goto out;
+       }
+
+       if (handler->state != CREATE) {
+               DbgPrint("[%s] is not created\n", id);
+               goto out;
+       }
+
+       if (lb_get_lb_fb(handler)) {
+               lb_invoke_event_handler(handler, LB_EVENT_PD_UPDATE_END);
+       } else {
+               ErrPrint("Invalid request[%s]", id);
+       }
+
+out:
+       return NULL;
+}
+
 static struct packet *master_lb_updated(pid_t pid, int handle, const struct packet *packet)
 {
        const char *pkgname;
@@ -214,13 +442,12 @@ static struct packet *master_lb_updated(pid_t pid, int handle, const struct pack
                                &priority, &content, &title);
        if (ret != 8) {
                ErrPrint("Invalid argument\n");
-               ret = -EINVAL;
                goto out;
        }
 
        handler = lb_find_livebox(pkgname, id);
        if (!handler) {
-               ret = -ENOENT;
+               ErrPrint("instance(%s) is not exists\n", id);
                goto out;
        }
 
@@ -231,34 +458,33 @@ static struct packet *master_lb_updated(pid_t pid, int handle, const struct pack
                 * Don't try to notice anything with this, Just ignore all events
                 * Beacuse the user doesn't wants know about this anymore
                 */
-               ret = -EPERM;
+               DbgPrint("(%s) is not exists, but updated\n", id);
                goto out;
        }
 
        lb_set_priority(handler, priority);
        lb_set_content(handler, content);
        lb_set_title(handler, title);
+       lb_set_size(handler, lb_w, lb_h);
 
        if (lb_text_lb(handler)) {
-               lb_set_size(handler, lb_w, lb_h);
-               ret = parse_desc(handler, util_uri_to_path(id), 0);
+               (void)parse_desc(handler, livebox_filename(handler), 0);
                /*!
                 * \note
                 * DESC parser will call the "text event callback".
+                * Don't need to call global event callback in this case.
                 */
                goto out;
        } else if (lb_get_lb_fb(handler)) {
-               lb_set_size(handler, lb_w, lb_h);
                lb_set_lb_fb(handler, fbfile);
                ret = fb_sync(lb_get_lb_fb(handler));
-               if (ret < 0)
-                       ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
+               if (ret != LB_STATUS_SUCCESS)
+                       ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, util_basename(util_uri_to_path(id)), ret);
        } else {
-               lb_set_size(handler, lb_w, lb_h);
-               ret = 0;
+               ret = LB_STATUS_SUCCESS;
        }
 
-       if (ret == 0)
+       if (ret == LB_STATUS_SUCCESS)
                lb_invoke_event_handler(handler, LB_EVENT_LB_UPDATED);
 
 out:
@@ -284,12 +510,12 @@ static struct packet *master_pd_created(pid_t pid, int handle, const struct pack
 
        handler = lb_find_livebox(pkgname, id);
        if (!handler) {
-               ret = -ENOENT;
+               ErrPrint("Instance(%s) is not exists\n", id);
                goto out;
        }
 
        if (handler->state != CREATE) {
-               ret = -EPERM;
+               ErrPrint("Instance(%s) is not created\n", id);
                goto out;
        }
 
@@ -299,11 +525,8 @@ static struct packet *master_pd_created(pid_t pid, int handle, const struct pack
        } else {
                (void)lb_set_pd_fb(handler, buf_id);
                ret = fb_sync(lb_get_pd_fb(handler));
-               if (ret < 0) {
-                       ErrPrint("Failed to do sync FB (%s - %s)\n",
-                                       pkgname,
-                                       util_basename(util_uri_to_path(id)));
-               }
+               if (ret < 0)
+                       ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
        }
 
        handler->is_pd_created = (status == 0);
@@ -319,7 +542,6 @@ static struct packet *master_pd_created(pid_t pid, int handle, const struct pack
                lb_invoke_event_handler(handler, LB_EVENT_PD_CREATED);
        }
 
-       ret = 0;
 out:
        return NULL;
 }
@@ -340,12 +562,12 @@ static struct packet *master_pd_destroyed(pid_t pid, int handle, const struct pa
 
        handler = lb_find_livebox(pkgname, id);
        if (!handler) {
-               ret = -ENOENT;
+               ErrPrint("Instance(%s) is not exists\n", id);
                goto out;
        }
 
        if (handler->state != CREATE) {
-               ret = -EPERM;
+               ErrPrint("Instance(%s) is not created\n", id);
                goto out;
        }
 
@@ -362,7 +584,6 @@ static struct packet *master_pd_destroyed(pid_t pid, int handle, const struct pa
                lb_invoke_event_handler(handler, LB_EVENT_PD_DESTROYED);
        }
 
-       ret = 0;
 out:
        return NULL;
 }
@@ -384,13 +605,12 @@ static struct packet *master_pd_updated(pid_t pid, int handle, const struct pack
                                &pd_w, &pd_h);
        if (ret != 6) {
                ErrPrint("Invalid argument\n");
-               ret = -EINVAL;
                goto out;
        }
 
        handler = lb_find_livebox(pkgname, id);
        if (!handler) {
-               ret = -ENOENT;
+               ErrPrint("Instance(%s) is not exists\n", id);
                goto out;
        }
 
@@ -401,27 +621,170 @@ static struct packet *master_pd_updated(pid_t pid, int handle, const struct pack
                 * So don't try to notice anything about this anymore.
                 * Just ignore all events.
                 */
-               ret = -EPERM;
+               ErrPrint("Instance(%s) is not created\n", id);
                goto out;
        }
 
        lb_set_pdsize(handler, pd_w, pd_h);
 
        if (lb_text_pd(handler)) {
-               ret = parse_desc(handler, descfile, 1);
+               (void)parse_desc(handler, descfile, 1);
        } else {
                (void)lb_set_pd_fb(handler, fbfile);
 
                ret = fb_sync(lb_get_pd_fb(handler));
-               if (ret < 0) {
-                       ErrPrint("Failed to do sync FB (%s - %s)\n",
-                                       pkgname,
-                                       util_basename(util_uri_to_path(id)));
-                       goto out;
+               if (ret < 0)
+                       ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
+               else
+                       lb_invoke_event_handler(handler, LB_EVENT_PD_UPDATED);
+       }
+
+out:
+       return NULL;
+}
+
+static struct packet *master_update_mode(pid_t pid, int handle, const struct packet *packet)
+{
+       struct livebox *handler;
+       const char *pkgname;
+       const char *id;
+       int active_mode;
+       int status;
+       int ret;
+
+       if (!packet) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssii", &pkgname, &id, &status, &active_mode);
+       if (ret != 4) {
+               ErrPrint("Invalid argument\n");
+               goto out;
+       }
+
+       DbgPrint("Update mode is changed: %d, %d, %s\n", status, active_mode, id);
+
+       handler = lb_find_livebox(pkgname, id);
+       if (!handler) {
+               ErrPrint("Livebox(%s) is not found\n", id);
+               goto out;
+       }
+
+       if (handler->state != CREATE) {
+               ErrPrint("Livebox(%s) is not created yet\n", id);
+               goto out;
+       }
+
+       if (status == LB_STATUS_SUCCESS)
+               lb_set_update_mode(handler, active_mode);
+
+       if (handler->update_mode_cb) {
+               handler->update_mode_cb(handler, status, handler->update_mode_cbdata);
+
+               handler->update_mode_cb = NULL;
+               handler->update_mode_cbdata = NULL;
+       } else {
+               lb_invoke_event_handler(handler, LB_EVENT_UPDATE_MODE_CHANGED);
+       }
+
+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;
+       const char *fbfile;
+       int status;
+       int ret;
+       int w;
+       int h;
+       int is_pd;
+
+       if (!packet) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       ret = packet_get(packet, "sssiiii", &pkgname, &id, &fbfile, &is_pd, &w, &h, &status);
+       if (ret != 7) {
+               ErrPrint("Invalid argument\n");
+               goto out;
+       }
+
+       DbgPrint("Size is changed: %dx%d (%s), fb: [%s]\n", w, h, id, fbfile);
+
+       handler = lb_find_livebox(pkgname, id);
+       if (!handler) {
+               ErrPrint("Livebox(%s) is not found\n", id);
+               goto out;
+       }
+
+       if (handler->state != CREATE) {
+               ErrPrint("Livebox(%s) is not created yet\n", id);
+               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 only.
+                */
+               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 (%d)\n", status);
                }
+       } else {
+               if (status == 0) {
+                       DbgPrint("LB is successfully resized (%dx%d)\n", w, h);
+                       lb_set_size(handler, w, h);
+
+                       /*!
+                        * \NOTE
+                        * If there is a created LB FB, 
+                        * Update it too.
+                        */
+                       if (lb_get_lb_fb(handler)) {
+                               lb_set_lb_fb(handler, fbfile);
+
+                               ret = fb_sync(lb_get_lb_fb(handler));
+                               if (ret < 0)
+                                       ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
 
-               lb_invoke_event_handler(handler, LB_EVENT_PD_UPDATED);
-               ret = 0;
+                               /* Just update the size info only. */
+                       }
+
+                       /*!
+                        * \NOTE
+                        * I cannot believe client.
+                        * So I added some log before & after call the user callback.
+                        */
+                       if (handler->size_changed_cb) {
+                               handler->size_changed_cb(handler, status, handler->size_cbdata);
+
+                               handler->size_changed_cb = NULL;
+                               handler->size_cbdata = NULL;
+                       } else {
+                               lb_invoke_event_handler(handler, LB_EVENT_LB_SIZE_CHANGED);
+                       }
+               } else {
+                       DbgPrint("LB is not resized: %dx%d (%d)\n", w, h, status);
+                       if (handler->size_changed_cb) {
+                               handler->size_changed_cb(handler, status, handler->size_cbdata);
+
+                               handler->size_changed_cb = NULL;
+                               handler->size_cbdata = NULL;
+                       }
+               }
        }
 
 out:
@@ -440,22 +803,21 @@ static struct packet *master_period_changed(pid_t pid, int handle, const struct
        ret = packet_get(packet, "idss", &status, &period, &pkgname, &id);
        if (ret != 4) {
                ErrPrint("Invalid argument\n");
-               ret = -EINVAL;
                goto out;
        }
 
        handler = lb_find_livebox(pkgname, id);
        if (!handler) {
-               ErrPrint("Livebox(%s - %s) is not found\n", pkgname, id);
-               ret = -ENOENT;
+               ErrPrint("Livebox(%s) is not found\n", id);
                goto out;
        }
 
        if (handler->state != CREATE) {
-               ret = -EPERM;
+               ErrPrint("Livebox(%s) is not created\n", id);
                goto out;
        }
 
+       DbgPrint("Update period is changed? %lf (%d)\n", period, status);
        if (status == 0)
                lb_set_period(handler, period);
 
@@ -464,12 +826,10 @@ static struct packet *master_period_changed(pid_t pid, int handle, const struct
 
                handler->period_changed_cb = NULL;
                handler->period_cbdata = NULL;
-       } else {
+       } else if (status == 0) {
                lb_invoke_event_handler(handler, LB_EVENT_PERIOD_CHANGED);
        }
 
-       ret = 0;
-
 out:
        return NULL;
 }
@@ -487,13 +847,12 @@ static struct packet *master_group_changed(pid_t pid, int handle, const struct p
        ret = packet_get(packet, "ssiss", &pkgname, &id, &status, &cluster, &category);
        if (ret != 5) {
                ErrPrint("Invalid argument\n");
-               ret = -EINVAL;
                goto out;
        }
 
        handler = lb_find_livebox(pkgname, id);
        if (!handler) {
-               ret = -ENOENT;
+               ErrPrint("Livebox(%s) is not exists\n", id);
                goto out;
        }
 
@@ -503,24 +862,23 @@ static struct packet *master_group_changed(pid_t pid, int handle, const struct p
                 * Do no access this handler,
                 * You cannot believe this handler anymore.
                 */
-               ret = -EPERM;
+               ErrPrint("Livebox(%s) is not created\n", id);
                goto out;
        }
 
+       DbgPrint("Group is changed? [%s] / [%s] (%d)\n", cluster, category, status);
        if (status == 0)
-               lb_set_group(handler, cluster, category);
+               (void)lb_set_group(handler, cluster, category);
 
        if (handler->group_changed_cb) {
                handler->group_changed_cb(handler, status, handler->group_cbdata);
 
                handler->group_changed_cb = NULL;
                handler->group_cbdata = NULL;
-       } else {
+       } else if (status == 0) {
                lb_invoke_event_handler(handler, LB_EVENT_GROUP_CHANGED);
        }
 
-       ret = 0;
-
 out:
        return NULL;
 }
@@ -567,7 +925,7 @@ static struct packet *master_created(pid_t pid, int handle, const struct packet
                        &lb_type, &pd_type, &period, &title, &is_pinned_up);
        if (ret != 22) {
                ErrPrint("Invalid argument\n");
-               ret = -EINVAL;
+               ret = LB_STATUS_ERROR_INVALID;
                goto out;
        }
 
@@ -587,7 +945,7 @@ static struct packet *master_created(pid_t pid, int handle, const struct packet
                handler = lb_new_livebox(pkgname, id, timestamp);
                if (!handler) {
                        ErrPrint("Failed to create a new livebox\n");
-                       ret = -EFAULT;
+                       ret = LB_STATUS_ERROR_FAULT;
                        goto out;
                }
 
@@ -600,7 +958,7 @@ static struct packet *master_created(pid_t pid, int handle, const struct packet
                                 * This is not possible!!!
                                 */
                                ErrPrint("Invalid handler\n");
-                               ret = -EINVAL;
+                               ret = LB_STATUS_ERROR_INVALID;
                                goto out;
                        }
 
@@ -621,7 +979,7 @@ static struct packet *master_created(pid_t pid, int handle, const struct packet
                                        content, cluster, category,
                                        lb_fname, pd_fname);
 
-                       ret = -EALREADY;
+                       ret = LB_STATUS_ERROR_ALREADY;
                        goto out;
                }
 
@@ -653,6 +1011,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:
@@ -720,7 +1079,7 @@ out:
                 * Do not clear this to use this from the deleted event callback.
                 * if this value is not cleared when the deleted event callback check it,
                 * it means that the created function is not called yet.
-                * Then the call the deleted event callback with -ECANCELED errno.
+                * Then the call the deleted event callback with LB_STATUS_ERROR_CANCEL errno.
                 */
        }
 
@@ -765,10 +1124,47 @@ static struct method s_table[] = {
                .handler = master_period_changed,
        },
        {
+               .cmd = "size_changed",
+               .handler = master_size_changed,
+       },
+       {
                .cmd = "pinup",
                .handler = master_pinup,
        },
        {
+               .cmd = "scroll",
+               .handler = master_hold_scroll,
+       },
+
+       {
+               .cmd = "update_mode",
+               .handler = master_update_mode,
+       },
+
+       {
+               .cmd = "lb_update_begin",
+               .handler = master_lb_update_begin,
+       },
+       {
+               .cmd = "lb_update_end",
+               .handler = master_lb_update_end,
+       },
+
+       {
+               .cmd = "pd_update_begin",
+               .handler = master_pd_update_begin,
+       },
+       {
+               .cmd = "pd_update_end",
+               .handler = master_pd_update_end,
+       },
+
+       {
+               .cmd = "access_status",
+               .handler = master_access_status,
+       },
+
+       {
                .cmd = NULL,
                .handler = NULL,
        },
@@ -817,7 +1213,7 @@ static inline void make_connection(void)
                if (s_info.reconnector == 0)
                        ErrPrint("Failed to fire the reconnector\n");
 
-               ErrPrint("Try this again 10 secs later\n");
+               ErrPrint("Try this again A sec later\n");
                return;
        }
 
@@ -899,5 +1295,3 @@ int client_fini(void)
 }
 
 /* End of a file */
-
-