#include <dynamicbox_errno.h>
#include <dynamicbox_service.h>
#include <dynamicbox_cmd_list.h>
+#include <dynamicbox_buffer.h>
#include <secure_socket.h>
#include "debug.h"
}
/*!< 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
* 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) {
goto out;
}
- if (common->state != CREATE) {
+ if (common->state != DBOX_STATE_CREATE) {
ErrPrint("(%s) is not created\n", id);
goto out;
}
goto out;
}
- if (common->state != CREATE) {
+ if (common->state != DBOX_STATE_CREATE) {
ErrPrint("[%s] is not created\n", id);
goto out;
}
goto out;
}
- if (common->state != CREATE) {
+ if (common->state != DBOX_STATE_CREATE) {
ErrPrint("[%s] is not created\n", id);
goto out;
}
goto out;
}
- if (common->state != CREATE) {
+ if (common->state != DBOX_STATE_CREATE) {
ErrPrint("[%s] is not created\n", id);
goto out;
}
goto out;
}
- if (common->state != CREATE) {
+ if (common->state != DBOX_STATE_CREATE) {
ErrPrint("[%s] is not created\n", id);
goto out;
}
goto out;
}
- if (common->state != CREATE) {
+ if (common->state != DBOX_STATE_CREATE) {
ErrPrint("[%s] is not created\n", id);
goto out;
}
goto out;
}
- if (common->state != CREATE) {
+ if (common->state != DBOX_STATE_CREATE) {
ErrPrint("[%s] is not created\n", id);
goto out;
}
goto out;
}
- if (common->state != CREATE) {
+ if (common->state != DBOX_STATE_CREATE) {
/*!
* \note
* Already deleted by the user.
goto out;
}
- if (common->state != CREATE) {
+ if (common->state != DBOX_STATE_CREATE) {
/*!
* \note
* Already deleted by the user.
goto out;
}
- if (common->state != CREATE) {
+ if (common->state != DBOX_STATE_CREATE) {
ErrPrint("Instance(%s) is not created\n", id);
goto out;
}
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;
}
goto out;
}
- if (common->state != CREATE) {
+ if (common->state != DBOX_STATE_CREATE) {
ErrPrint("Instance(%s) is not created\n", id);
goto out;
}
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;
}
goto out;
}
- if (common->state != CREATE) {
+ if (common->state != DBOX_STATE_CREATE) {
/*!
* \note
* This handler is already deleted by the user.
goto out;
}
- if (common->state != CREATE) {
+ if (common->state != DBOX_STATE_CREATE) {
ErrPrint("Livebox(%s) is not created yet\n", id);
goto out;
}
goto out;
}
- if (common->state != CREATE) {
+ if (common->state != DBOX_STATE_CREATE) {
ErrPrint("Livebox(%s) is not created yet\n", id);
goto out;
}
goto out;
}
- if (common->state != CREATE) {
+ if (common->state != DBOX_STATE_CREATE) {
ErrPrint("Livebox(%s) is not created\n", id);
goto out;
}
goto out;
}
- if (common->state != CREATE) {
+ if (common->state != DBOX_STATE_CREATE) {
/*!
* \note
* Do no access this handler,
double period;
int is_pinned_up;
- int old_state = DESTROYED;
+ int old_state = DBOX_STATE_DESTROYED;
int ret;
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!!!
/*!
* \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;
}
ret = 0;
- if (common->state == CREATE) {
+ if (common->state == DBOX_STATE_CREATE) {
dlist_foreach(common->dynamicbox_list, l, handler) {
/*!
* \note
}
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);
* 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);
}
#include <dynamicbox_service.h>
#include <dynamicbox_errno.h>
#include <dynamicbox_cmd_list.h>
+#include <dynamicbox_buffer.h>
#include "debug.h"
#include "fb.h"
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);
if (handle->common->refcnt == 1) {
handle->common->delete_type = type;
- handle->common->state = DELETE;
+ handle->common->state = DBOX_STATE_DELETE;
if (!handle->common->id) {
/*!
}
handler->visible = DBOX_SHOW;
- handler->state = CREATE;
+ handler->state = DBOX_STATE_CREATE;
handler = dbox_ref(handler);
if (handler->common->visible != DBOX_SHOW) {
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;
}
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;
}
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) {
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;
}
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;
}
* 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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
{
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;
}
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;
}
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;
}
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;
}
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;
}
* 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;
}
* 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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
return NULL;
}
- if (handler->state != CREATE) {
+ if (handler->state != DBOX_STATE_CREATE) {
ErrPrint("Handler is invalid\n");
return NULL;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
#include <dlog.h>
#include <dynamicbox_errno.h> /* For error code */
+#include <dynamicbox_buffer.h>
#include "debug.h"
#include "util.h"
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;
static int sync_for_file(struct fb_info *info)
{
int fd;
- struct buffer *buffer;
+ dynamicbox_fb_t buffer;
buffer = info->buffer;
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;
}
static int sync_for_pixmap(struct fb_info *info)
{
- struct buffer *buffer;
+ dynamicbox_fb_t buffer;
XShmSegmentInfo si;
XImage *xim;
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;
}
}
if (info->buffer) {
- struct buffer *buffer;
+ dynamicbox_fb_t buffer;
buffer = info->buffer;
buffer->info = NULL;
void *fb_acquire_buffer(struct fb_info *info)
{
- struct buffer *buffer;
+ dynamicbox_fb_t buffer;
if (!info) {
ErrPrint("info == NIL\n");
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;
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;
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:
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) {
}
}
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) {
int fb_refcnt(void *data)
{
- struct buffer *buffer;
+ dynamicbox_fb_t buffer;
struct shmid_ds buf;
int ret;
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;
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:
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;
}
}