Replace BUFFER_TYPE with DBOX_BUFFER_TYPE
authorSung-jae Park <nicesj.park@samsung.com>
Thu, 25 Sep 2014 13:49:36 +0000 (22:49 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Thu, 25 Sep 2014 14:37:12 +0000 (23:37 +0900)
which is exported from dynamicbox_service.

[model] Redwood,Kiran,B3(Wearable)
[binary_type] AP
[customer] Docomo/Orange/ATT/Open
[issue#] N/A
[problem]
[cause]
[solution]
[team] HomeTF
[request]
[horizontal_expansion]

Change-Id: I5253140b147abc43da255e18a8029c69abcfa193

include/dynamicbox_internal.h
include/fb.h
src/client.c
src/dynamicbox.c
src/dynamicbox_internal.c
src/fb.c
src/fb_wayland.c

index 076940b..7320561 100644 (file)
@@ -94,9 +94,9 @@ enum gbar_type { /*!< Must have to be sync with data-provider-master */
 };
 
 enum dynamicbox_state {
-       CREATE = 0xBEEFbeef,
-       DELETE = 0xDEADdead, /* Delete only for this client */
-       DESTROYED = 0x00DEAD00
+       DBOX_STATE_CREATE = 0xBEEFbeef,
+       DBOX_STATE_DELETE = 0xDEADdead, /* Delete only for this client */
+       DBOX_STATE_DESTROYED = 0x00DEAD00
 };
 
 struct dynamicbox_common {
index 9e567dd..6f02268 100644 (file)
 
 struct fb_info;
 
-enum buffer_type { /*!< Must have to be sync with libprovider, liblivebox-viewer */
-       BUFFER_TYPE_FILE,
-       BUFFER_TYPE_SHM,
-       BUFFER_TYPE_PIXMAP,
-       BUFFER_TYPE_ERROR
-};
-
 extern int fb_init(void *disp);
 extern int fb_fini(void);
 extern const char *fb_id(struct fb_info *info);
index 5a1766c..ee6f6a5 100644 (file)
@@ -34,6 +34,7 @@
 #include <dynamicbox_errno.h>
 #include <dynamicbox_service.h>
 #include <dynamicbox_cmd_list.h>
+#include <dynamicbox_buffer.h>
 #include <secure_socket.h>
 
 #include "debug.h"
@@ -205,8 +206,8 @@ static struct packet *master_deleted(pid_t pid, int handle, const struct packet
        }
 
        /*!< Check validity of this "handler" */
-       if (common->state != CREATE) {
-               if (common->state != DELETE) {
+       if (common->state != DBOX_STATE_CREATE) {
+               if (common->state != DBOX_STATE_DELETE) {
                        /*!
                         * \note
                         * This is not possible
@@ -224,7 +225,7 @@ static struct packet *master_deleted(pid_t pid, int handle, const struct packet
         * Then we will get panic.
         * To prevent it, we should change its state first.
         */
-       common->state = DELETE;
+       common->state = DBOX_STATE_DELETE;
 
        dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
                if (handler->cbs.created.cb) {
@@ -311,7 +312,7 @@ static struct packet *master_dbox_update_begin(pid_t pid, int handle, const stru
                goto out;
        }
 
-       if (common->state != CREATE) {
+       if (common->state != DBOX_STATE_CREATE) {
                ErrPrint("(%s) is not created\n", id);
                goto out;
        }
@@ -369,7 +370,7 @@ static struct packet *master_gbar_update_begin(pid_t pid, int handle, const stru
                goto out;
        }
 
-       if (common->state != CREATE) {
+       if (common->state != DBOX_STATE_CREATE) {
                ErrPrint("[%s] is not created\n", id);
                goto out;
        }
@@ -414,7 +415,7 @@ static struct packet *master_dbox_update_end(pid_t pid, int handle, const struct
                goto out;
        }
 
-       if (common->state != CREATE) {
+       if (common->state != DBOX_STATE_CREATE) {
                ErrPrint("[%s] is not created\n", id);
                goto out;
        }
@@ -454,7 +455,7 @@ static struct packet *master_key_status(pid_t pid, int handle, const struct pack
                goto out;
        }
 
-       if (common->state != CREATE) {
+       if (common->state != DBOX_STATE_CREATE) {
                ErrPrint("[%s] is not created\n", id);
                goto out;
        }
@@ -503,7 +504,7 @@ static struct packet *master_request_close_gbar(pid_t pid, int handle, const str
                goto out;
        }
 
-       if (common->state != CREATE) {
+       if (common->state != DBOX_STATE_CREATE) {
                ErrPrint("[%s] is not created\n", id);
                goto out;
        }
@@ -544,7 +545,7 @@ static struct packet *master_access_status(pid_t pid, int handle, const struct p
                goto out;
        }
 
-       if (common->state != CREATE) {
+       if (common->state != DBOX_STATE_CREATE) {
                ErrPrint("[%s] is not created\n", id);
                goto out;
        }
@@ -588,7 +589,7 @@ static struct packet *master_gbar_update_end(pid_t pid, int handle, const struct
                goto out;
        }
 
-       if (common->state != CREATE) {
+       if (common->state != DBOX_STATE_CREATE) {
                ErrPrint("[%s] is not created\n", id);
                goto out;
        }
@@ -637,7 +638,7 @@ static struct packet *master_extra_info(pid_t pid, int handle, const struct pack
                goto out;
        }
 
-       if (common->state != CREATE) {
+       if (common->state != DBOX_STATE_CREATE) {
                /*!
                 * \note
                 * Already deleted by the user.
@@ -685,7 +686,7 @@ static struct packet *master_dbox_updated(pid_t pid, int handle, const struct pa
                goto out;
        }
 
-       if (common->state != CREATE) {
+       if (common->state != DBOX_STATE_CREATE) {
                /*!
                 * \note
                 * Already deleted by the user.
@@ -776,7 +777,7 @@ static struct packet *master_gbar_created(pid_t pid, int handle, const struct pa
                goto out;
        }
 
-       if (common->state != CREATE) {
+       if (common->state != DBOX_STATE_CREATE) {
                ErrPrint("Instance(%s) is not created\n", id);
                goto out;
        }
@@ -800,12 +801,12 @@ static struct packet *master_gbar_created(pid_t pid, int handle, const struct pa
                        case _GBAR_TYPE_SCRIPT:
                        case _GBAR_TYPE_BUFFER:
                                switch (fb_type(dbox_get_gbar_fb(common))) {
-                               case BUFFER_TYPE_FILE:
-                               case BUFFER_TYPE_SHM:
+                               case DBOX_FB_TYPE_FILE:
+                               case DBOX_FB_TYPE_SHM:
                                        dbox_create_lock_file(common, 1);
                                        break;
-                               case BUFFER_TYPE_PIXMAP:
-                               case BUFFER_TYPE_ERROR:
+                               case DBOX_FB_TYPE_PIXMAP:
+                               case DBOX_FB_TYPE_ERROR:
                                default:
                                        break;
                                }
@@ -873,7 +874,7 @@ static struct packet *master_gbar_destroyed(pid_t pid, int handle, const struct
                goto out;
        }
 
-       if (common->state != CREATE) {
+       if (common->state != DBOX_STATE_CREATE) {
                ErrPrint("Instance(%s) is not created\n", id);
                goto out;
        }
@@ -916,12 +917,12 @@ static struct packet *master_gbar_destroyed(pid_t pid, int handle, const struct
        case _GBAR_TYPE_SCRIPT:
        case _GBAR_TYPE_BUFFER:
                switch (fb_type(dbox_get_gbar_fb(common))) {
-               case BUFFER_TYPE_FILE:
-               case BUFFER_TYPE_SHM:
+               case DBOX_FB_TYPE_FILE:
+               case DBOX_FB_TYPE_SHM:
                        dbox_destroy_lock_file(common, 1);
                        break;
-               case BUFFER_TYPE_PIXMAP:
-               case BUFFER_TYPE_ERROR:
+               case DBOX_FB_TYPE_PIXMAP:
+               case DBOX_FB_TYPE_ERROR:
                default:
                        break;
                }
@@ -965,7 +966,7 @@ static struct packet *master_gbar_updated(pid_t pid, int handle, const struct pa
                goto out;
        }
 
-       if (common->state != CREATE) {
+       if (common->state != DBOX_STATE_CREATE) {
                /*!
                 * \note
                 * This handler is already deleted by the user.
@@ -1037,7 +1038,7 @@ static struct packet *master_update_mode(pid_t pid, int handle, const struct pac
                goto out;
        }
 
-       if (common->state != CREATE) {
+       if (common->state != DBOX_STATE_CREATE) {
                ErrPrint("Livebox(%s) is not created yet\n", id);
                goto out;
        }
@@ -1098,7 +1099,7 @@ static struct packet *master_size_changed(pid_t pid, int handle, const struct pa
                goto out;
        }
 
-       if (common->state != CREATE) {
+       if (common->state != DBOX_STATE_CREATE) {
                ErrPrint("Livebox(%s) is not created yet\n", id);
                goto out;
        }
@@ -1197,7 +1198,7 @@ static struct packet *master_period_changed(pid_t pid, int handle, const struct
                goto out;
        }
 
-       if (common->state != CREATE) {
+       if (common->state != DBOX_STATE_CREATE) {
                ErrPrint("Livebox(%s) is not created\n", id);
                goto out;
        }
@@ -1254,7 +1255,7 @@ static struct packet *master_group_changed(pid_t pid, int handle, const struct p
                goto out;
        }
 
-       if (common->state != CREATE) {
+       if (common->state != DBOX_STATE_CREATE) {
                /*!
                 * \note
                 * Do no access this handler,
@@ -1322,7 +1323,7 @@ static struct packet *master_created(pid_t pid, int handle, const struct packet
        double period;
        int is_pinned_up;
 
-       int old_state = DESTROYED;
+       int old_state = DBOX_STATE_DESTROYED;
 
        int ret;
 
@@ -1361,8 +1362,8 @@ static struct packet *master_created(pid_t pid, int handle, const struct packet
                common = handler->common;
                old_state = common->state;
        } else {
-               if (common->state != CREATE) {
-                       if (common->state != DELETE) {
+               if (common->state != DBOX_STATE_CREATE) {
+                       if (common->state != DBOX_STATE_DELETE) {
                                /*!
                                 * \note
                                 * This is not possible!!!
@@ -1415,16 +1416,16 @@ static struct packet *master_created(pid_t pid, int handle, const struct packet
                /*!
                 * \note
                 * Livebox should create the lock file from here.
-                * Even if the old_state == DELETE,
+                * Even if the old_state == DBOX_STATE_DELETE,
                 * the lock file will be deleted from deleted event callback.
                 */
                switch (fb_type(dbox_get_dbox_fb(common))) {
-               case BUFFER_TYPE_FILE:
-               case BUFFER_TYPE_SHM:
+               case DBOX_FB_TYPE_FILE:
+               case DBOX_FB_TYPE_SHM:
                        dbox_create_lock_file(common, 0);
                        break;
-               case BUFFER_TYPE_PIXMAP:
-               case BUFFER_TYPE_ERROR:
+               case DBOX_FB_TYPE_PIXMAP:
+               case DBOX_FB_TYPE_ERROR:
                default:
                        break;
                }
@@ -1490,7 +1491,7 @@ static struct packet *master_created(pid_t pid, int handle, const struct packet
 
        ret = 0;
 
-       if (common->state == CREATE) {
+       if (common->state == DBOX_STATE_CREATE) {
                dlist_foreach(common->dynamicbox_list, l, handler) {
                        /*!
                         * \note
@@ -1516,7 +1517,7 @@ static struct packet *master_created(pid_t pid, int handle, const struct packet
        }
 
 out:
-       if (ret == 0 && old_state == DELETE) {
+       if (ret == 0 && old_state == DBOX_STATE_DELETE) {
                struct dlist *n;
 
                DbgPrint("Take place an unexpected case [%d]\n", common->refcnt);
@@ -1530,7 +1531,7 @@ out:
                                                 * Callback will be called in any cases
                                                 */
                                        }
-                               } else if (handler->state != DELETE) {
+                               } else if (handler->state != DBOX_STATE_DELETE) {
                                        handler->cbs.created.cb(handler, DBOX_STATUS_ERROR_CANCEL, handler->cbs.created.data);
                                        dbox_unref(handler, 1);
                                }
index 0dc67f0..9a38d9c 100644 (file)
@@ -33,6 +33,7 @@
 #include <dynamicbox_service.h>
 #include <dynamicbox_errno.h>
 #include <dynamicbox_cmd_list.h>
+#include <dynamicbox_buffer.h>
 
 #include "debug.h"
 #include "fb.h"
@@ -1034,7 +1035,7 @@ static void job_del_cb(dynamicbox_h handle, int type, void *data)
        data = cbinfo->data;
        dbox_destroy_cb_info(cbinfo);
 
-       if (handle->common->state != CREATE) {
+       if (handle->common->state != DBOX_STATE_CREATE) {
                DbgPrint("[%s] %d\n", handle->common->pkgname, handle->refcnt);
                if (cb) {
                        cb(handle, DBOX_STATUS_ERROR_NONE, data);
@@ -1045,7 +1046,7 @@ static void job_del_cb(dynamicbox_h handle, int type, void *data)
 
        if (handle->common->refcnt == 1) {
                handle->common->delete_type = type;
-               handle->common->state = DELETE;
+               handle->common->state = DBOX_STATE_DELETE;
 
                if (!handle->common->id) {
                        /*!
@@ -1273,7 +1274,7 @@ EAPI dynamicbox_h dynamicbox_add(const char *pkgname, const char *content, const
        }
 
        handler->visible = DBOX_SHOW;
-       handler->state = CREATE;
+       handler->state = DBOX_STATE_CREATE;
        handler = dbox_ref(handler);
 
        if (handler->common->visible != DBOX_SHOW) {
@@ -1285,12 +1286,12 @@ EAPI dynamicbox_h dynamicbox_add(const char *pkgname, const char *content, const
 
 EAPI double dynamicbox_period(dynamicbox_h handler)
 {
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is not valid\n");
                return 0.0f;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Invalid handle\n");
                return 0.0f;
        }
@@ -1309,12 +1310,12 @@ EAPI int dynamicbox_set_period(dynamicbox_h handler, double period, dynamicbox_r
        unsigned int cmd = CMD_SET_PERIOD;
        int ret;
 
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is not valid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Invalid handle\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -1368,12 +1369,12 @@ EAPI int dynamicbox_del(dynamicbox_h handler, int type, dynamicbox_ret_cb cb, vo
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (handler->state != CREATE) {
+       if (handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is already deleted\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       handler->state = DELETE;
+       handler->state = DBOX_STATE_DELETE;
 
        cbinfo = dbox_create_cb_info(cb, data);
        if (!cbinfo) {
@@ -1433,12 +1434,12 @@ EAPI int dynamicbox_set_update_mode(dynamicbox_h handler, int active_update, dyn
        unsigned int cmd = CMD_UPDATE_MODE;
        int ret;
 
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is Invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is Invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -1482,12 +1483,12 @@ EAPI int dynamicbox_set_update_mode(dynamicbox_h handler, int active_update, dyn
 
 EAPI int dynamicbox_is_active_update(dynamicbox_h handler)
 {
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is Invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is Invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -1512,12 +1513,12 @@ EAPI int dynamicbox_resize(dynamicbox_h handler, int type, dynamicbox_ret_cb cb,
         * Create a new instance or find another linkable instance.
         */
 
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is not valid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Invalid handle\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -1682,12 +1683,12 @@ EAPI int dynamicbox_click(dynamicbox_h handler, double x, double y)
        unsigned int cmd = CMD_CLICKED;
        int ret;
 
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -1721,12 +1722,12 @@ EAPI int dynamicbox_click(dynamicbox_h handler, double x, double y)
 
 EAPI int dynamicbox_has_gbar(dynamicbox_h handler)
 {
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -1741,12 +1742,12 @@ EAPI int dynamicbox_has_gbar(dynamicbox_h handler)
 
 EAPI int dynamicbox_glance_bar_is_created(dynamicbox_h handler)
 {
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -1765,12 +1766,12 @@ EAPI int dynamicbox_create_glance_bar(dynamicbox_h handler, double x, double y,
        unsigned int cmd = CMD_CREATE_GBAR;
        int ret;
 
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -1830,12 +1831,12 @@ EAPI int dynamicbox_move_glance_bar(dynamicbox_h handler, double x, double y)
        struct packet *packet;
        unsigned int cmd = CMD_GBAR_MOVE;
 
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -1898,12 +1899,12 @@ EAPI int dynamicbox_destroy_glance_bar(dynamicbox_h handler, dynamicbox_ret_cb c
        unsigned int cmd = CMD_DESTROY_GBAR;
        int ret;
 
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -1974,12 +1975,12 @@ EAPI int dynamicbox_feed_access_event(dynamicbox_h handler, enum dynamicbox_acce
        unsigned int cmd;
        int ret = 0;    /* re-used for sending event type */
 
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -2110,12 +2111,12 @@ EAPI int dynamicbox_feed_mouse_event(dynamicbox_h handler, enum dynamicbox_mouse
        int h = 1;
        unsigned int cmd;
 
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -2280,12 +2281,12 @@ EAPI int dynamicbox_feed_key_event(dynamicbox_h handler, enum dynamicbox_key_eve
        int ret;
        unsigned int cmd;
 
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -2416,12 +2417,12 @@ EAPI int dynamicbox_feed_key_event(dynamicbox_h handler, enum dynamicbox_key_eve
 
 EAPI const char *dynamicbox_filename(dynamicbox_h handler)
 {
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return NULL;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return NULL;
        }
@@ -2444,12 +2445,12 @@ EAPI int dynamicbox_get_glance_bar_size(dynamicbox_h handler, int *w, int *h)
        int _w;
        int _h;
 
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -2482,12 +2483,12 @@ EAPI int dynamicbox_size(dynamicbox_h handler)
        int w;
        int h;
 
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -2526,12 +2527,12 @@ EAPI int dynamicbox_set_group(dynamicbox_h handler, const char *cluster, const c
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!cluster || !category || handler->state != CREATE) {
+       if (!cluster || !category || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Invalid argument\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Invalid argument\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -2583,12 +2584,12 @@ EAPI int dynamicbox_get_group(dynamicbox_h handler, const char **cluster, const
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!cluster || !category || handler->state != CREATE) {
+       if (!cluster || !category || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Invalid argument\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Invalid argument\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -2613,12 +2614,12 @@ EAPI int dynamicbox_get_supported_sizes(dynamicbox_h handler, int *cnt, int *siz
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!cnt || handler->state != CREATE) {
+       if (!cnt || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is not valid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is not valid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -2649,12 +2650,12 @@ EAPI const char *dynamicbox_pkgname(dynamicbox_h handler)
                return NULL;
        }
 
-       if (handler->state != CREATE) {
+       if (handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is not valid\n");
                return NULL;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is not valid\n");
                return NULL;
        }
@@ -2664,12 +2665,12 @@ EAPI const char *dynamicbox_pkgname(dynamicbox_h handler)
 
 EAPI double dynamicbox_priority(dynamicbox_h handler)
 {
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return -1.0f;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return -1.0f;
        }
@@ -2740,12 +2741,12 @@ EAPI enum dynamicbox_type dynamicbox_type(dynamicbox_h handler, int gbar)
 {
        enum dynamicbox_type type;
 
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_TYPE_INVALID;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_TYPE_INVALID;
        }
@@ -2811,7 +2812,7 @@ EAPI int dynamicbox_set_text_handler(dynamicbox_h handler, int gbar, struct dyna
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (handler->state != CREATE) {
+       if (handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is not valid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -2828,12 +2829,12 @@ EAPI int dynamicbox_set_text_handler(dynamicbox_h handler, int gbar, struct dyna
 EAPI unsigned int dynamicbox_acquire_resource_id(dynamicbox_h handler, int gbar, dynamicbox_ret_cb cb, void *data)
 {
        if (gbar) {
-               if (!handler || handler->state != CREATE) {
+               if (!handler || handler->state != DBOX_STATE_CREATE) {
                        ErrPrint("Handler is invalid\n");
                        return DBOX_STATUS_ERROR_INVALID_PARAMETER;
                }
 
-               if (!handler->common || handler->common->state != CREATE) {
+               if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                        ErrPrint("Handler is invalid\n");
                        return DBOX_STATUS_ERROR_INVALID_PARAMETER;
                }
@@ -2850,12 +2851,12 @@ EAPI unsigned int dynamicbox_acquire_resource_id(dynamicbox_h handler, int gbar,
 
                return dbox_acquire_gbar_pixmap(handler, cb, data);
        } else {
-               if (!handler || handler->state != CREATE) {
+               if (!handler || handler->state != DBOX_STATE_CREATE) {
                        ErrPrint("Handler is invalid\n");
                        return DBOX_STATUS_ERROR_INVALID_PARAMETER;
                }
 
-               if (!handler->common || handler->common->state != CREATE) {
+               if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                        ErrPrint("Handler is invalid\n");
                        return DBOX_STATUS_ERROR_INVALID_PARAMETER;
                }
@@ -2889,7 +2890,7 @@ EAPI int dynamicbox_release_resource_id(dynamicbox_h handler, int gbar, unsigned
        const char *id;
        unsigned int cmd;
 
-       if (resource_id == 0 /* || handler->state != CREATE */) {
+       if (resource_id == 0 /* || handler->state != DBOX_STATE_CREATE */) {
                ErrPrint("Pixmap is invalid [%d]\n", resource_id);
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -2914,7 +2915,7 @@ EAPI int dynamicbox_release_resource_id(dynamicbox_h handler, int gbar, unsigned
                         * Master will try to find the buffer handler using given resource_id. if the pkgname and id is not valid.
                         */
                } else {
-                       if (!handler->common /* || handler-common->state != CREATE */) {
+                       if (!handler->common /* || handler-common->state != DBOX_STATE_CREATE */) {
                                ErrPrint("Handler is invalid\n");
                                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
                        }
@@ -2954,7 +2955,7 @@ EAPI int dynamicbox_release_resource_id(dynamicbox_h handler, int gbar, unsigned
                         * Master will try to find the buffer handler using given resource_id. if the pkgname and id is not valid.
                         */
                } else {
-                       if (!handler->common /* || handler->common->state != CREATE */) {
+                       if (!handler->common /* || handler->common->state != DBOX_STATE_CREATE */) {
                                ErrPrint("Handler is invalid\n");
                                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
                        }
@@ -2991,12 +2992,12 @@ EAPI unsigned int dynamicbox_resource_id(const dynamicbox_h handler, int gbar)
        int pixmap = 0;
 
        if (gbar) {
-               if (!handler || handler->state != CREATE) {
+               if (!handler || handler->state != DBOX_STATE_CREATE) {
                        ErrPrint("Handler is invalid\n");
                        return 0;
                }
 
-               if (!handler->common || handler->common->state != CREATE) {
+               if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                        ErrPrint("Handler is invalid\n");
                        return 0;
                }
@@ -3017,12 +3018,12 @@ EAPI unsigned int dynamicbox_resource_id(const dynamicbox_h handler, int gbar)
                        return 0;
                }
        } else {
-               if (!handler || handler->state != CREATE) {
+               if (!handler || handler->state != DBOX_STATE_CREATE) {
                        ErrPrint("Handler is invalid\n");
                        return 0;
                }
 
-               if (!handler->common || handler->common->state != CREATE) {
+               if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                        ErrPrint("Handler is invalid\n");
                        return 0;
                }
@@ -3051,12 +3052,12 @@ EAPI unsigned int dynamicbox_resource_id(const dynamicbox_h handler, int gbar)
 EAPI void *dynamicbox_acquire_fb(dynamicbox_h handler, int gbar)
 {
        if (gbar) {
-               if (!handler || handler->state != CREATE) {
+               if (!handler || handler->state != DBOX_STATE_CREATE) {
                        ErrPrint("Handler is invalid\n");
                        return NULL;
                }
 
-               if (!handler->common || handler->common->state != CREATE) {
+               if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                        ErrPrint("Handler is invalid\n");
                        return NULL;
                }
@@ -3073,12 +3074,12 @@ EAPI void *dynamicbox_acquire_fb(dynamicbox_h handler, int gbar)
 
                return fb_acquire_buffer(handler->common->gbar.fb);
        } else {
-               if (!handler || handler->state != CREATE) {
+               if (!handler || handler->state != DBOX_STATE_CREATE) {
                        ErrPrint("Handler is invalid\n");
                        return NULL;
                }
 
-               if (!handler->common || handler->common->state != CREATE) {
+               if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                        ErrPrint("Handler is invalid\n");
                        return NULL;
                }
@@ -3109,12 +3110,12 @@ EAPI int dynamicbox_fb_refcnt(void *buffer)
 
 EAPI int dynamicbox_fb_buffer_size(dynamicbox_h handler, int gbar)
 {
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -3133,12 +3134,12 @@ EAPI int dynamicbox_fb_buffer_size(dynamicbox_h handler, int gbar)
 
 EAPI int dynamicbox_is_created_by_user(dynamicbox_h handler)
 {
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -3157,12 +3158,12 @@ EAPI int dynamicbox_set_pinup(dynamicbox_h handler, int flag, dynamicbox_ret_cb
        unsigned int cmd = CMD_PINUP_CHANGED;
        int ret;
 
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -3204,12 +3205,12 @@ EAPI int dynamicbox_set_pinup(dynamicbox_h handler, int flag, dynamicbox_ret_cb
 
 EAPI int dynamicbox_is_pinned_up(dynamicbox_h handler)
 {
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -3224,12 +3225,12 @@ EAPI int dynamicbox_is_pinned_up(dynamicbox_h handler)
 
 EAPI int dynamicbox_has_pinup(dynamicbox_h handler)
 {
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -3249,7 +3250,7 @@ EAPI int dynamicbox_set_data(dynamicbox_h handler, void *data)
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (handler->state != CREATE) {
+       if (handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -3265,7 +3266,7 @@ EAPI void *dynamicbox_data(dynamicbox_h handler)
                return NULL;
        }
 
-       if (handler->state != CREATE) {
+       if (handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return NULL;
        }
@@ -3275,12 +3276,12 @@ EAPI void *dynamicbox_data(dynamicbox_h handler)
 
 EAPI const char *dynamicbox_content(dynamicbox_h handler)
 {
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return NULL;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Invalid handle\n");
                return NULL;
        }
@@ -3290,12 +3291,12 @@ EAPI const char *dynamicbox_content(dynamicbox_h handler)
 
 EAPI const char *dynamicbox_title(dynamicbox_h handler)
 {
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return NULL;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Invalid handle\n");
                return NULL;
        }
@@ -3310,12 +3311,12 @@ EAPI int dynamicbox_emit_text_signal(dynamicbox_h handler, const char *emission,
        unsigned int cmd = CMD_TEXT_SIGNAL;
        int ret;
 
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -3400,12 +3401,12 @@ EAPI int dynamicbox_refresh(dynamicbox_h handler, int force)
        struct packet *packet;
        unsigned int cmd = CMD_UPDATE;
 
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is not valid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -3448,12 +3449,12 @@ EAPI int dynamicbox_set_visibility(dynamicbox_h handler, enum dynamicbox_visible
        int old_state;
        int ret;
 
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is not valid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -3489,12 +3490,12 @@ EAPI int dynamicbox_set_visibility(dynamicbox_h handler, enum dynamicbox_visible
 
 EAPI enum dynamicbox_visible_state dynamicbox_visibility(dynamicbox_h handler)
 {
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is invalid\n");
                return DBOX_VISIBLE_ERROR;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is not valid\n");
                return DBOX_VISIBLE_ERROR;
        }
@@ -3537,12 +3538,12 @@ EAPI int dynamicbox_viewer_set_resumed(void)
 
 EAPI int dynamicbox_sync_fb(dynamicbox_h handler, int gbar)
 {
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Invalid handle\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Invalid handle\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -3561,12 +3562,12 @@ EAPI int dynamicbox_sync_fb(dynamicbox_h handler, int gbar)
 
 EAPI const char *dynamicbox_alt_icon(dynamicbox_h handler)
 {
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is not valid[%p]\n", handler);
                return NULL;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is not valid\n");
                return NULL;
        }
@@ -3576,12 +3577,12 @@ EAPI const char *dynamicbox_alt_icon(dynamicbox_h handler)
 
 EAPI const char *dynamicbox_alt_name(dynamicbox_h handler)
 {
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is not valid[%p]\n", handler);
                return NULL;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is not valid\n");
                return NULL;
        }
@@ -3594,12 +3595,12 @@ EAPI int dynamicbox_acquire_fb_lock(dynamicbox_h handler, int is_gbar)
        int ret = DBOX_STATUS_ERROR_NONE;
        int fd;
 
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is not valid[%p]\n", handler);
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Handler is not valid\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -3615,7 +3616,7 @@ EAPI int dynamicbox_acquire_fb_lock(dynamicbox_h handler, int is_gbar)
                        return DBOX_STATUS_ERROR_INVALID_PARAMETER;
                }
 
-               if (fb_type(dbox_get_gbar_fb(handler->common)) == BUFFER_TYPE_FILE) {
+               if (fb_type(dbox_get_gbar_fb(handler->common)) == DBOX_FB_TYPE_FILE) {
                        return DBOX_STATUS_ERROR_NONE;
                }
 
@@ -3626,7 +3627,7 @@ EAPI int dynamicbox_acquire_fb_lock(dynamicbox_h handler, int is_gbar)
                        return DBOX_STATUS_ERROR_INVALID_PARAMETER;
                }
 
-               if (fb_type(dbox_get_dbox_fb(handler->common)) == BUFFER_TYPE_FILE) {
+               if (fb_type(dbox_get_dbox_fb(handler->common)) == DBOX_FB_TYPE_FILE) {
                        return DBOX_STATUS_ERROR_NONE;
                }
 
@@ -3643,12 +3644,12 @@ EAPI int dynamicbox_release_fb_lock(dynamicbox_h handler, int is_gbar)
        int ret = DBOX_STATUS_ERROR_NONE;
        int fd;
 
-       if (!handler || handler->state != CREATE) {
+       if (!handler || handler->state != DBOX_STATE_CREATE) {
                ErrPrint("Invalid handle\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!handler->common || handler->common->state != CREATE) {
+       if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
                ErrPrint("Invalid handle\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
@@ -3664,7 +3665,7 @@ EAPI int dynamicbox_release_fb_lock(dynamicbox_h handler, int is_gbar)
                        return DBOX_STATUS_ERROR_INVALID_PARAMETER;
                }
 
-               if (fb_type(dbox_get_gbar_fb(handler->common)) == BUFFER_TYPE_FILE) {
+               if (fb_type(dbox_get_gbar_fb(handler->common)) == DBOX_FB_TYPE_FILE) {
                        return DBOX_STATUS_ERROR_NONE;
                }
 
@@ -3675,7 +3676,7 @@ EAPI int dynamicbox_release_fb_lock(dynamicbox_h handler, int is_gbar)
                        return DBOX_STATUS_ERROR_INVALID_PARAMETER;
                }
 
-               if (fb_type(dbox_get_dbox_fb(handler->common)) == BUFFER_TYPE_FILE) {
+               if (fb_type(dbox_get_dbox_fb(handler->common)) == DBOX_FB_TYPE_FILE) {
                        return DBOX_STATUS_ERROR_NONE;
                }
 
index 9e61ef1..efd3188 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <dynamicbox_errno.h>
 #include <dynamicbox_service.h>
+#include <dynamicbox_buffer.h>
 
 #include <packet.h>
 
@@ -225,7 +226,7 @@ struct dynamicbox_common *dbox_create_common_handle(dynamicbox_h handle, const c
        common->dbox.lock = NULL;
        common->dbox.lock_fd = -1;
 
-       common->state = CREATE;
+       common->state = DBOX_STATE_CREATE;
        common->visible = DBOX_SHOW;
 
        s_info.dynamicbox_common_list = dlist_append(s_info.dynamicbox_common_list, common);
@@ -236,7 +237,7 @@ int dbox_destroy_common_handle(struct dynamicbox_common *common)
 {
        dlist_remove_data(s_info.dynamicbox_common_list, common);
 
-       common->state = DESTROYED;
+       common->state = DBOX_STATE_DESTROYED;
 
        if (common->filename) {
                (void)util_unlink(common->filename);
@@ -454,7 +455,7 @@ dynamicbox_h dbox_new_dynamicbox(const char *pkgname, const char *id, double tim
        dbox_common_ref(handler->common, handler);
        dbox_set_id(handler->common, id);
        handler->common->timestamp = timestamp;
-       handler->common->state = CREATE;
+       handler->common->state = DBOX_STATE_CREATE;
        handler->visible = DBOX_SHOW;
        s_info.dynamicbox_list = dlist_append(s_info.dynamicbox_list, handler);
 
@@ -643,7 +644,7 @@ int dbox_set_gbar_fb(struct dynamicbox_common *common, const char *filename)
 {
        struct fb_info *fb;
 
-       if (!common || common->state != CREATE) {
+       if (!common || common->state != DBOX_STATE_CREATE) {
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
@@ -810,7 +811,7 @@ dynamicbox_h dbox_unref(dynamicbox_h handler, int destroy_common)
 
        dlist_remove_data(s_info.dynamicbox_list, handler);
 
-       handler->state = DESTROYED;
+       handler->state = DBOX_STATE_DESTROYED;
        if (dbox_common_unref(handler->common, handler) == 0) {
                if (destroy_common) {
                        /*!
@@ -886,7 +887,7 @@ int dbox_sync_dbox_fb(struct dynamicbox_common *common)
 {
        int ret;
 
-       if (fb_type(dbox_get_dbox_fb(common)) == BUFFER_TYPE_FILE && common->dbox.lock_fd >= 0) {
+       if (fb_type(dbox_get_dbox_fb(common)) == DBOX_FB_TYPE_FILE && common->dbox.lock_fd >= 0) {
                (void)dbox_fb_lock(common->dbox.lock_fd);
                ret = fb_sync(dbox_get_dbox_fb(common));
                (void)dbox_fb_unlock(common->dbox.lock_fd);
@@ -901,7 +902,7 @@ int dbox_sync_gbar_fb(struct dynamicbox_common *common)
 {
        int ret;
 
-       if (fb_type(dbox_get_gbar_fb(common)) == BUFFER_TYPE_FILE && common->gbar.lock_fd >= 0) {
+       if (fb_type(dbox_get_gbar_fb(common)) == DBOX_FB_TYPE_FILE && common->gbar.lock_fd >= 0) {
                (void)dbox_fb_lock(common->gbar.lock_fd);
                ret = fb_sync(dbox_get_gbar_fb(common));
                (void)dbox_fb_unlock(common->gbar.lock_fd);
@@ -969,7 +970,7 @@ struct dynamicbox_common *dbox_find_sharable_common_handle(const char *pkgname,
        }
 
        dlist_foreach(s_info.dynamicbox_common_list, l, common) {
-               if (common->state != CREATE) {
+               if (common->state != DBOX_STATE_CREATE) {
                        continue;
                }
 
index 54b3707..fd1f915 100644 (file)
--- a/src/fb.c
+++ b/src/fb.c
@@ -33,6 +33,7 @@
 
 #include <dlog.h>
 #include <dynamicbox_errno.h> /* For error code */
+#include <dynamicbox_buffer.h>
 
 #include "debug.h"
 #include "util.h"
@@ -51,17 +52,6 @@ struct fb_info {
        int handle;
 };
 
-struct buffer { /*!< Must has to be sync with slave & provider */
-       enum {
-               CREATED = 0x00beef00,
-               DESTROYED = 0x00dead00
-       } state;
-       enum buffer_type type;
-       int refcnt;
-       void *info;
-       char data[];
-};
-
 static struct {
        Display *disp;
        int screen;
@@ -110,7 +100,7 @@ static inline void update_fb_size(struct fb_info *info)
 static int sync_for_file(struct fb_info *info)
 {
        int fd;
-       struct buffer *buffer;
+       dynamicbox_fb_t buffer;
 
        buffer = info->buffer;
 
@@ -118,12 +108,12 @@ static int sync_for_file(struct fb_info *info)
                return DBOX_STATUS_ERROR_NONE;
        }
 
-       if (buffer->state != CREATED) {
+       if (buffer->state != DBOX_FB_STATE_CREATED) {
                ErrPrint("Invalid state of a FB\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (buffer->type != BUFFER_TYPE_FILE) {
+       if (buffer->type != DBOX_FB_TYPE_FILE) {
                ErrPrint("Invalid buffer\n");
                return DBOX_STATUS_ERROR_NONE;
        }
@@ -167,7 +157,7 @@ static int sync_for_file(struct fb_info *info)
 
 static int sync_for_pixmap(struct fb_info *info)
 {
-       struct buffer *buffer;
+       dynamicbox_fb_t buffer;
        XShmSegmentInfo si;
        XImage *xim;
 
@@ -176,12 +166,12 @@ static int sync_for_pixmap(struct fb_info *info)
                return DBOX_STATUS_ERROR_NONE;
        }
 
-       if (buffer->state != CREATED) {
+       if (buffer->state != DBOX_FB_STATE_CREATED) {
                ErrPrint("Invalid state of a FB\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (buffer->type != BUFFER_TYPE_PIXMAP) {
+       if (buffer->type != DBOX_FB_TYPE_PIXMAP) {
                ErrPrint("Invalid buffer\n");
                return DBOX_STATUS_ERROR_NONE;
        }
@@ -349,7 +339,7 @@ int fb_destroy(struct fb_info *info)
        }
 
        if (info->buffer) {
-               struct buffer *buffer;
+               dynamicbox_fb_t buffer;
                buffer = info->buffer;
 
                buffer->info = NULL;
@@ -386,7 +376,7 @@ int fb_is_created(struct fb_info *info)
 
 void *fb_acquire_buffer(struct fb_info *info)
 {
-       struct buffer *buffer;
+       dynamicbox_fb_t buffer;
 
        if (!info) {
                ErrPrint("info == NIL\n");
@@ -404,9 +394,9 @@ void *fb_acquire_buffer(struct fb_info *info)
                                return NULL;
                        }
 
-                       buffer->type = BUFFER_TYPE_PIXMAP;
+                       buffer->type = DBOX_FB_TYPE_PIXMAP;
                        buffer->refcnt = 0;
-                       buffer->state = CREATED;
+                       buffer->state = DBOX_FB_STATE_CREATED;
                        buffer->info = info;
                        info->buffer = buffer;
 
@@ -425,9 +415,9 @@ void *fb_acquire_buffer(struct fb_info *info)
                                return NULL;
                        }
 
-                       buffer->type = BUFFER_TYPE_FILE;
+                       buffer->type = DBOX_FB_TYPE_FILE;
                        buffer->refcnt = 0;
-                       buffer->state = CREATED;
+                       buffer->state = DBOX_FB_STATE_CREATED;
                        buffer->info = info;
                        info->buffer = buffer;
 
@@ -449,10 +439,10 @@ void *fb_acquire_buffer(struct fb_info *info)
        buffer = info->buffer;
 
        switch (buffer->type) {
-       case BUFFER_TYPE_PIXMAP:
+       case DBOX_FB_TYPE_PIXMAP:
                buffer->refcnt++;
                break;
-       case BUFFER_TYPE_FILE:
+       case DBOX_FB_TYPE_FILE:
                buffer->refcnt++;
                break;
        default:
@@ -465,33 +455,33 @@ void *fb_acquire_buffer(struct fb_info *info)
 
 int fb_release_buffer(void *data)
 {
-       struct buffer *buffer;
+       dynamicbox_fb_t buffer;
 
        if (!data) {
                ErrPrint("buffer data == NIL\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       buffer = container_of(data, struct buffer, data);
+       buffer = container_of(data, struct dynamicbox_fb, data);
 
-       if (buffer->state != CREATED) {
+       if (buffer->state != DBOX_FB_STATE_CREATED) {
                ErrPrint("Invalid handle\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
        switch (buffer->type) {
-       case BUFFER_TYPE_SHM:
+       case DBOX_FB_TYPE_SHM:
                if (shmdt(buffer) < 0) {
                        ErrPrint("shmdt: %s\n", strerror(errno));
                }
                break;
-       case BUFFER_TYPE_PIXMAP:
+       case DBOX_FB_TYPE_PIXMAP:
                buffer->refcnt--;
                if (buffer->refcnt == 0) {
                        struct fb_info *info;
                        info = buffer->info;
 
-                       buffer->state = DESTROYED;
+                       buffer->state = DBOX_FB_STATE_DESTROYED;
                        free(buffer);
                
                        if (info && info->buffer == buffer) {
@@ -499,13 +489,13 @@ int fb_release_buffer(void *data)
                        }
                }
                break;
-       case BUFFER_TYPE_FILE:
+       case DBOX_FB_TYPE_FILE:
                buffer->refcnt--;
                if (buffer->refcnt == 0) {
                        struct fb_info *info;
                        info = buffer->info;
 
-                       buffer->state = DESTROYED;
+                       buffer->state = DBOX_FB_STATE_DESTROYED;
                        free(buffer);
 
                        if (info && info->buffer == buffer) {
@@ -523,7 +513,7 @@ int fb_release_buffer(void *data)
 
 int fb_refcnt(void *data)
 {
-       struct buffer *buffer;
+       dynamicbox_fb_t buffer;
        struct shmid_ds buf;
        int ret;
 
@@ -531,15 +521,15 @@ int fb_refcnt(void *data)
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       buffer = container_of(data, struct buffer, data);
+       buffer = container_of(data, struct dynamicbox_fb, data);
 
-       if (buffer->state != CREATED) {
+       if (buffer->state != DBOX_FB_STATE_CREATED) {
                ErrPrint("Invalid handle\n");
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
        switch (buffer->type) {
-       case BUFFER_TYPE_SHM:
+       case DBOX_FB_TYPE_SHM:
                if (shmctl(buffer->refcnt, IPC_STAT, &buf) < 0) {
                        ErrPrint("Error: %s\n", strerror(errno));
                        return DBOX_STATUS_ERROR_FAULT;
@@ -547,10 +537,10 @@ int fb_refcnt(void *data)
 
                ret = buf.shm_nattch;
                break;
-       case BUFFER_TYPE_PIXMAP:
+       case DBOX_FB_TYPE_PIXMAP:
                ret = buffer->refcnt;
                break;
-       case BUFFER_TYPE_FILE:
+       case DBOX_FB_TYPE_FILE:
                ret = buffer->refcnt;
                break;
        default:
@@ -591,26 +581,26 @@ int fb_size(struct fb_info *info)
 
 int fb_type(struct fb_info *info)
 {
-       struct buffer *buffer;
+       dynamicbox_fb_t buffer;
 
        if (!info) {
-               return BUFFER_TYPE_ERROR;
+               return DBOX_FB_TYPE_ERROR;
        }
 
        buffer = info->buffer;
        if (!buffer) {
-               int type = BUFFER_TYPE_ERROR;
+               int type = DBOX_FB_TYPE_ERROR;
                /*!
                 * \note
                 * Try to get this from SCHEMA
                 */
                if (info->id) {
                        if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
-                               type = BUFFER_TYPE_FILE;
+                               type = DBOX_FB_TYPE_FILE;
                        } else if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
-                               type = BUFFER_TYPE_PIXMAP;
+                               type = DBOX_FB_TYPE_PIXMAP;
                        } else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) {
-                               type = BUFFER_TYPE_SHM;
+                               type = DBOX_FB_TYPE_SHM;
                        }
                }
 
index 4a89f86..88d3059 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <dlog.h>
 #include <dynamicbox_errno.h> /* For error code */
+#include <dynamicbox_buffer.h>
 
 #include "debug.h"
 #include "util.h"
@@ -47,17 +48,6 @@ struct fb_info {
        int handle;
 };
 
-struct buffer { /*!< Must has to be sync with slave & provider */
-       enum {
-               CREATED = 0x00beef00,
-               DESTROYED = 0x00dead00
-       } state;
-       enum buffer_type type;
-       int refcnt;
-       void *info;
-       char data[];
-};
-
 static struct {
 } s_info = {
 };
@@ -93,7 +83,7 @@ static inline int sync_for_file(struct fb_info *info)
                return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (buffer->type != BUFFER_TYPE_FILE) {
+       if (buffer->type != DBOX_BUFFER_TYPE_FILE) {
                ErrPrint("Invalid buffer\n");
                return DBOX_STATUS_ERROR_NONE;
        }
@@ -267,7 +257,7 @@ void *fb_acquire_buffer(struct fb_info *info)
                                return NULL;
                        }
 
-                       buffer->type = BUFFER_TYPE_FILE;
+                       buffer->type = DBOX_BUFFER_TYPE_FILE;
                        buffer->refcnt = 0;
                        buffer->state = CREATED;
                        buffer->info = info;
@@ -291,10 +281,10 @@ void *fb_acquire_buffer(struct fb_info *info)
        buffer = info->buffer;
 
        switch (buffer->type) {
-       case BUFFER_TYPE_FILE:
+       case DBOX_BUFFER_TYPE_FILE:
                buffer->refcnt++;
                break;
-       case BUFFER_TYPE_PIXMAP:
+       case DBOX_BUFFER_TYPE_PIXMAP:
        default:
                DbgPrint("Unknwon FP: %d\n", buffer->type);
                break;
@@ -320,18 +310,18 @@ int fb_release_buffer(void *data)
        }
 
        switch (buffer->type) {
-       case BUFFER_TYPE_SHM:
+       case DBOX_BUFFER_TYPE_SHM:
                if (shmdt(buffer) < 0) {
                        ErrPrint("shmdt: %s\n", strerror(errno));
                }
                break;
-       case BUFFER_TYPE_FILE:
+       case DBOX_BUFFER_TYPE_FILE:
                buffer->refcnt--;
                if (buffer->refcnt == 0) {
                        struct fb_info *info;
                        info = buffer->info;
 
-                       buffer->state = DESTROYED;
+                       buffer->state = DBOX_FB_STATE_DESTROYED;
                        free(buffer);
 
                        if (info && info->buffer == buffer) {
@@ -339,7 +329,7 @@ int fb_release_buffer(void *data)
                        }
                }
                break;
-       case BUFFER_TYPE_PIXMAP:
+       case DBOX_BUFFER_TYPE_PIXMAP:
        default:
                ErrPrint("Unknwon buffer type\n");
                break;
@@ -366,7 +356,7 @@ int fb_refcnt(void *data)
        }
 
        switch (buffer->type) {
-       case BUFFER_TYPE_SHM:
+       case DBOX_BUFFER_TYPE_SHM:
                if (shmctl(buffer->refcnt, IPC_STAT, &buf) < 0) {
                        ErrPrint("Error: %s\n", strerror(errno));
                        return DBOX_STATUS_ERROR_FAULT;
@@ -374,10 +364,10 @@ int fb_refcnt(void *data)
 
                ret = buf.shm_nattch;
                break;
-       case BUFFER_TYPE_FILE:
+       case DBOX_BUFFER_TYPE_FILE:
                ret = buffer->refcnt;
                break;
-       case BUFFER_TYPE_PIXMAP:
+       case DBOX_BUFFER_TYPE_PIXMAP:
        default:
                ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
                break;
@@ -419,23 +409,23 @@ int fb_type(struct fb_info *info)
        struct buffer *buffer;
 
        if (!info) {
-               return BUFFER_TYPE_ERROR;
+               return DBOX_BUFFER_TYPE_ERROR;
        }
 
        buffer = info->buffer;
        if (!buffer) {
-               int type = BUFFER_TYPE_ERROR;
+               int type = DBOX_BUFFER_TYPE_ERROR;
                /*!
                 * \note
                 * Try to get this from SCHEMA
                 */
                if (info->id) {
                        if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
-                               type = BUFFER_TYPE_FILE;
+                               type = DBOX_BUFFER_TYPE_FILE;
                        } else if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
                                /* Unsupported type */
                        } else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) {
-                               type = BUFFER_TYPE_SHM;
+                               type = DBOX_BUFFER_TYPE_SHM;
                        }
                }