#include <dynamicbox.h>
#include <dynamicbox_service.h>
#include <dynamicbox_errno.h>
+#include <dynamicbox_buffer.h>
#if defined(LOG_TAG)
#undef LOG_TAG
#define DBOX_CLASS_NAME "dynamicbox"
-#define DBOX_PRIMARY_BUFFER -1
#define DBOX_KEEP_BUFFER -2
+#define DEFAULT_CLUSTER "user,created"
+#define DEFAULT_CATEGORY "default"
+
int errno;
/*!
struct widget_data *data;
int idx;
unsigned int resource_id;
+ int status;
dynamicbox = dynamicbox_data(handle);
if (!dynamicbox) {
case DBOX_EVENT_DBOX_EXTRA_BUFFER_CREATED:
dynamicbox_get_affected_extra_buffer(handle, 0, &idx, &resource_id);
DbgPrint("Extra buffer created for DBOX: %d (%u)\n", idx, resource_id);
+
+ status = dynamicbox_acquire_extra_resource_id(handle, 0, idx, acquire_dbox_extra_resource_cb, data);
+ if (status < 0) {
+ ErrPrint("Failed to acquire resource: %u (0x%X)\n", resource_id, status);
+ break;
+ }
+
if (!data->dbox_extra) {
data->dbox_extra = calloc(dynamicbox_option(DBOX_OPTION_EXTRA_BUFFER_CNT), sizeof(*data->dbox_extra));
if (!data->dbox_extra) {
data->dbox_extra[idx] = resource_id;
data->dbox_extra_cnt++;
-
- if (dynamicbox_acquire_extra_resource_id(handle, 0, idx, acquire_dbox_extra_resource_cb, data) < 0) {
- ErrPrint("Failed to acquire resource: %u\n", resource_id);
- }
break;
case DBOX_EVENT_DBOX_EXTRA_BUFFER_DESTROYED:
dynamicbox_get_affected_extra_buffer(handle, 0, &idx, &resource_id);
DbgPrint("Extra buffer destroyed for DBOX: %d (%u)\n", idx, resource_id);
if (data->dbox_extra[idx] != resource_id) {
DbgPrint("Resource Id mismatched\n");
+ if (data->dbox_extra[idx] == 0u) {
+ DbgPrint("Not acquired resourced\n");
+ break;
+ }
}
+
data->dbox_extra[idx] = 0u;
data->dbox_extra_cnt--;
if (!data->dbox_extra_cnt) {
ErrPrint("calloc: %s\n", strerror(errno));
}
}
+
data->gbar_extra[idx] = resource_id;
data->gbar_extra_cnt++;
break;
case DBOX_EVENT_DBOX_EXTRA_UPDATED:
dynamicbox_get_affected_extra_buffer(handle, 0, &idx, &resource_id);
- DbgPrint("Extra buffer updated for DBOX: %d (%u)\n", idx, resource_id);
if (!data->dbox_extra) {
ErrPrint("Extra buffer is not prepared yet\n");
} else {
break;
case DBOX_EVENT_GBAR_EXTRA_UPDATED:
dynamicbox_get_affected_extra_buffer(handle, 1, &idx, &resource_id);
- DbgPrint("Extra buffer updated for GBAR: %d (%u)\n", idx, resource_id);
if (!data->gbar_extra) {
ErrPrint("Extra buffer is not prepared yet\n");
} else {
}
if (!cluster) {
- cluster = "user,created";
+ cluster = DEFAULT_CLUSTER;
}
if (!category) {
- category = "default";
+ category = DEFAULT_CATEGORY;
}
_cluster = strdup(cluster);
const char *function;
if (packet_get(packet, "sss", &pkgname, &id, &function) != 3) {
- ErrPrint("Invalid arguments\n");
- return NULL;
+ ErrPrint("Invalid arguments\n");
+ return NULL;
}
DbgPrint("[%s]\n", pkgname);
ret = packet_get(packet, "ssi", &pkgname, &id, &seize);
if (ret != 3) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("Instance(%s) is not exists\n", id);
- goto out;
+ ErrPrint("Instance(%s) is not exists\n", id);
+ goto out;
}
DbgPrint("HOLD: [%s] seize(%d)\n", id, seize);
seize = seize ? DBOX_EVENT_HOLD_SCROLL : DBOX_EVENT_RELEASE_SCROLL;
dlist_foreach(common->dynamicbox_list, l, dynamicbox) {
- dbox_invoke_event_handler(dynamicbox, seize);
+ dbox_invoke_event_handler(dynamicbox, seize);
}
out:
ret = packet_get(packet, "iisss", &status, &pinup, &pkgname, &id, &content);
if (ret != 5) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("Instance (%s) is not exists\n", id);
- goto out;
+ ErrPrint("Instance (%s) is not exists\n", id);
+ goto out;
}
if (status == (int)DBOX_STATUS_ERROR_NONE) {
- new_content = strdup(content);
- if (new_content) {
- free(common->content);
- common->content = new_content;
- common->is_pinned_up = pinup;
- } else {
- ErrPrint("Heap: %s\n", strerror(errno));
- status = DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- }
+ new_content = strdup(content);
+ if (new_content) {
+ free(common->content);
+ common->content = new_content;
+ common->is_pinned_up = pinup;
+ } else {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ status = DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
}
common->request.pinup = 0;
dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
- if (handler->cbs.pinup.cb) {
- dynamicbox_ret_cb cb;
- void *cbdata;
+ if (handler->cbs.pinup.cb) {
+ dynamicbox_ret_cb cb;
+ void *cbdata;
- /* Make sure that user can call pinup API in its result callback */
- cb = handler->cbs.pinup.cb;
- cbdata = handler->cbs.pinup.data;
+ /* Make sure that user can call pinup API in its result callback */
+ cb = handler->cbs.pinup.cb;
+ cbdata = handler->cbs.pinup.data;
- handler->cbs.pinup.cb = NULL;
- handler->cbs.pinup.data = NULL;
+ handler->cbs.pinup.cb = NULL;
+ handler->cbs.pinup.data = NULL;
- cb(handler, status, cbdata);
- } else if (status == (int)DBOX_STATUS_ERROR_NONE) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_PINUP_CHANGED);
- }
+ cb(handler, status, cbdata);
+ } else if (status == (int)DBOX_STATUS_ERROR_NONE) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_PINUP_CHANGED);
+ }
}
out:
int reason;
if (packet_get(packet, "ssdi", &pkgname, &id, ×tamp, &reason) != 4) {
- ErrPrint("Invalid arguemnt\n");
- goto out;
+ ErrPrint("Invalid arguemnt\n");
+ goto out;
}
DbgPrint("[%s]\n", pkgname);
common = dbox_find_common_handle_by_timestamp(timestamp);
if (!common) {
- /*!
- * \note
- * This can be happens only if the user delete a dynamicbox
- * right after create it before receive created event.
- */
- goto out;
+ /*!
+ * \note
+ * This can be happens only if the user delete a dynamicbox
+ * right after create it before receive created event.
+ */
+ goto out;
}
/*!< Check validity of this "handler" */
if (common->state != DBOX_STATE_CREATE) {
- if (common->state != DBOX_STATE_DELETE) {
- /*!
- * \note
- * This is not possible
- */
- ErrPrint("Already deleted handler (%s - %s)\n", pkgname, id);
- return NULL;
- }
+ if (common->state != DBOX_STATE_DELETE) {
+ /*!
+ * \note
+ * This is not possible
+ */
+ ErrPrint("Already deleted handler (%s - %s)\n", pkgname, id);
+ return NULL;
+ }
}
common->request.deleted = 0;
common->state = DBOX_STATE_DELETE;
dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
- if (handler->cbs.created.cb) {
- dynamicbox_ret_cb cb;
- void *cbdata;
- /*!
- * \note
- *
- * "if (handler->id == NULL) {"
- *
- * The instance is not created yet.
- * But the master forcely destroy it and send destroyed event to this
- * without the created event.
- *
- * It could be destroyed when a slave has critical error(fault)
- * before creating an instance successfully.
- */
- if (handler->cbs.created.cb == handler->cbs.deleted.cb) {
- if (handler->cbs.created.data != handler->cbs.deleted.data) {
- DbgPrint("cb is same but cbdata is different (%s - %s)\n", pkgname, id);
- }
-
- handler->cbs.deleted.cb = NULL;
- handler->cbs.deleted.data = NULL;
- }
-
- cb = handler->cbs.created.cb;
- cbdata = handler->cbs.created.data;
-
- handler->cbs.created.cb = NULL;
- handler->cbs.created.data = NULL;
-
- if (reason == (int)DBOX_STATUS_ERROR_NONE) {
- reason = DBOX_STATUS_ERROR_CANCEL;
- }
-
- cb(handler, reason, cbdata);
- } else if (common->id) {
- if (handler->cbs.deleted.cb) {
- dynamicbox_ret_cb cb;
- void *cbdata;
-
- cb = handler->cbs.deleted.cb;
- cbdata = handler->cbs.deleted.data;
-
- handler->cbs.deleted.cb = NULL;
- handler->cbs.deleted.data = NULL;
-
- cb(handler, reason, cbdata);
- } else {
- dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
- }
- }
-
- /* Just try to delete it, if a user didn't remove it from the live box list */
- dbox_unref(handler, 1);
+ if (handler->cbs.created.cb) {
+ dynamicbox_ret_cb cb;
+ void *cbdata;
+ /*!
+ * \note
+ *
+ * "if (handler->id == NULL) {"
+ *
+ * The instance is not created yet.
+ * But the master forcely destroy it and send destroyed event to this
+ * without the created event.
+ *
+ * It could be destroyed when a slave has critical error(fault)
+ * before creating an instance successfully.
+ */
+ if (handler->cbs.created.cb == handler->cbs.deleted.cb) {
+ if (handler->cbs.created.data != handler->cbs.deleted.data) {
+ DbgPrint("cb is same but cbdata is different (%s - %s)\n", pkgname, id);
+ }
+
+ handler->cbs.deleted.cb = NULL;
+ handler->cbs.deleted.data = NULL;
+ }
+
+ cb = handler->cbs.created.cb;
+ cbdata = handler->cbs.created.data;
+
+ handler->cbs.created.cb = NULL;
+ handler->cbs.created.data = NULL;
+
+ if (reason == (int)DBOX_STATUS_ERROR_NONE) {
+ reason = DBOX_STATUS_ERROR_CANCEL;
+ }
+
+ cb(handler, reason, cbdata);
+ } else if (common->id) {
+ if (handler->cbs.deleted.cb) {
+ dynamicbox_ret_cb cb;
+ void *cbdata;
+
+ cb = handler->cbs.deleted.cb;
+ cbdata = handler->cbs.deleted.data;
+
+ handler->cbs.deleted.cb = NULL;
+ handler->cbs.deleted.data = NULL;
+
+ cb(handler, reason, cbdata);
+ } else {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ }
+ }
+
+ /* Just try to delete it, if a user didn't remove it from the live box list */
+ dbox_unref(handler, 1);
}
out:
ret = packet_get(packet, "ssdsss", &pkgname, &id, &priority, &content, &title, &fbfile);
if (ret != 6) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("Instance[%s] is not exists\n", id);
- goto out;
+ ErrPrint("Instance[%s] is not exists\n", id);
+ goto out;
}
if (common->state != DBOX_STATE_CREATE) {
- ErrPrint("(%s) is not created\n", id);
- goto out;
+ ErrPrint("(%s) is not created\n", id);
+ goto out;
}
dbox_set_priority(common, priority);
* And then begin updating again after change its size.
*/
if (dbox_get_dbox_fb(common)) {
- (void)dbox_set_dbox_fb(common, fbfile);
-
- ret = dbox_sync_dbox_fb(common);
-
- if (ret != (int)DBOX_STATUS_ERROR_NONE) {
- ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, fbfile, ret);
+ (void)dbox_set_dbox_fb(common, fbfile);
+
+ ret = dbox_sync_dbox_fb(common);
+
+ if (ret != (int)DBOX_STATUS_ERROR_NONE) {
+ ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, fbfile, ret);
+ } else {
+ struct dlist *l;
+ dlist_foreach(common->dynamicbox_list, l, handler) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DBOX_UPDATE_BEGIN);
+ }
+ }
} else {
- struct dlist *l;
- dlist_foreach(common->dynamicbox_list, l, handler) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_DBOX_UPDATE_BEGIN);
- }
- }
- } else {
- ErrPrint("Invalid request[%s], %s\n", id, fbfile);
+ ErrPrint("Invalid request[%s], %s\n", id, fbfile);
}
out:
ret = packet_get(packet, "sss", &pkgname, &id, &fbfile);
if (ret != 2) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("Instance[%s] is not exists\n", id);
- goto out;
+ ErrPrint("Instance[%s] is not exists\n", id);
+ goto out;
}
if (common->state != DBOX_STATE_CREATE) {
- ErrPrint("[%s] is not created\n", id);
- goto out;
+ ErrPrint("[%s] is not created\n", id);
+ goto out;
}
if (dbox_get_gbar_fb(common)) {
- (void)dbox_set_gbar_fb(common, fbfile);
-
- ret = dbox_sync_gbar_fb(common);
- if (ret != (int)DBOX_STATUS_ERROR_NONE) {
- ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, fbfile, ret);
- } else {
- struct dlist *l;
- dlist_foreach(common->dynamicbox_list, l, handler) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_UPDATE_BEGIN);
- }
- }
+ (void)dbox_set_gbar_fb(common, fbfile);
+
+ ret = dbox_sync_gbar_fb(common);
+ if (ret != (int)DBOX_STATUS_ERROR_NONE) {
+ ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, fbfile, ret);
+ } else {
+ struct dlist *l;
+ dlist_foreach(common->dynamicbox_list, l, handler) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_UPDATE_BEGIN);
+ }
+ }
} else {
- ErrPrint("Invalid request[%s], %s\n", id, fbfile);
+ ErrPrint("Invalid request[%s], %s\n", id, fbfile);
}
out:
ret = packet_get(packet, "ss", &pkgname, &id);
if (ret != 2) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("Instance[%s] is not exists\n", id);
- goto out;
+ ErrPrint("Instance[%s] is not exists\n", id);
+ goto out;
}
if (common->state != DBOX_STATE_CREATE) {
- ErrPrint("[%s] is not created\n", id);
- goto out;
+ ErrPrint("[%s] is not created\n", id);
+ goto out;
}
if (dbox_get_dbox_fb(common)) {
- struct dlist *l;
- dlist_foreach(common->dynamicbox_list, l, handler) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_DBOX_UPDATE_END);
- }
+ struct dlist *l;
+ dlist_foreach(common->dynamicbox_list, l, handler) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DBOX_UPDATE_END);
+ }
} else {
- ErrPrint("Invalid request[%s]\n", id);
+ ErrPrint("Invalid request[%s]\n", id);
}
out:
ret = packet_get(packet, "ssi", &pkgname, &id, &status);
if (ret != 3) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("Instance[%s] is not exists\n", id);
- goto out;
+ ErrPrint("Instance[%s] is not exists\n", id);
+ goto out;
}
if (common->state != DBOX_STATE_CREATE) {
- ErrPrint("[%s] is not created\n", id);
- goto out;
+ ErrPrint("[%s] is not created\n", id);
+ goto out;
}
common->request.key_event = 0;
dlist_foreach(common->dynamicbox_list, l, handler) {
- if (handler->cbs.key_event.cb) {
- dynamicbox_ret_cb cb;
- void *cbdata;
+ if (handler->cbs.key_event.cb) {
+ dynamicbox_ret_cb cb;
+ void *cbdata;
- cb = handler->cbs.key_event.cb;
- cbdata = handler->cbs.key_event.data;
+ cb = handler->cbs.key_event.cb;
+ cbdata = handler->cbs.key_event.data;
- handler->cbs.key_event.cb = NULL;
- handler->cbs.key_event.data = NULL;
+ handler->cbs.key_event.cb = NULL;
+ handler->cbs.key_event.data = NULL;
- cb(handler, status, cbdata);
- } else {
- ErrPrint("Invalid event[%s]\n", id);
- }
+ cb(handler, status, cbdata);
+ } else {
+ ErrPrint("Invalid event[%s]\n", id);
+ }
}
out:
ret = packet_get(packet, "ssi", &pkgname, &id, &reason);
if (ret != 3) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("Instance[%s] is not exists\n", id);
- goto out;
+ ErrPrint("Instance[%s] is not exists\n", id);
+ goto out;
}
if (common->state != DBOX_STATE_CREATE) {
- ErrPrint("[%s] is not created\n", id);
- goto out;
+ ErrPrint("[%s] is not created\n", id);
+ goto out;
}
if (!common->is_gbar_created) {
- DbgPrint("GBAR is not created, closing what?(%s)\n", id);
- goto out;
+ DbgPrint("GBAR is not created, closing what?(%s)\n", id);
+ goto out;
}
DbgPrint("Reason: %d\n", reason);
dlist_foreach(common->dynamicbox_list, l, handler) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_REQUEST_CLOSE_GBAR);
+ dbox_invoke_event_handler(handler, DBOX_EVENT_REQUEST_CLOSE_GBAR);
}
out:
return NULL;
ret = packet_get(packet, "ssi", &pkgname, &id, &status);
if (ret != 3) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("Instance[%s] is not exists\n", id);
- goto out;
+ ErrPrint("Instance[%s] is not exists\n", id);
+ goto out;
}
if (common->state != DBOX_STATE_CREATE) {
- ErrPrint("[%s] is not created\n", id);
- goto out;
+ ErrPrint("[%s] is not created\n", id);
+ goto out;
}
common->request.access_event = 0;
dlist_foreach(common->dynamicbox_list, l, handler) {
- if (handler->cbs.access_event.cb) {
- dynamicbox_ret_cb cb;
- void *cbdata;
+ if (handler->cbs.access_event.cb) {
+ dynamicbox_ret_cb cb;
+ void *cbdata;
- cb = handler->cbs.access_event.cb;
- cbdata = handler->cbs.access_event.data;
+ cb = handler->cbs.access_event.cb;
+ cbdata = handler->cbs.access_event.data;
- handler->cbs.access_event.cb = NULL;
- handler->cbs.access_event.data = NULL;
+ handler->cbs.access_event.cb = NULL;
+ handler->cbs.access_event.data = NULL;
- cb(handler, status, cbdata);
- }
+ cb(handler, status, cbdata);
+ }
}
out:
return NULL;
ret = packet_get(packet, "ss", &pkgname, &id);
if (ret != 2) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("Instance[%s] is not exists\n", id);
- goto out;
+ ErrPrint("Instance[%s] is not exists\n", id);
+ goto out;
}
if (common->state != DBOX_STATE_CREATE) {
- ErrPrint("[%s] is not created\n", id);
- goto out;
+ ErrPrint("[%s] is not created\n", id);
+ goto out;
}
if (dbox_get_dbox_fb(common)) {
- struct dlist *l;
+ struct dlist *l;
- dlist_foreach(common->dynamicbox_list, l, handler) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_UPDATE_END);
- }
+ dlist_foreach(common->dynamicbox_list, l, handler) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_UPDATE_END);
+ }
} else {
- ErrPrint("Invalid request[%s]", id);
+ ErrPrint("Invalid request[%s]", id);
}
out:
struct dlist *n;
ret = packet_get(packet, "ssssssd", &pkgname, &id,
- &content, &title,
- &icon, &name,
- &priority);
+ &content, &title,
+ &icon, &name,
+ &priority);
if (ret != 7) {
- ErrPrint("Invalid parameters\n");
- goto out;
+ ErrPrint("Invalid parameters\n");
+ goto out;
}
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("instance(%s) is not exists\n", id);
- goto out;
+ ErrPrint("instance(%s) is not exists\n", id);
+ goto out;
}
if (common->state != DBOX_STATE_CREATE) {
- /*!
- * \note
- * Already deleted by the user.
- * Don't try to notice anything with this, Just ignore all events
- * Beacuse the user doesn't wants know about this anymore
- */
- ErrPrint("(%s) is not exists, but updated\n", id);
- goto out;
+ /*!
+ * \note
+ * Already deleted by the user.
+ * Don't try to notice anything with this, Just ignore all events
+ * Beacuse the user doesn't wants know about this anymore
+ */
+ ErrPrint("(%s) is not exists, but updated\n", id);
+ goto out;
}
dbox_set_priority(common, priority);
dbox_set_alt_name(common, name);
dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_EXTRA_INFO_UPDATED);
+ dbox_invoke_event_handler(handler, DBOX_EVENT_EXTRA_INFO_UPDATED);
}
out:
return NULL;
ret = packet_get(packet, "ssiiiiii", &pkgname, &id, &is_gbar, &idx, &x, &y, &w, &h);
if (ret != 8) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("instance(%s) is not exists\n", id);
- goto out;
+ ErrPrint("instance(%s) is not exists\n", id);
+ goto out;
}
if (common->state != DBOX_STATE_CREATE) {
- /*!
- * \note
- * Already deleted by the user.
- * Don't try to notice anything with this, Just ignore all events
- * Beacuse the user doesn't wants know about this anymore
- */
- ErrPrint("(%s) is not exists, but updated\n", id);
- goto out;
- }
-
- if (common->request.created) {
- DbgPrint("Creation is not done yet. waiting create event(%s)\n", id);
- goto out;
+ /*!
+ * \note
+ * Already deleted by the user.
+ * Don't try to notice anything with this, Just ignore all events
+ * Beacuse the user doesn't wants know about this anymore
+ */
+ ErrPrint("(%s) is not exists, but updated\n", id);
+ goto out;
}
if (is_gbar) {
- common->gbar.last_damage.x = x;
- common->gbar.last_damage.y = y;
- common->gbar.last_damage.w = w;
- common->gbar.last_damage.h = h;
- event_type = DBOX_EVENT_GBAR_EXTRA_UPDATED;
- common->gbar.last_extra_buffer_idx = idx;
- } else {
- common->dbox.last_damage.x = x;
- common->dbox.last_damage.y = y;
- common->dbox.last_damage.w = w;
- common->dbox.last_damage.h = h;
- event_type = DBOX_EVENT_DBOX_EXTRA_UPDATED;
- common->dbox.last_extra_buffer_idx = idx;
+ common->gbar.last_damage.x = x;
+ common->gbar.last_damage.y = y;
+ common->gbar.last_damage.w = w;
+ common->gbar.last_damage.h = h;
+ common->gbar.last_extra_buffer_idx = idx;
- if (conf_frame_drop_for_resizing() && common->request.size_changed) {
- /* Just for skipping the update event callback call, After request to resize buffer, update event will be discarded */
- DbgPrint("Discards obsoloted update event\n");
- ret = DBOX_STATUS_ERROR_BUSY;
+ event_type = DBOX_EVENT_GBAR_EXTRA_UPDATED;
} else {
- if (!conf_manual_sync()) {
- ret = dbox_sync_dbox_fb(common);
- if (ret != (int)DBOX_STATUS_ERROR_NONE) {
- ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, util_basename(util_uri_to_path(id)), ret);
- }
- } else {
- ret = DBOX_STATUS_ERROR_NONE;
- }
- }
- }
-
- if (ret == (int)DBOX_STATUS_ERROR_NONE) {
- struct dlist *l;
- struct dlist *n;
-
- dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
- dbox_invoke_event_handler(handler, event_type);
- }
+ common->dbox.last_damage.x = x;
+ common->dbox.last_damage.y = y;
+ common->dbox.last_damage.w = w;
+ common->dbox.last_damage.h = h;
+ common->dbox.last_extra_buffer_idx = idx;
+
+ event_type = DBOX_EVENT_DBOX_EXTRA_UPDATED;
+
+ if (conf_frame_drop_for_resizing() && common->request.size_changed) {
+ /* Just for skipping the update event callback call, After request to resize buffer, update event will be discarded */
+ DbgPrint("Discards obsoloted update event\n");
+ ret = DBOX_STATUS_ERROR_BUSY;
+ } else {
+ if (!conf_manual_sync()) {
+ ret = dbox_sync_dbox_fb(common);
+ if (ret != (int)DBOX_STATUS_ERROR_NONE) {
+ ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, util_basename(util_uri_to_path(id)), ret);
+ }
+ } else {
+ ret = DBOX_STATUS_ERROR_NONE;
+ }
+ }
+ }
+
+ if (!common->request.created && ret == (int)DBOX_STATUS_ERROR_NONE) {
+ struct dlist *l;
+ struct dlist *n;
+
+ dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
+ dbox_invoke_event_handler(handler, event_type);
+ }
}
out:
ret = packet_get(packet, "ssssiiii", &pkgname, &id, &fbfile, &safe_file, &x, &y, &w, &h);
if (ret != 8) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("instance(%s) is not exists\n", id);
- goto out;
+ ErrPrint("instance(%s) is not exists\n", id);
+ goto out;
}
if (common->state != DBOX_STATE_CREATE) {
- /*!
- * \note
- * Already deleted by the user.
- * Don't try to notice anything with this, Just ignore all events
- * Beacuse the user doesn't wants know about this anymore
- */
- ErrPrint("(%s) is not exists, but updated\n", id);
- goto out;
- }
-
- if (common->request.created) {
- DbgPrint("Creation is not done yet. waiting create event(%s)\n", id);
- goto out;
+ /*!
+ * \note
+ * Already deleted by the user.
+ * Don't try to notice anything with this, Just ignore all events
+ * Beacuse the user doesn't wants know about this anymore
+ */
+ ErrPrint("(%s) is not exists, but updated\n", id);
+ goto out;
}
common->dbox.last_damage.x = x;
common->dbox.last_damage.y = y;
common->dbox.last_damage.w = w;
common->dbox.last_damage.h = h;
+ common->dbox.last_extra_buffer_idx = DBOX_PRIMARY_BUFFER;
dbox_set_filename(common, safe_file);
+ if (common->request.created) {
+ DbgPrint("Creation is not done yet. waiting create event(%s)\n", id);
+ goto out;
+ }
+
if (dbox_text_dbox(common)) {
- const char *common_filename;
+ const char *common_filename;
- common_filename = common->filename ? common->filename : util_uri_to_path(common->id);
+ common_filename = common->filename ? common->filename : util_uri_to_path(common->id);
- (void)parse_desc(common, common_filename, 0);
- /*!
- * \note
- * DESC parser will call the "text event callback".
- * Don't need to call global event callback in this case.
- */
- goto out;
+ (void)parse_desc(common, common_filename, 0);
+ /*!
+ * \note
+ * DESC parser will call the "text event callback".
+ * Don't need to call global event callback in this case.
+ */
+ goto out;
} else if (dbox_get_dbox_fb(common)) {
- /*!
- * \todo
- * replace this with "flag" instead of "callback address"
- */
- if (conf_frame_drop_for_resizing() && common->request.size_changed) {
- /* Just for skipping the update event callback call, After request to resize buffer, update event will be discarded */
- DbgPrint("Discards obsoloted update event\n");
- ret = DBOX_STATUS_ERROR_BUSY;
- } else {
- (void)dbox_set_dbox_fb(common, fbfile);
-
- if (!conf_manual_sync()) {
- ret = dbox_sync_dbox_fb(common);
- if (ret != (int)DBOX_STATUS_ERROR_NONE) {
- ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, util_basename(util_uri_to_path(id)), ret);
- }
- } else {
- ret = DBOX_STATUS_ERROR_NONE;
- }
- }
+ /*!
+ * \todo
+ * replace this with "flag" instead of "callback address"
+ */
+ if (conf_frame_drop_for_resizing() && common->request.size_changed) {
+ /* Just for skipping the update event callback call, After request to resize buffer, update event will be discarded */
+ DbgPrint("Discards obsoloted update event\n");
+ ret = DBOX_STATUS_ERROR_BUSY;
+ } else {
+ (void)dbox_set_dbox_fb(common, fbfile);
+
+ if (!conf_manual_sync()) {
+ ret = dbox_sync_dbox_fb(common);
+ if (ret != (int)DBOX_STATUS_ERROR_NONE) {
+ ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, util_basename(util_uri_to_path(id)), ret);
+ }
+ } else {
+ ret = DBOX_STATUS_ERROR_NONE;
+ }
+ }
} else {
- ret = DBOX_STATUS_ERROR_NONE;
+ ret = DBOX_STATUS_ERROR_NONE;
}
if (ret == (int)DBOX_STATUS_ERROR_NONE) {
- struct dlist *l;
- struct dlist *n;
+ struct dlist *l;
+ struct dlist *n;
- dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_DBOX_UPDATED);
- }
+ dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DBOX_UPDATED);
+ }
}
out:
ret = packet_get(packet, "sssiii", &pkgname, &id, &buf_id, &width, &height, &status);
if (ret != 6) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
DbgPrint("[%s]\n", pkgname);
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("Instance(%s) is not exists\n", id);
- goto out;
+ ErrPrint("Instance(%s) is not exists\n", id);
+ goto out;
}
if (common->state != DBOX_STATE_CREATE) {
- ErrPrint("Instance(%s) is not created\n", id);
- goto out;
+ ErrPrint("Instance(%s) is not created\n", id);
+ goto out;
}
if (!common->request.gbar_created) {
- ErrPrint("GBAR create request is canceled\n");
- goto out;
+ ErrPrint("GBAR create request is canceled\n");
+ goto out;
}
common->is_gbar_created = (status == (int)DBOX_STATUS_ERROR_NONE);
common->request.gbar_created = 0;
if (common->is_gbar_created) {
- dbox_set_gbarsize(common, width, height);
- if (dbox_text_gbar(common)) {
- DbgPrint("Text TYPE does not need to handle this\n");
- } else {
- (void)dbox_set_gbar_fb(common, buf_id);
-
- switch (common->gbar.type) {
- case GBAR_TYPE_SCRIPT:
- case GBAR_TYPE_BUFFER:
- switch (fb_type(dbox_get_gbar_fb(common))) {
- case DBOX_FB_TYPE_FILE:
- case DBOX_FB_TYPE_SHM:
- common->gbar.lock = dynamicbox_service_create_lock(common->id, DBOX_TYPE_GBAR, DBOX_LOCK_READ);
- break;
- case DBOX_FB_TYPE_PIXMAP:
- case DBOX_FB_TYPE_ERROR:
- default:
- break;
- }
- break;
- case GBAR_TYPE_UIFW:
- case GBAR_TYPE_TEXT:
- default:
- break;
- }
-
- ret = dbox_sync_gbar_fb(common);
- if (ret < 0) {
- ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
- }
- }
+ dbox_set_gbarsize(common, width, height);
+ if (dbox_text_gbar(common)) {
+ DbgPrint("Text TYPE does not need to handle this\n");
+ } else {
+ (void)dbox_set_gbar_fb(common, buf_id);
+
+ switch (common->gbar.type) {
+ case GBAR_TYPE_SCRIPT:
+ case GBAR_TYPE_BUFFER:
+ switch (fb_type(dbox_get_gbar_fb(common))) {
+ case DBOX_FB_TYPE_FILE:
+ case DBOX_FB_TYPE_SHM:
+ common->gbar.lock = dynamicbox_service_create_lock(common->id, DBOX_TYPE_GBAR, DBOX_LOCK_READ);
+ break;
+ case DBOX_FB_TYPE_PIXMAP:
+ case DBOX_FB_TYPE_ERROR:
+ default:
+ break;
+ }
+ break;
+ case GBAR_TYPE_UIFW:
+ case GBAR_TYPE_TEXT:
+ default:
+ break;
+ }
+
+ ret = dbox_sync_gbar_fb(common);
+ if (ret < 0) {
+ ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
+ }
+ }
}
DbgPrint("PERF_DBOX\n");
dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
- if (handler->cbs.gbar_created.cb) {
- dynamicbox_ret_cb cb;
- void *cbdata;
+ if (handler->cbs.gbar_created.cb) {
+ dynamicbox_ret_cb cb;
+ void *cbdata;
- cb = handler->cbs.gbar_created.cb;
- cbdata = handler->cbs.gbar_created.data;
+ cb = handler->cbs.gbar_created.cb;
+ cbdata = handler->cbs.gbar_created.data;
- handler->cbs.gbar_created.cb = NULL;
- handler->cbs.gbar_created.data = NULL;
+ handler->cbs.gbar_created.cb = NULL;
+ handler->cbs.gbar_created.data = NULL;
- /*!
- * Before call the Callback function,
- * gbar_create_cb must be reset.
- * Because, in the create callback, user can call create_gbar function again.
- */
- cb(handler, status, cbdata);
- } else if (status == (int)DBOX_STATUS_ERROR_NONE) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_CREATED);
- }
+ /*!
+ * Before call the Callback function,
+ * gbar_create_cb must be reset.
+ * Because, in the create callback, user can call create_gbar function again.
+ */
+ cb(handler, status, cbdata);
+ } else if (status == (int)DBOX_STATUS_ERROR_NONE) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_CREATED);
+ }
}
out:
ret = packet_get(packet, "ssi", &pkgname, &id, &status);
if (ret != 3) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
DbgPrint("[%s]\n", pkgname);
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("Instance(%s) is not exists\n", id);
- goto out;
+ ErrPrint("Instance(%s) is not exists\n", id);
+ goto out;
}
if (common->state != DBOX_STATE_CREATE) {
- ErrPrint("Instance(%s) is not created\n", id);
- goto out;
+ ErrPrint("Instance(%s) is not created\n", id);
+ goto out;
}
if (common->is_gbar_created == 0) {
- ErrPrint("GBAR is not created, event is ignored\n");
- goto out;
+ ErrPrint("GBAR is not created, event is ignored\n");
+ goto out;
}
common->is_gbar_created = 0;
common->request.gbar_destroyed = 0;
dlist_foreach(common->dynamicbox_list, l, handler) {
- if (handler->cbs.gbar_destroyed.cb) {
- dynamicbox_ret_cb cb;
- void *cbdata;
+ if (handler->cbs.gbar_destroyed.cb) {
+ dynamicbox_ret_cb cb;
+ void *cbdata;
- cb = handler->cbs.gbar_destroyed.cb;
- cbdata = handler->cbs.gbar_destroyed.data;
+ cb = handler->cbs.gbar_destroyed.cb;
+ cbdata = handler->cbs.gbar_destroyed.data;
- handler->cbs.gbar_destroyed.cb = NULL;
- handler->cbs.gbar_destroyed.data = NULL;
+ handler->cbs.gbar_destroyed.cb = NULL;
+ handler->cbs.gbar_destroyed.data = NULL;
- /*!
- * Before call the Callback function,
- * gbar_destroyed_cb must be reset.
- * Because, in the create callback, user can call destroy_gbar function again.
- */
- cb(handler, status, cbdata);
- } else if (status == (int)DBOX_STATUS_ERROR_NONE) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_DESTROYED);
- }
+ /*!
+ * Before call the Callback function,
+ * gbar_destroyed_cb must be reset.
+ * Because, in the create callback, user can call destroy_gbar function again.
+ */
+ cb(handler, status, cbdata);
+ } else if (status == (int)DBOX_STATUS_ERROR_NONE) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_DESTROYED);
+ }
}
/*!
* Lock file should be deleted after all callbacks are processed.
*/
switch (common->gbar.type) {
- case GBAR_TYPE_SCRIPT:
- case GBAR_TYPE_BUFFER:
- switch (fb_type(dbox_get_gbar_fb(common))) {
- case DBOX_FB_TYPE_FILE:
- case DBOX_FB_TYPE_SHM:
- dynamicbox_service_destroy_lock(common->gbar.lock);
- common->gbar.lock = NULL;
- break;
- case DBOX_FB_TYPE_PIXMAP:
- case DBOX_FB_TYPE_ERROR:
- default:
- break;
- }
- break;
- case GBAR_TYPE_UIFW:
- case GBAR_TYPE_TEXT:
- default:
- break;
+ case GBAR_TYPE_SCRIPT:
+ case GBAR_TYPE_BUFFER:
+ switch (fb_type(dbox_get_gbar_fb(common))) {
+ case DBOX_FB_TYPE_FILE:
+ case DBOX_FB_TYPE_SHM:
+ dynamicbox_service_destroy_lock(common->gbar.lock);
+ common->gbar.lock = NULL;
+ break;
+ case DBOX_FB_TYPE_PIXMAP:
+ case DBOX_FB_TYPE_ERROR:
+ default:
+ break;
+ }
+ break;
+ case GBAR_TYPE_UIFW:
+ case GBAR_TYPE_TEXT:
+ default:
+ break;
}
out:
ret = packet_get(packet, "ssssiiii", &pkgname, &id, &fbfile, &descfile, &x, &y, &w, &h);
if (ret != 8) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("Instance(%s) is not exists\n", id);
- goto out;
+ ErrPrint("Instance(%s) is not exists\n", id);
+ goto out;
}
common->gbar.last_damage.x = x;
common->gbar.last_damage.h = h;
if (common->state != DBOX_STATE_CREATE) {
- /*!
- * \note
- * This handler is already deleted by the user.
- * So don't try to notice anything about this anymore.
- * Just ignore all events.
- */
- ErrPrint("Instance(%s) is not created\n", id);
- goto out;
+ /*!
+ * \note
+ * This handler is already deleted by the user.
+ * So don't try to notice anything about this anymore.
+ * Just ignore all events.
+ */
+ ErrPrint("Instance(%s) is not created\n", id);
+ goto out;
}
if (dbox_text_gbar(common)) {
- (void)parse_desc(common, descfile, 1);
- } else {
- if (conf_frame_drop_for_resizing() && common->request.size_changed) {
- /* Just for skipping the update event callback call, After request to resize buffer, update event will be discarded */
- DbgPrint("Discards obsoloted update event\n");
+ (void)parse_desc(common, descfile, 1);
} else {
- (void)dbox_set_gbar_fb(common, fbfile);
-
- if (!conf_manual_sync()) {
- ret = dbox_sync_gbar_fb(common);
- if (ret < 0) {
- ErrPrint("Failed to do sync FB (%s - %s), %d\n", pkgname, util_basename(util_uri_to_path(id)), ret);
- } else {
- dlist_foreach(common->dynamicbox_list, l, handler) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_UPDATED);
- }
- }
- } else {
- dlist_foreach(common->dynamicbox_list, l, handler) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_UPDATED);
- }
- }
- }
+ if (conf_frame_drop_for_resizing() && common->request.size_changed) {
+ /* Just for skipping the update event callback call, After request to resize buffer, update event will be discarded */
+ DbgPrint("Discards obsoloted update event\n");
+ } else {
+ (void)dbox_set_gbar_fb(common, fbfile);
+
+ if (!conf_manual_sync()) {
+ ret = dbox_sync_gbar_fb(common);
+ if (ret < 0) {
+ ErrPrint("Failed to do sync FB (%s - %s), %d\n", pkgname, util_basename(util_uri_to_path(id)), ret);
+ } else {
+ dlist_foreach(common->dynamicbox_list, l, handler) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_UPDATED);
+ }
+ }
+ } else {
+ dlist_foreach(common->dynamicbox_list, l, handler) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_UPDATED);
+ }
+ }
+ }
}
out:
int ret;
if (!packet) {
- ErrPrint("Invalid packet\n");
- goto out;
+ ErrPrint("Invalid packet\n");
+ goto out;
}
ret = packet_get(packet, "ssii", &pkgname, &id, &pixmap, &idx);
if (ret != 4) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
if (idx < 0 || idx >= conf_extra_buffer_count()) {
- ErrPrint("Extra buffer count is not matched\n");
- goto out;
+ ErrPrint("Extra buffer count is not matched\n");
+ goto out;
}
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("DBOX(%s) is not found\n", id);
- goto out;
+ ErrPrint("DBOX(%s) is not found\n", id);
+ goto out;
}
if (common->state != DBOX_STATE_CREATE) {
- ErrPrint("DBOX(%s) is not created yet\n", id);
- goto out;
+ ErrPrint("DBOX(%s) is not created yet\n", id);
+ goto out;
}
if (!common->gbar.extra_buffer && conf_extra_buffer_count()) {
- common->gbar.extra_buffer = calloc(conf_extra_buffer_count(), sizeof(*common->gbar.extra_buffer));
- if (!common->gbar.extra_buffer) {
- ErrPrint("DBOX(%s) calloc: %s\n", id, strerror(errno));
- }
+ common->gbar.extra_buffer = calloc(conf_extra_buffer_count(), sizeof(*common->gbar.extra_buffer));
+ if (!common->gbar.extra_buffer) {
+ ErrPrint("DBOX(%s) calloc: %s\n", id, strerror(errno));
+ }
}
common->gbar.last_extra_buffer_idx = idx;
if (common->gbar.extra_buffer[idx] != pixmap) {
- DbgPrint("Extra buffer Pixmap is not matched %u <> %u\n", common->dbox.extra_buffer[idx], pixmap);
+ DbgPrint("Extra buffer Pixmap is not matched %u <> %u\n", common->dbox.extra_buffer[idx], pixmap);
}
dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_EXTRA_BUFFER_DESTROYED);
+ dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_EXTRA_BUFFER_DESTROYED);
}
out:
return NULL;
int ret;
if (!packet) {
- ErrPrint("Invalid packet\n");
- goto out;
+ ErrPrint("Invalid packet\n");
+ goto out;
}
ret = packet_get(packet, "ssii", &pkgname, &id, &pixmap, &idx);
if (ret != 4) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
if (idx < 0 || idx >= conf_extra_buffer_count()) {
- ErrPrint("Extra buffer count is not matched\n");
- goto out;
+ ErrPrint("Extra buffer count is not matched\n");
+ goto out;
}
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("DBOX(%s) is not found\n", id);
- goto out;
+ ErrPrint("DBOX(%s) is not found\n", id);
+ goto out;
}
if (common->state != DBOX_STATE_CREATE) {
- ErrPrint("DBOX(%s) is not created yet\n", id);
- goto out;
+ ErrPrint("DBOX(%s) is not created yet\n", id);
+ goto out;
}
if (!common->dbox.extra_buffer && conf_extra_buffer_count()) {
- common->dbox.extra_buffer = calloc(conf_extra_buffer_count(), sizeof(*common->dbox.extra_buffer));
- if (!common->dbox.extra_buffer) {
- ErrPrint("DBOX(%s) calloc: %s\n", id, strerror(errno));
- }
+ common->dbox.extra_buffer = calloc(conf_extra_buffer_count(), sizeof(*common->dbox.extra_buffer));
+ if (!common->dbox.extra_buffer) {
+ ErrPrint("DBOX(%s) calloc: %s\n", id, strerror(errno));
+ }
}
common->dbox.last_extra_buffer_idx = idx;
if (common->dbox.extra_buffer[idx] != pixmap) {
- DbgPrint("Extra buffer Pixmap is not matched %u <> %u\n", common->dbox.extra_buffer[idx], pixmap);
+ DbgPrint("Extra buffer Pixmap is not matched %u <> %u\n", common->dbox.extra_buffer[idx], pixmap);
}
dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_DBOX_EXTRA_BUFFER_DESTROYED);
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DBOX_EXTRA_BUFFER_DESTROYED);
}
out:
return NULL;
int ret;
if (!packet) {
- ErrPrint("Invalid packet\n");
- goto out;
+ ErrPrint("Invalid packet\n");
+ goto out;
}
ret = packet_get(packet, "ssii", &pkgname, &id, &pixmap, &idx);
if (ret != 4) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
if (idx < 0 || idx >= conf_extra_buffer_count()) {
- ErrPrint("Extra buffer count is not matched\n");
- goto out;
+ ErrPrint("Extra buffer count is not matched\n");
+ goto out;
}
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("DBOX(%s) is not found\n", id);
- goto out;
+ ErrPrint("DBOX(%s) is not found\n", id);
+ goto out;
}
if (common->state != DBOX_STATE_CREATE) {
- ErrPrint("DBOX(%s) is not created yet\n", id);
- goto out;
+ ErrPrint("DBOX(%s) is not created yet\n", id);
+ goto out;
}
if (!common->dbox.extra_buffer && conf_extra_buffer_count()) {
- common->dbox.extra_buffer = calloc(conf_extra_buffer_count(), sizeof(*common->dbox.extra_buffer));
- if (!common->dbox.extra_buffer) {
- ErrPrint("DBOX(%s) calloc: %s\n", id, strerror(errno));
- }
+ common->dbox.extra_buffer = calloc(conf_extra_buffer_count(), sizeof(*common->dbox.extra_buffer));
+ if (!common->dbox.extra_buffer) {
+ ErrPrint("DBOX(%s) calloc: %s\n", id, strerror(errno));
+ }
}
common->dbox.last_extra_buffer_idx = idx;
common->dbox.extra_buffer[idx] = pixmap;
dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_DBOX_EXTRA_BUFFER_CREATED);
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DBOX_EXTRA_BUFFER_CREATED);
}
out:
return NULL;
int ret;
if (!packet) {
- ErrPrint("Invalid packet\n");
- goto out;
+ ErrPrint("Invalid packet\n");
+ goto out;
}
ret = packet_get(packet, "ssii", &pkgname, &id, &pixmap, &idx);
if (ret != 4) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
if (idx < 0 || idx >= conf_extra_buffer_count()) {
- ErrPrint("Extra buffer count is not matched\n");
- goto out;
+ ErrPrint("Extra buffer count is not matched\n");
+ goto out;
}
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("DBOX(%s) is not found\n", id);
- goto out;
+ ErrPrint("DBOX(%s) is not found\n", id);
+ goto out;
}
if (common->state != DBOX_STATE_CREATE) {
- ErrPrint("DBOX(%s) is not created yet\n", id);
- goto out;
+ ErrPrint("DBOX(%s) is not created yet\n", id);
+ goto out;
}
if (!common->gbar.extra_buffer && conf_extra_buffer_count()) {
- common->gbar.extra_buffer = calloc(conf_extra_buffer_count(), sizeof(*common->gbar.extra_buffer));
- if (!common->gbar.extra_buffer) {
- ErrPrint("DBOX(%s) calloc: %s\n", id, strerror(errno));
- }
+ common->gbar.extra_buffer = calloc(conf_extra_buffer_count(), sizeof(*common->gbar.extra_buffer));
+ if (!common->gbar.extra_buffer) {
+ ErrPrint("DBOX(%s) calloc: %s\n", id, strerror(errno));
+ }
}
common->gbar.last_extra_buffer_idx = idx;
common->gbar.extra_buffer[idx] = pixmap;
dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_EXTRA_BUFFER_CREATED);
+ dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_EXTRA_BUFFER_CREATED);
}
out:
return NULL;
int ret;
if (!packet) {
- ErrPrint("Invalid packet\n");
- goto out;
+ ErrPrint("Invalid packet\n");
+ goto out;
}
ret = packet_get(packet, "ssii", &pkgname, &id, &status, &active_mode);
if (ret != 4) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("DBOX(%s) is not found\n", id);
- goto out;
+ ErrPrint("DBOX(%s) is not found\n", id);
+ goto out;
}
if (common->state != DBOX_STATE_CREATE) {
- ErrPrint("DBOX(%s) is not created yet\n", id);
- goto out;
+ ErrPrint("DBOX(%s) is not created yet\n", id);
+ goto out;
}
if (status == (int)DBOX_STATUS_ERROR_NONE) {
- dbox_set_update_mode(common, active_mode);
+ dbox_set_update_mode(common, active_mode);
}
common->request.update_mode = 0;
dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
- if (handler->cbs.update_mode.cb) {
- dynamicbox_ret_cb cb;
- void *cbdata;
+ if (handler->cbs.update_mode.cb) {
+ dynamicbox_ret_cb cb;
+ void *cbdata;
- cb = handler->cbs.update_mode.cb;
- cbdata = handler->cbs.update_mode.data;
+ cb = handler->cbs.update_mode.cb;
+ cbdata = handler->cbs.update_mode.data;
- handler->cbs.update_mode.cb = NULL;
- handler->cbs.update_mode.data = NULL;
+ handler->cbs.update_mode.cb = NULL;
+ handler->cbs.update_mode.data = NULL;
- cb(handler, status, cbdata);
- } else if (status == (int)DBOX_STATUS_ERROR_NONE) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_UPDATE_MODE_CHANGED);
- }
+ cb(handler, status, cbdata);
+ } else if (status == (int)DBOX_STATUS_ERROR_NONE) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_UPDATE_MODE_CHANGED);
+ }
}
out:
int is_gbar;
if (!packet) {
- ErrPrint("Invalid packet\n");
- goto out;
+ ErrPrint("Invalid packet\n");
+ goto out;
}
ret = packet_get(packet, "sssiiii", &pkgname, &id, &fbfile, &is_gbar, &w, &h, &status);
if (ret != 7) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("DBOX(%s) is not found\n", id);
- goto out;
+ ErrPrint("DBOX(%s) is not found\n", id);
+ goto out;
}
if (common->state != DBOX_STATE_CREATE) {
- ErrPrint("DBOX(%s) is not created yet\n", id);
- goto out;
+ ErrPrint("DBOX(%s) is not created yet\n", id);
+ goto out;
}
common->request.size_changed = 0;
if (is_gbar) {
- /*!
- * \NOTE
- * GBAR is not able to resized by the client.
- * GBAR is only can be managed by the provider.
- * So the GBAR has no private resized event handler.
- * Notify it via global event handler only.
- */
- if (status == (int)DBOX_STATUS_ERROR_NONE) {
- struct dlist *l;
-
- dbox_set_gbarsize(common, w, h);
- dlist_foreach(common->dynamicbox_list, l, handler) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_SIZE_CHANGED);
- }
- } else {
- ErrPrint("This is not possible. GBAR Size is changed but the return value is not ZERO (%d)\n", status);
- }
+ /*!
+ * \NOTE
+ * GBAR is not able to resized by the client.
+ * GBAR is only can be managed by the provider.
+ * So the GBAR has no private resized event handler.
+ * Notify it via global event handler only.
+ */
+ if (status == (int)DBOX_STATUS_ERROR_NONE) {
+ struct dlist *l;
+
+ dbox_set_gbarsize(common, w, h);
+ dlist_foreach(common->dynamicbox_list, l, handler) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_GBAR_SIZE_CHANGED);
+ }
+ } else {
+ ErrPrint("This is not possible. GBAR Size is changed but the return value is not ZERO (%d)\n", status);
+ }
} else {
- struct dlist *l;
- struct dlist *n;
-
- if (status == (int)DBOX_STATUS_ERROR_NONE) {
- dbox_set_size(common, w, h);
-
- /*!
- * \NOTE
- * If there is a created DBOX FB,
- * Update it too.
- */
- if (dbox_get_dbox_fb(common)) {
- (void)dbox_set_dbox_fb(common, fbfile);
-
- ret = dbox_sync_dbox_fb(common);
- if (ret < 0) {
- ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
- }
-
- /* Just update the size info only. */
- }
- }
-
- /*!
- * \NOTE
- * I cannot believe client.
- * So I added some log before & after call the user callback.
- */
- dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
- if (handler->cbs.size_changed.cb) {
- dynamicbox_ret_cb cb;
- void *cbdata;
-
- cb = handler->cbs.size_changed.cb;
- cbdata = handler->cbs.size_changed.data;
-
- handler->cbs.size_changed.cb = NULL;
- handler->cbs.size_changed.data = NULL;
-
- cb(handler, status, cbdata);
- } else if (status == (int)DBOX_STATUS_ERROR_NONE) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_DBOX_SIZE_CHANGED);
- }
- }
+ struct dlist *l;
+ struct dlist *n;
+
+ if (status == (int)DBOX_STATUS_ERROR_NONE) {
+ dbox_set_size(common, w, h);
+
+ /*!
+ * \NOTE
+ * If there is a created DBOX FB,
+ * Update it too.
+ */
+ if (dbox_get_dbox_fb(common)) {
+ (void)dbox_set_dbox_fb(common, fbfile);
+
+ ret = dbox_sync_dbox_fb(common);
+ if (ret < 0) {
+ ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
+ }
+
+ /* Just update the size info only. */
+ }
+ }
+
+ /*!
+ * \NOTE
+ * I cannot believe client.
+ * So I added some log before & after call the user callback.
+ */
+ dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
+ if (handler->cbs.size_changed.cb) {
+ dynamicbox_ret_cb cb;
+ void *cbdata;
+
+ cb = handler->cbs.size_changed.cb;
+ cbdata = handler->cbs.size_changed.data;
+
+ handler->cbs.size_changed.cb = NULL;
+ handler->cbs.size_changed.data = NULL;
+
+ cb(handler, status, cbdata);
+ } else if (status == (int)DBOX_STATUS_ERROR_NONE) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DBOX_SIZE_CHANGED);
+ }
+ }
}
out:
ret = packet_get(packet, "idss", &status, &period, &pkgname, &id);
if (ret != 4) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("DBOX(%s) is not found\n", id);
- goto out;
+ ErrPrint("DBOX(%s) is not found\n", id);
+ goto out;
}
if (common->state != DBOX_STATE_CREATE) {
- ErrPrint("DBOX(%s) is not created\n", id);
- goto out;
+ ErrPrint("DBOX(%s) is not created\n", id);
+ goto out;
}
if (status == (int)DBOX_STATUS_ERROR_NONE) {
- dbox_set_period(common, period);
+ dbox_set_period(common, period);
}
common->request.period_changed = 0;
dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
- if (handler->cbs.period_changed.cb) {
- dynamicbox_ret_cb cb;
- void *cbdata;
+ if (handler->cbs.period_changed.cb) {
+ dynamicbox_ret_cb cb;
+ void *cbdata;
- cb = handler->cbs.period_changed.cb;
- cbdata = handler->cbs.period_changed.data;
+ cb = handler->cbs.period_changed.cb;
+ cbdata = handler->cbs.period_changed.data;
- handler->cbs.period_changed.cb = NULL;
- handler->cbs.period_changed.data = NULL;
+ handler->cbs.period_changed.cb = NULL;
+ handler->cbs.period_changed.data = NULL;
- cb(handler, status, cbdata);
- } else if (status == (int)DBOX_STATUS_ERROR_NONE) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_PERIOD_CHANGED);
- }
+ cb(handler, status, cbdata);
+ } else if (status == (int)DBOX_STATUS_ERROR_NONE) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_PERIOD_CHANGED);
+ }
}
out:
ret = packet_get(packet, "ssiss", &pkgname, &id, &status, &cluster, &category);
if (ret != 5) {
- ErrPrint("Invalid argument\n");
- goto out;
+ ErrPrint("Invalid argument\n");
+ goto out;
}
common = dbox_find_common_handle(pkgname, id);
if (!common) {
- ErrPrint("DBOX(%s) is not exists\n", id);
- goto out;
+ ErrPrint("DBOX(%s) is not exists\n", id);
+ goto out;
}
if (common->state != DBOX_STATE_CREATE) {
- /*!
- * \note
- * Do no access this handler,
- * You cannot believe this handler anymore.
- */
- ErrPrint("DBOX(%s) is not created\n", id);
- goto out;
+ /*!
+ * \note
+ * Do no access this handler,
+ * You cannot believe this handler anymore.
+ */
+ ErrPrint("DBOX(%s) is not created\n", id);
+ goto out;
}
if (status == (int)DBOX_STATUS_ERROR_NONE) {
- (void)dbox_set_group(common, cluster, category);
+ (void)dbox_set_group(common, cluster, category);
}
common->request.group_changed = 0;
dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
- if (handler->cbs.group_changed.cb) {
- dynamicbox_ret_cb cb;
- void *cbdata;
+ if (handler->cbs.group_changed.cb) {
+ dynamicbox_ret_cb cb;
+ void *cbdata;
- cb = handler->cbs.group_changed.cb;
- cbdata = handler->cbs.group_changed.data;
+ cb = handler->cbs.group_changed.cb;
+ cbdata = handler->cbs.group_changed.data;
- handler->cbs.group_changed.cb = NULL;
- handler->cbs.group_changed.data = NULL;
+ handler->cbs.group_changed.cb = NULL;
+ handler->cbs.group_changed.data = NULL;
- cb(handler, status, cbdata);
- } else if (status == (int)DBOX_STATUS_ERROR_NONE) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_GROUP_CHANGED);
- }
+ cb(handler, status, cbdata);
+ } else if (status == (int)DBOX_STATUS_ERROR_NONE) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_GROUP_CHANGED);
+ }
}
out:
struct dynamicbox_common *common;
if (!packet) {
- ErrPrint("Invalid packet\n");
- return NULL;
+ ErrPrint("Invalid packet\n");
+ return NULL;
}
ret = packet_get(packet, "ds", ×tamp, &id);
if (ret != 2) {
- ErrPrint("Invalid paramter\n");
- return NULL;
+ ErrPrint("Invalid paramter\n");
+ return NULL;
}
common = dbox_find_common_handle_by_timestamp(timestamp);
if (!common) {
- ErrPrint("Handle is not found for %d\n", timestamp);
- return NULL;
+ ErrPrint("Handle is not found for %d\n", timestamp);
+ return NULL;
}
dbox_set_id(common, id);
int ret;
ret = packet_get(packet, "dsssiiiisssssdiiiiidsi",
- ×tamp,
- &pkgname, &id, &content,
- &dbox_w, &dbox_h, &gbar_w, &gbar_h,
- &cluster, &category, &dbox_fname, &gbar_fname,
- &auto_launch, &priority, &size_list, &user, &pinup_supported,
- &dbox_type, &gbar_type, &period, &title, &is_pinned_up);
+ ×tamp,
+ &pkgname, &id, &content,
+ &dbox_w, &dbox_h, &gbar_w, &gbar_h,
+ &cluster, &category, &dbox_fname, &gbar_fname,
+ &auto_launch, &priority, &size_list, &user, &pinup_supported,
+ &dbox_type, &gbar_type, &period, &title, &is_pinned_up);
if (ret != 22) {
- ErrPrint("Invalid argument\n");
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- goto out;
+ ErrPrint("Invalid argument\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ goto out;
}
ErrPrint("[%lf] pkgname: %s, id: %s, content: %s, "
- "gbar_w: %d, gbar_h: %d, dbox_w: %d, dbox_h: %d, "
- "cluster: %s, category: %s, dbox_fname: \"%s\", gbar_fname: \"%s\", "
- "auto_launch: %s, priority: %lf, size_list: %d, user: %d, pinup: %d, "
- "dbox_type: %d, gbar_type: %d, period: %lf, title: [%s], is_pinned_up: %d\n",
- timestamp, pkgname, id, content,
- gbar_w, gbar_h, dbox_w, dbox_h,
- cluster, category, dbox_fname, gbar_fname,
- auto_launch, priority, size_list, user, pinup_supported,
- dbox_type, gbar_type, period, title, is_pinned_up);
+ "gbar_w: %d, gbar_h: %d, dbox_w: %d, dbox_h: %d, "
+ "cluster: %s, category: %s, dbox_fname: \"%s\", gbar_fname: \"%s\", "
+ "auto_launch: %s, priority: %lf, size_list: %d, user: %d, pinup: %d, "
+ "dbox_type: %d, gbar_type: %d, period: %lf, title: [%s], is_pinned_up: %d\n",
+ timestamp, pkgname, id, content,
+ gbar_w, gbar_h, dbox_w, dbox_h,
+ cluster, category, dbox_fname, gbar_fname,
+ auto_launch, priority, size_list, user, pinup_supported,
+ dbox_type, gbar_type, period, title, is_pinned_up);
common = dbox_find_common_handle_by_timestamp(timestamp);
if (!common) {
- handler = dbox_new_dynamicbox(pkgname, id, timestamp, cluster, category);
- if (!handler) {
- ErrPrint("Failed to create a new dynamicbox\n");
- ret = DBOX_STATUS_ERROR_FAULT;
- goto out;
- }
- common = handler->common;
- old_state = common->state;
+ handler = dbox_new_dynamicbox(pkgname, id, timestamp, cluster, category);
+ if (!handler) {
+ ErrPrint("Failed to create a new dynamicbox\n");
+ ret = DBOX_STATUS_ERROR_FAULT;
+ goto out;
+ }
+ common = handler->common;
+ old_state = common->state;
} else {
- if (common->state != DBOX_STATE_CREATE) {
- if (common->state != DBOX_STATE_DELETE) {
- /*!
- * \note
- * This is not possible!!!
- */
- ErrPrint("Invalid handler\n");
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- goto out;
- }
-
- /*!
- * \note
- * After get the delete states,
- * call the create callback with deleted result.
- */
- }
-
- old_state = common->state;
-
- if (common->id && common->request.created == 0) {
- ErrPrint("Already created: timestamp[%lf] "
- "pkgname[%s], id[%s] content[%s] "
- "cluster[%s] category[%s] dbox_fname[%s] gbar_fname[%s]\n",
- timestamp, pkgname, id,
- content, cluster, category,
- dbox_fname, gbar_fname);
-
- ret = DBOX_STATUS_ERROR_ALREADY;
- goto out;
- }
-
- dbox_set_id(common, id);
+ if (common->state != DBOX_STATE_CREATE) {
+ if (common->state != DBOX_STATE_DELETE) {
+ /*!
+ * \note
+ * This is not possible!!!
+ */
+ ErrPrint("Invalid handler\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ goto out;
+ }
+
+ /*!
+ * \note
+ * After get the delete states,
+ * call the create callback with deleted result.
+ */
+ }
+
+ old_state = common->state;
+
+ if (common->id && common->request.created == 0) {
+ ErrPrint("Already created: timestamp[%lf] "
+ "pkgname[%s], id[%s] content[%s] "
+ "cluster[%s] category[%s] dbox_fname[%s] gbar_fname[%s]\n",
+ timestamp, pkgname, id,
+ content, cluster, category,
+ dbox_fname, gbar_fname);
+
+ ret = DBOX_STATUS_ERROR_ALREADY;
+ goto out;
+ }
+
+ dbox_set_id(common, id);
}
common->request.created = 0;
common->is_pinned_up = is_pinned_up;
switch (dbox_type) {
- case DBOX_TYPE_UIFW:
- case DBOX_TYPE_FILE:
- break;
- case DBOX_TYPE_SCRIPT:
- case DBOX_TYPE_BUFFER:
- if (!strlen(dbox_fname)) {
- break;
- }
- (void)dbox_set_dbox_fb(common, dbox_fname);
-
- /*!
- * \note
- * DBOX should create the lock file from here.
- * 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 DBOX_FB_TYPE_FILE:
- case DBOX_FB_TYPE_SHM:
- common->dbox.lock = dynamicbox_service_create_lock(common->id, DBOX_TYPE_DBOX, DBOX_LOCK_READ);
- break;
- case DBOX_FB_TYPE_PIXMAP:
- case DBOX_FB_TYPE_ERROR:
- default:
- break;
- }
-
- ret = dbox_sync_dbox_fb(common);
- if (ret < 0) {
- ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
- }
- break;
- case DBOX_TYPE_TEXT:
- dbox_set_text_dbox(common);
- break;
- default:
- break;
+ case DBOX_TYPE_UIFW:
+ case DBOX_TYPE_FILE:
+ break;
+ case DBOX_TYPE_SCRIPT:
+ case DBOX_TYPE_BUFFER:
+ if (!strlen(dbox_fname)) {
+ break;
+ }
+ (void)dbox_set_dbox_fb(common, dbox_fname);
+
+ /*!
+ * \note
+ * DBOX should create the lock file from here.
+ * 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 DBOX_FB_TYPE_FILE:
+ case DBOX_FB_TYPE_SHM:
+ common->dbox.lock = dynamicbox_service_create_lock(common->id, DBOX_TYPE_DBOX, DBOX_LOCK_READ);
+ break;
+ case DBOX_FB_TYPE_PIXMAP:
+ case DBOX_FB_TYPE_ERROR:
+ default:
+ break;
+ }
+
+ ret = dbox_sync_dbox_fb(common);
+ if (ret < 0) {
+ ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
+ }
+ break;
+ case DBOX_TYPE_TEXT:
+ dbox_set_text_dbox(common);
+ break;
+ default:
+ break;
}
common->gbar.type = gbar_type;
dbox_set_gbarsize(common, gbar_w, gbar_h);
dbox_set_default_gbarsize(common, gbar_w, gbar_h);
switch (gbar_type) {
- case GBAR_TYPE_SCRIPT:
- case GBAR_TYPE_BUFFER:
- if (!strlen(gbar_fname)) {
- break;
- }
-
- dbox_set_gbar_fb(common, gbar_fname);
-
- ret = dbox_sync_gbar_fb(common);
- if (ret < 0) {
- ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
- }
-
- /*!
- * \brief
- * GBAR doesn't need to create the lock file from here.
- * Just create it from GBAR_CREATED event.
- */
-
- break;
- case GBAR_TYPE_TEXT:
- dbox_set_text_gbar(common);
- break;
- case GBAR_TYPE_UIFW:
- default:
- break;
+ case GBAR_TYPE_SCRIPT:
+ case GBAR_TYPE_BUFFER:
+ if (!strlen(gbar_fname)) {
+ break;
+ }
+
+ dbox_set_gbar_fb(common, gbar_fname);
+
+ ret = dbox_sync_gbar_fb(common);
+ if (ret < 0) {
+ ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
+ }
+
+ /*!
+ * \brief
+ * GBAR doesn't need to create the lock file from here.
+ * Just create it from GBAR_CREATED event.
+ */
+
+ break;
+ case GBAR_TYPE_TEXT:
+ dbox_set_text_gbar(common);
+ break;
+ case GBAR_TYPE_UIFW:
+ default:
+ break;
}
dbox_set_priority(common, priority);
ret = 0;
if (common->state == DBOX_STATE_CREATE) {
- dlist_foreach(common->dynamicbox_list, l, handler) {
- /*!
- * \note
- * These callback can change the handler->state.
- * So we have to use the "old_state" which stored state before call these callbacks
- */
+ dlist_foreach(common->dynamicbox_list, l, handler) {
+ /*!
+ * \note
+ * These callback can change the handler->state.
+ * So we have to use the "old_state" which stored state before call these callbacks
+ */
- if (handler->cbs.created.cb) {
- dynamicbox_ret_cb cb;
- void *cbdata;
+ if (handler->cbs.created.cb) {
+ dynamicbox_ret_cb cb;
+ void *cbdata;
- cb = handler->cbs.created.cb;
- cbdata = handler->cbs.created.data;
+ cb = handler->cbs.created.cb;
+ cbdata = handler->cbs.created.data;
- handler->cbs.created.cb = NULL;
- handler->cbs.created.data = NULL;
+ handler->cbs.created.cb = NULL;
+ handler->cbs.created.data = NULL;
- cb(handler, ret, cbdata);
- } else {
- dbox_invoke_event_handler(handler, DBOX_EVENT_CREATED);
- }
- }
+ cb(handler, ret, cbdata);
+ } else {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_CREATED);
+ }
+ }
}
out:
if (ret == 0 && old_state == DBOX_STATE_DELETE) {
- struct dlist *n;
-
- DbgPrint("Take place an unexpected case [%d]\n", common->refcnt);
- dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
- if (handler->cbs.created.cb) {
- if (!handler->common->request.deleted) {
- if (dbox_send_delete(handler, common->delete_type, handler->cbs.created.cb, handler->cbs.created.data) < 0) {
- /*!
- * \note
- * Already sent or something else happens.
- * Callback will be called in any cases
- */
- }
- } else if (handler->state != DBOX_STATE_DELETE) {
- handler->cbs.created.cb(handler, DBOX_STATUS_ERROR_CANCEL, handler->cbs.created.data);
- dbox_unref(handler, 1);
- }
- } else {
- dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
- dbox_unref(handler, 1);
- }
- }
-
- /*!
- * \note
- * handler->cbs.created.cb = NULL;
- * handler->cbs.created.data = NULL;
- *
- * Do not clear this to use this from the deleted event callback.
- * if this value is not cleared when the deleted event callback check it,
- * it means that the created function is not called yet.
- * Then the call the deleted event callback with DBOX_STATUS_ERROR_CANCEL errno.
- */
+ struct dlist *n;
+
+ DbgPrint("Take place an unexpected case [%d]\n", common->refcnt);
+ dlist_foreach_safe(common->dynamicbox_list, l, n, handler) {
+ if (handler->cbs.created.cb) {
+ if (!handler->common->request.deleted) {
+ if (dbox_send_delete(handler, common->delete_type, handler->cbs.created.cb, handler->cbs.created.data) < 0) {
+ /*!
+ * \note
+ * Already sent or something else happens.
+ * Callback will be called in any cases
+ */
+ }
+ } else if (handler->state != DBOX_STATE_DELETE) {
+ handler->cbs.created.cb(handler, DBOX_STATUS_ERROR_CANCEL, handler->cbs.created.data);
+ dbox_unref(handler, 1);
+ }
+ } else {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
+ }
+ }
+
+ /*!
+ * \note
+ * handler->cbs.created.cb = NULL;
+ * handler->cbs.created.data = NULL;
+ *
+ * Do not clear this to use this from the deleted event callback.
+ * if this value is not cleared when the deleted event callback check it,
+ * it means that the created function is not called yet.
+ * Then the call the deleted event callback with DBOX_STATUS_ERROR_CANCEL errno.
+ */
}
return NULL;
static struct method s_table[] = {
{ /* DBOX_UPDATED */
- .cmd = CMD_STR_DBOX_UPDATED, /* pkgname, id, dbox_w, dbox_h, priority, ret */
- .handler = master_dbox_updated,
+ .cmd = CMD_STR_DBOX_UPDATED, /* pkgname, id, dbox_w, dbox_h, priority, ret */
+ .handler = master_dbox_updated,
},
{ /* GBAR_UPDATED */
- .cmd = CMD_STR_GBAR_UPDATED, /* pkgname, id, descfile, pd_w, pd_h, ret */
- .handler = master_gbar_updated,
+ .cmd = CMD_STR_GBAR_UPDATED, /* pkgname, id, descfile, pd_w, pd_h, ret */
+ .handler = master_gbar_updated,
},
{ /* EXTRA_UPDATED */
- .cmd = CMD_STR_EXTRA_UPDATED,
- .handler = master_extra_updated,
+ .cmd = CMD_STR_EXTRA_UPDATED,
+ .handler = master_extra_updated,
},
{ /* EXTRA_INFO */
- .cmd = CMD_STR_EXTRA_INFO,
- .handler = master_extra_info,
+ .cmd = CMD_STR_EXTRA_INFO,
+ .handler = master_extra_info,
},
{ /* DELETED */
- .cmd = CMD_STR_DELETED, /* pkgname, id, timestamp, ret */
- .handler = master_deleted,
+ .cmd = CMD_STR_DELETED, /* pkgname, id, timestamp, ret */
+ .handler = master_deleted,
},
{ /* FAULTED */
- .cmd = CMD_STR_FAULT_PACKAGE, /* pkgname, id, function, ret */
- .handler = master_fault_package,
+ .cmd = CMD_STR_FAULT_PACKAGE, /* pkgname, id, function, ret */
+ .handler = master_fault_package,
},
{ /* SCROLL */
- .cmd = CMD_STR_SCROLL,
- .handler = master_hold_scroll,
+ .cmd = CMD_STR_SCROLL,
+ .handler = master_hold_scroll,
},
{ /* DBOX_UPDATE_BEGIN */
- .cmd = CMD_STR_DBOX_UPDATE_BEGIN,
- .handler = master_dbox_update_begin,
+ .cmd = CMD_STR_DBOX_UPDATE_BEGIN,
+ .handler = master_dbox_update_begin,
},
{ /* DBOX_UPDATE_END */
- .cmd = CMD_STR_DBOX_UPDATE_END,
- .handler = master_dbox_update_end,
+ .cmd = CMD_STR_DBOX_UPDATE_END,
+ .handler = master_dbox_update_end,
},
{ /* GBAR_UPDATE_BEGIN */
- .cmd = CMD_STR_GBAR_UPDATE_BEGIN,
- .handler = master_gbar_update_begin,
+ .cmd = CMD_STR_GBAR_UPDATE_BEGIN,
+ .handler = master_gbar_update_begin,
},
{ /* GBAR_UPDATE_END */
- .cmd = CMD_STR_GBAR_UPDATE_END,
- .handler = master_gbar_update_end,
+ .cmd = CMD_STR_GBAR_UPDATE_END,
+ .handler = master_gbar_update_end,
},
{ /* ACCESS_STATUS */
- .cmd = CMD_STR_ACCESS_STATUS,
- .handler = master_access_status,
+ .cmd = CMD_STR_ACCESS_STATUS,
+ .handler = master_access_status,
},
{ /* KEY_STATUS */
- .cmd = CMD_STR_KEY_STATUS,
- .handler = master_key_status,
+ .cmd = CMD_STR_KEY_STATUS,
+ .handler = master_key_status,
},
{ /* CLOSE_GBAR */
- .cmd = CMD_STR_CLOSE_GBAR,
- .handler = master_request_close_gbar,
+ .cmd = CMD_STR_CLOSE_GBAR,
+ .handler = master_request_close_gbar,
},
{ /* GBAR_CREATED */
- .cmd = CMD_STR_GBAR_CREATED,
- .handler = master_gbar_created,
+ .cmd = CMD_STR_GBAR_CREATED,
+ .handler = master_gbar_created,
},
{ /* GBAR_DESTROYED */
- .cmd = CMD_STR_GBAR_DESTROYED,
- .handler = master_gbar_destroyed,
+ .cmd = CMD_STR_GBAR_DESTROYED,
+ .handler = master_gbar_destroyed,
},
{ /* CREATED */
- .cmd = CMD_STR_CREATED,
- .handler = master_created,
+ .cmd = CMD_STR_CREATED,
+ .handler = master_created,
},
{ /* GROUP_CHANGED */
- .cmd = CMD_STR_GROUP_CHANGED,
- .handler = master_group_changed,
+ .cmd = CMD_STR_GROUP_CHANGED,
+ .handler = master_group_changed,
},
{ /* PERIOD_CHANGED */
- .cmd = CMD_STR_PERIOD_CHANGED,
- .handler = master_period_changed,
+ .cmd = CMD_STR_PERIOD_CHANGED,
+ .handler = master_period_changed,
},
{ /* SIZE_CHANGED */
- .cmd = CMD_STR_SIZE_CHANGED,
- .handler = master_size_changed,
+ .cmd = CMD_STR_SIZE_CHANGED,
+ .handler = master_size_changed,
},
{ /* PINUP */
- .cmd = CMD_STR_PINUP,
- .handler = master_pinup,
+ .cmd = CMD_STR_PINUP,
+ .handler = master_pinup,
},
{ /* UPDATE_MODE */
- .cmd = CMD_STR_UPDATE_MODE,
- .handler = master_update_mode,
+ .cmd = CMD_STR_UPDATE_MODE,
+ .handler = master_update_mode,
},
{ /* DBOX_CREATE_XBUF */
- .cmd = CMD_STR_DBOX_CREATE_XBUF,
- .handler = master_dbox_extra_buffer_created,
+ .cmd = CMD_STR_DBOX_CREATE_XBUF,
+ .handler = master_dbox_extra_buffer_created,
},
{ /* GBAR_CREATE_XBUF */
- .cmd = CMD_STR_GBAR_CREATE_XBUF,
- .handler = master_gbar_extra_buffer_created,
+ .cmd = CMD_STR_GBAR_CREATE_XBUF,
+ .handler = master_gbar_extra_buffer_created,
},
{ /* DBOX_DESTROY_XBUF */
- .cmd = CMD_STR_DBOX_DESTROY_XBUF,
- .handler = master_dbox_extra_buffer_destroyed,
+ .cmd = CMD_STR_DBOX_DESTROY_XBUF,
+ .handler = master_dbox_extra_buffer_destroyed,
},
{ /* GBAR_DESTROY_XBUF */
- .cmd = CMD_STR_GBAR_DESTROY_XBUF,
- .handler = master_gbar_extra_buffer_destroyed,
+ .cmd = CMD_STR_GBAR_DESTROY_XBUF,
+ .handler = master_gbar_extra_buffer_destroyed,
},
{ /* UPDATE_ID */
- .cmd = CMD_STR_UPDATE_ID,
- .handler = master_update_id,
+ .cmd = CMD_STR_UPDATE_ID,
+ .handler = master_update_id,
},
{
- .cmd = NULL,
- .handler = NULL,
+ .cmd = NULL,
+ .handler = NULL,
},
};
static void acquire_cb(dynamicbox_h handler, const struct packet *result, void *data)
{
if (!result) {
- DbgPrint("Result packet is not valid\n");
+ DbgPrint("Result packet is not valid\n");
} else {
- int ret;
- int extra_buffer_count;
+ int ret;
+ int extra_buffer_count;
- if (packet_get(result, "ii", &ret, &extra_buffer_count) != 2) {
- ErrPrint("Invalid argument\n");
- } else {
- DbgPrint("Acquire returns: %d (%d)\n", ret, extra_buffer_count);
- conf_set_extra_buffer_count(extra_buffer_count);
- }
+ if (packet_get(result, "ii", &ret, &extra_buffer_count) != 2) {
+ ErrPrint("Invalid argument\n");
+ } else {
+ DbgPrint("Acquire returns: %d (%d)\n", ret, extra_buffer_count);
+ conf_set_extra_buffer_count(extra_buffer_count);
+ }
}
return;
s_info.fd = com_core_packet_client_init(client_addr(), 0, s_table);
if (s_info.fd < 0) {
- ErrPrint("Try this again later\n");
- return DBOX_STATUS_ERROR_IO_ERROR;
+ ErrPrint("Try this again later\n");
+ return DBOX_STATUS_ERROR_IO_ERROR;
}
packet = packet_create((const char *)&cmd, "ds", util_timestamp(), client_direct_addr());
if (!packet) {
- com_core_packet_client_fini(s_info.fd);
- s_info.fd = -1;
- return DBOX_STATUS_ERROR_FAULT;
+ com_core_packet_client_fini(s_info.fd);
+ s_info.fd = -1;
+ return DBOX_STATUS_ERROR_FAULT;
}
ret = master_rpc_async_request(NULL, packet, 1, acquire_cb, NULL);
if (ret < 0) {
- ErrPrint("Master RPC returns %d\n", ret);
- com_core_packet_client_fini(s_info.fd);
- s_info.fd = -1;
- return DBOX_STATUS_ERROR_IO_ERROR;
+ ErrPrint("Master RPC returns %d\n", ret);
+ com_core_packet_client_fini(s_info.fd);
+ s_info.fd = -1;
+ return DBOX_STATUS_ERROR_IO_ERROR;
}
return DBOX_STATUS_ERROR_NONE;
int state = 0;
if (vconf_get_bool(VCONFKEY_MASTER_STARTED, &state) < 0) {
- ErrPrint("Unable to get [%s]\n", VCONFKEY_MASTER_STARTED);
+ ErrPrint("Unable to get [%s]\n", VCONFKEY_MASTER_STARTED);
}
DbgPrint("Master state: %d\n", state);
if (state == 1 && make_connection() == (int)DBOX_STATUS_ERROR_NONE) {
- int ret;
- ret = vconf_ignore_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb);
- if (ret < 0) {
- DbgPrint("master_started vconf key de-registered [%d]\n", ret);
- }
+ int ret;
+ ret = vconf_ignore_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb);
+ if (ret < 0) {
+ DbgPrint("master_started vconf key de-registered [%d]\n", ret);
+ }
}
}
static gboolean timeout_cb(gpointer data)
{
if (vconf_notify_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb, NULL) < 0) {
- ErrPrint("Failed to add vconf for monitoring service state\n");
+ ErrPrint("Failed to add vconf for monitoring service state\n");
} else {
- DbgPrint("vconf event callback is registered\n");
+ DbgPrint("vconf event callback is registered\n");
}
master_started_cb(NULL, NULL);
static int disconnected_cb(int handle, void *data)
{
if (s_info.fd != handle) {
- /*!< This handle is not my favor */
- return 0;
+ /*!< This handle is not my favor */
+ return 0;
}
s_info.fd = -1; /*!< Disconnected */
/* Try to reconnect after 1 sec later */
if (!s_info.timer_id) {
- DbgPrint("Reconnecting timer is added\n");
- s_info.timer_id = g_timeout_add(1000, timeout_cb, NULL);
- if (s_info.timer_id == 0) {
- ErrPrint("Unable to add reconnecting timer\n");
- return 0;
- }
+ DbgPrint("Reconnecting timer is added\n");
+ s_info.timer_id = g_timeout_add(1000, timeout_cb, NULL);
+ if (s_info.timer_id == 0) {
+ ErrPrint("Unable to add reconnecting timer\n");
+ return 0;
+ }
} else {
- ErrPrint("Reconnecting timer is already exists\n");
+ ErrPrint("Reconnecting timer is already exists\n");
}
return 0;
static struct method s_direct_table[] = {
{
- .cmd = CMD_STR_DBOX_UPDATED, /* pkgname, id, lb_w, lb_h, priority, ret */
- .handler = master_dbox_updated,
+ .cmd = CMD_STR_DBOX_UPDATED, /* pkgname, id, lb_w, lb_h, priority, ret */
+ .handler = master_dbox_updated,
},
{
- .cmd = CMD_STR_GBAR_UPDATED, /* pkgname, id, descfile, pd_w, pd_h, ret */
- .handler = master_gbar_updated,
+ .cmd = CMD_STR_GBAR_UPDATED, /* pkgname, id, descfile, pd_w, pd_h, ret */
+ .handler = master_gbar_updated,
},
{
- .cmd = CMD_STR_EXTRA_UPDATED,
- .handler = master_extra_updated,
+ .cmd = CMD_STR_EXTRA_UPDATED,
+ .handler = master_extra_updated,
},
{
- .cmd = NULL,
- .handler = NULL,
+ .cmd = NULL,
+ .handler = NULL,
},
};
char path[MAX_DIRECT_ADDR];
if (!conf_direct_update()) {
- return;
+ return;
}
if (!strncmp(s_info.client_addr, COM_CORE_REMOTE_SCHEME, strlen(COM_CORE_REMOTE_SCHEME))) {
- ErrPrint("Remote model is not support this\n");
- return;
+ ErrPrint("Remote model is not support this\n");
+ return;
}
snprintf(path, sizeof(path) - 1, "/tmp/.%d.%lf.dbox.viewer", getpid(), util_timestamp());
s_info.direct_addr = strdup(path);
if (!s_info.direct_addr) {
- ErrPrint("strdup: %s\n", strerror(errno));
- return;
+ ErrPrint("strdup: %s\n", strerror(errno));
+ return;
}
s_info.direct_fd = com_core_packet_server_init(client_direct_addr(), s_direct_table);
if (s_info.direct_fd < 0) {
- ErrPrint("Failed to prepare server: %s\n", client_direct_addr());
- return;
+ ErrPrint("Failed to prepare server: %s\n", client_direct_addr());
+ return;
}
DbgPrint("Direct update is prepared: %s - %d\n", client_direct_addr(), client_direct_fd());
s_info.client_addr = vconf_get_str(VCONFKEY_MASTER_CLIENT_ADDR);
if (!s_info.client_addr) {
- s_info.client_addr = strdup(CLIENT_SOCKET);
- if (!s_info.client_addr) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- }
+ s_info.client_addr = strdup(CLIENT_SOCKET);
+ if (!s_info.client_addr) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
}
(void)file_service_init();
prepare_direct_update();
if (vconf_notify_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb, NULL) < 0) {
- ErrPrint("Failed to add vconf for service state\n");
+ ErrPrint("Failed to add vconf for service state\n");
} else {
- DbgPrint("vconf event callback is registered\n");
+ DbgPrint("vconf event callback is registered\n");
}
master_started_cb(NULL, NULL);
ret = vconf_ignore_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb);
if (ret < 0) {
- DbgPrint("Ignore vconf key: %d\n", ret);
+ DbgPrint("Ignore vconf key: %d\n", ret);
}
com_core_del_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL);
s_info.fd = -1;
if (s_info.direct_fd >= 0) {
- com_core_packet_server_fini(s_info.direct_fd);
- s_info.direct_fd = -1;
+ com_core_packet_server_fini(s_info.direct_fd);
+ s_info.direct_fd = -1;
}
free(s_info.client_addr);
struct dynamicbox_script_operators *ops;
if (!block || !block->part || !block->data) {
- ErrPrint("Invalid argument\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid argument\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (ops->update_text) {
- ops->update_text(handle, (const char *)block->id, (const char *)block->part, (const char *)block->data);
+ ops->update_text(handle, (const char *)block->id, (const char *)block->part, (const char *)block->data);
}
return 0;
struct dynamicbox_script_operators *ops;
if (!block || !block->part) {
- ErrPrint("Invalid argument\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid argument\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (ops->update_image) {
- ops->update_image(handle, block->id, block->part, block->data, block->option);
+ ops->update_image(handle, block->id, block->part, block->data, block->option);
}
return 0;
struct dynamicbox_script_operators *ops;
if (!block || !block->part) {
- ErrPrint("Invalid argument\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid argument\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (ops->update_script) {
- ops->update_script(handle, block->id, block->target, block->part, block->data, block->option);
+ ops->update_script(handle, block->id, block->target, block->part, block->data, block->option);
}
return 0;
struct dynamicbox_script_operators *ops;
if (!block) {
- ErrPrint("Invalid argument\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid argument\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (ops->update_signal) {
- ops->update_signal(handle, block->id, block->data, block->part);
+ ops->update_signal(handle, block->id, block->data, block->part);
}
return 0;
struct dynamicbox_script_operators *ops;
if (!block || !block->data || !block->part) {
- ErrPrint("Invalid argument\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid argument\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (sscanf(block->data, "%lfx%lf", &dx, &dy) != 2) {
- ErrPrint("Invalid format of data\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid format of data\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (ops->update_drag) {
- ops->update_drag(handle, block->id, block->part, dx, dy);
+ ops->update_drag(handle, block->id, block->part, dx, dy);
}
return 0;
struct dynamicbox_script_operators *ops;
if (!block || !block->part || !block->data) {
- ErrPrint("Invalid argument\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid argument\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (!strcasecmp(block->part, INFO_SIZE)) {
- int w, h;
+ int w, h;
- if (sscanf(block->data, "%dx%d", &w, &h) != 2) {
- ErrPrint("Invalid format (%s)\n", block->data);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
+ if (sscanf(block->data, "%dx%d", &w, &h) != 2) {
+ ErrPrint("Invalid format (%s)\n", block->data);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
- if (ops->update_info_size) {
- ops->update_info_size(handle, block->id, w, h);
- }
+ if (ops->update_info_size) {
+ ops->update_info_size(handle, block->id, w, h);
+ }
} else if (!strcasecmp(block->part, INFO_CATEGORY)) {
- if (ops->update_info_category) {
- ops->update_info_category(handle, block->id, block->data);
- }
+ if (ops->update_info_category) {
+ ops->update_info_category(handle, block->id, block->data);
+ }
}
return 0;
struct dynamicbox_script_operators *ops;
if (!block) {
- ErrPrint("Invalid argument\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid argument\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (ops->update_access) {
- ops->update_access(handle, block->id, block->part, block->data, block->option);
+ ops->update_access(handle, block->id, block->part, block->data, block->option);
}
return 0;
struct dynamicbox_script_operators *ops;
if (!block) {
- ErrPrint("Invalid argument\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid argument\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (ops->operate_access) {
- ops->operate_access(handle, block->id, block->part, block->data, block->option);
+ ops->operate_access(handle, block->id, block->part, block->data, block->option);
}
return 0;
struct dynamicbox_script_operators *ops;
if (!block) {
- ErrPrint("Invalid argument\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid argument\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (ops->update_color) {
- ops->update_color(handle, block->id, block->part, block->data);
+ ops->update_color(handle, block->id, block->part, block->data);
}
return 0;
ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (ops->update_begin) {
- ops->update_begin(handle);
+ ops->update_begin(handle);
}
return 0;
ops = is_gbar ? &handle->cbs.gbar_ops : &handle->cbs.dbox_ops;
if (ops->update_end) {
- ops->update_end(handle);
+ ops->update_end(handle);
}
return 0;
{
typedef int (*update_function_t)(dynamicbox_h handle, struct block *block, int is_gbar);
static update_function_t updators[] = {
- update_access,
- operate_access,
- update_color,
- update_drag,
- update_image,
- update_info,
- update_script,
- update_signal,
- update_text,
- NULL
+ update_access,
+ operate_access,
+ update_color,
+ update_drag,
+ update_image,
+ update_info,
+ update_script,
+ update_signal,
+ update_text,
+ NULL
};
if (block->type >= 0 || block->type < TYPE_MAX) {
- (void)updators[block->type](handle, block, is_gbar);
+ (void)updators[block->type](handle, block, is_gbar);
} else {
- ErrPrint("Block type[%d] is not valid\n", block->type);
+ ErrPrint("Block type[%d] is not valid\n", block->type);
}
}
fd = open(filename, O_RDONLY);
if (fd < 0) {
- ErrPrint("open: %s\n", strerror(errno));
- return NULL;
+ ErrPrint("open: %s\n", strerror(errno));
+ return NULL;
}
filesize = lseek(fd, 0L, SEEK_END);
if (filesize == (off_t)-1) {
- ErrPrint("lseek: %s\n", strerror(errno));
- goto errout;
+ ErrPrint("lseek: %s\n", strerror(errno));
+ goto errout;
}
if (lseek(fd, 0L, SEEK_SET) < 0) {
- ErrPrint("lseek: %s\n", strerror(errno));
- goto errout;
+ ErrPrint("lseek: %s\n", strerror(errno));
+ goto errout;
}
filebuf = malloc(filesize + 1);
if (!filebuf) {
- ErrPrint("malloc: %s\n", strerror(errno));
- goto errout;
+ ErrPrint("malloc: %s\n", strerror(errno));
+ goto errout;
}
while (readsize < filesize) {
- ret = read(fd, filebuf + readsize, (size_t)filesize - readsize);
- if (ret < 0) {
- if (errno == EINTR) {
- DbgPrint("Read is interrupted\n");
- continue;
- }
+ ret = read(fd, filebuf + readsize, (size_t)filesize - readsize);
+ if (ret < 0) {
+ if (errno == EINTR) {
+ DbgPrint("Read is interrupted\n");
+ continue;
+ }
- ErrPrint("read: %s\n", strerror(errno));
- free(filebuf);
- filebuf = NULL;
- break;
- }
+ ErrPrint("read: %s\n", strerror(errno));
+ free(filebuf);
+ filebuf = NULL;
+ break;
+ }
- readsize += ret;
+ readsize += ret;
}
if (filebuf) {
- filebuf[readsize] = '\0';
+ filebuf[readsize] = '\0';
}
/*!
errout:
if (close(fd) < 0) {
- ErrPrint("close: %s\n", strerror(errno));
+ ErrPrint("close: %s\n", strerror(errno));
}
return filebuf;
struct dlist *handle_iterator;
dynamicbox_h handler;
enum state {
- BEGIN,
- FIELD,
- DATA,
- END,
- DONE,
- ERROR,
+ BEGIN,
+ FIELD,
+ DATA,
+ END,
+ DONE,
+ ERROR,
} state;
filebuf = load_file(filename);
if (!filebuf) {
- return DBOX_STATUS_ERROR_IO_ERROR;
+ return DBOX_STATUS_ERROR_IO_ERROR;
}
fileptr = filebuf;
state = BEGIN;
while (*fileptr && state != ERROR) {
- switch (state) {
- case BEGIN:
- if (*fileptr == '{') {
- block = calloc(1, sizeof(*block));
- if (!block) {
- ErrPrint("calloc: %s\n", strerror(errno));
- state = ERROR;
- continue;
- }
- state = FIELD;
- ptr = NULL;
- }
- break;
- case FIELD:
- if (isspace(*fileptr)) {
- if (ptr != NULL) {
- *fileptr = '\0';
- }
- } else if (*fileptr == '=') {
- *fileptr = '\0';
- ptr = NULL;
- state = DATA;
- } else if (ptr == NULL) {
- ptr = fileptr;
- field_idx = 0;
- field_len = 0;
-
- while (field_list[field_idx]) {
- if (field_list[field_idx][field_len] == *fileptr) {
- break;
- }
- field_idx++;
- }
-
- if (!field_list[field_idx]) {
- ErrPrint("Invalid field\n");
- state = ERROR;
- continue;
- }
-
- field_len++;
- } else {
- if (field_list[field_idx][field_len] != *fileptr) {
- field_idx++;
- while (field_list[field_idx]) {
- if (!strncmp(field_list[field_idx], fileptr - field_len, field_len)) {
- break;
- } else {
- field_idx++;
- }
- }
-
- if (!field_list[field_idx]) {
- state = ERROR;
- ErrPrint("field is not valid\n");
- continue;
- }
- }
-
- field_len++;
- }
- break;
- case DATA:
- switch (field_idx) {
- case FIELD_TYPE:
- if (ptr == NULL) {
- if (isspace(*fileptr)) {
- break;
- }
-
- if (*fileptr == '\0') {
- state = ERROR;
- ErrPrint("Type is not valid\n");
- continue;
- }
-
- ptr = fileptr;
- type_idx = 0;
- type_len = 0;
- }
-
- if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
- *fileptr = '\0';
- }
-
- if (type_list[type_idx][type_len] != *fileptr) {
- type_idx++;
- while (type_list[type_idx]) {
- if (!strncmp(type_list[type_idx], fileptr - type_len, type_len)) {
- break;
- } else {
- type_idx++;
- }
- }
-
- if (!type_list[type_idx]) {
- state = ERROR;
- ErrPrint("type is not valid (%s)\n", fileptr - type_len);
- continue;
- }
- }
-
- if (!*fileptr) {
- block->type = type_idx;
- state = DONE;
- ptr = NULL;
- }
-
- type_len++;
- break;
- case FIELD_PART:
- if (ptr == NULL) {
- ptr = fileptr;
- }
-
- if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
- *fileptr = '\0';
- }
-
- if (!*fileptr) {
- block->part = ptr;
- state = DONE;
- ptr = NULL;
- }
- break;
- case FIELD_DATA:
- if (ptr == NULL) {
- ptr = fileptr;
- }
-
- if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
- *fileptr = '\0';
- }
-
- if (!*fileptr) {
- block->data = ptr;
- state = DONE;
- ptr = NULL;
- }
- break;
- case FIELD_OPTION:
- if (ptr == NULL) {
- ptr = fileptr;
- }
-
- if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
- *fileptr = '\0';
- }
-
- if (!*fileptr) {
- block->option = ptr;
- state = DONE;
- ptr = NULL;
- }
- break;
- case FIELD_ID:
- if (ptr == NULL) {
- ptr = fileptr;
- }
-
- if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
- *fileptr = '\0';
- }
-
- if (!*fileptr) {
- block->id = ptr;
- state = DONE;
- ptr = NULL;
- }
- break;
- case FIELD_TARGET:
- if (ptr == NULL) {
- ptr = fileptr;
- }
-
- if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
- *fileptr = '\0';
- }
-
- if (!*fileptr) {
- block->target = ptr;
- state = DONE;
- ptr = NULL;
- }
- break;
- case FIELD_FILE:
- if (ptr == NULL) {
- ptr = fileptr;
- }
-
- if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
- *fileptr = '\0';
- }
-
- if (!*fileptr) {
- block->target = ptr;
- state = DONE;
- ptr = NULL;
- }
- default:
- break;
- }
-
- break;
- case DONE:
- if (isspace(*fileptr)) {
- } else if (*fileptr == '}') {
- state = BEGIN;
- block->filename = filename;
- block_list = dlist_append(block_list, block);
- block = NULL;
- } else {
- state = FIELD;
- continue;
- }
- break;
- case END:
- default:
- break;
- }
-
- fileptr++;
+ switch (state) {
+ case BEGIN:
+ if (*fileptr == '{') {
+ block = calloc(1, sizeof(*block));
+ if (!block) {
+ ErrPrint("calloc: %s\n", strerror(errno));
+ state = ERROR;
+ continue;
+ }
+ state = FIELD;
+ ptr = NULL;
+ }
+ break;
+ case FIELD:
+ if (isspace(*fileptr)) {
+ if (ptr != NULL) {
+ *fileptr = '\0';
+ }
+ } else if (*fileptr == '=') {
+ *fileptr = '\0';
+ ptr = NULL;
+ state = DATA;
+ } else if (ptr == NULL) {
+ ptr = fileptr;
+ field_idx = 0;
+ field_len = 0;
+
+ while (field_list[field_idx]) {
+ if (field_list[field_idx][field_len] == *fileptr) {
+ break;
+ }
+ field_idx++;
+ }
+
+ if (!field_list[field_idx]) {
+ ErrPrint("Invalid field\n");
+ state = ERROR;
+ continue;
+ }
+
+ field_len++;
+ } else {
+ if (field_list[field_idx][field_len] != *fileptr) {
+ field_idx++;
+ while (field_list[field_idx]) {
+ if (!strncmp(field_list[field_idx], fileptr - field_len, field_len)) {
+ break;
+ } else {
+ field_idx++;
+ }
+ }
+
+ if (!field_list[field_idx]) {
+ state = ERROR;
+ ErrPrint("field is not valid\n");
+ continue;
+ }
+ }
+
+ field_len++;
+ }
+ break;
+ case DATA:
+ switch (field_idx) {
+ case FIELD_TYPE:
+ if (ptr == NULL) {
+ if (isspace(*fileptr)) {
+ break;
+ }
+
+ if (*fileptr == '\0') {
+ state = ERROR;
+ ErrPrint("Type is not valid\n");
+ continue;
+ }
+
+ ptr = fileptr;
+ type_idx = 0;
+ type_len = 0;
+ }
+
+ if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
+ *fileptr = '\0';
+ }
+
+ if (type_list[type_idx][type_len] != *fileptr) {
+ type_idx++;
+ while (type_list[type_idx]) {
+ if (!strncmp(type_list[type_idx], fileptr - type_len, type_len)) {
+ break;
+ } else {
+ type_idx++;
+ }
+ }
+
+ if (!type_list[type_idx]) {
+ state = ERROR;
+ ErrPrint("type is not valid (%s)\n", fileptr - type_len);
+ continue;
+ }
+ }
+
+ if (!*fileptr) {
+ block->type = type_idx;
+ state = DONE;
+ ptr = NULL;
+ }
+
+ type_len++;
+ break;
+ case FIELD_PART:
+ if (ptr == NULL) {
+ ptr = fileptr;
+ }
+
+ if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
+ *fileptr = '\0';
+ }
+
+ if (!*fileptr) {
+ block->part = ptr;
+ state = DONE;
+ ptr = NULL;
+ }
+ break;
+ case FIELD_DATA:
+ if (ptr == NULL) {
+ ptr = fileptr;
+ }
+
+ if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
+ *fileptr = '\0';
+ }
+
+ if (!*fileptr) {
+ block->data = ptr;
+ state = DONE;
+ ptr = NULL;
+ }
+ break;
+ case FIELD_OPTION:
+ if (ptr == NULL) {
+ ptr = fileptr;
+ }
+
+ if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
+ *fileptr = '\0';
+ }
+
+ if (!*fileptr) {
+ block->option = ptr;
+ state = DONE;
+ ptr = NULL;
+ }
+ break;
+ case FIELD_ID:
+ if (ptr == NULL) {
+ ptr = fileptr;
+ }
+
+ if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
+ *fileptr = '\0';
+ }
+
+ if (!*fileptr) {
+ block->id = ptr;
+ state = DONE;
+ ptr = NULL;
+ }
+ break;
+ case FIELD_TARGET:
+ if (ptr == NULL) {
+ ptr = fileptr;
+ }
+
+ if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
+ *fileptr = '\0';
+ }
+
+ if (!*fileptr) {
+ block->target = ptr;
+ state = DONE;
+ ptr = NULL;
+ }
+ break;
+ case FIELD_FILE:
+ if (ptr == NULL) {
+ ptr = fileptr;
+ }
+
+ if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
+ *fileptr = '\0';
+ }
+
+ if (!*fileptr) {
+ block->target = ptr;
+ state = DONE;
+ ptr = NULL;
+ }
+ default:
+ break;
+ }
+
+ break;
+ case DONE:
+ if (isspace(*fileptr)) {
+ } else if (*fileptr == '}') {
+ state = BEGIN;
+ block->filename = filename;
+ block_list = dlist_append(block_list, block);
+ block = NULL;
+ } else {
+ state = FIELD;
+ continue;
+ }
+ break;
+ case END:
+ default:
+ break;
+ }
+
+ fileptr++;
}
if (state != BEGIN) {
- struct dlist *l;
- struct dlist *n;
- ErrPrint("State %d\n", state);
+ struct dlist *l;
+ struct dlist *n;
+ ErrPrint("State %d\n", state);
- free(filebuf);
- free(block);
+ free(filebuf);
+ free(block);
- dlist_foreach_safe(block_list, l, n, block) {
- free(block);
- block_list = dlist_remove(block_list, l);
- }
+ dlist_foreach_safe(block_list, l, n, block) {
+ free(block);
+ block_list = dlist_remove(block_list, l);
+ }
- return DBOX_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
-
+
block = dlist_data(dlist_prev(block_list));
if (block) {
- block->filebuf = filebuf;
+ block->filebuf = filebuf;
} else {
- ErrPrint("Last block is not exists (There is no parsed block)\n");
- free(filebuf);
+ ErrPrint("Last block is not exists (There is no parsed block)\n");
+ free(filebuf);
}
ErrPrint("Begin: Set content for object\n");
dlist_foreach(common->dynamicbox_list, l, handler) {
- update_begin(handler, is_gbar);
+ update_begin(handler, is_gbar);
}
dlist_foreach_safe(block_list, l, n, block) {
- dlist_foreach(common->dynamicbox_list, handle_iterator, handler) {
- consuming_parsed_block(handler, is_gbar, block);
- }
+ dlist_foreach(common->dynamicbox_list, handle_iterator, handler) {
+ consuming_parsed_block(handler, is_gbar, block);
+ }
- block_list = dlist_remove(block_list, l);
- delete_block(block);
+ block_list = dlist_remove(block_list, l);
+ delete_block(block);
}
dlist_foreach(common->dynamicbox_list, l, handler) {
- update_end(handler, is_gbar);
+ update_end(handler, is_gbar);
}
ErrPrint("End: Set content for object\n");
item = malloc(sizeof(*item));
if (!item) {
- return NULL;
+ return NULL;
}
item->next = NULL;
item->data = data;
if (!list) {
- item->prev = item;
+ item->prev = item;
- list = item;
+ list = item;
} else {
- item->prev = list->prev;
- item->prev->next = item;
- list->prev = item;
+ item->prev = list->prev;
+ item->prev->next = item;
+ list->prev = item;
}
assert(!list->prev->next && "item NEXT");
item = malloc(sizeof(*item));
if (!item) {
- return NULL;
+ return NULL;
}
item->data = data;
if (!list) {
- item->prev = item;
- item->next = NULL;
+ item->prev = item;
+ item->next = NULL;
} else {
- if (list->prev->next) {
- list->prev->next = item;
- }
+ if (list->prev->next) {
+ list->prev->next = item;
+ }
- item->prev = list->prev;
- item->next = list;
+ item->prev = list->prev;
+ item->next = list;
- list->prev = item;
+ list->prev = item;
}
struct dlist *dlist_remove(struct dlist *list, struct dlist *l)
{
if (!list || !l) {
- return NULL;
+ return NULL;
}
if (l == list) {
- list = l->next;
+ list = l->next;
} else {
- l->prev->next = l->next;
+ l->prev->next = l->next;
}
if (l->next) {
- l->next->prev = l->prev;
+ l->next->prev = l->prev;
}
/*!
* \note
* If we didn't care about this, the head element(list) can indicates the invalid element.
*/
else if (list) {
- list->prev = l->prev;
+ list->prev = l->prev;
}
free(l);
void *_data;
dlist_foreach(list, l, _data) {
- if (data == _data) {
- return l;
- }
+ if (data == _data) {
+ return l;
+ }
}
return NULL;
i = 0;
dlist_foreach(l, n, data) {
- i++;
+ i++;
}
return i;
i = 0;
for (n = l; n; n = n->next) {
- if (i == nth) {
- return n;
- }
- i++;
+ if (i == nth) {
+ return n;
+ }
+ i++;
}
return NULL;
struct dlist *job_list;
struct launch {
- int (*handler)(dynamicbox_h handler, const char *appid, void *data);
- void *data;
+ int (*handler)(dynamicbox_h handler, const char *appid, void *data);
+ void *data;
} launch;
} s_info = {
.init_count = 0,
.job_timer = 0,
.job_list = NULL,
.launch = {
- .handler = default_launch_handler,
- .data = NULL,
+ .handler = default_launch_handler,
+ .data = NULL,
},
};
ret = aul_launch_app(appid, NULL);
if (ret <= 0) {
- ErrPrint("Failed to launch an app %s (%d)\n", appid, ret);
+ ErrPrint("Failed to launch an app %s (%d)\n", appid, ret);
}
/*
int ret;
if (!result) {
- ret = DBOX_STATUS_ERROR_FAULT;
- goto errout;
+ ret = DBOX_STATUS_ERROR_FAULT;
+ goto errout;
} else if (packet_get(result, "i", &ret) != 1) {
- ErrPrint("Invalid argument\n");
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- goto errout;
+ ErrPrint("Invalid argument\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ goto errout;
}
if (ret < 0) {
- ErrPrint("Resize request is failed: %d\n", ret);
- goto errout;
+ ErrPrint("Resize request is failed: %d\n", ret);
+ goto errout;
}
return;
handler->common->request.update_mode = 0;
if (handler->common->state != DBOX_STATE_DELETE) {
- if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
- dbox_unref(handler, 1);
- }
+ if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
+ }
}
}
int ret;
if (!result) {
- ret = DBOX_STATUS_ERROR_FAULT;
- goto errout;
+ ret = DBOX_STATUS_ERROR_FAULT;
+ goto errout;
} else if (packet_get(result, "i", &ret) != 1) {
- ErrPrint("Invalid argument\n");
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- goto errout;
+ ErrPrint("Invalid argument\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ goto errout;
}
/*!
* after this request.
*/
if (ret < 0) {
- ErrPrint("Resize request is failed: %d\n", ret);
- goto errout;
+ ErrPrint("Resize request is failed: %d\n", ret);
+ goto errout;
}
return;
handler->common->request.size_changed = 0;
if (handler->common->state != DBOX_STATE_DELETE) {
- if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
- dbox_unref(handler, 1);
- }
+ if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
+ }
}
}
dbox_destroy_cb_info(info);
if (!result) {
- ret = DBOX_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
- ErrPrint("Invalid argument\n");
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid argument\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (cb) {
- cb(handler, ret, cbdata);
+ cb(handler, ret, cbdata);
}
return;
}
int ret;
if (!result) {
- ret = DBOX_STATUS_ERROR_FAULT;
- goto errout;
+ ret = DBOX_STATUS_ERROR_FAULT;
+ goto errout;
} else if (packet_get(result, "i", &ret) != 1) {
- ErrPrint("Invalid argument\n");
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- goto errout;
+ ErrPrint("Invalid argument\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ goto errout;
}
if (ret < 0) {
- goto errout;
+ goto errout;
}
return;
handler->common->request.group_changed = 0;
if (handler->common->state != DBOX_STATE_DELETE) {
- if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
- dbox_unref(handler, 1);
- }
+ if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
+ }
}
}
int ret;
if (!result) {
- ret = DBOX_STATUS_ERROR_FAULT;
- goto errout;
+ ret = DBOX_STATUS_ERROR_FAULT;
+ goto errout;
} else if (packet_get(result, "i", &ret) != 1) {
- ErrPrint("Invalid argument\n");
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- goto errout;
+ ErrPrint("Invalid argument\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ goto errout;
}
if (ret < 0) {
- goto errout;
+ goto errout;
}
return;
handler->common->request.period_changed = 0;
if (handler->common->state != DBOX_STATE_DELETE) {
- if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
- dbox_unref(handler, 1);
- }
+ if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
+ }
}
}
int ret;
if (!result) {
- ret = DBOX_STATUS_ERROR_FAULT;
- goto errout;
+ ret = DBOX_STATUS_ERROR_FAULT;
+ goto errout;
} else if (packet_get(result, "i", &ret) != 1) {
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- goto errout;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ goto errout;
}
if (ret < 0) {
- ErrPrint("Failed to create a GBAR[%d]\n", ret);
- goto errout;
+ ErrPrint("Failed to create a GBAR[%d]\n", ret);
+ goto errout;
}
return;
handler->common->request.gbar_created = 0;
if (handler->common->state != DBOX_STATE_DELETE) {
- if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
- dbox_unref(handler, 1);
- }
+ if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
+ }
}
}
dbox_destroy_cb_info(info);
if (!result) {
- ret = DBOX_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
} else if (packet_get(result, "is", &ret, &pkgname) != 2) {
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (cb) {
- cb(handler, ret, cbdata);
+ cb(handler, ret, cbdata);
}
}
dbox_destroy_cb_info(info);
if (!result) {
- ErrPrint("Result is NIL (may connection lost)\n");
- ret = DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Result is NIL (may connection lost)\n");
+ ret = DBOX_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
- ErrPrint("Invalid parameter\n");
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid parameter\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (ret == (int)DBOX_STATUS_ERROR_NONE) {
- handler->cbs.gbar_destroyed.cb = cb;
- handler->cbs.gbar_destroyed.data = cbdata;
+ handler->cbs.gbar_destroyed.cb = cb;
+ handler->cbs.gbar_destroyed.data = cbdata;
} else {
- handler->common->is_gbar_created = 0;
- handler->common->request.gbar_destroyed = 0;
+ handler->common->is_gbar_created = 0;
+ handler->common->request.gbar_destroyed = 0;
- if (cb) {
- cb(handler, ret, cbdata);
- }
+ if (cb) {
+ cb(handler, ret, cbdata);
+ }
}
}
dbox_destroy_cb_info(info);
if (!result) {
- ret = DBOX_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (cb) {
- cb(handler, ret, cbdata);
+ cb(handler, ret, cbdata);
}
}
dbox_destroy_cb_info(info);
if (!result) {
- ret = DBOX_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (cb) {
- cb(handler, ret, cbdata);
+ cb(handler, ret, cbdata);
}
}
id = fb_id(handler->common->dbox.fb);
if (!id || strncasecmp(id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet = packet_create((const char *)&cmd, "ss", handler->common->pkgname, handler->common->id);
if (!packet) {
- ErrPrint("Failed to build a param\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to build a param\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
- packet_destroy(packet);
- return DBOX_STATUS_ERROR_FAULT;
+ packet_destroy(packet);
+ return DBOX_STATUS_ERROR_FAULT;
}
ret = master_rpc_async_request(handler, packet, 0, dbox_pixmap_acquired_cb, cbinfo);
if (ret < 0) {
- dbox_destroy_cb_info(cbinfo);
+ dbox_destroy_cb_info(cbinfo);
}
return ret;
dbox_destroy_cb_info(info);
if (!result) {
- pixmap = 0; /* PIXMAP 0 means error */
+ pixmap = 0; /* PIXMAP 0 means error */
} else if (packet_get(result, "ii", &pixmap, &ret) != 2) {
- pixmap = 0;
+ pixmap = 0;
}
if (ret == (int)DBOX_STATUS_ERROR_BUSY) {
- ret = dbox_acquire_dbox_pixmap(handler, cb, cbdata);
- DbgPrint("Busy, Try again: %d\n", ret);
- /* Try again */
+ ret = dbox_acquire_dbox_pixmap(handler, cb, cbdata);
+ DbgPrint("Busy, Try again: %d\n", ret);
+ /* Try again */
} else if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
- if (cb) {
- cb(handler, pixmap, cbdata);
- }
-
- if (handler->common->state != DBOX_STATE_DELETE) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
- dbox_unref(handler, 1);
- }
+ if (cb) {
+ cb(handler, pixmap, cbdata);
+ }
+
+ if (handler->common->state != DBOX_STATE_DELETE) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
+ }
} else {
- if (cb) {
- cb(handler, pixmap, cbdata);
- }
+ if (cb) {
+ cb(handler, pixmap, cbdata);
+ }
}
}
dbox_destroy_cb_info(info);
if (!result) {
- pixmap = 0;
+ pixmap = 0;
} else if (packet_get(result, "ii", &pixmap, &ret) != 2) {
- pixmap = 0;
+ pixmap = 0;
}
if (cb) {
- cb(handler, pixmap, cbdata);
+ cb(handler, pixmap, cbdata);
}
if (handler->common->state != DBOX_STATE_DELETE) {
- if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
- dbox_unref(handler, 1);
- }
+ if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
+ }
}
}
packet = packet_create((const char *)&cmd, "ssi", handler->common->pkgname, handler->common->id, idx);
if (!packet) {
- ErrPrint("Failed to build a param\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to build a param\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
- packet_destroy(packet);
- return DBOX_STATUS_ERROR_FAULT;
+ packet_destroy(packet);
+ return DBOX_STATUS_ERROR_FAULT;
}
ret = master_rpc_async_request(handler, packet, 0, gbar_xpixmap_acquired_cb, cbinfo);
if (ret < 0) {
- /*!
- * \note
- * Packet will be destroyed by master_rpc_async_request
- */
- dbox_destroy_cb_info(cbinfo);
+ /*!
+ * \note
+ * Packet will be destroyed by master_rpc_async_request
+ */
+ dbox_destroy_cb_info(cbinfo);
}
return ret;
packet = packet_create((const char *)&cmd, "ssi", handler->common->pkgname, handler->common->id, idx);
if (!packet) {
- ErrPrint("Failed to build a param\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to build a param\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
- packet_destroy(packet);
- return DBOX_STATUS_ERROR_FAULT;
+ packet_destroy(packet);
+ return DBOX_STATUS_ERROR_FAULT;
}
ret = master_rpc_async_request(handler, packet, 0, dbox_xpixmap_acquired_cb, cbinfo);
if (ret < 0) {
- /*!
- * \note
- * Packet will be destroyed by master_rpc_async_request
- */
- dbox_destroy_cb_info(cbinfo);
+ /*!
+ * \note
+ * Packet will be destroyed by master_rpc_async_request
+ */
+ dbox_destroy_cb_info(cbinfo);
}
return ret;
id = fb_id(handler->common->gbar.fb);
if (!id || strncasecmp(id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet = packet_create((const char *)&cmd, "ss", handler->common->pkgname, handler->common->id);
if (!packet) {
- ErrPrint("Failed to build a param\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to build a param\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
- packet_destroy(packet);
- return DBOX_STATUS_ERROR_FAULT;
+ packet_destroy(packet);
+ return DBOX_STATUS_ERROR_FAULT;
}
ret = master_rpc_async_request(handler, packet, 0, gbar_pixmap_acquired_cb, cbinfo);
if (ret < 0) {
- /*!
- * \note
- * Packet will be destroyed by master_rpc_async_request
- */
- dbox_destroy_cb_info(cbinfo);
+ /*!
+ * \note
+ * Packet will be destroyed by master_rpc_async_request
+ */
+ dbox_destroy_cb_info(cbinfo);
}
return ret;
dbox_destroy_cb_info(info);
if (!result) {
- pixmap = 0; /* PIXMAP 0 means error */
- ret = DBOX_STATUS_ERROR_FAULT;
+ pixmap = 0; /* PIXMAP 0 means error */
+ ret = DBOX_STATUS_ERROR_FAULT;
} else if (packet_get(result, "ii", &pixmap, &ret) != 2) {
- pixmap = 0;
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ pixmap = 0;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (cb) {
- DbgPrint("ret: %x, pixmap: %d\n", ret, pixmap);
- cb(handler, pixmap, cbdata);
+ DbgPrint("ret: %x, pixmap: %d\n", ret, pixmap);
+ cb(handler, pixmap, cbdata);
}
if (handler->common->state != DBOX_STATE_DELETE) {
- if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
- dbox_unref(handler, 1);
- }
+ if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
+ }
}
}
dbox_destroy_cb_info(info);
if (!result) {
- pixmap = 0; /* PIXMAP 0 means error */
- ret = DBOX_STATUS_ERROR_FAULT;
+ pixmap = 0; /* PIXMAP 0 means error */
+ ret = DBOX_STATUS_ERROR_FAULT;
} else if (packet_get(result, "ii", &pixmap, &ret) != 2) {
- pixmap = 0;
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ pixmap = 0;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (ret == (int)DBOX_STATUS_ERROR_BUSY) {
- ret = dbox_acquire_gbar_pixmap(handler, cb, cbdata);
- DbgPrint("Busy, Try again: %d\n", ret);
- /* Try again */
+ ret = dbox_acquire_gbar_pixmap(handler, cb, cbdata);
+ DbgPrint("Busy, Try again: %d\n", ret);
+ /* Try again */
} else if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
- if (cb) {
- cb(handler, pixmap, cbdata);
- }
-
- if (handler->common->state != DBOX_STATE_DELETE) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
- dbox_unref(handler, 1);
- }
+ if (cb) {
+ cb(handler, pixmap, cbdata);
+ }
+
+ if (handler->common->state != DBOX_STATE_DELETE) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
+ }
} else {
- if (cb) {
- DbgPrint("ret: %d, pixmap: %d\n", ret, pixmap);
- cb(handler, pixmap, cbdata);
- }
+ if (cb) {
+ DbgPrint("ret: %d, pixmap: %d\n", ret, pixmap);
+ cb(handler, pixmap, cbdata);
+ }
}
}
int ret;
if (!result) {
- ret = DBOX_STATUS_ERROR_FAULT;
- goto errout;
+ ret = DBOX_STATUS_ERROR_FAULT;
+ goto errout;
} else if (packet_get(result, "i", &ret) != 1) {
- goto errout;
+ goto errout;
}
if (ret < 0) {
- goto errout;
+ goto errout;
}
return;
handler->common->request.pinup = 0;
if (handler->common->state != DBOX_STATE_DELETE) {
- if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
- dbox_unref(handler, 1);
- }
+ if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
+ }
}
}
int ret;
if (!result) {
- ret = DBOX_STATUS_ERROR_FAULT;
- return;
+ ret = DBOX_STATUS_ERROR_FAULT;
+ return;
}
if (packet_get(result, "i", &ret) != 1) {
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- return;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ return;
}
if (ret != DBOX_STATUS_ERROR_NONE) {
- goto errout;
+ goto errout;
}
return;
handler->common->request.key_event = 0;
if (handler->common->state != DBOX_STATE_DELETE) {
- if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
- dbox_unref(handler, 1);
- }
+ if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
+ }
}
}
int ret;
if (!result) {
- ret = DBOX_STATUS_ERROR_FAULT;
- return;
+ ret = DBOX_STATUS_ERROR_FAULT;
+ return;
}
if (packet_get(result, "i", &ret) != 1) {
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- return;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ return;
}
if (ret != DBOX_STATUS_ERROR_NONE) {
- goto errout;
+ goto errout;
}
return;
handler->common->request.access_event = 0;
if (handler->common->state != DBOX_STATE_DELETE) {
- if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
- dbox_unref(handler, 1);
- }
+ if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST && handler->refcnt == 2) {
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
+ }
}
}
packet = packet_create(event, "ssdiii", handler->common->pkgname, handler->common->id, timestamp, x, y, type);
if (!packet) {
- ErrPrint("Failed to build packet\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to build packet\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_async_request(handler, packet, 0, access_ret_cb, NULL);
timestamp = util_timestamp();
packet = packet_create(event, "ssdi", handler->common->pkgname, handler->common->id, timestamp, keycode);
if (!packet) {
- ErrPrint("Failed to build packet\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to build packet\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_async_request(handler, packet, 0, key_ret_cb, NULL);
timestamp = util_timestamp();
packet = packet_create_noack(event, "ssdii", handler->common->pkgname, handler->common->id, timestamp, x, y);
if (!packet) {
- ErrPrint("Failed to build param\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to build param\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(handler, packet);
snprintf(filename, sizeof(filename), "/tmp/%d.box.log", getpid());
__file_log_fp = fopen(filename, "w+t");
if (!__file_log_fp) {
- __file_log_fp = fdopen(1, "w+t");
+ __file_log_fp = fdopen(1, "w+t");
}
#endif
ret = dynamicbox_service_init();
if (ret != DBOX_STATUS_ERROR_NONE) {
- return ret;
+ return ret;
}
ret = fb_init(disp);
if (ret != DBOX_STATUS_ERROR_NONE) {
- dynamicbox_service_fini();
- return ret;
+ dynamicbox_service_fini();
+ return ret;
}
ret = client_init(use_thread);
if (ret != DBOX_STATUS_ERROR_NONE) {
- fb_fini();
- dynamicbox_service_fini();
- return ret;
+ fb_fini();
+ dynamicbox_service_fini();
+ return ret;
}
s_info.init_count++;
dbox = dynamicbox_service_dbox_id(pkgname);
if (!dbox) {
- dbox = strdup(pkgname);
+ dbox = strdup(pkgname);
}
return dbox;
l = dlist_nth(s_info.job_list, 0);
if (!l) {
- s_info.job_timer = 0;
- return FALSE;
+ s_info.job_timer = 0;
+ return FALSE;
}
item = dlist_data(l);
s_info.job_list = dlist_remove(s_info.job_list, l);
if (item) {
- item->cb(item->handle, item->ret, item->data);
- dbox_unref(item->handle, 1);
- free(item);
+ item->cb(item->handle, item->ret, item->data);
+ dbox_unref(item->handle, 1);
+ free(item);
}
return TRUE;
struct job_item *item;
if (!job_cb) {
- ErrPrint("Invalid argument\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid argument\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
item = malloc(sizeof(*item));
if (!item) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
}
item->handle = dbox_ref(handle);
s_info.job_list = dlist_append(s_info.job_list, item);
if (!s_info.job_timer) {
- s_info.job_timer = g_timeout_add(1, job_execute_cb, NULL);
- if (!s_info.job_timer) {
- ErrPrint("Failed to create a job timer\n");
- }
+ s_info.job_timer = g_timeout_add(1, job_execute_cb, NULL);
+ if (!s_info.job_timer) {
+ ErrPrint("Failed to create a job timer\n");
+ }
}
return DBOX_STATUS_ERROR_NONE;
dbox_destroy_cb_info(info);
if (!result) {
- ret = DBOX_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (ret >= 0) {
- handler->cbs.created.cb = cb;
- handler->cbs.created.data = cbdata;
-
- /*!
- * \note
- * Don't go anymore ;)
- */
- return;
+ handler->cbs.created.cb = cb;
+ handler->cbs.created.data = cbdata;
+
+ /*!
+ * \note
+ * Don't go anymore ;)
+ */
+ return;
} else if (cb) {
- /*!
- * \note
- * It means the current instance is not created,
- * so user has to know about this.
- * notice it to user using "deleted" event.
- */
- cb(handler, ret, cbdata);
+ /*!
+ * \note
+ * It means the current instance is not created,
+ * so user has to know about this.
+ * notice it to user using "deleted" event.
+ */
+ cb(handler, ret, cbdata);
}
dbox_unref(handler, 1);
common = handler->common;
packet = packet_create((const char *)&cmd, "dssssdii",
- common->timestamp, common->pkgname, common->content,
- common->cluster, common->category,
- common->dbox.period, common->dbox.width, common->dbox.height);
+ common->timestamp, common->pkgname, common->content,
+ common->cluster, common->category,
+ common->dbox.period, common->dbox.width, common->dbox.height);
if (!packet) {
- ErrPrint("Failed to create a new packet\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to create a new packet\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ return DBOX_STATUS_ERROR_FAULT;
}
cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
- ErrPrint("Failed to create a cbinfo\n");
- packet_destroy(packet);
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ ErrPrint("Failed to create a cbinfo\n");
+ packet_destroy(packet);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
}
/*!
*/
ret = master_rpc_async_request(handler, packet, 0, new_ret_cb, cbinfo);
if (ret < 0) {
- ErrPrint("Failed to send a new packet\n");
- dbox_destroy_cb_info(cbinfo);
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to send a new packet\n");
+ dbox_destroy_cb_info(cbinfo);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ return DBOX_STATUS_ERROR_FAULT;
}
handler->common->request.created = 1;
return DBOX_STATUS_ERROR_NONE;
struct cb_info *cbinfo = data;
if (cbinfo->cb) {
- cbinfo->cb(handle, ret, cbinfo->data);
+ cbinfo->cb(handle, ret, cbinfo->data);
}
dbox_destroy_cb_info(cbinfo);
cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
- ErrPrint("Failed to create a cbinfo\n");
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ ErrPrint("Failed to create a cbinfo\n");
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
}
if (job_add(handler, create_cb, DBOX_STATUS_ERROR_NONE, cbinfo) != DBOX_STATUS_ERROR_NONE) {
- dbox_destroy_cb_info(cbinfo);
+ dbox_destroy_cb_info(cbinfo);
}
return DBOX_STATUS_ERROR_NONE;
static void refresh_for_paused_updating_cb(dynamicbox_h handle, int ret, void *data)
{
if (handle->paused_updating == 0) {
- DbgPrint("Paused updates are cleared\n");
- return;
+ DbgPrint("Paused updates are cleared\n");
+ return;
}
DbgPrint("Pending updates are found\n");
int ret;
if (handler->common->visible != DBOX_SHOW && state == DBOX_SHOW) {
- need_to_add_job = !!handler->paused_updating;
+ need_to_add_job = !!handler->paused_updating;
} else if (handler->common->visible == DBOX_SHOW && state != DBOX_SHOW) {
- if (!!dbox_find_dbox_in_show(handler->common)) {
- return DBOX_STATUS_ERROR_NONE;
- }
+ if (!!dbox_find_dbox_in_show(handler->common)) {
+ return DBOX_STATUS_ERROR_NONE;
+ }
} else if (handler->common->visible == DBOX_SHOW && state == DBOX_SHOW && handler->paused_updating) {
- if (job_add(handler, refresh_for_paused_updating_cb, DBOX_STATUS_ERROR_NONE, NULL) < 0) {
- ErrPrint("Unable to add a new job for refreshing box\n");
- }
+ if (job_add(handler, refresh_for_paused_updating_cb, DBOX_STATUS_ERROR_NONE, NULL) < 0) {
+ ErrPrint("Unable to add a new job for refreshing box\n");
+ }
- return DBOX_STATUS_ERROR_NONE;
+ return DBOX_STATUS_ERROR_NONE;
} else {
- /*!
- * \brief
- * No need to send this to the master
- */
- return DBOX_STATUS_ERROR_NONE;
+ /*!
+ * \brief
+ * No need to send this to the master
+ */
+ return DBOX_STATUS_ERROR_NONE;
}
packet = packet_create_noack((const char *)&cmd, "ssi", handler->common->pkgname, handler->common->id, (int)state);
if (!packet) {
- ErrPrint("Failed to create a packet\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to create a packet\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
ret = master_rpc_request_only(handler, packet);
if (ret == (int)DBOX_STATUS_ERROR_NONE) {
- DbgPrint("[%s] visibility is changed 0x[%x]\n", handler->common->pkgname, state);
- handler->common->visible = state;
+ DbgPrint("[%s] visibility is changed 0x[%x]\n", handler->common->pkgname, state);
+ handler->common->visible = state;
- if (need_to_add_job) {
- if (job_add(handler, refresh_for_paused_updating_cb, DBOX_STATUS_ERROR_NONE, NULL) < 0) {
- ErrPrint("Unable to add a new job for refreshing box\n");
- }
- }
+ if (need_to_add_job) {
+ if (job_add(handler, refresh_for_paused_updating_cb, DBOX_STATUS_ERROR_NONE, NULL) < 0) {
+ ErrPrint("Unable to add a new job for refreshing box\n");
+ }
+ }
}
return ret;
item = dbox_find_dbox_in_show(old_common);
if (!item) {
- item = dbox_get_dbox_nth(old_common, 0);
- if (item) {
- dbox_set_visibility(item, DBOX_HIDE_WITH_PAUSE);
+ item = dbox_get_dbox_nth(old_common, 0);
+ if (item) {
+ dbox_set_visibility(item, DBOX_HIDE_WITH_PAUSE);
+ } else {
+ ErrPrint("Unable to get the valid handle from common handler\n");
+ }
} else {
- ErrPrint("Unable to get the valid handle from common handler\n");
- }
- } else {
- dbox_set_visibility(item, DBOX_SHOW);
+ dbox_set_visibility(item, DBOX_SHOW);
}
}
dynamicbox_ret_cb cb;
if (handle->visible == DBOX_SHOW) {
- dbox_update_visibility(handle->common);
+ dbox_update_visibility(handle->common);
}
cb = cbinfo->cb;
dbox_destroy_cb_info(cbinfo);
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);
- }
+ DbgPrint("[%s] %d\n", handle->common->pkgname, handle->refcnt);
+ if (cb) {
+ cb(handle, DBOX_STATUS_ERROR_NONE, data);
+ }
- return;
+ return;
}
if (handle->common->refcnt == 1) {
- handle->common->delete_type = type;
- handle->common->state = DBOX_STATE_DELETE;
-
- if (!handle->common->id) {
- /*!
- * \note
- * The id is not determined yet.
- * It means a user didn't receive created event yet.
- * Then just stop to delete procedure from here.
- * Because the "created" event handle will release this.
- * By the way, if the user adds any callback for getting return status of this,
- * call it at here.
- */
- if (cb) {
- cb(handle, DBOX_STATUS_ERROR_NONE, data);
- }
- }
-
- DbgPrint("Send delete request\n");
- dbox_send_delete(handle, type, cb, data);
+ handle->common->delete_type = type;
+ handle->common->state = DBOX_STATE_DELETE;
+
+ if (!handle->common->id) {
+ /*!
+ * \note
+ * The id is not determined yet.
+ * It means a user didn't receive created event yet.
+ * Then just stop to delete procedure from here.
+ * Because the "created" event handle will release this.
+ * By the way, if the user adds any callback for getting return status of this,
+ * call it at here.
+ */
+ if (cb) {
+ cb(handle, DBOX_STATUS_ERROR_NONE, data);
+ }
+ }
+
+ DbgPrint("Send delete request\n");
+ dbox_send_delete(handle, type, cb, data);
} else {
- if (cb) {
- cb(handle, DBOX_STATUS_ERROR_NONE, data);
- }
+ if (cb) {
+ cb(handle, DBOX_STATUS_ERROR_NONE, data);
+ }
- DbgPrint("Before unref: %d\n", handle->common->refcnt);
- dbox_unref(handle, 1);
+ DbgPrint("Before unref: %d\n", handle->common->refcnt);
+ dbox_unref(handle, 1);
}
}
struct cb_info *info = data;
if (info->cb) {
- info->cb(handler, ret, info->data);
+ info->cb(handler, ret, info->data);
}
free(info);
static void turn_off_gbar_destroyed_flag_cb(dynamicbox_h handler, int ret, void *data)
{
if (handler->common->request.gbar_destroyed) {
- dynamicbox_ret_cb cb;
- void *data;
+ dynamicbox_ret_cb cb;
+ void *data;
- DbgPrint("gbar_destroyed request is canceled\n");
- handler->common->request.gbar_destroyed = 0;
- cb = handler->cbs.gbar_destroyed.cb;
- data = handler->cbs.gbar_destroyed.data;
- handler->cbs.gbar_destroyed.cb = NULL;
- handler->cbs.gbar_destroyed.data = NULL;
+ DbgPrint("gbar_destroyed request is canceled\n");
+ handler->common->request.gbar_destroyed = 0;
+ cb = handler->cbs.gbar_destroyed.cb;
+ data = handler->cbs.gbar_destroyed.data;
+ handler->cbs.gbar_destroyed.cb = NULL;
+ handler->cbs.gbar_destroyed.data = NULL;
- if (cb) {
- cb(handler, ret, data);
- }
+ if (cb) {
+ cb(handler, ret, data);
+ }
}
}
static void turn_off_gbar_created_flag_cb(dynamicbox_h handler, int ret, void *data)
{
if (handler->common->request.gbar_created) {
- dynamicbox_ret_cb cb;
- void *data;
+ dynamicbox_ret_cb cb;
+ void *data;
- DbgPrint("gbar_created request is canceled\n");
- handler->common->request.gbar_created = 0;
- cb = handler->cbs.gbar_created.cb;
- data = handler->cbs.gbar_created.data;
- handler->cbs.gbar_created.cb = NULL;
- handler->cbs.gbar_created.data = NULL;
+ DbgPrint("gbar_created request is canceled\n");
+ handler->common->request.gbar_created = 0;
+ cb = handler->cbs.gbar_created.cb;
+ data = handler->cbs.gbar_created.data;
+ handler->cbs.gbar_created.cb = NULL;
+ handler->cbs.gbar_created.data = NULL;
- if (cb) {
- cb(handler, ret, data);
- }
+ if (cb) {
+ cb(handler, ret, data);
+ }
}
}
EAPI int dynamicbox_init(void *disp, int prevent_overwrite, double event_filter, int use_thread)
{
if (s_info.init_count > 0) {
- s_info.init_count++;
- return DBOX_STATUS_ERROR_NONE;
+ s_info.init_count++;
+ return DBOX_STATUS_ERROR_NONE;
}
/*!
EAPI int dynamicbox_fini(void)
{
if (s_info.init_count <= 0) {
- ErrPrint("Doesn't initialized\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Doesn't initialized\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
s_info.init_count--;
if (s_info.init_count > 0) {
- ErrPrint("init count : %d\n", s_info.init_count);
- return DBOX_STATUS_ERROR_NONE;
+ ErrPrint("init count : %d\n", s_info.init_count);
+ return DBOX_STATUS_ERROR_NONE;
}
client_fini();
int h = 0;
if (!pkgname || !cluster || !category) {
- ErrPrint("Invalid arguments: pkgname[%p], cluster[%p], category[%p]\n",
- pkgname, cluster, category);
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
+ ErrPrint("Invalid arguments: pkgname[%p], cluster[%p], category[%p]\n",
+ pkgname, cluster, category);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
}
dboxid = dbox_pkgname(pkgname);
if (!dboxid) {
- ErrPrint("Invalid package: %s\n", pkgname);
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
+ ErrPrint("Invalid package: %s\n", pkgname);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
}
if (dynamicbox_service_is_enabled(dboxid) == 0) {
- DbgPrint("Livebox [%s](%s) is disabled package\n", dboxid, pkgname);
- free(dboxid);
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_DISABLED);
- return NULL;
+ DbgPrint("Livebox [%s](%s) is disabled package\n", dboxid, pkgname);
+ free(dboxid);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_DISABLED);
+ return NULL;
}
if (type != DBOX_SIZE_TYPE_UNKNOWN) {
- (void)dynamicbox_service_get_size(type, &w, &h);
+ (void)dynamicbox_service_get_size(type, &w, &h);
}
handler = calloc(1, sizeof(*handler));
if (!handler) {
- ErrPrint("Error: %s\n", strerror(errno));
- free(dboxid);
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
- return NULL;
+ ErrPrint("Error: %s\n", strerror(errno));
+ free(dboxid);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ return NULL;
}
if (!cb) {
- cb = default_create_cb;
+ cb = default_create_cb;
}
handler->common = dbox_find_sharable_common_handle(dboxid, content, w, h, cluster, category);
if (!handler->common) {
- handler->common = dbox_create_common_handle(handler, dboxid, cluster, category);
- free(dboxid);
- if (!handler->common) {
- ErrPrint("Failed to find common handle\n");
- free(handler);
- return NULL;
- }
-
- if (!content || !strlen(content)) {
- char *pc;
- /**
- * @note
- * I know the content should not be modified. use it temporarly without "const"
- */
- pc = dynamicbox_service_content(handler->common->pkgname);
- dbox_set_content(handler->common, pc);
- free(pc);
+ handler->common = dbox_create_common_handle(handler, dboxid, cluster, category);
+ free(dboxid);
+ if (!handler->common) {
+ ErrPrint("Failed to find common handle\n");
+ free(handler);
+ return NULL;
+ }
+
+ if (!content || !strlen(content)) {
+ char *pc;
+ /**
+ * @note
+ * I know the content should not be modified. use it temporarly without "const"
+ */
+ pc = dynamicbox_service_content(handler->common->pkgname);
+ dbox_set_content(handler->common, pc);
+ free(pc);
+ } else {
+ dbox_set_content(handler->common, content);
+ }
+
+ dbox_set_period(handler->common, period);
+ dbox_set_size(handler->common, w, h);
+ dbox_common_ref(handler->common, handler);
+
+ if (create_real_instance(handler, cb, data) < 0) {
+ if (dbox_common_unref(handler->common, handler) == 0) {
+ /*!
+ * Delete common
+ */
+ dbox_destroy_common_handle(handler->common);
+ handler->common = NULL;
+ }
+ free(handler);
+ return NULL;
+ }
} else {
- dbox_set_content(handler->common, content);
- }
-
- dbox_set_period(handler->common, period);
- dbox_set_size(handler->common, w, h);
- dbox_common_ref(handler->common, handler);
-
- if (create_real_instance(handler, cb, data) < 0) {
- if (dbox_common_unref(handler->common, handler) == 0) {
- /*!
- * Delete common
- */
- dbox_destroy_common_handle(handler->common);
- handler->common = NULL;
- }
- free(handler);
- return NULL;
- }
- } else {
- free(dboxid);
-
- dbox_common_ref(handler->common, handler);
-
- if (handler->common->request.created) {
- /*!
- * If a box is in creating, wait its result too
- */
- handler->cbs.created.cb = cb;
- handler->cbs.created.data = data;
- } else {
- /*!
- * or fire the fake created_event
- */
- if (create_fake_instance(handler, cb, data) < 0) {
- if (dbox_common_unref(handler->common, handler) == 0) {
- /*!
- * Delete common
- */
- dbox_destroy_common_handle(handler->common);
- }
- free(handler);
- return NULL;
- }
- }
+ free(dboxid);
+
+ dbox_common_ref(handler->common, handler);
+
+ if (handler->common->request.created) {
+ /*!
+ * If a box is in creating, wait its result too
+ */
+ handler->cbs.created.cb = cb;
+ handler->cbs.created.data = data;
+ } else {
+ /*!
+ * or fire the fake created_event
+ */
+ if (create_fake_instance(handler, cb, data) < 0) {
+ if (dbox_common_unref(handler->common, handler) == 0) {
+ /*!
+ * Delete common
+ */
+ dbox_destroy_common_handle(handler->common);
+ }
+ free(handler);
+ return NULL;
+ }
+ }
}
handler->visible = DBOX_SHOW;
handler = dbox_ref(handler);
if (handler->common->visible != DBOX_SHOW) {
- dbox_set_visibility(handler, DBOX_SHOW);
+ dbox_set_visibility(handler, DBOX_SHOW);
}
return handler;
EAPI double dynamicbox_period(dynamicbox_h handler)
{
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is not valid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return -1.0f;
+ ErrPrint("Handler is not valid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return -1.0f;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Invalid handle\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return -1.0f;
+ ErrPrint("Invalid handle\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return -1.0f;
}
if (!handler->common->id) {
- ErrPrint("Hnalder is not valid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return -1.0f;
+ ErrPrint("Hnalder is not valid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return -1.0f;
}
return handler->common->dbox.period;
int ret;
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Invalid handle\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handle\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (handler->common->request.period_changed) {
- ErrPrint("Previous request for changing period is not finished\n");
- return DBOX_STATUS_ERROR_BUSY;
+ ErrPrint("Previous request for changing period is not finished\n");
+ return DBOX_STATUS_ERROR_BUSY;
}
if (!handler->common->is_user) {
- ErrPrint("CA Livebox is not able to change the period\n");
- return DBOX_STATUS_ERROR_PERMISSION_DENIED;
+ ErrPrint("CA Livebox is not able to change the period\n");
+ return DBOX_STATUS_ERROR_PERMISSION_DENIED;
}
if (handler->common->dbox.period == period) {
- DbgPrint("No changes\n");
- return DBOX_STATUS_ERROR_ALREADY;
+ DbgPrint("No changes\n");
+ return DBOX_STATUS_ERROR_ALREADY;
}
packet = packet_create((const char *)&cmd, "ssd", handler->common->pkgname, handler->common->id, period);
if (!packet) {
- ErrPrint("Failed to build a packet %s\n", handler->common->pkgname);
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to build a packet %s\n", handler->common->pkgname);
+ return DBOX_STATUS_ERROR_FAULT;
}
if (!cb) {
- cb = default_period_changed_cb;
+ cb = default_period_changed_cb;
}
ret = master_rpc_async_request(handler, packet, 0, period_ret_cb, NULL);
if (ret == (int)DBOX_STATUS_ERROR_NONE) {
- handler->cbs.period_changed.cb = cb;
- handler->cbs.period_changed.data = data;
- handler->common->request.period_changed = 1;
+ handler->cbs.period_changed.cb = cb;
+ handler->cbs.period_changed.data = data;
+ handler->common->request.period_changed = 1;
}
return ret;
struct cb_info *cbinfo;
if (!handler) {
- ErrPrint("Handler is NIL\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is NIL\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is already deleted\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is already deleted\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
handler->state = DBOX_STATE_DELETE;
cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
- ErrPrint("Failed to create a cbinfo\n");
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ ErrPrint("Failed to create a cbinfo\n");
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
}
if (job_add(handler, job_del_cb, type, cbinfo) != DBOX_STATUS_ERROR_NONE) {
- ErrPrint("Failed to add a new job\n");
- dbox_destroy_cb_info(cbinfo);
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to add a new job\n");
+ dbox_destroy_cb_info(cbinfo);
+ return DBOX_STATUS_ERROR_FAULT;
}
return DBOX_STATUS_ERROR_NONE;
EAPI int dynamicbox_add_fault_handler(dynamicbox_fault_handler_cb dbox_cb, void *data)
{
if (!dbox_cb) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return dbox_add_fault_handler(dbox_cb, data);
EAPI void *dynamicbox_remove_fault_handler(dynamicbox_fault_handler_cb dbox_cb)
{
if (!dbox_cb) {
- return NULL;
+ return NULL;
}
return dbox_remove_fault_handler(dbox_cb);
EAPI int dynamicbox_add_event_handler(dynamicbox_event_handler_cb dbox_cb, void *data)
{
if (!dbox_cb) {
- ErrPrint("Invalid argument dbox_cb is nil\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid argument dbox_cb is nil\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return dbox_add_event_handler(dbox_cb, data);
EAPI void *dynamicbox_remove_event_handler(dynamicbox_event_handler_cb dbox_cb)
{
if (!dbox_cb) {
- return NULL;
+ return NULL;
}
return dbox_remove_event_handler(dbox_cb);
int ret;
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is Invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is Invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is Invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is Invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Handler is Invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is Invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (handler->common->request.update_mode) {
- ErrPrint("Previous update_mode cb is not finished yet\n");
- return DBOX_STATUS_ERROR_BUSY;
+ ErrPrint("Previous update_mode cb is not finished yet\n");
+ return DBOX_STATUS_ERROR_BUSY;
}
if (handler->common->is_active_update == active_update) {
- return DBOX_STATUS_ERROR_ALREADY;
+ return DBOX_STATUS_ERROR_ALREADY;
}
if (!handler->common->is_user) {
- return DBOX_STATUS_ERROR_PERMISSION_DENIED;
+ return DBOX_STATUS_ERROR_PERMISSION_DENIED;
}
packet = packet_create((const char *)&cmd, "ssi", handler->common->pkgname, handler->common->id, active_update);
if (!packet) {
- return DBOX_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
if (!cb) {
- cb = default_update_mode_cb;
+ cb = default_update_mode_cb;
}
ret = master_rpc_async_request(handler, packet, 0, update_mode_cb, NULL);
if (ret == (int)DBOX_STATUS_ERROR_NONE) {
- handler->cbs.update_mode.cb = cb;
- handler->cbs.update_mode.data = data;
- handler->common->request.update_mode = 1;
+ handler->cbs.update_mode.cb = cb;
+ handler->cbs.update_mode.data = data;
+ handler->common->request.update_mode = 1;
}
return ret;
EAPI int dynamicbox_is_active_update(dynamicbox_h handler)
{
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is Invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is Invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is Invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is Invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return handler->common->is_active_update;
*/
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Invalid handle\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handle\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
/*!
* So we should not use the common->request.size_changed flag.
*/
if (handler->cbs.size_changed.cb) {
- ErrPrint("Previous resize request is not finished yet\n");
- return DBOX_STATUS_ERROR_BUSY;
+ ErrPrint("Previous resize request is not finished yet\n");
+ return DBOX_STATUS_ERROR_BUSY;
}
if (dynamicbox_service_get_size(type, &w, &h) != 0) {
- ErrPrint("Invalid size type\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid size type\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (handler->common->dbox.width == w && handler->common->dbox.height == h) {
- DbgPrint("No changes\n");
- return DBOX_STATUS_ERROR_ALREADY;
+ DbgPrint("No changes\n");
+ return DBOX_STATUS_ERROR_ALREADY;
}
if (!handler->common->is_user) {
- ErrPrint("CA Livebox is not able to be resized\n");
- return DBOX_STATUS_ERROR_PERMISSION_DENIED;
+ ErrPrint("CA Livebox is not able to be resized\n");
+ return DBOX_STATUS_ERROR_PERMISSION_DENIED;
}
if (handler->common->refcnt <= 1) {
- struct packet *packet;
- unsigned int cmd = CMD_RESIZE;
-
- /* Only 1 instance */
- packet = packet_create((const char *)&cmd, "ssii", handler->common->pkgname, handler->common->id, w, h);
- if (!packet) {
- ErrPrint("Failed to build param\n");
- return DBOX_STATUS_ERROR_FAULT;
- }
-
- if (!cb) {
- cb = default_dbox_size_changed_cb;
- }
-
- ret = master_rpc_async_request(handler, packet, 0, resize_cb, NULL);
- if (ret == (int)DBOX_STATUS_ERROR_NONE) {
- handler->cbs.size_changed.cb = cb;
- handler->cbs.size_changed.data = data;
- handler->common->request.size_changed = 1;
- }
+ struct packet *packet;
+ unsigned int cmd = CMD_RESIZE;
+
+ /* Only 1 instance */
+ packet = packet_create((const char *)&cmd, "ssii", handler->common->pkgname, handler->common->id, w, h);
+ if (!packet) {
+ ErrPrint("Failed to build param\n");
+ return DBOX_STATUS_ERROR_FAULT;
+ }
+
+ if (!cb) {
+ cb = default_dbox_size_changed_cb;
+ }
+
+ ret = master_rpc_async_request(handler, packet, 0, resize_cb, NULL);
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+ handler->cbs.size_changed.cb = cb;
+ handler->cbs.size_changed.data = data;
+ handler->common->request.size_changed = 1;
+ }
} else {
- common = dbox_find_sharable_common_handle(handler->common->pkgname, handler->common->content, w, h, handler->common->cluster, handler->common->category);
- if (!common) {
- struct dynamicbox_common *old_common;
- /*!
- * \note
- * If the common handler is in resizing,
- * if user tries to resize a hander, then simply create new one even if the requested size is same with this.
-
- if (handler->common->request.size_changed) {
- }
-
- */
-
- old_common = handler->common;
-
- common = dbox_create_common_handle(handler, old_common->pkgname, old_common->cluster, old_common->category);
- if (!common) {
- ErrPrint("Failed to create common handle\n");
- return DBOX_STATUS_ERROR_FAULT;
- }
-
- dbox_set_size(common, w, h);
- dbox_set_content(common, old_common->content);
- dbox_set_period(common, old_common->dbox.period);
-
- /*!
- * \note
- * Disconnecting from old one.
- */
- if (dbox_common_unref(old_common, handler) == 0) {
- /*!
- * \note
- * Impossible
- */
- ErrPrint("Common has no associated handler\n");
- }
-
- dbox_common_ref(common, handler);
-
- /*!
- * Connect to a new one
- */
- handler->common = common;
-
- /*!
- * \TODO
- * Need to care, if it fails to create a common handle,
- * the resize operation will be failed.
- * in that case, we should reuse the old common handle
- */
- ret = create_real_instance(handler, cb, data);
- if (ret < 0) {
- dbox_common_unref(common, handler);
- dbox_destroy_common_handle(common);
-
- dbox_common_ref(old_common, handler);
- handler->common = old_common;
- } else {
- /*!
- * In this case, we should update visibility of old_common's dynamicboxes
- */
- if (handler->visible == DBOX_SHOW) {
- dbox_update_visibility(old_common);
- }
- }
- } else {
- struct cb_info *cbinfo;
-
- cbinfo = dbox_create_cb_info(cb, data);
- if (!cbinfo) {
- ErrPrint("Failed to create a cbinfo\n");
- ret = DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- } else {
- ret = job_add(handler, resize_job_cb, DBOX_STATUS_ERROR_NONE, cbinfo);
- if (ret == (int)DBOX_STATUS_ERROR_NONE) {
- struct dynamicbox_common *old_common;
-
- old_common = handler->common;
-
- if (dbox_common_unref(handler->common, handler) == 0) {
- ErrPrint("Old common has no associated handler\n");
- }
-
- dbox_common_ref(common, handler);
- handler->common = common;
-
- if (handler->visible == DBOX_SHOW) {
- dbox_update_visibility(old_common); /* To update visibility: Show --> Paused */
- dbox_update_visibility(common); /* To update visibility: Paused --> Show */
- }
- } else {
- dbox_destroy_cb_info(cbinfo);
- }
- }
- }
+ common = dbox_find_sharable_common_handle(handler->common->pkgname, handler->common->content, w, h, handler->common->cluster, handler->common->category);
+ if (!common) {
+ struct dynamicbox_common *old_common;
+ /*!
+ * \note
+ * If the common handler is in resizing,
+ * if user tries to resize a hander, then simply create new one even if the requested size is same with this.
+
+ if (handler->common->request.size_changed) {
+ }
+
+ */
+
+ old_common = handler->common;
+
+ common = dbox_create_common_handle(handler, old_common->pkgname, old_common->cluster, old_common->category);
+ if (!common) {
+ ErrPrint("Failed to create common handle\n");
+ return DBOX_STATUS_ERROR_FAULT;
+ }
+
+ dbox_set_size(common, w, h);
+ dbox_set_content(common, old_common->content);
+ dbox_set_period(common, old_common->dbox.period);
+
+ /*!
+ * \note
+ * Disconnecting from old one.
+ */
+ if (dbox_common_unref(old_common, handler) == 0) {
+ /*!
+ * \note
+ * Impossible
+ */
+ ErrPrint("Common has no associated handler\n");
+ }
+
+ dbox_common_ref(common, handler);
+
+ /*!
+ * Connect to a new one
+ */
+ handler->common = common;
+
+ /*!
+ * \TODO
+ * Need to care, if it fails to create a common handle,
+ * the resize operation will be failed.
+ * in that case, we should reuse the old common handle
+ */
+ ret = create_real_instance(handler, cb, data);
+ if (ret < 0) {
+ dbox_common_unref(common, handler);
+ dbox_destroy_common_handle(common);
+
+ dbox_common_ref(old_common, handler);
+ handler->common = old_common;
+ } else {
+ /*!
+ * In this case, we should update visibility of old_common's dynamicboxes
+ */
+ if (handler->visible == DBOX_SHOW) {
+ dbox_update_visibility(old_common);
+ }
+ }
+ } else {
+ struct cb_info *cbinfo;
+
+ cbinfo = dbox_create_cb_info(cb, data);
+ if (!cbinfo) {
+ ErrPrint("Failed to create a cbinfo\n");
+ ret = DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ } else {
+ ret = job_add(handler, resize_job_cb, DBOX_STATUS_ERROR_NONE, cbinfo);
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+ struct dynamicbox_common *old_common;
+
+ old_common = handler->common;
+
+ if (dbox_common_unref(handler->common, handler) == 0) {
+ ErrPrint("Old common has no associated handler\n");
+ }
+
+ dbox_common_ref(common, handler);
+ handler->common = common;
+
+ if (handler->visible == DBOX_SHOW) {
+ dbox_update_visibility(old_common); /* To update visibility: Show --> Paused */
+ dbox_update_visibility(common); /* To update visibility: Paused --> Show */
+ }
+ } else {
+ dbox_destroy_cb_info(cbinfo);
+ }
+ }
+ }
}
return ret;
int ret;
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (handler->common->dbox.auto_launch) {
- if (s_info.launch.handler) {
- ret = s_info.launch.handler(handler, handler->common->dbox.auto_launch, s_info.launch.data);
- if (ret < 0) {
- ErrPrint("launch handler app %s (%d)\n", handler->common->dbox.auto_launch, ret);
- }
- }
+ if (s_info.launch.handler) {
+ ret = s_info.launch.handler(handler, handler->common->dbox.auto_launch, s_info.launch.data);
+ if (ret < 0) {
+ ErrPrint("launch handler app %s (%d)\n", handler->common->dbox.auto_launch, ret);
+ }
+ }
}
timestamp = util_timestamp();
packet = packet_create_noack((const char *)&cmd, "sssddd", handler->common->pkgname, handler->common->id, "clicked", timestamp, x, y);
if (!packet) {
- ErrPrint("Failed to build param\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to build param\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
ret = master_rpc_request_only(handler, packet);
EAPI int dynamicbox_has_glance_bar(dynamicbox_h handler)
{
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return !!handler->common->gbar.fb;
EAPI int dynamicbox_glance_bar_is_created(dynamicbox_h handler)
{
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->gbar.fb || !handler->common->id) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return handler->common->is_gbar_created;
int ret;
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->gbar.fb || !handler->common->id) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
/*!
* Only one handler can have a GBAR
*/
if (handler->common->is_gbar_created) {
- DbgPrint("GBAR is already created\n");
- return DBOX_STATUS_ERROR_NONE;
+ DbgPrint("GBAR is already created\n");
+ return DBOX_STATUS_ERROR_NONE;
}
if (handler->common->request.gbar_created) {
- ErrPrint("Previous request is not completed yet\n");
- return DBOX_STATUS_ERROR_BUSY;
+ ErrPrint("Previous request is not completed yet\n");
+ return DBOX_STATUS_ERROR_BUSY;
}
/*!
* Turn off the gbar_destroyed request flag
*/
if (handler->common->request.gbar_destroyed) {
- if (job_add(handler, turn_off_gbar_destroyed_flag_cb, DBOX_STATUS_ERROR_CANCEL, NULL) < 0) {
- ErrPrint("Failed to add gbar_destroyed job\n");
- }
+ if (job_add(handler, turn_off_gbar_destroyed_flag_cb, DBOX_STATUS_ERROR_CANCEL, NULL) < 0) {
+ ErrPrint("Failed to add gbar_destroyed job\n");
+ }
}
packet = packet_create((const char *)&cmd, "ssdd", handler->common->pkgname, handler->common->id, x, y);
if (!packet) {
- ErrPrint("Failed to build param\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to build param\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
if (!cb) {
- cb = default_gbar_created_cb;
+ cb = default_gbar_created_cb;
}
DbgPrint("PERF_DBOX\n");
ret = master_rpc_async_request(handler, packet, 0, gbar_create_cb, NULL);
if (ret == (int)DBOX_STATUS_ERROR_NONE) {
- handler->cbs.gbar_created.cb = cb;
- handler->cbs.gbar_created.data = data;
- handler->common->request.gbar_created = 1;
+ handler->cbs.gbar_created.cb = cb;
+ handler->cbs.gbar_created.data = data;
+ handler->common->request.gbar_created = 1;
}
return ret;
unsigned int cmd = CMD_GBAR_MOVE;
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->gbar.fb || !handler->common->id) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->is_gbar_created) {
- ErrPrint("GBAR is not created\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("GBAR is not created\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet = packet_create_noack((const char *)&cmd, "ssdd", handler->common->pkgname, handler->common->id, x, y);
if (!packet) {
- ErrPrint("Failed to build param\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to build param\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(handler, packet);
int ret;
if (!pkgname) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet = packet_create((const char *)&cmd, "s", pkgname);
if (!packet) {
- ErrPrint("Failed to build a param\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to build a param\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
- ErrPrint("Unable to create cbinfo\n");
- packet_destroy(packet);
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Unable to create cbinfo\n");
+ packet_destroy(packet);
+ return DBOX_STATUS_ERROR_FAULT;
}
ret = master_rpc_async_request(NULL, packet, 0, activated_cb, cbinfo);
if (ret < 0) {
- dbox_destroy_cb_info(cbinfo);
+ dbox_destroy_cb_info(cbinfo);
}
return ret;
int ret;
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->gbar.fb || !handler->common->id) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
/*!
* the flag should be in the ADT "common"
*/
if (!handler->common->is_gbar_created && !handler->common->request.gbar_created) {
- ErrPrint("GBAR is not created\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("GBAR is not created\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (handler->common->request.gbar_destroyed) {
- ErrPrint("GBAR destroy request is already sent\n");
- return DBOX_STATUS_ERROR_ALREADY;
+ ErrPrint("GBAR destroy request is already sent\n");
+ return DBOX_STATUS_ERROR_ALREADY;
}
/*!
* Disable the gbar_created request flag
*/
if (handler->common->request.gbar_created) {
- if (job_add(handler, turn_off_gbar_created_flag_cb, DBOX_STATUS_ERROR_CANCEL, NULL) < 0) {
- ErrPrint("Failed to add a new job\n");
- }
+ if (job_add(handler, turn_off_gbar_created_flag_cb, DBOX_STATUS_ERROR_CANCEL, NULL) < 0) {
+ ErrPrint("Failed to add a new job\n");
+ }
}
DbgPrint("[%s]\n", handler->common->pkgname);
packet = packet_create((const char *)&cmd, "ss", handler->common->pkgname, handler->common->id);
if (!packet) {
- ErrPrint("Failed to build a param\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to build a param\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
if (!cb) {
- cb = default_gbar_destroyed_cb;
+ cb = default_gbar_destroyed_cb;
}
cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
- packet_destroy(packet);
- return DBOX_STATUS_ERROR_FAULT;
+ packet_destroy(packet);
+ return DBOX_STATUS_ERROR_FAULT;
}
ret = master_rpc_async_request(handler, packet, 0, gbar_destroy_cb, cbinfo);
if (ret < 0) {
- dbox_destroy_cb_info(cbinfo);
+ dbox_destroy_cb_info(cbinfo);
} else {
- handler->common->request.gbar_destroyed = 1;
+ handler->common->request.gbar_destroyed = 1;
}
return ret;
int ret = 0; /* re-used for sending event type */
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (handler->common->request.access_event) {
- ErrPrint("Previous access event is not yet done\n");
- return DBOX_STATUS_ERROR_BUSY;
+ ErrPrint("Previous access event is not yet done\n");
+ return DBOX_STATUS_ERROR_BUSY;
}
if (type & DBOX_ACCESS_EVENT_GBAR_MASK) {
- if (!handler->common->is_gbar_created) {
- ErrPrint("GBAR is not created\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- w = handler->common->gbar.width;
- h = handler->common->gbar.height;
-
- switch (type & ~(DBOX_ACCESS_EVENT_GBAR_MASK | DBOX_ACCESS_EVENT_DBOX_MASK)) {
- case DBOX_ACCESS_EVENT_HIGHLIGHT:
- cmd = CMD_GBAR_ACCESS_HL;
- ret = (int)info->type;
- break;
- case DBOX_ACCESS_EVENT_ACTIVATE:
- cmd = CMD_GBAR_ACCESS_ACTIVATE;
- break;
- case DBOX_ACCESS_EVENT_ACTION:
- cmd = CMD_GBAR_ACCESS_ACTION;
- ret = (int)info->type;
- break;
- case DBOX_ACCESS_EVENT_SCROLL:
- cmd = CMD_GBAR_ACCESS_SCROLL;
- ret = (int)info->type;
- break;
- case DBOX_ACCESS_EVENT_VALUE_CHANGE:
- cmd = CMD_GBAR_ACCESS_VALUE_CHANGE;
- break;
- case DBOX_ACCESS_EVENT_MOUSE:
- cmd = CMD_GBAR_ACCESS_MOUSE;
- ret = (int)info->type;
- break;
- case DBOX_ACCESS_EVENT_BACK:
- cmd = CMD_GBAR_ACCESS_BACK;
- break;
- case DBOX_ACCESS_EVENT_OVER:
- cmd = CMD_GBAR_ACCESS_OVER;
- break;
- case DBOX_ACCESS_EVENT_READ:
- cmd = CMD_GBAR_ACCESS_READ;
- break;
- case DBOX_ACCESS_EVENT_ENABLE:
- cmd = CMD_GBAR_ACCESS_ENABLE;
- ret = info->type;
- break;
- default:
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
+ if (!handler->common->is_gbar_created) {
+ ErrPrint("GBAR is not created\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ w = handler->common->gbar.width;
+ h = handler->common->gbar.height;
+
+ switch (type & ~(DBOX_ACCESS_EVENT_GBAR_MASK | DBOX_ACCESS_EVENT_DBOX_MASK)) {
+ case DBOX_ACCESS_EVENT_HIGHLIGHT:
+ cmd = CMD_GBAR_ACCESS_HL;
+ ret = (int)info->type;
+ break;
+ case DBOX_ACCESS_EVENT_ACTIVATE:
+ cmd = CMD_GBAR_ACCESS_ACTIVATE;
+ break;
+ case DBOX_ACCESS_EVENT_ACTION:
+ cmd = CMD_GBAR_ACCESS_ACTION;
+ ret = (int)info->type;
+ break;
+ case DBOX_ACCESS_EVENT_SCROLL:
+ cmd = CMD_GBAR_ACCESS_SCROLL;
+ ret = (int)info->type;
+ break;
+ case DBOX_ACCESS_EVENT_VALUE_CHANGE:
+ cmd = CMD_GBAR_ACCESS_VALUE_CHANGE;
+ break;
+ case DBOX_ACCESS_EVENT_MOUSE:
+ cmd = CMD_GBAR_ACCESS_MOUSE;
+ ret = (int)info->type;
+ break;
+ case DBOX_ACCESS_EVENT_BACK:
+ cmd = CMD_GBAR_ACCESS_BACK;
+ break;
+ case DBOX_ACCESS_EVENT_OVER:
+ cmd = CMD_GBAR_ACCESS_OVER;
+ break;
+ case DBOX_ACCESS_EVENT_READ:
+ cmd = CMD_GBAR_ACCESS_READ;
+ break;
+ case DBOX_ACCESS_EVENT_ENABLE:
+ cmd = CMD_GBAR_ACCESS_ENABLE;
+ ret = info->type;
+ break;
+ default:
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
} else if (type & DBOX_ACCESS_EVENT_DBOX_MASK) {
- w = handler->common->dbox.width;
- h = handler->common->dbox.height;
- switch (type & ~(DBOX_ACCESS_EVENT_GBAR_MASK | DBOX_ACCESS_EVENT_DBOX_MASK)) {
- case DBOX_ACCESS_EVENT_HIGHLIGHT:
- cmd = CMD_DBOX_ACCESS_HL;
- ret = (int)info->type;
- break;
- case DBOX_ACCESS_EVENT_ACTIVATE:
- cmd = CMD_DBOX_ACCESS_ACTIVATE;
- break;
- case DBOX_ACCESS_EVENT_ACTION:
- cmd = CMD_DBOX_ACCESS_ACTION;
- ret = (int)info->type;
- break;
- case DBOX_ACCESS_EVENT_SCROLL:
- cmd = CMD_DBOX_ACCESS_SCROLL;
- ret = (int)info->type;
- break;
- case DBOX_ACCESS_EVENT_VALUE_CHANGE:
- cmd = CMD_DBOX_ACCESS_VALUE_CHANGE;
- break;
- case DBOX_ACCESS_EVENT_MOUSE:
- cmd = CMD_DBOX_ACCESS_MOUSE;
- ret = (int)info->type;
- break;
- case DBOX_ACCESS_EVENT_BACK:
- cmd = CMD_DBOX_ACCESS_BACK;
- break;
- case DBOX_ACCESS_EVENT_OVER:
- cmd = CMD_DBOX_ACCESS_OVER;
- break;
- case DBOX_ACCESS_EVENT_READ:
- cmd = CMD_DBOX_ACCESS_READ;
- break;
- case DBOX_ACCESS_EVENT_ENABLE:
- cmd = CMD_DBOX_ACCESS_ENABLE;
- ret = info->type;
- break;
- default:
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
+ w = handler->common->dbox.width;
+ h = handler->common->dbox.height;
+ switch (type & ~(DBOX_ACCESS_EVENT_GBAR_MASK | DBOX_ACCESS_EVENT_DBOX_MASK)) {
+ case DBOX_ACCESS_EVENT_HIGHLIGHT:
+ cmd = CMD_DBOX_ACCESS_HL;
+ ret = (int)info->type;
+ break;
+ case DBOX_ACCESS_EVENT_ACTIVATE:
+ cmd = CMD_DBOX_ACCESS_ACTIVATE;
+ break;
+ case DBOX_ACCESS_EVENT_ACTION:
+ cmd = CMD_DBOX_ACCESS_ACTION;
+ ret = (int)info->type;
+ break;
+ case DBOX_ACCESS_EVENT_SCROLL:
+ cmd = CMD_DBOX_ACCESS_SCROLL;
+ ret = (int)info->type;
+ break;
+ case DBOX_ACCESS_EVENT_VALUE_CHANGE:
+ cmd = CMD_DBOX_ACCESS_VALUE_CHANGE;
+ break;
+ case DBOX_ACCESS_EVENT_MOUSE:
+ cmd = CMD_DBOX_ACCESS_MOUSE;
+ ret = (int)info->type;
+ break;
+ case DBOX_ACCESS_EVENT_BACK:
+ cmd = CMD_DBOX_ACCESS_BACK;
+ break;
+ case DBOX_ACCESS_EVENT_OVER:
+ cmd = CMD_DBOX_ACCESS_OVER;
+ break;
+ case DBOX_ACCESS_EVENT_READ:
+ cmd = CMD_DBOX_ACCESS_READ;
+ break;
+ case DBOX_ACCESS_EVENT_ENABLE:
+ cmd = CMD_DBOX_ACCESS_ENABLE;
+ ret = info->type;
+ break;
+ default:
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
} else {
- ErrPrint("Invalid event type\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid event type\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!cb) {
- cb = default_access_event_cb;
+ cb = default_access_event_cb;
}
ret = send_access_event(handler, (const char *)&cmd, info->x * w, info->y * h, ret);
if (ret == (int)DBOX_STATUS_ERROR_NONE) {
- handler->cbs.access_event.cb = cb;
- handler->cbs.access_event.data = data;
- handler->common->request.access_event = 1;
+ handler->cbs.access_event.cb = cb;
+ handler->cbs.access_event.data = data;
+ handler->common->request.access_event = 1;
}
return ret;
unsigned int cmd;
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!(type & DBOX_MOUSE_EVENT_MASK)) {
- ErrPrint("Invalid content event is used\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid content event is used\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (type & DBOX_MOUSE_EVENT_GBAR_MASK) {
- int flag = 1;
-
- if (!handler->common->is_gbar_created) {
- ErrPrint("GBAR is not created\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- if (!handler->common->gbar.fb) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- if (type & DBOX_MOUSE_EVENT_MOVE) {
- if (fabs(info->x - handler->common->gbar.x) < conf_event_filter() && fabs(info->y - handler->common->gbar.y) < conf_event_filter()) {
- return DBOX_STATUS_ERROR_BUSY;
- }
- } else if (type & DBOX_MOUSE_EVENT_SET) {
- flag = 0;
- }
-
- if (flag) {
- handler->common->gbar.x = info->x;
- handler->common->gbar.y = info->y;
- w = handler->common->gbar.width;
- h = handler->common->gbar.height;
- }
-
- switch ((type & ~(DBOX_MOUSE_EVENT_GBAR_MASK | DBOX_MOUSE_EVENT_DBOX_MASK))) {
- case DBOX_MOUSE_EVENT_ENTER | DBOX_MOUSE_EVENT_MASK:
- cmd = CMD_GBAR_MOUSE_ENTER;
- break;
- case DBOX_MOUSE_EVENT_LEAVE | DBOX_MOUSE_EVENT_MASK:
- cmd = CMD_GBAR_MOUSE_LEAVE;
- break;
- case DBOX_MOUSE_EVENT_UP | DBOX_MOUSE_EVENT_MASK:
- cmd = CMD_GBAR_MOUSE_UP;
- break;
- case DBOX_MOUSE_EVENT_DOWN | DBOX_MOUSE_EVENT_MASK:
- cmd = CMD_GBAR_MOUSE_DOWN;
- break;
- case DBOX_MOUSE_EVENT_MOVE | DBOX_MOUSE_EVENT_MASK:
- cmd = CMD_GBAR_MOUSE_MOVE;
- break;
- case DBOX_MOUSE_EVENT_SET | DBOX_MOUSE_EVENT_MASK:
- cmd = CMD_GBAR_MOUSE_SET;
- break;
- case DBOX_MOUSE_EVENT_UNSET | DBOX_MOUSE_EVENT_MASK:
- cmd = CMD_GBAR_MOUSE_UNSET;
- break;
- case DBOX_MOUSE_EVENT_ON_SCROLL | DBOX_MOUSE_EVENT_MASK:
- cmd = CMD_GBAR_MOUSE_ON_SCROLL;
- break;
- case DBOX_MOUSE_EVENT_ON_HOLD | DBOX_MOUSE_EVENT_MASK:
- cmd = CMD_GBAR_MOUSE_ON_HOLD;
- break;
- case DBOX_MOUSE_EVENT_OFF_SCROLL | DBOX_MOUSE_EVENT_MASK:
- cmd = CMD_GBAR_MOUSE_OFF_SCROLL;
- break;
- case DBOX_MOUSE_EVENT_OFF_HOLD | DBOX_MOUSE_EVENT_MASK:
- cmd = CMD_GBAR_MOUSE_OFF_HOLD;
- break;
- default:
- ErrPrint("Invalid event type\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
+ int flag = 1;
+
+ if (!handler->common->is_gbar_created) {
+ ErrPrint("GBAR is not created\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!handler->common->gbar.fb) {
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ if (type & DBOX_MOUSE_EVENT_MOVE) {
+ if (fabs(info->x - handler->common->gbar.x) < conf_event_filter() && fabs(info->y - handler->common->gbar.y) < conf_event_filter()) {
+ return DBOX_STATUS_ERROR_BUSY;
+ }
+ } else if (type & DBOX_MOUSE_EVENT_SET) {
+ flag = 0;
+ }
+
+ if (flag) {
+ handler->common->gbar.x = info->x;
+ handler->common->gbar.y = info->y;
+ w = handler->common->gbar.width;
+ h = handler->common->gbar.height;
+ }
+
+ switch ((type & ~(DBOX_MOUSE_EVENT_GBAR_MASK | DBOX_MOUSE_EVENT_DBOX_MASK))) {
+ case DBOX_MOUSE_EVENT_ENTER | DBOX_MOUSE_EVENT_MASK:
+ cmd = CMD_GBAR_MOUSE_ENTER;
+ break;
+ case DBOX_MOUSE_EVENT_LEAVE | DBOX_MOUSE_EVENT_MASK:
+ cmd = CMD_GBAR_MOUSE_LEAVE;
+ break;
+ case DBOX_MOUSE_EVENT_UP | DBOX_MOUSE_EVENT_MASK:
+ cmd = CMD_GBAR_MOUSE_UP;
+ break;
+ case DBOX_MOUSE_EVENT_DOWN | DBOX_MOUSE_EVENT_MASK:
+ cmd = CMD_GBAR_MOUSE_DOWN;
+ break;
+ case DBOX_MOUSE_EVENT_MOVE | DBOX_MOUSE_EVENT_MASK:
+ cmd = CMD_GBAR_MOUSE_MOVE;
+ break;
+ case DBOX_MOUSE_EVENT_SET | DBOX_MOUSE_EVENT_MASK:
+ cmd = CMD_GBAR_MOUSE_SET;
+ break;
+ case DBOX_MOUSE_EVENT_UNSET | DBOX_MOUSE_EVENT_MASK:
+ cmd = CMD_GBAR_MOUSE_UNSET;
+ break;
+ case DBOX_MOUSE_EVENT_ON_SCROLL | DBOX_MOUSE_EVENT_MASK:
+ cmd = CMD_GBAR_MOUSE_ON_SCROLL;
+ break;
+ case DBOX_MOUSE_EVENT_ON_HOLD | DBOX_MOUSE_EVENT_MASK:
+ cmd = CMD_GBAR_MOUSE_ON_HOLD;
+ break;
+ case DBOX_MOUSE_EVENT_OFF_SCROLL | DBOX_MOUSE_EVENT_MASK:
+ cmd = CMD_GBAR_MOUSE_OFF_SCROLL;
+ break;
+ case DBOX_MOUSE_EVENT_OFF_HOLD | DBOX_MOUSE_EVENT_MASK:
+ cmd = CMD_GBAR_MOUSE_OFF_HOLD;
+ break;
+ default:
+ ErrPrint("Invalid event type\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
} else if (type & DBOX_MOUSE_EVENT_DBOX_MASK) {
- int flag = 1;
-
- if (!handler->common->dbox.fb) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- if (type & DBOX_MOUSE_EVENT_MOVE) {
- if (fabs(info->x - handler->common->dbox.x) < conf_event_filter() && fabs(info->y - handler->common->dbox.y) < conf_event_filter()) {
- return DBOX_STATUS_ERROR_BUSY;
- }
- } else if (type & DBOX_MOUSE_EVENT_SET) {
- flag = 0;
- }
-
- if (flag) {
- handler->common->dbox.x = info->x;
- handler->common->dbox.y = info->y;
- w = handler->common->dbox.width;
- h = handler->common->dbox.height;
- }
-
- switch ((type & ~(DBOX_MOUSE_EVENT_GBAR_MASK | DBOX_MOUSE_EVENT_DBOX_MASK))) {
- case DBOX_MOUSE_EVENT_ENTER | DBOX_MOUSE_EVENT_MASK:
- cmd = CMD_DBOX_MOUSE_ENTER;
- break;
- case DBOX_MOUSE_EVENT_LEAVE | DBOX_MOUSE_EVENT_MASK:
- cmd = CMD_DBOX_MOUSE_LEAVE;
- break;
- case DBOX_MOUSE_EVENT_UP | DBOX_MOUSE_EVENT_MASK:
- cmd = CMD_DBOX_MOUSE_UP;
- break;
- case DBOX_MOUSE_EVENT_DOWN | DBOX_MOUSE_EVENT_MASK:
- cmd = CMD_DBOX_MOUSE_DOWN;
- break;
- case DBOX_MOUSE_EVENT_MOVE | DBOX_MOUSE_EVENT_MASK:
- if (!handler->common->dbox.mouse_event) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
- cmd = CMD_DBOX_MOUSE_MOVE;
- break;
- case DBOX_MOUSE_EVENT_SET | DBOX_MOUSE_EVENT_MASK:
- if (!handler->common->dbox.mouse_event) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
- cmd = CMD_DBOX_MOUSE_SET;
- break;
- case DBOX_MOUSE_EVENT_UNSET | DBOX_MOUSE_EVENT_MASK:
- if (!handler->common->dbox.mouse_event) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
- cmd = CMD_DBOX_MOUSE_UNSET;
- break;
- case DBOX_MOUSE_EVENT_ON_SCROLL | DBOX_MOUSE_EVENT_MASK:
- cmd = CMD_DBOX_MOUSE_ON_SCROLL;
- break;
- case DBOX_MOUSE_EVENT_ON_HOLD | DBOX_MOUSE_EVENT_MASK:
- cmd = CMD_DBOX_MOUSE_ON_HOLD;
- break;
- case DBOX_MOUSE_EVENT_OFF_SCROLL | DBOX_MOUSE_EVENT_MASK:
- cmd = CMD_DBOX_MOUSE_OFF_SCROLL;
- break;
- case DBOX_MOUSE_EVENT_OFF_HOLD | DBOX_MOUSE_EVENT_MASK:
- cmd = CMD_DBOX_MOUSE_OFF_HOLD;
- break;
- default:
- ErrPrint("Invalid event type\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
+ int flag = 1;
+
+ if (!handler->common->dbox.fb) {
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ if (type & DBOX_MOUSE_EVENT_MOVE) {
+ if (fabs(info->x - handler->common->dbox.x) < conf_event_filter() && fabs(info->y - handler->common->dbox.y) < conf_event_filter()) {
+ return DBOX_STATUS_ERROR_BUSY;
+ }
+ } else if (type & DBOX_MOUSE_EVENT_SET) {
+ flag = 0;
+ }
+
+ if (flag) {
+ handler->common->dbox.x = info->x;
+ handler->common->dbox.y = info->y;
+ w = handler->common->dbox.width;
+ h = handler->common->dbox.height;
+ }
+
+ switch ((type & ~(DBOX_MOUSE_EVENT_GBAR_MASK | DBOX_MOUSE_EVENT_DBOX_MASK))) {
+ case DBOX_MOUSE_EVENT_ENTER | DBOX_MOUSE_EVENT_MASK:
+ cmd = CMD_DBOX_MOUSE_ENTER;
+ break;
+ case DBOX_MOUSE_EVENT_LEAVE | DBOX_MOUSE_EVENT_MASK:
+ cmd = CMD_DBOX_MOUSE_LEAVE;
+ break;
+ case DBOX_MOUSE_EVENT_UP | DBOX_MOUSE_EVENT_MASK:
+ cmd = CMD_DBOX_MOUSE_UP;
+ break;
+ case DBOX_MOUSE_EVENT_DOWN | DBOX_MOUSE_EVENT_MASK:
+ cmd = CMD_DBOX_MOUSE_DOWN;
+ break;
+ case DBOX_MOUSE_EVENT_MOVE | DBOX_MOUSE_EVENT_MASK:
+ if (!handler->common->dbox.mouse_event) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ cmd = CMD_DBOX_MOUSE_MOVE;
+ break;
+ case DBOX_MOUSE_EVENT_SET | DBOX_MOUSE_EVENT_MASK:
+ if (!handler->common->dbox.mouse_event) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ cmd = CMD_DBOX_MOUSE_SET;
+ break;
+ case DBOX_MOUSE_EVENT_UNSET | DBOX_MOUSE_EVENT_MASK:
+ if (!handler->common->dbox.mouse_event) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ cmd = CMD_DBOX_MOUSE_UNSET;
+ break;
+ case DBOX_MOUSE_EVENT_ON_SCROLL | DBOX_MOUSE_EVENT_MASK:
+ cmd = CMD_DBOX_MOUSE_ON_SCROLL;
+ break;
+ case DBOX_MOUSE_EVENT_ON_HOLD | DBOX_MOUSE_EVENT_MASK:
+ cmd = CMD_DBOX_MOUSE_ON_HOLD;
+ break;
+ case DBOX_MOUSE_EVENT_OFF_SCROLL | DBOX_MOUSE_EVENT_MASK:
+ cmd = CMD_DBOX_MOUSE_OFF_SCROLL;
+ break;
+ case DBOX_MOUSE_EVENT_OFF_HOLD | DBOX_MOUSE_EVENT_MASK:
+ cmd = CMD_DBOX_MOUSE_OFF_HOLD;
+ break;
+ default:
+ ErrPrint("Invalid event type\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
} else {
- ErrPrint("Invalid event type\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid event type\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return send_mouse_event(handler, (const char *)&cmd, info->x * w, info->y * h);
unsigned int cmd;
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!(type & DBOX_KEY_EVENT_MASK)) {
- ErrPrint("Invalid key event is used\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid key event is used\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (handler->common->request.key_event) {
- ErrPrint("Previous key event is not completed yet\n");
- return DBOX_STATUS_ERROR_BUSY;
+ ErrPrint("Previous key event is not completed yet\n");
+ return DBOX_STATUS_ERROR_BUSY;
}
if (type & DBOX_MOUSE_EVENT_GBAR_MASK) {
- if (!handler->common->is_gbar_created) {
- ErrPrint("GBAR is not created\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- if (!handler->common->gbar.fb) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- if (type & DBOX_KEY_EVENT_DOWN) {
- /*!
- * \TODO
- * filtering the reproduced events if it is too fast
- */
- } else if (type & DBOX_KEY_EVENT_SET) {
- /*!
- * \TODO
- * What can I do for this case?
- */
- }
-
- /*!
- * Must be short than 29 bytes.
- */
- switch ((type & ~(DBOX_MOUSE_EVENT_GBAR_MASK | DBOX_MOUSE_EVENT_DBOX_MASK))) {
- case DBOX_KEY_EVENT_FOCUS_IN | DBOX_KEY_EVENT_MASK:
- cmd = CMD_GBAR_KEY_FOCUS_IN;
- break;
- case DBOX_KEY_EVENT_FOCUS_OUT | DBOX_KEY_EVENT_MASK:
- cmd = CMD_GBAR_KEY_FOCUS_OUT;
- break;
- case DBOX_KEY_EVENT_UP | DBOX_KEY_EVENT_MASK:
- cmd = CMD_GBAR_KEY_UP;
- break;
- case DBOX_KEY_EVENT_DOWN | DBOX_KEY_EVENT_MASK:
- cmd = CMD_GBAR_KEY_DOWN;
- break;
- case DBOX_KEY_EVENT_SET | DBOX_KEY_EVENT_MASK:
- cmd = CMD_GBAR_KEY_SET;
- break;
- case DBOX_KEY_EVENT_UNSET | DBOX_KEY_EVENT_MASK:
- cmd = CMD_GBAR_KEY_UNSET;
- break;
- default:
- ErrPrint("Invalid event type\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
+ if (!handler->common->is_gbar_created) {
+ ErrPrint("GBAR is not created\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!handler->common->gbar.fb) {
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ if (type & DBOX_KEY_EVENT_DOWN) {
+ /*!
+ * \TODO
+ * filtering the reproduced events if it is too fast
+ */
+ } else if (type & DBOX_KEY_EVENT_SET) {
+ /*!
+ * \TODO
+ * What can I do for this case?
+ */
+ }
+
+ /*!
+ * Must be short than 29 bytes.
+ */
+ switch ((type & ~(DBOX_MOUSE_EVENT_GBAR_MASK | DBOX_MOUSE_EVENT_DBOX_MASK))) {
+ case DBOX_KEY_EVENT_FOCUS_IN | DBOX_KEY_EVENT_MASK:
+ cmd = CMD_GBAR_KEY_FOCUS_IN;
+ break;
+ case DBOX_KEY_EVENT_FOCUS_OUT | DBOX_KEY_EVENT_MASK:
+ cmd = CMD_GBAR_KEY_FOCUS_OUT;
+ break;
+ case DBOX_KEY_EVENT_UP | DBOX_KEY_EVENT_MASK:
+ cmd = CMD_GBAR_KEY_UP;
+ break;
+ case DBOX_KEY_EVENT_DOWN | DBOX_KEY_EVENT_MASK:
+ cmd = CMD_GBAR_KEY_DOWN;
+ break;
+ case DBOX_KEY_EVENT_SET | DBOX_KEY_EVENT_MASK:
+ cmd = CMD_GBAR_KEY_SET;
+ break;
+ case DBOX_KEY_EVENT_UNSET | DBOX_KEY_EVENT_MASK:
+ cmd = CMD_GBAR_KEY_UNSET;
+ break;
+ default:
+ ErrPrint("Invalid event type\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
} else if (type & DBOX_MOUSE_EVENT_DBOX_MASK) {
- if (!handler->common->dbox.fb) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- if (type & DBOX_KEY_EVENT_DOWN) {
- /*!
- * \TODO
- * filtering the reproduced events if it is too fast
- */
- } else if (type & DBOX_KEY_EVENT_SET) {
- /*!
- * What can I do for this case?
- */
- }
-
- switch ((type & ~(DBOX_MOUSE_EVENT_GBAR_MASK | DBOX_MOUSE_EVENT_DBOX_MASK))) {
- case DBOX_KEY_EVENT_FOCUS_IN | DBOX_KEY_EVENT_MASK:
- cmd = CMD_DBOX_KEY_FOCUS_IN;
- break;
- case DBOX_KEY_EVENT_FOCUS_OUT | DBOX_KEY_EVENT_MASK:
- cmd = CMD_DBOX_KEY_FOCUS_OUT;
- break;
- case DBOX_KEY_EVENT_UP | DBOX_KEY_EVENT_MASK:
- cmd = CMD_DBOX_KEY_UP;
- break;
- case DBOX_KEY_EVENT_DOWN | DBOX_KEY_EVENT_MASK:
- cmd = CMD_DBOX_KEY_DOWN;
- break;
- case DBOX_KEY_EVENT_SET | DBOX_KEY_EVENT_MASK:
- cmd = CMD_DBOX_KEY_SET;
- break;
- case DBOX_KEY_EVENT_UNSET | DBOX_KEY_EVENT_MASK:
- cmd = CMD_DBOX_KEY_UNSET;
- break;
- default:
- ErrPrint("Invalid event type\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
+ if (!handler->common->dbox.fb) {
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ if (type & DBOX_KEY_EVENT_DOWN) {
+ /*!
+ * \TODO
+ * filtering the reproduced events if it is too fast
+ */
+ } else if (type & DBOX_KEY_EVENT_SET) {
+ /*!
+ * What can I do for this case?
+ */
+ }
+
+ switch ((type & ~(DBOX_MOUSE_EVENT_GBAR_MASK | DBOX_MOUSE_EVENT_DBOX_MASK))) {
+ case DBOX_KEY_EVENT_FOCUS_IN | DBOX_KEY_EVENT_MASK:
+ cmd = CMD_DBOX_KEY_FOCUS_IN;
+ break;
+ case DBOX_KEY_EVENT_FOCUS_OUT | DBOX_KEY_EVENT_MASK:
+ cmd = CMD_DBOX_KEY_FOCUS_OUT;
+ break;
+ case DBOX_KEY_EVENT_UP | DBOX_KEY_EVENT_MASK:
+ cmd = CMD_DBOX_KEY_UP;
+ break;
+ case DBOX_KEY_EVENT_DOWN | DBOX_KEY_EVENT_MASK:
+ cmd = CMD_DBOX_KEY_DOWN;
+ break;
+ case DBOX_KEY_EVENT_SET | DBOX_KEY_EVENT_MASK:
+ cmd = CMD_DBOX_KEY_SET;
+ break;
+ case DBOX_KEY_EVENT_UNSET | DBOX_KEY_EVENT_MASK:
+ cmd = CMD_DBOX_KEY_UNSET;
+ break;
+ default:
+ ErrPrint("Invalid event type\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
} else {
- ErrPrint("Invalid event type\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid event type\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!cb) {
- cb = default_key_event_cb;
+ cb = default_key_event_cb;
}
ret = send_key_event(handler, (const char *)&cmd, info->keycode);
if (ret == (int)DBOX_STATUS_ERROR_NONE) {
- handler->cbs.key_event.cb = cb;
- handler->cbs.key_event.data = data;
- handler->common->request.key_event = 1;
+ handler->cbs.key_event.cb = cb;
+ handler->cbs.key_event.data = data;
+ handler->common->request.key_event = 1;
}
return ret;
EAPI const char *dynamicbox_filename(dynamicbox_h handler)
{
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return NULL;
+ ErrPrint("Handler is invalid\n");
+ return NULL;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return NULL;
+ ErrPrint("Handler is invalid\n");
+ return NULL;
}
if (!handler->common->id) {
- ErrPrint("Handler is not valid\n");
- return NULL;
+ ErrPrint("Handler is not valid\n");
+ return NULL;
}
if (handler->common->filename) {
- return handler->common->filename;
+ return handler->common->filename;
}
/* Oooops */
int _h;
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!w) {
- w = &_w;
+ w = &_w;
}
if (!h) {
- h = &_h;
+ h = &_h;
}
if (!handler->common->is_gbar_created) {
- *w = handler->common->gbar.default_width;
- *h = handler->common->gbar.default_height;
+ *w = handler->common->gbar.default_width;
+ *h = handler->common->gbar.default_height;
} else {
- *w = handler->common->gbar.width;
- *h = handler->common->gbar.height;
+ *w = handler->common->gbar.width;
+ *h = handler->common->gbar.height;
}
return DBOX_STATUS_ERROR_NONE;
int h;
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_SIZE_TYPE_UNKNOWN;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_SIZE_TYPE_UNKNOWN;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_SIZE_TYPE_UNKNOWN;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_SIZE_TYPE_UNKNOWN;
}
if (!handler->common->id) {
- ErrPrint("Handler is not valid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_SIZE_TYPE_UNKNOWN;
+ ErrPrint("Handler is not valid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_SIZE_TYPE_UNKNOWN;
}
w = handler->common->dbox.width;
h = handler->common->dbox.height;
switch (handler->common->dbox.type) {
- case DBOX_TYPE_BUFFER:
- case DBOX_TYPE_SCRIPT:
- if (!fb_is_created(handler->common->dbox.fb)) {
- w = 0;
- h = 0;
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
- }
- break;
- default:
- break;
+ case DBOX_TYPE_BUFFER:
+ case DBOX_TYPE_SCRIPT:
+ if (!fb_is_created(handler->common->dbox.fb)) {
+ w = 0;
+ h = 0;
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
+ }
+ break;
+ default:
+ break;
}
return dynamicbox_service_size_type(w, h);
int ret;
if (!handler) {
- ErrPrint("Handler is NIL\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is NIL\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!cluster || !category || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Invalid argument\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid argument\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Invalid argument\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid argument\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Invalid argument\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid argument\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (handler->common->request.group_changed) {
- ErrPrint("Previous group changing request is not finished yet\n");
- return DBOX_STATUS_ERROR_BUSY;
+ ErrPrint("Previous group changing request is not finished yet\n");
+ return DBOX_STATUS_ERROR_BUSY;
}
if (!handler->common->is_user) {
- ErrPrint("CA Livebox is not able to change the group\n");
- return DBOX_STATUS_ERROR_PERMISSION_DENIED;
+ ErrPrint("CA Livebox is not able to change the group\n");
+ return DBOX_STATUS_ERROR_PERMISSION_DENIED;
}
if (!strcmp(handler->common->cluster, cluster) && !strcmp(handler->common->category, category)) {
- DbgPrint("No changes\n");
- return DBOX_STATUS_ERROR_ALREADY;
+ DbgPrint("No changes\n");
+ return DBOX_STATUS_ERROR_ALREADY;
}
packet = packet_create((const char *)&cmd, "ssss", handler->common->pkgname, handler->common->id, cluster, category);
if (!packet) {
- ErrPrint("Failed to build a param\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to build a param\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
if (!cb) {
- cb = default_group_changed_cb;
+ cb = default_group_changed_cb;
}
ret = master_rpc_async_request(handler, packet, 0, set_group_ret_cb, NULL);
if (ret == (int)DBOX_STATUS_ERROR_NONE) {
- handler->cbs.group_changed.cb = cb;
- handler->cbs.group_changed.data = data;
- handler->common->request.group_changed = 1;
+ handler->cbs.group_changed.cb = cb;
+ handler->cbs.group_changed.data = data;
+ handler->common->request.group_changed = 1;
}
return ret;
EAPI int dynamicbox_get_group(dynamicbox_h handler, const char **cluster, const char **category)
{
if (!handler) {
- ErrPrint("Handler is NIL\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is NIL\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!cluster || !category || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Invalid argument\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid argument\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Invalid argument\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid argument\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Invalid argument\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid argument\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
*cluster = handler->common->cluster;
register int j;
if (!handler || !size_list) {
- ErrPrint("Invalid argument, handler(%p), size_list(%p)\n", handler, size_list);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid argument, handler(%p), size_list(%p)\n", handler, size_list);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!cnt || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
for (j = i = 0; i < DBOX_NR_OF_SIZE_LIST; i++) {
- if (handler->common->dbox.size_list & (0x01 << i)) {
- if (j == *cnt) {
- break;
- }
+ if (handler->common->dbox.size_list & (0x01 << i)) {
+ if (j == *cnt) {
+ break;
+ }
- size_list[j++] = (dynamicbox_size_type_e)(0x01 << i);
- }
+ size_list[j++] = (dynamicbox_size_type_e)(0x01 << i);
+ }
}
*cnt = j;
EAPI const char *dynamicbox_pkgname(dynamicbox_h handler)
{
if (!handler) {
- ErrPrint("Handler is NIL\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
+ ErrPrint("Handler is NIL\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
}
if (handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is not valid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
+ ErrPrint("Handler is not valid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is not valid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
+ ErrPrint("Handler is not valid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
}
dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
EAPI double dynamicbox_priority(dynamicbox_h handler)
{
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return -1.0f;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return -1.0f;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return -1.0f;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return -1.0f;
}
if (!handler->common->id) {
- ErrPrint("Handler is not valid (%p)\n", handler);
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return -1.0f;
+ ErrPrint("Handler is not valid (%p)\n", handler);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return -1.0f;
}
return handler->common->dbox.priority;
packet = packet_create((const char *)&cmd, "s", cluster);
if (!packet) {
- ErrPrint("Failed to build a param\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to build a param\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
- packet_destroy(packet);
- return DBOX_STATUS_ERROR_FAULT;
+ packet_destroy(packet);
+ return DBOX_STATUS_ERROR_FAULT;
}
ret = master_rpc_async_request(NULL, packet, 0, delete_cluster_cb, cbinfo);
if (ret < 0) {
- dbox_destroy_cb_info(cbinfo);
+ dbox_destroy_cb_info(cbinfo);
}
return ret;
packet = packet_create((const char *)&cmd, "ss", cluster, category);
if (!packet) {
- ErrPrint("Failed to build a param\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to build a param\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
- packet_destroy(packet);
- return DBOX_STATUS_ERROR_FAULT;
+ packet_destroy(packet);
+ return DBOX_STATUS_ERROR_FAULT;
}
ret = master_rpc_async_request(NULL, packet, 0, delete_category_cb, cbinfo);
if (ret < 0) {
- dbox_destroy_cb_info(cbinfo);
+ dbox_destroy_cb_info(cbinfo);
}
return ret;
EAPI dynamicbox_type_e dynamicbox_type(dynamicbox_h handler, int gbar)
{
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_CONTENT_TYPE_INVALID;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_CONTENT_TYPE_INVALID;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_CONTENT_TYPE_INVALID;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_CONTENT_TYPE_INVALID;
}
if (!handler->common->id) {
- ErrPrint("Handler is not valid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_CONTENT_TYPE_INVALID;
+ ErrPrint("Handler is not valid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_CONTENT_TYPE_INVALID;
}
if (gbar) {
- switch (handler->common->gbar.type) {
- case GBAR_TYPE_TEXT:
- return DBOX_CONTENT_TYPE_TEXT;
- case GBAR_TYPE_BUFFER:
- case GBAR_TYPE_SCRIPT:
- {
- const char *id;
- id = fb_id(handler->common->gbar.fb);
- if (id && !strncasecmp(id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
- return DBOX_CONTENT_TYPE_RESOURCE_ID;
- }
- }
- return DBOX_CONTENT_TYPE_BUFFER;
- case GBAR_TYPE_UIFW:
- return DBOX_CONTENT_TYPE_UIFW;
- default:
- break;
- }
+ switch (handler->common->gbar.type) {
+ case GBAR_TYPE_TEXT:
+ return DBOX_CONTENT_TYPE_TEXT;
+ case GBAR_TYPE_BUFFER:
+ case GBAR_TYPE_SCRIPT:
+ {
+ const char *id;
+ id = fb_id(handler->common->gbar.fb);
+ if (id && !strncasecmp(id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
+ return DBOX_CONTENT_TYPE_RESOURCE_ID;
+ }
+ }
+ return DBOX_CONTENT_TYPE_BUFFER;
+ case GBAR_TYPE_UIFW:
+ return DBOX_CONTENT_TYPE_UIFW;
+ default:
+ break;
+ }
} else {
- switch (handler->common->dbox.type) {
- case DBOX_TYPE_FILE:
- return DBOX_CONTENT_TYPE_IMAGE;
- case DBOX_TYPE_BUFFER:
- case DBOX_TYPE_SCRIPT:
- {
- const char *id;
- id = fb_id(handler->common->dbox.fb);
- if (id && !strncasecmp(id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
- return DBOX_CONTENT_TYPE_RESOURCE_ID;
- }
- }
- return DBOX_CONTENT_TYPE_BUFFER;
- case DBOX_TYPE_TEXT:
- return DBOX_CONTENT_TYPE_TEXT;
- case DBOX_TYPE_UIFW:
- return DBOX_CONTENT_TYPE_UIFW;
- default:
- break;
- }
+ switch (handler->common->dbox.type) {
+ case DBOX_TYPE_FILE:
+ return DBOX_CONTENT_TYPE_IMAGE;
+ case DBOX_TYPE_BUFFER:
+ case DBOX_TYPE_SCRIPT:
+ {
+ const char *id;
+ id = fb_id(handler->common->dbox.fb);
+ if (id && !strncasecmp(id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
+ return DBOX_CONTENT_TYPE_RESOURCE_ID;
+ }
+ }
+ return DBOX_CONTENT_TYPE_BUFFER;
+ case DBOX_TYPE_TEXT:
+ return DBOX_CONTENT_TYPE_TEXT;
+ case DBOX_TYPE_UIFW:
+ return DBOX_CONTENT_TYPE_UIFW;
+ default:
+ break;
+ }
}
dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
EAPI int dynamicbox_set_text_handler(dynamicbox_h handler, int gbar, struct dynamicbox_script_operators *ops)
{
if (!handler) {
- ErrPrint("Handler is NIL\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is NIL\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (gbar) {
- memcpy(&handler->cbs.gbar_ops, ops, sizeof(*ops));
+ memcpy(&handler->cbs.gbar_ops, ops, sizeof(*ops));
} else {
- memcpy(&handler->cbs.dbox_ops, ops, sizeof(*ops));
+ memcpy(&handler->cbs.dbox_ops, ops, sizeof(*ops));
}
return DBOX_STATUS_ERROR_NONE;
EAPI int dynamicbox_acquire_extra_resource_id(dynamicbox_h handler, int gbar, int idx, dynamicbox_ret_cb cb, void *data)
{
if (idx < 0) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Invalid handle\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handle\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (gbar) {
- if (handler->common->gbar.type != GBAR_TYPE_SCRIPT && handler->common->gbar.type != GBAR_TYPE_BUFFER) {
- ErrPrint("Invalid handler\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- if (!handler->common->gbar.extra_buffer) {
- return DBOX_STATUS_ERROR_NOT_EXIST;
- }
-
- if (idx >= conf_extra_buffer_count()) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- return dbox_acquire_gbar_extra_pixmap(handler, idx, cb, data);
+ /**
+ * This can be called from extra_resource_created event.
+ * and it can be called before get the created event.
+ * then we didn't know this handler's buffer type yet
+ * so we cannot use its type to validate handle
+ *
+ * handler->common.gbar.type == unknown
+ */
+ if (!handler->common->gbar.extra_buffer) {
+ return DBOX_STATUS_ERROR_NOT_EXIST;
+ }
+
+ if (idx >= conf_extra_buffer_count()) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ return dbox_acquire_gbar_extra_pixmap(handler, idx, cb, data);
} else {
- if (handler->common->dbox.type != DBOX_TYPE_SCRIPT && handler->common->dbox.type != DBOX_TYPE_BUFFER) {
- ErrPrint("Handler is not valid type\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- if (!handler->common->dbox.extra_buffer) {
- return DBOX_STATUS_ERROR_NOT_EXIST;
- }
-
- if (idx >= conf_extra_buffer_count()) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- return dbox_acquire_dbox_extra_pixmap(handler, idx, cb, data);
+ /**
+ * This can be called from extra_resource_created event.
+ * and it can be called before get the created event.
+ * then we didn't know this handler's buffer type yet
+ * so we cannot use its type to validate handle
+ *
+ * handler->common.dbox.type == unknown
+ */
+ if (!handler->common->dbox.extra_buffer) {
+ ErrPrint("Extra buffer is not prepared\n");
+ return DBOX_STATUS_ERROR_NOT_EXIST;
+ }
+
+ if (idx >= conf_extra_buffer_count()) {
+ ErrPrint("Invalid parameter: %d / %d\n", idx, conf_extra_buffer_count());
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ return dbox_acquire_dbox_extra_pixmap(handler, idx, cb, data);
}
}
EAPI int dynamicbox_acquire_resource_id(dynamicbox_h handler, int gbar, dynamicbox_ret_cb cb, void *data)
{
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Invalid handle\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handle\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (gbar) {
- if (handler->common->gbar.type != GBAR_TYPE_SCRIPT && handler->common->gbar.type != GBAR_TYPE_BUFFER) {
- ErrPrint("Handler is not valid type\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
+ if (handler->common->gbar.type != GBAR_TYPE_SCRIPT && handler->common->gbar.type != GBAR_TYPE_BUFFER) {
+ ErrPrint("Handler is not valid type\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
- return dbox_acquire_gbar_pixmap(handler, cb, data);
+ return dbox_acquire_gbar_pixmap(handler, cb, data);
} else {
- if (handler->common->dbox.type != DBOX_TYPE_SCRIPT && handler->common->dbox.type != DBOX_TYPE_BUFFER) {
- ErrPrint("Handler is not valid type\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
+ if (handler->common->dbox.type != DBOX_TYPE_SCRIPT && handler->common->dbox.type != DBOX_TYPE_BUFFER) {
+ ErrPrint("Handler is not valid type\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
- return dbox_acquire_dbox_pixmap(handler, cb, data);
+ return dbox_acquire_dbox_pixmap(handler, cb, data);
}
}
unsigned int cmd;
if (resource_id == 0 /* || handler->state != DBOX_STATE_CREATE */) {
- ErrPrint("Pixmap is invalid [%d]\n", resource_id);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Pixmap is invalid [%d]\n", resource_id);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (gbar) {
- if (!handler) {
- /*!
- * \note
- * Even though the handler is NULL, we should send the release request to the master.
- * Because the resource_id resource can be released after the handler is destroyed.
- * Pixmap resource is used by client. and it cannot be guaranteed to release resource_id.
- * In some cases, the resource_id can be released after the handler is deleted.
- *
- * Its implementation is up to the viewer app.
- * But we cannot force it to use only with valid handler.
- */
- DbgPrint("Using NULL handler\n");
- pkgname = NULL;
- id = NULL;
- /*!
- * \note
- * 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 != DBOX_STATE_CREATE */) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- if (!handler->common->id) {
- ErrPrint("Invalid handle\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- if (handler->common->gbar.type != GBAR_TYPE_SCRIPT && handler->common->gbar.type != GBAR_TYPE_BUFFER) {
- ErrPrint("Handler is not valid type\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- pkgname = handler->common->pkgname;
- id = handler->common->id;
- }
-
- cmd = CMD_GBAR_RELEASE_PIXMAP;
+ if (!handler) {
+ /*!
+ * \note
+ * Even though the handler is NULL, we should send the release request to the master.
+ * Because the resource_id resource can be released after the handler is destroyed.
+ * Pixmap resource is used by client. and it cannot be guaranteed to release resource_id.
+ * In some cases, the resource_id can be released after the handler is deleted.
+ *
+ * Its implementation is up to the viewer app.
+ * But we cannot force it to use only with valid handler.
+ */
+ DbgPrint("Using NULL handler\n");
+ pkgname = NULL;
+ id = NULL;
+ /*!
+ * \note
+ * 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 != DBOX_STATE_CREATE */) {
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!handler->common->id) {
+ ErrPrint("Invalid handle\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ /**
+ * This can be called from extra_resource_created event.
+ * and it can be called before get the created event.
+ * then we didn't know this handler's buffer type yet
+ * so we cannot use its type to validate handle
+ *
+ * handler->common.gbar.type == unknown
+ */
+
+ pkgname = handler->common->pkgname;
+ id = handler->common->id;
+ }
+
+ cmd = CMD_GBAR_RELEASE_PIXMAP;
} else {
- if (!handler) {
- /*!
- * \note
- * Even though the handler is NULL, we should send the release request to the master.
- * Because the resource_id resource can be released after the handler is destroyed.
- * Pixmap resource is used by client. and it cannot be guaranteed to release resource_id.
- * In some cases, the resource_id can be released after the handler is deleted.
- *
- * Its implementation is up to the viewer app.
- * But we cannot force it to use only with valid handler.
- */
- DbgPrint("Using NULL handler\n");
- pkgname = NULL;
- id = NULL;
- /*!
- * \note
- * 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 != DBOX_STATE_CREATE */) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- if (!handler->common->id) {
- ErrPrint("Invalid handle\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- if (handler->common->dbox.type != DBOX_TYPE_SCRIPT && handler->common->dbox.type != DBOX_TYPE_BUFFER) {
- ErrPrint("Handler is not valid type\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- pkgname = handler->common->pkgname;
- id = handler->common->id;
- }
-
- cmd = CMD_DBOX_RELEASE_PIXMAP;
+ if (!handler) {
+ /*!
+ * \note
+ * Even though the handler is NULL, we should send the release request to the master.
+ * Because the resource_id resource can be released after the handler is destroyed.
+ * Pixmap resource is used by client. and it cannot be guaranteed to release resource_id.
+ * In some cases, the resource_id can be released after the handler is deleted.
+ *
+ * Its implementation is up to the viewer app.
+ * But we cannot force it to use only with valid handler.
+ */
+ DbgPrint("Using NULL handler\n");
+ pkgname = NULL;
+ id = NULL;
+ /*!
+ * \note
+ * 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 != DBOX_STATE_CREATE */) {
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!handler->common->id) {
+ ErrPrint("Invalid handle\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ /**
+ * This can be called from extra_resource_created event.
+ * and it can be called before get the created event.
+ * then we didn't know this handler's buffer type yet
+ * so we cannot use its type to validate handle
+ *
+ * handler->common.dbox.type == unknown
+ */
+
+ pkgname = handler->common->pkgname;
+ id = handler->common->id;
+ }
+
+ cmd = CMD_DBOX_RELEASE_PIXMAP;
}
packet = packet_create_noack((const char *)&cmd, "ssi", pkgname, id, resource_id);
if (!packet) {
- ErrPrint("Failed to build a param\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to build a param\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(handler, packet);
EAPI unsigned int dynamicbox_extra_resource_id(const dynamicbox_h handler, int gbar, int idx)
{
if (idx < 0) {
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return 0u;
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return 0u;
}
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return 0u;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return 0u;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return 0u;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return 0u;
}
if (!handler->common->id) {
- ErrPrint("Invalid handler\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return 0u;
+ ErrPrint("Invalid handler\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return 0u;
}
if (gbar) {
- if (handler->common->gbar.type != GBAR_TYPE_SCRIPT && handler->common->gbar.type != GBAR_TYPE_BUFFER) {
- ErrPrint("Invalid handler\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return 0u;
- }
-
- if (!handler->common->gbar.extra_buffer || handler->common->gbar.last_extra_buffer_idx < 0) {
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
- return 0u;
- }
-
- return handler->common->gbar.extra_buffer[handler->common->gbar.last_extra_buffer_idx];
+ /**
+ * This can be called from extra_resource_created event.
+ * and it can be called before get the created event.
+ * then we didn't know this handler's buffer type yet
+ * so we cannot use its type to validate handle
+ *
+ * handler->common.gbar.type == unknown
+ */
+
+ if (!handler->common->gbar.extra_buffer || handler->common->gbar.last_extra_buffer_idx < 0) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
+ return 0u;
+ }
+
+ return handler->common->gbar.extra_buffer[handler->common->gbar.last_extra_buffer_idx];
} else {
- if (handler->common->dbox.type != DBOX_TYPE_SCRIPT && handler->common->dbox.type != DBOX_TYPE_BUFFER) {
- ErrPrint("Invalid handler\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return 0u;
- }
-
- if (!handler->common->dbox.extra_buffer || handler->common->dbox.last_extra_buffer_idx < 0) {
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
- return 0u;
- }
-
- return handler->common->dbox.extra_buffer[handler->common->dbox.last_extra_buffer_idx];
+ /**
+ * This can be called from extra_resource_created event.
+ * and it can be called before get the created event.
+ * then we didn't know this handler's buffer type yet
+ * so we cannot use its type to validate handle
+ *
+ * handler->common.dbox.type == unknown
+ */
+
+ if (!handler->common->dbox.extra_buffer || handler->common->dbox.last_extra_buffer_idx < 0) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
+ return 0u;
+ }
+
+ return handler->common->dbox.extra_buffer[handler->common->dbox.last_extra_buffer_idx];
}
}
unsigned int pixmap = 0u;
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return 0u;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return 0u;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return 0u;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return 0u;
}
if (!handler->common->id) {
- ErrPrint("Invalid handler\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return 0u;
+ ErrPrint("Invalid handler\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return 0u;
}
if (gbar) {
- if (handler->common->gbar.type != GBAR_TYPE_SCRIPT && handler->common->gbar.type != GBAR_TYPE_BUFFER) {
- ErrPrint("Invalid handler\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return 0u;
- }
-
- id = fb_id(handler->common->gbar.fb);
- if (id && sscanf(id, SCHEMA_PIXMAP "%u", &pixmap) != 1) {
- ErrPrint("PIXMAP Id is not valid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return 0u;
- }
+ if (handler->common->gbar.type != GBAR_TYPE_SCRIPT && handler->common->gbar.type != GBAR_TYPE_BUFFER) {
+ ErrPrint("Invalid handler\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return 0u;
+ }
+
+ id = fb_id(handler->common->gbar.fb);
+ if (id && sscanf(id, SCHEMA_PIXMAP "%u", &pixmap) != 1) {
+ ErrPrint("PIXMAP Id is not valid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return 0u;
+ }
} else {
- if (handler->common->dbox.type != DBOX_TYPE_SCRIPT && handler->common->dbox.type != DBOX_TYPE_BUFFER) {
- ErrPrint("Invalid handler\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return 0u;
- }
+ if (handler->common->dbox.type != DBOX_TYPE_SCRIPT && handler->common->dbox.type != DBOX_TYPE_BUFFER) {
+ ErrPrint("Invalid handler\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return 0u;
+ }
- id = fb_id(handler->common->dbox.fb);
- if (id && sscanf(id, SCHEMA_PIXMAP "%u", &pixmap) != 1) {
- ErrPrint("PIXMAP Id is not valid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return 0u;
- }
+ id = fb_id(handler->common->dbox.fb);
+ if (id && sscanf(id, SCHEMA_PIXMAP "%u", &pixmap) != 1) {
+ ErrPrint("PIXMAP Id is not valid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return 0u;
+ }
}
return pixmap;
EAPI void *dynamicbox_acquire_buffer(dynamicbox_h handler, int gbar)
{
if (gbar) {
- if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- if (!handler->common->id) {
- ErrPrint("Invalid handler\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- if (handler->common->gbar.type != GBAR_TYPE_SCRIPT && handler->common->gbar.type != GBAR_TYPE_BUFFER) {
- ErrPrint("Handler is not valid type\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- return fb_acquire_buffer(handler->common->gbar.fb);
+ if (!handler || handler->state != DBOX_STATE_CREATE) {
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
+ if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
+ if (!handler->common->id) {
+ ErrPrint("Invalid handler\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
+ if (handler->common->gbar.type != GBAR_TYPE_SCRIPT && handler->common->gbar.type != GBAR_TYPE_BUFFER) {
+ ErrPrint("Handler is not valid type\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
+ return fb_acquire_buffer(handler->common->gbar.fb);
} else {
- if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- if (!handler->common->id) {
- ErrPrint("Invalid handle\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- if (handler->common->dbox.type != DBOX_TYPE_SCRIPT && handler->common->dbox.type != DBOX_TYPE_BUFFER) {
- ErrPrint("Handler is not valid type\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- return fb_acquire_buffer(handler->common->dbox.fb);
+ if (!handler || handler->state != DBOX_STATE_CREATE) {
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
+ if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
+ if (!handler->common->id) {
+ ErrPrint("Invalid handle\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
+ if (handler->common->dbox.type != DBOX_TYPE_SCRIPT && handler->common->dbox.type != DBOX_TYPE_BUFFER) {
+ ErrPrint("Handler is not valid type\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
+ return fb_acquire_buffer(handler->common->dbox.fb);
}
}
EAPI int dynamicbox_buffer_size(dynamicbox_h handler, int gbar)
{
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Invalid handler\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handler\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (gbar) {
- return fb_size(handler->common->gbar.fb);
+ return fb_size(handler->common->gbar.fb);
} else {
- return fb_size(handler->common->dbox.fb);
+ return fb_size(handler->common->dbox.fb);
}
}
EAPI int dynamicbox_is_created_by_user(dynamicbox_h handler)
{
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Invalid handler\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handler\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return handler->common->is_user;
int ret;
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Invalid handler\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handler\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (handler->common->request.pinup) {
- ErrPrint("Previous pinup request is not finished\n");
- return DBOX_STATUS_ERROR_BUSY;
+ ErrPrint("Previous pinup request is not finished\n");
+ return DBOX_STATUS_ERROR_BUSY;
}
if (handler->common->is_pinned_up == flag) {
- DbgPrint("No changes\n");
- return DBOX_STATUS_ERROR_ALREADY;
+ DbgPrint("No changes\n");
+ return DBOX_STATUS_ERROR_ALREADY;
}
packet = packet_create((const char *)&cmd, "ssi", handler->common->pkgname, handler->common->id, flag);
if (!packet) {
- ErrPrint("Failed to build a param\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to build a param\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
if (!cb) {
- cb = default_pinup_cb;
+ cb = default_pinup_cb;
}
ret = master_rpc_async_request(handler, packet, 0, pinup_done_cb, NULL);
if (ret == (int)DBOX_STATUS_ERROR_NONE) {
- handler->cbs.pinup.cb = cb;
- handler->cbs.pinup.data = data;
- handler->common->request.pinup = 1;
+ handler->cbs.pinup.cb = cb;
+ handler->cbs.pinup.data = data;
+ handler->common->request.pinup = 1;
}
return ret;
EAPI int dynamicbox_is_pinned_up(dynamicbox_h handler)
{
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Invalid handler\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handler\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return handler->common->is_pinned_up;
EAPI int dynamicbox_has_pinup(dynamicbox_h handler)
{
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Invalid handler\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handler\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return handler->common->dbox.pinup_supported;
EAPI int dynamicbox_set_data(dynamicbox_h handler, void *data)
{
if (!handler) {
- ErrPrint("Handler is NIL\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is NIL\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
handler->data = data;
EAPI void *dynamicbox_data(dynamicbox_h handler)
{
if (!handler) {
- ErrPrint("Handler is NIL\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
+ ErrPrint("Handler is NIL\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
}
if (handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
}
return handler->data;
EAPI const char *dynamicbox_content(dynamicbox_h handler)
{
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Invalid handle\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
+ ErrPrint("Invalid handle\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
}
dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
EAPI const char *dynamicbox_title(dynamicbox_h handler)
{
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Invalid handle\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
+ ErrPrint("Invalid handle\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
}
dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
const char *source;
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if ((handler->common->dbox.type != DBOX_TYPE_TEXT && handler->common->gbar.type != GBAR_TYPE_TEXT) || !handler->common->id) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!event_info) {
- ErrPrint("Invalid event info\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid event info\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
emission = event_info->emission;
if (!emission) {
- emission = "";
+ emission = "";
}
source = event_info->source;
if (!source) {
- source = "";
+ source = "";
}
packet = packet_create((const char *)&cmd, "ssssdddd",
- handler->common->pkgname, handler->common->id,
- emission, source,
- event_info->geometry.sx, event_info->geometry.sy,
- event_info->geometry.ex, event_info->geometry.ey);
+ handler->common->pkgname, handler->common->id,
+ emission, source,
+ event_info->geometry.sx, event_info->geometry.sy,
+ event_info->geometry.ex, event_info->geometry.ey);
if (!packet) {
- ErrPrint("Failed to build a param\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to build a param\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
- packet_destroy(packet);
- return DBOX_STATUS_ERROR_FAULT;
+ packet_destroy(packet);
+ return DBOX_STATUS_ERROR_FAULT;
}
ret = master_rpc_async_request(handler, packet, 0, text_signal_cb, cbinfo);
if (ret < 0) {
- dbox_destroy_cb_info(cbinfo);
+ dbox_destroy_cb_info(cbinfo);
}
return ret;
packet = packet_create_noack((const char *)&cmd, "ss", cluster ? cluster : "", category ? category : "");
if (!packet) {
- ErrPrint("Failed to create a packet\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to create a packet\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(NULL, packet);
packet = packet_create_noack((const char *)&cmd, "ss", cluster ? cluster : "", category ? category : "");
if (!packet) {
- ErrPrint("Failed to create a packet\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to create a packet\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(NULL, packet);
unsigned int cmd = CMD_UPDATE;
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet = packet_create_noack((const char *)&cmd, "ssi", handler->common->pkgname, handler->common->id, force);
if (!packet) {
- ErrPrint("Failed to create a packet\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to create a packet\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(handler, packet);
unsigned int cmd = CMD_REFRESH_GROUP;
if (!cluster || !category) {
- ErrPrint("Invalid argument\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid argument\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet = packet_create_noack((const char *)&cmd, "ssi", cluster, category, force);
if (!packet) {
- ErrPrint("Failed to create a packet\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to create a packet\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(NULL, packet);
int ret;
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is invalid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->is_user) {
- /* System cluster dynamicbox cannot be changed its visible states */
- if (state == DBOX_HIDE_WITH_PAUSE) {
- ErrPrint("CA Livebox is not able to change the visibility\n");
- return DBOX_STATUS_ERROR_PERMISSION_DENIED;
- }
+ /* System cluster dynamicbox cannot be changed its visible states */
+ if (state == DBOX_HIDE_WITH_PAUSE) {
+ ErrPrint("CA Livebox is not able to change the visibility\n");
+ return DBOX_STATUS_ERROR_PERMISSION_DENIED;
+ }
}
if (handler->visible == state) {
- DbgPrint("%s has no changes\n", handler->common->pkgname);
- return DBOX_STATUS_ERROR_ALREADY;
+ DbgPrint("%s has no changes\n", handler->common->pkgname);
+ return DBOX_STATUS_ERROR_ALREADY;
}
old_state = handler->visible;
ret = dbox_set_visibility(handler, state);
if (ret < 0) {
- handler->visible = old_state;
+ handler->visible = old_state;
}
return ret;
EAPI dynamicbox_visible_state_e dynamicbox_visibility(dynamicbox_h handler)
{
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is invalid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_VISIBLE_ERROR;
+ ErrPrint("Handler is invalid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_VISIBLE_ERROR;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is not valid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_VISIBLE_ERROR;
+ ErrPrint("Handler is not valid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_VISIBLE_ERROR;
}
if (!handler->common->id) {
- ErrPrint("Handler is not valid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_VISIBLE_ERROR;
+ ErrPrint("Handler is not valid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_VISIBLE_ERROR;
}
return handler->visible;
packet = packet_create_noack((const char *)&cmd, "d", util_timestamp());
if (!packet) {
- ErrPrint("Failed to create a pause packet\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to create a pause packet\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(NULL, packet);
packet = packet_create_noack((const char *)&cmd, "d", util_timestamp());
if (!packet) {
- ErrPrint("Failed to create a resume packet\n");
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to create a resume packet\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(NULL, packet);
EAPI int dynamicbox_sync_buffer(dynamicbox_h handler, int gbar)
{
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Invalid handle\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handle\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Invalid handle\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handle\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Invalid handle\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handle\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (gbar) {
- return dbox_sync_gbar_fb(handler->common);
+ return dbox_sync_gbar_fb(handler->common);
} else {
- return dbox_sync_dbox_fb(handler->common);
+ return dbox_sync_dbox_fb(handler->common);
}
}
EAPI const char *dynamicbox_alternative_icon(dynamicbox_h handler)
{
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is not valid[%p]\n", handler);
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
+ ErrPrint("Handler is not valid[%p]\n", handler);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is not valid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
+ ErrPrint("Handler is not valid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
}
return handler->common->alt.icon;
EAPI const char *dynamicbox_alternative_name(dynamicbox_h handler)
{
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is not valid[%p]\n", handler);
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
+ ErrPrint("Handler is not valid[%p]\n", handler);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is not valid\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
+ ErrPrint("Handler is not valid\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
}
return handler->common->alt.name;
int ret = DBOX_STATUS_ERROR_NONE;
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is not valid[%p]\n", handler);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid[%p]\n", handler);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Handler is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Handler is not valid[%p]\n", handler);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid[%p]\n", handler);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (is_gbar) {
- ret = dynamicbox_service_acquire_lock(handler->common->gbar.lock);
+ ret = dynamicbox_service_acquire_lock(handler->common->gbar.lock);
} else {
- ret = dynamicbox_service_acquire_lock(handler->common->dbox.lock);
+ ret = dynamicbox_service_acquire_lock(handler->common->dbox.lock);
}
return ret == 0 ? DBOX_STATUS_ERROR_NONE : DBOX_STATUS_ERROR_FAULT;
int ret = DBOX_STATUS_ERROR_NONE;
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Invalid handle\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handle\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Invalid handle\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handle\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Handler is not valid[%p]\n", handler);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid[%p]\n", handler);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (is_gbar) {
- ret = dynamicbox_service_release_lock(handler->common->gbar.lock);
+ ret = dynamicbox_service_release_lock(handler->common->gbar.lock);
} else {
- ret = dynamicbox_service_release_lock(handler->common->dbox.lock);
+ ret = dynamicbox_service_release_lock(handler->common->dbox.lock);
}
return ret == 0 ? DBOX_STATUS_ERROR_NONE : DBOX_STATUS_ERROR_FAULT;
int ret = DBOX_STATUS_ERROR_NONE;
switch (option) {
- case DBOX_OPTION_MANUAL_SYNC:
- conf_set_manual_sync(state);
- break;
- case DBOX_OPTION_FRAME_DROP_FOR_RESIZE:
- conf_set_frame_drop_for_resizing(state);
- break;
- case DBOX_OPTION_SHARED_CONTENT:
- conf_set_shared_content(state);
- break;
- case DBOX_OPTION_DIRECT_UPDATE:
- if (s_info.init_count) {
- DbgPrint("Already intialized, this option is not applied\n");
- }
- conf_set_direct_update(state);
- break;
- case DBOX_OPTION_EXTRA_BUFFER_CNT:
- ErrPrint("Permission denied\n");
- ret = DBOX_STATUS_ERROR_PERMISSION_DENIED;
- break;
- default:
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- break;
+ case DBOX_OPTION_MANUAL_SYNC:
+ conf_set_manual_sync(state);
+ break;
+ case DBOX_OPTION_FRAME_DROP_FOR_RESIZE:
+ conf_set_frame_drop_for_resizing(state);
+ break;
+ case DBOX_OPTION_SHARED_CONTENT:
+ conf_set_shared_content(state);
+ break;
+ case DBOX_OPTION_DIRECT_UPDATE:
+ if (s_info.init_count) {
+ DbgPrint("Already intialized, this option is not applied\n");
+ }
+ conf_set_direct_update(state);
+ break;
+ case DBOX_OPTION_EXTRA_BUFFER_CNT:
+ ErrPrint("Permission denied\n");
+ ret = DBOX_STATUS_ERROR_PERMISSION_DENIED;
+ break;
+ default:
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ break;
}
return ret;
dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
switch (option) {
- case DBOX_OPTION_MANUAL_SYNC:
- ret = conf_manual_sync();
- break;
- case DBOX_OPTION_FRAME_DROP_FOR_RESIZE:
- ret = conf_frame_drop_for_resizing();
- break;
- case DBOX_OPTION_SHARED_CONTENT:
- ret = conf_shared_content();
- break;
- case DBOX_OPTION_DIRECT_UPDATE:
- ret = conf_direct_update();
- break;
- case DBOX_OPTION_EXTRA_BUFFER_CNT:
- ret = conf_extra_buffer_count();
- break;
- default:
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- break;
+ case DBOX_OPTION_MANUAL_SYNC:
+ ret = conf_manual_sync();
+ break;
+ case DBOX_OPTION_FRAME_DROP_FOR_RESIZE:
+ ret = conf_frame_drop_for_resizing();
+ break;
+ case DBOX_OPTION_SHARED_CONTENT:
+ ret = conf_shared_content();
+ break;
+ case DBOX_OPTION_DIRECT_UPDATE:
+ ret = conf_direct_update();
+ break;
+ case DBOX_OPTION_EXTRA_BUFFER_CNT:
+ ret = conf_extra_buffer_count();
+ break;
+ default:
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ break;
}
return ret;
EAPI int dynamicbox_damage_region_get(dynamicbox_h handler, int gbar, const dynamicbox_damage_region_t *region)
{
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Invalid handle\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handle\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Invalid handle\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handle\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Handler is not valid[%p]\n", handler);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid[%p]\n", handler);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (gbar) {
- region = &handler->common->dbox.last_damage;
+ region = &handler->common->dbox.last_damage;
} else {
- region = &handler->common->gbar.last_damage;
+ region = &handler->common->gbar.last_damage;
}
return DBOX_STATUS_ERROR_NONE;
unsigned int _resource_id;
if (!handler || handler->state != DBOX_STATE_CREATE) {
- ErrPrint("Invalid handle\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handle\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common || handler->common->state != DBOX_STATE_CREATE) {
- ErrPrint("Invalid handle\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handle\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!handler->common->id) {
- ErrPrint("Handler is not valid[%p]\n", handler);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handler is not valid[%p]\n", handler);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!idx) {
- idx = &_idx;
+ idx = &_idx;
}
if (!resource_id) {
- resource_id = &_resource_id;
+ resource_id = &_resource_id;
}
if (gbar) {
- if (!handler->common->gbar.extra_buffer || handler->common->gbar.last_extra_buffer_idx < 0) {
- return DBOX_STATUS_ERROR_NOT_EXIST;
- }
+ if (!handler->common->gbar.extra_buffer || handler->common->gbar.last_extra_buffer_idx < 0) {
+ return DBOX_STATUS_ERROR_NOT_EXIST;
+ }
- *idx = handler->common->gbar.last_extra_buffer_idx;
- *resource_id = handler->common->gbar.extra_buffer[*idx];
+ *idx = handler->common->gbar.last_extra_buffer_idx;
+ *resource_id = handler->common->gbar.extra_buffer[*idx];
} else {
- if (!handler->common->dbox.extra_buffer || handler->common->dbox.last_extra_buffer_idx < 0) {
- return DBOX_STATUS_ERROR_NOT_EXIST;
- }
+ if (!handler->common->dbox.extra_buffer || handler->common->dbox.last_extra_buffer_idx < 0) {
+ return DBOX_STATUS_ERROR_NOT_EXIST;
+ }
- *idx = handler->common->dbox.last_extra_buffer_idx;
- *resource_id = handler->common->dbox.extra_buffer[*idx];
+ *idx = handler->common->dbox.last_extra_buffer_idx;
+ *resource_id = handler->common->dbox.extra_buffer[*idx];
}
return DBOX_STATUS_ERROR_NONE;
dbox_destroy_cb_info(info);
if (!result) {
- ErrPrint("Connection lost?\n");
- ret = DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Connection lost?\n");
+ ret = DBOX_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
- ErrPrint("Invalid argument\n");
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid argument\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (ret == 0) {
- handler->cbs.deleted.cb = cb;
- handler->cbs.deleted.data = cbdata;
+ handler->cbs.deleted.cb = cb;
+ handler->cbs.deleted.data = cbdata;
} else if (cb) {
- cb(handler, ret, cbdata);
+ cb(handler, ret, cbdata);
}
/*!
common = calloc(1, sizeof(*common));
if (!common) {
- ErrPrint("Heap: %s\n", strerror(errno));
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
- return NULL;
+ ErrPrint("Heap: %s\n", strerror(errno));
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ return NULL;
}
common->pkgname = strdup(pkgname);
if (!common->pkgname) {
- free(common);
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
- return NULL;
+ free(common);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ return NULL;
}
common->cluster = strdup(cluster);
if (!common->cluster) {
- ErrPrint("Error: %s\n", strerror(errno));
- free(common->pkgname);
- free(common);
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
- return NULL;
+ ErrPrint("Error: %s\n", strerror(errno));
+ free(common->pkgname);
+ free(common);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ return NULL;
}
common->category = strdup(category);
if (!common->category) {
- ErrPrint("Error: %s\n", strerror(errno));
- free(common->cluster);
- free(common->pkgname);
- free(common);
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
- return NULL;
+ ErrPrint("Error: %s\n", strerror(errno));
+ free(common->cluster);
+ free(common->pkgname);
+ free(common);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ return NULL;
}
/* Data provider will set this */
common->delete_type = DBOX_DELETE_PERMANENTLY;
common->gbar.lock = NULL;
- common->gbar.last_extra_buffer_idx = -1;
+ common->gbar.last_extra_buffer_idx = DBOX_PRIMARY_BUFFER;
common->dbox.lock = NULL;
- common->dbox.last_extra_buffer_idx = -1;
+ common->dbox.last_extra_buffer_idx = DBOX_PRIMARY_BUFFER;
common->state = DBOX_STATE_CREATE;
common->visible = DBOX_SHOW;
common->state = DBOX_STATE_DESTROYED;
if (common->filename) {
- (void)util_unlink(common->filename);
+ (void)util_unlink(common->filename);
}
free(common->cluster);
free(common->alt.name);
if (common->dbox.fb) {
- fb_destroy(common->dbox.fb);
- common->dbox.fb = NULL;
+ fb_destroy(common->dbox.fb);
+ common->dbox.fb = NULL;
}
if (common->gbar.fb) {
- fb_destroy(common->gbar.fb);
- common->gbar.fb = NULL;
+ fb_destroy(common->gbar.fb);
+ common->gbar.fb = NULL;
}
return 0;
void *ps = NULL;
if (cluster) {
- pc = strdup(cluster);
- if (!pc) {
- ErrPrint("Heap: %s (cluster: %s)\n", strerror(errno), cluster);
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- }
+ pc = strdup(cluster);
+ if (!pc) {
+ ErrPrint("Heap: %s (cluster: %s)\n", strerror(errno), cluster);
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
}
if (category) {
- ps = strdup(category);
- if (!ps) {
- ErrPrint("Heap: %s (category: %s)\n", strerror(errno), category);
- free(pc);
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- }
+ ps = strdup(category);
+ if (!ps) {
+ ErrPrint("Heap: %s (category: %s)\n", strerror(errno), category);
+ free(pc);
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
}
if (common->cluster) {
- free(common->cluster);
+ free(common->cluster);
}
if (common->category) {
- free(common->category);
+ free(common->category);
}
common->cluster = pc;
size_type = dynamicbox_service_size_type(w, h);
if (size_type != DBOX_SIZE_TYPE_UNKNOWN) {
- common->dbox.mouse_event = dynamicbox_service_mouse_event(common->pkgname, size_type);
+ common->dbox.mouse_event = dynamicbox_service_mouse_event(common->pkgname, size_type);
}
}
s_info.fault_state = INFO_STATE_CALLBACK_IN_PROCESSING;
dlist_foreach_safe(s_info.fault_list, l, n, info) {
- if (!info->is_deleted && info->handler(event, pkgname, file, func, info->user_data) == EXIT_FAILURE) {
- info->is_deleted = 1;
- }
+ if (!info->is_deleted && info->handler(event, pkgname, file, func, info->user_data) == EXIT_FAILURE) {
+ info->is_deleted = 1;
+ }
- if (info->is_deleted) {
- s_info.fault_list = dlist_remove(s_info.fault_list, l);
- free(info);
- }
+ if (info->is_deleted) {
+ s_info.fault_list = dlist_remove(s_info.fault_list, l);
+ free(info);
+ }
}
s_info.fault_state &= ~INFO_STATE_CALLBACK_IN_PROCESSING;
struct event_info *info;
if (event == DBOX_EVENT_DBOX_UPDATED && handler->common->refcnt > 1) {
- if (handler->visible != DBOX_SHOW) {
- DbgPrint("Update requested(pending) - %s\n", handler->common->pkgname);
- handler->paused_updating++;
- return;
- } else {
- handler->paused_updating = 0;
- }
+ if (handler->visible != DBOX_SHOW) {
+ DbgPrint("Update requested(pending) - %s\n", handler->common->pkgname);
+ handler->paused_updating++;
+ return;
+ } else {
+ handler->paused_updating = 0;
+ }
}
s_info.event_state = INFO_STATE_CALLBACK_IN_PROCESSING;
dlist_foreach_safe(s_info.event_list, l, n, info) {
- if (!info->is_deleted && info->handler(handler, event, info->user_data) == EXIT_FAILURE) {
- DbgPrint("Event handler returns EXIT_FAILURE\n");
- info->is_deleted = 1;
- }
+ if (!info->is_deleted && info->handler(handler, event, info->user_data) == EXIT_FAILURE) {
+ DbgPrint("Event handler returns EXIT_FAILURE\n");
+ info->is_deleted = 1;
+ }
- if (info->is_deleted) {
- s_info.event_list = dlist_remove(s_info.event_list, l);
- free(info);
- }
+ if (info->is_deleted) {
+ s_info.event_list = dlist_remove(s_info.event_list, l);
+ free(info);
+ }
}
s_info.event_state &= ~INFO_STATE_CALLBACK_IN_PROCESSING;
struct dynamicbox_common *common;
dlist_foreach(s_info.dynamicbox_common_list, l, common) {
- if (!common->id) {
- continue;
- }
+ if (!common->id) {
+ continue;
+ }
- if (!strcmp(common->pkgname, pkgname) && !strcmp(common->id, id)) {
- return common;
- }
+ if (!strcmp(common->pkgname, pkgname) && !strcmp(common->id, id)) {
+ return common;
+ }
}
return NULL;
struct dynamicbox_common *common;
dlist_foreach(s_info.dynamicbox_common_list, l, common) {
- if (common->timestamp == timestamp) {
- return common;
- }
+ if (common->timestamp == timestamp) {
+ return common;
+ }
}
return NULL;
handler = calloc(1, sizeof(*handler));
if (!handler) {
- ErrPrint("Failed to create a new dynamicbox\n");
- return NULL;
+ ErrPrint("Failed to create a new dynamicbox\n");
+ return NULL;
}
handler->common = dbox_create_common_handle(handler, pkgname, cluster, category);
if (!handler->common) {
- ErrPrint("Heap: %s\n", strerror(errno));
- free(handler);
- return NULL;
+ ErrPrint("Heap: %s\n", strerror(errno));
+ free(handler);
+ return NULL;
}
dbox_common_ref(handler->common, handler);
dynamicbox_h handler;
dlist_foreach_safe(s_info.dynamicbox_list, l, n, handler) {
- dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
- dbox_unref(handler, 1);
+ dbox_invoke_event_handler(handler, DBOX_EVENT_DELETED);
+ dbox_unref(handler, 1);
}
return DBOX_STATUS_ERROR_NONE;
char *pc = NULL;
if (content) {
- pc = strdup(content);
- if (!pc) {
- ErrPrint("heap: %s [%s]\n", strerror(errno), content);
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- }
+ pc = strdup(content);
+ if (!pc) {
+ ErrPrint("heap: %s [%s]\n", strerror(errno), content);
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
}
free(common->content);
char *pt = NULL;
if (title) {
- pt = strdup(title);
- if (!pt) {
- ErrPrint("heap: %s [%s]\n", strerror(errno), title);
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- }
+ pt = strdup(title);
+ if (!pt) {
+ ErrPrint("heap: %s [%s]\n", strerror(errno), title);
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
}
free(common->title);
char *pa = NULL;
if (!auto_launch || !strlen(auto_launch)) {
- return;
+ return;
}
pa = strdup(auto_launch);
if (!pa) {
- ErrPrint("heap: %s, [%s]\n", strerror(errno), auto_launch);
- return;
+ ErrPrint("heap: %s, [%s]\n", strerror(errno), auto_launch);
+ return;
}
free(common->dbox.auto_launch);
char *pi = NULL;
if (id) {
- pi = strdup(id);
- if (!pi) {
- ErrPrint("heap: %s [%s]\n", strerror(errno), pi);
- return;
- }
+ pi = strdup(id);
+ if (!pi) {
+ ErrPrint("heap: %s [%s]\n", strerror(errno), pi);
+ return;
+ }
}
free(common->id);
void dbox_set_filename(struct dynamicbox_common *common, const char *filename)
{
if (common->filename) {
- if (common->dbox.type == DBOX_TYPE_FILE || common->dbox.type == DBOX_TYPE_TEXT) {
- if (common->filename[0] && unlink(common->filename) < 0) {
- ErrPrint("unlink: %s (%s)\n", strerror(errno), common->filename);
- }
- }
+ if (common->dbox.type == DBOX_TYPE_FILE || common->dbox.type == DBOX_TYPE_TEXT) {
+ if (common->filename[0] && unlink(common->filename) < 0) {
+ ErrPrint("unlink: %s (%s)\n", strerror(errno), common->filename);
+ }
+ }
- free(common->filename);
+ free(common->filename);
}
common->filename = strdup(filename);
if (!common->filename) {
- ErrPrint("Heap: %s\n", strerror(errno));
+ ErrPrint("Heap: %s\n", strerror(errno));
}
}
char *_icon = NULL;
if (icon && strlen(icon)) {
- _icon = strdup(icon);
- if (!_icon) {
- ErrPrint("Heap: %s\n", strerror(errno));
- }
+ _icon = strdup(icon);
+ if (!_icon) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
}
free(common->alt.icon);
char *_name = NULL;
if (name && strlen(name)) {
- _name = strdup(name);
- if (!_name) {
- ErrPrint("Heap: %s\n", strerror(errno));
- }
+ _name = strdup(name);
+ if (!_name) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
}
free(common->alt.name);
struct fb_info *fb;
if (!common) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
fb = common->dbox.fb;
if (fb && !strcmp(fb_id(fb), filename)) { /*!< BUFFER is not changed, */
- return DBOX_STATUS_ERROR_NONE;
+ return DBOX_STATUS_ERROR_NONE;
}
common->dbox.fb = NULL;
if (!filename || filename[0] == '\0') {
- if (fb) {
- fb_destroy(fb);
- }
- return DBOX_STATUS_ERROR_NONE;
+ if (fb) {
+ fb_destroy(fb);
+ }
+ return DBOX_STATUS_ERROR_NONE;
}
common->dbox.fb = fb_create(filename, common->dbox.width, common->dbox.height);
if (!common->dbox.fb) {
- ErrPrint("Faield to create a FB\n");
- if (fb) {
- fb_destroy(fb);
- }
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Faield to create a FB\n");
+ if (fb) {
+ fb_destroy(fb);
+ }
+ return DBOX_STATUS_ERROR_FAULT;
}
if (fb) {
- fb_destroy(fb);
+ fb_destroy(fb);
}
return DBOX_STATUS_ERROR_NONE;
struct fb_info *fb;
if (!common || common->state != DBOX_STATE_CREATE) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
fb = common->gbar.fb;
if (fb && !strcmp(fb_id(fb), filename)) {
- /* BUFFER is not changed, just update the content */
- return DBOX_STATUS_ERROR_EXIST;
+ /* BUFFER is not changed, just update the content */
+ return DBOX_STATUS_ERROR_EXIST;
}
common->gbar.fb = NULL;
if (!filename || filename[0] == '\0') {
- if (fb) {
- fb_destroy(fb);
- }
- return DBOX_STATUS_ERROR_NONE;
+ if (fb) {
+ fb_destroy(fb);
+ }
+ return DBOX_STATUS_ERROR_NONE;
}
common->gbar.fb = fb_create(filename, common->gbar.width, common->gbar.height);
if (!common->gbar.fb) {
- ErrPrint("Failed to create a FB\n");
- if (fb) {
- fb_destroy(fb);
- }
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to create a FB\n");
+ if (fb) {
+ fb_destroy(fb);
+ }
+ return DBOX_STATUS_ERROR_FAULT;
}
if (fb) {
- fb_destroy(fb);
+ fb_destroy(fb);
}
return DBOX_STATUS_ERROR_NONE;
}
dynamicbox_h dbox_ref(dynamicbox_h handler)
{
if (!handler) {
- return NULL;
+ return NULL;
}
handler->refcnt++;
dynamicbox_h dbox_unref(dynamicbox_h handler, int destroy_common)
{
if (!handler) {
- return NULL;
+ return NULL;
}
handler->refcnt--;
if (handler->refcnt > 0) {
- return handler;
+ return handler;
}
if (handler->cbs.created.cb) {
- handler->cbs.created.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.created.data);
- handler->cbs.created.cb = NULL;
- handler->cbs.created.data = NULL;
+ handler->cbs.created.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.created.data);
+ handler->cbs.created.cb = NULL;
+ handler->cbs.created.data = NULL;
}
if (handler->cbs.deleted.cb) {
- handler->cbs.deleted.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.deleted.data);
- handler->cbs.deleted.cb = NULL;
- handler->cbs.deleted.data = NULL;
+ handler->cbs.deleted.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.deleted.data);
+ handler->cbs.deleted.cb = NULL;
+ handler->cbs.deleted.data = NULL;
}
if (handler->cbs.pinup.cb) {
- handler->cbs.pinup.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.pinup.data);
- handler->cbs.pinup.cb = NULL;
- handler->cbs.pinup.data = NULL;
+ handler->cbs.pinup.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.pinup.data);
+ handler->cbs.pinup.cb = NULL;
+ handler->cbs.pinup.data = NULL;
}
if (handler->cbs.group_changed.cb) {
- handler->cbs.group_changed.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.group_changed.data);
- handler->cbs.group_changed.cb = NULL;
- handler->cbs.group_changed.data = NULL;
+ handler->cbs.group_changed.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.group_changed.data);
+ handler->cbs.group_changed.cb = NULL;
+ handler->cbs.group_changed.data = NULL;
}
if (handler->cbs.period_changed.cb) {
- handler->cbs.period_changed.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.period_changed.data);
- handler->cbs.period_changed.cb = NULL;
- handler->cbs.period_changed.data = NULL;
+ handler->cbs.period_changed.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.period_changed.data);
+ handler->cbs.period_changed.cb = NULL;
+ handler->cbs.period_changed.data = NULL;
}
if (handler->cbs.size_changed.cb) {
- handler->cbs.size_changed.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.size_changed.data);
- handler->cbs.size_changed.cb = NULL;
- handler->cbs.size_changed.data = NULL;
+ handler->cbs.size_changed.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.size_changed.data);
+ handler->cbs.size_changed.cb = NULL;
+ handler->cbs.size_changed.data = NULL;
}
if (handler->cbs.gbar_created.cb) {
- handler->cbs.gbar_created.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.gbar_created.data);
- handler->cbs.gbar_created.cb = NULL;
- handler->cbs.gbar_created.data = NULL;
+ handler->cbs.gbar_created.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.gbar_created.data);
+ handler->cbs.gbar_created.cb = NULL;
+ handler->cbs.gbar_created.data = NULL;
}
if (handler->cbs.gbar_destroyed.cb) {
- handler->cbs.gbar_destroyed.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.gbar_destroyed.data);
- handler->cbs.gbar_destroyed.cb = NULL;
- handler->cbs.gbar_destroyed.data = NULL;
+ handler->cbs.gbar_destroyed.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.gbar_destroyed.data);
+ handler->cbs.gbar_destroyed.cb = NULL;
+ handler->cbs.gbar_destroyed.data = NULL;
}
if (handler->cbs.update_mode.cb) {
- handler->cbs.update_mode.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.update_mode.data);
- handler->cbs.update_mode.cb = NULL;
- handler->cbs.update_mode.data = NULL;
+ handler->cbs.update_mode.cb(handler, DBOX_STATUS_ERROR_FAULT, handler->cbs.update_mode.data);
+ handler->cbs.update_mode.cb = NULL;
+ handler->cbs.update_mode.data = NULL;
}
if (handler->cbs.access_event.cb) {
- handler->cbs.access_event.cb(handler, DBOX_ACCESS_STATUS_ERROR, handler->cbs.access_event.data);
- handler->cbs.access_event.cb = NULL;
- handler->cbs.access_event.data = NULL;
+ handler->cbs.access_event.cb(handler, DBOX_ACCESS_STATUS_ERROR, handler->cbs.access_event.data);
+ handler->cbs.access_event.cb = NULL;
+ handler->cbs.access_event.data = NULL;
}
if (handler->cbs.key_event.cb) {
- handler->cbs.key_event.cb(handler, DBOX_KEY_STATUS_ERROR, handler->cbs.key_event.data);
- handler->cbs.key_event.cb = NULL;
- handler->cbs.key_event.data = NULL;
+ handler->cbs.key_event.cb(handler, DBOX_KEY_STATUS_ERROR, handler->cbs.key_event.data);
+ handler->cbs.key_event.cb = NULL;
+ handler->cbs.key_event.data = NULL;
}
dlist_remove_data(s_info.dynamicbox_list, handler);
handler->state = DBOX_STATE_DESTROYED;
if (dbox_common_unref(handler->common, handler) == 0) {
- if (destroy_common) {
- /*!
- * \note
- * Lock file should be deleted after all callbacks are processed.
- */
- (void)dynamicbox_service_destroy_lock(handler->common->dbox.lock);
- handler->common->dbox.lock = NULL;
- dbox_destroy_common_handle(handler->common);
- }
+ if (destroy_common) {
+ /*!
+ * \note
+ * Lock file should be deleted after all callbacks are processed.
+ */
+ (void)dynamicbox_service_destroy_lock(handler->common->dbox.lock);
+ handler->common->dbox.lock = NULL;
+ dbox_destroy_common_handle(handler->common);
+ }
}
free(handler);
DbgPrint("Handler is released\n");
int ret;
if (handler->common->request.deleted) {
- ErrPrint("Already in-progress\n");
- if (cb) {
- cb(handler, DBOX_STATUS_ERROR_NONE, data);
- }
- return DBOX_STATUS_ERROR_BUSY;
+ ErrPrint("Already in-progress\n");
+ if (cb) {
+ cb(handler, DBOX_STATUS_ERROR_NONE, data);
+ }
+ return DBOX_STATUS_ERROR_BUSY;
}
if (!cb) {
- cb = default_delete_cb;
+ cb = default_delete_cb;
}
packet = packet_create("delete", "ssid", handler->common->pkgname, handler->common->id, type, handler->common->timestamp);
if (!packet) {
- ErrPrint("Failed to build a param\n");
- if (cb) {
- cb(handler, DBOX_STATUS_ERROR_FAULT, data);
- }
+ ErrPrint("Failed to build a param\n");
+ if (cb) {
+ cb(handler, DBOX_STATUS_ERROR_FAULT, data);
+ }
- return DBOX_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
cbinfo = dbox_create_cb_info(cb, data);
if (!cbinfo) {
- packet_destroy(packet);
- ErrPrint("Failed to create cbinfo\n");
- if (cb) {
- cb(handler, DBOX_STATUS_ERROR_FAULT, data);
- }
+ packet_destroy(packet);
+ ErrPrint("Failed to create cbinfo\n");
+ if (cb) {
+ cb(handler, DBOX_STATUS_ERROR_FAULT, data);
+ }
- return DBOX_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
ret = master_rpc_async_request(handler, packet, 0, del_ret_cb, cbinfo);
if (ret < 0) {
- /*!
- * Packet is destroyed by master_rpc_async_request.
- */
- dbox_destroy_cb_info(cbinfo);
-
- if (cb) {
- cb(handler, DBOX_STATUS_ERROR_FAULT, data);
- }
+ /*!
+ * Packet is destroyed by master_rpc_async_request.
+ */
+ dbox_destroy_cb_info(cbinfo);
+
+ if (cb) {
+ cb(handler, DBOX_STATUS_ERROR_FAULT, data);
+ }
} else {
- handler->common->request.deleted = 1;
+ handler->common->request.deleted = 1;
}
return ret;
int ret;
if (fb_type(dbox_get_dbox_fb(common)) == DBOX_FB_TYPE_FILE) {
- (void)dynamicbox_service_acquire_lock(common->dbox.lock);
- ret = fb_sync(dbox_get_dbox_fb(common), common->dbox.last_damage.x, common->dbox.last_damage.y, common->dbox.last_damage.w, common->dbox.last_damage.h);
- (void)dynamicbox_service_release_lock(common->dbox.lock);
+ (void)dynamicbox_service_acquire_lock(common->dbox.lock);
+ ret = fb_sync(dbox_get_dbox_fb(common), common->dbox.last_damage.x, common->dbox.last_damage.y, common->dbox.last_damage.w, common->dbox.last_damage.h);
+ (void)dynamicbox_service_release_lock(common->dbox.lock);
} else {
- ret = fb_sync(dbox_get_dbox_fb(common), common->dbox.last_damage.x, common->dbox.last_damage.y, common->dbox.last_damage.w, common->dbox.last_damage.h);
+ ret = fb_sync(dbox_get_dbox_fb(common), common->dbox.last_damage.x, common->dbox.last_damage.y, common->dbox.last_damage.w, common->dbox.last_damage.h);
}
return ret;
int ret;
if (fb_type(dbox_get_gbar_fb(common)) == DBOX_FB_TYPE_FILE) {
- (void)dynamicbox_service_acquire_lock(common->gbar.lock);
- ret = fb_sync(dbox_get_gbar_fb(common), common->gbar.last_damage.x, common->gbar.last_damage.y, common->gbar.last_damage.w, common->gbar.last_damage.h);
- (void)dynamicbox_service_release_lock(common->gbar.lock);
+ (void)dynamicbox_service_acquire_lock(common->gbar.lock);
+ ret = fb_sync(dbox_get_gbar_fb(common), common->gbar.last_damage.x, common->gbar.last_damage.y, common->gbar.last_damage.w, common->gbar.last_damage.h);
+ (void)dynamicbox_service_release_lock(common->gbar.lock);
} else {
- ret = fb_sync(dbox_get_gbar_fb(common), common->gbar.last_damage.x, common->gbar.last_damage.y, common->gbar.last_damage.w, common->gbar.last_damage.h);
+ ret = fb_sync(dbox_get_gbar_fb(common), common->gbar.last_damage.x, common->gbar.last_damage.y, common->gbar.last_damage.w, common->gbar.last_damage.h);
}
return ret;
struct dynamicbox_common *common;
if (!conf_shared_content()) {
- /*!
- * Shared content option is turnned off.
- */
- return NULL;
+ /*!
+ * Shared content option is turnned off.
+ */
+ return NULL;
}
dlist_foreach(s_info.dynamicbox_common_list, l, common) {
- if (common->state != DBOX_STATE_CREATE) {
- continue;
- }
-
- if (strcmp(common->pkgname, pkgname)) {
- continue;
- }
-
- if (strcmp(common->cluster, cluster)) {
- DbgPrint("Cluster mismatched\n");
- continue;
- }
-
- if (strcmp(common->category, category)) {
- DbgPrint("Category mismatched\n");
- continue;
- }
-
- if (common->content && content) {
- if (strcmp(common->content, content)) {
- DbgPrint("%s Content ([%s] <> [%s])\n", common->pkgname, common->content, content);
- continue;
- }
- } else {
- int c1_len;
- int c2_len;
-
- /*!
- * \note
- * We assumes "" (ZERO length string) to NULL
- */
- c1_len = common->content ? strlen(common->content) : 0;
- c2_len = content ? strlen(content) : 0;
- if (c1_len != c2_len) {
- DbgPrint("%s Content %p <> %p\n", common->pkgname, common->content, content);
- continue;
- }
- }
-
- if (common->request.size_changed) {
- DbgPrint("Changing size\n");
- /*!
- * \note
- * Do not re-use resizing instance.
- * We will not use predicted size.
- */
- continue;
- }
-
- if (common->request.created) {
- DbgPrint("Creating now but re-use it (%s)\n", common->pkgname);
- }
-
- if (common->dbox.width != w || common->dbox.height != h) {
- DbgPrint("Size mismatched\n");
- continue;
- }
-
- DbgPrint("common handle is found: %p\n", common);
- return common;
+ if (common->state != DBOX_STATE_CREATE) {
+ continue;
+ }
+
+ if (strcmp(common->pkgname, pkgname)) {
+ continue;
+ }
+
+ if (strcmp(common->cluster, cluster)) {
+ DbgPrint("Cluster mismatched\n");
+ continue;
+ }
+
+ if (strcmp(common->category, category)) {
+ DbgPrint("Category mismatched\n");
+ continue;
+ }
+
+ if (common->content && content) {
+ if (strcmp(common->content, content)) {
+ DbgPrint("%s Content ([%s] <> [%s])\n", common->pkgname, common->content, content);
+ continue;
+ }
+ } else {
+ int c1_len;
+ int c2_len;
+
+ /*!
+ * \note
+ * We assumes "" (ZERO length string) to NULL
+ */
+ c1_len = common->content ? strlen(common->content) : 0;
+ c2_len = content ? strlen(content) : 0;
+ if (c1_len != c2_len) {
+ DbgPrint("%s Content %p <> %p\n", common->pkgname, common->content, content);
+ continue;
+ }
+ }
+
+ if (common->request.size_changed) {
+ DbgPrint("Changing size\n");
+ /*!
+ * \note
+ * Do not re-use resizing instance.
+ * We will not use predicted size.
+ */
+ continue;
+ }
+
+ if (common->request.created) {
+ DbgPrint("Creating now but re-use it (%s)\n", common->pkgname);
+ }
+
+ if (common->dbox.width != w || common->dbox.height != h) {
+ DbgPrint("Size mismatched\n");
+ continue;
+ }
+
+ DbgPrint("common handle is found: %p\n", common);
+ return common;
}
return NULL;
dynamicbox_h item;
dlist_foreach(common->dynamicbox_list, l, item) {
- if (item->visible == DBOX_SHOW) {
- DbgPrint("%s visibility is not changed\n", common->pkgname);
- return item;
- }
+ if (item->visible == DBOX_SHOW) {
+ DbgPrint("%s visibility is not changed\n", common->pkgname);
+ return item;
+ }
}
return NULL;
struct event_info *info;
info = malloc(sizeof(*info));
if (!info) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
}
info->handler = dbox_cb;
struct dlist *l;
dlist_foreach(s_info.event_list, l, info) {
- if (info->handler == dbox_cb) {
- void *data;
+ if (info->handler == dbox_cb) {
+ void *data;
- data = info->user_data;
+ data = info->user_data;
- if (s_info.event_state == INFO_STATE_CALLBACK_IN_PROCESSING) {
- info->is_deleted = 1;
- } else {
- s_info.event_list = dlist_remove(s_info.event_list, l);
- free(info);
- }
+ if (s_info.event_state == INFO_STATE_CALLBACK_IN_PROCESSING) {
+ info->is_deleted = 1;
+ } else {
+ s_info.event_list = dlist_remove(s_info.event_list, l);
+ free(info);
+ }
- return data;
- }
+ return data;
+ }
}
return NULL;
struct fault_info *info;
info = malloc(sizeof(*info));
if (!info) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
}
info->handler = dbox_cb;
struct dlist *l;
dlist_foreach(s_info.fault_list, l, info) {
- if (info->handler == dbox_cb) {
- void *data;
+ if (info->handler == dbox_cb) {
+ void *data;
- data = info->user_data;
+ data = info->user_data;
- if (s_info.fault_state == INFO_STATE_CALLBACK_IN_PROCESSING) {
- info->is_deleted = 1;
- } else {
- s_info.fault_list = dlist_remove(s_info.fault_list, l);
- free(info);
- }
+ if (s_info.fault_state == INFO_STATE_CALLBACK_IN_PROCESSING) {
+ info->is_deleted = 1;
+ } else {
+ s_info.fault_list = dlist_remove(s_info.fault_list, l);
+ free(info);
+ }
- return data;
- }
+ return data;
+ }
}
return NULL;
info = malloc(sizeof(*info));
if (!info) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return NULL;
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return NULL;
}
info->cb = cb;
{
s_info.disp = disp;
if (s_info.disp) {
- Screen *screen;
+ Screen *screen;
- screen = DefaultScreenOfDisplay(s_info.disp);
+ screen = DefaultScreenOfDisplay(s_info.disp);
- s_info.screen = DefaultScreen(s_info.disp);
- s_info.visual = DefaultVisualOfScreen(screen);
+ s_info.screen = DefaultScreen(s_info.disp);
+ s_info.visual = DefaultVisualOfScreen(screen);
}
return DBOX_STATUS_ERROR_NONE;
int fb_fini(void)
{
if (s_info.disp_is_opened && s_info.disp) {
- XCloseDisplay(s_info.disp);
+ XCloseDisplay(s_info.disp);
}
s_info.disp = NULL;
buffer = info->buffer;
if (!buffer) { /* Ignore this sync request */
- return DBOX_STATUS_ERROR_NONE;
+ return DBOX_STATUS_ERROR_NONE;
}
if (buffer->state != DBOX_FB_STATE_CREATED) {
- ErrPrint("Invalid state of a FB\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid state of a FB\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (buffer->type != DBOX_FB_TYPE_FILE) {
- ErrPrint("Invalid buffer\n");
- return DBOX_STATUS_ERROR_NONE;
+ ErrPrint("Invalid buffer\n");
+ return DBOX_STATUS_ERROR_NONE;
}
fd = open(util_uri_to_path(info->id), O_RDONLY);
if (fd < 0) {
- ErrPrint("Failed to open a file (%s) because of (%s)\n",
- util_uri_to_path(info->id), strerror(errno));
+ ErrPrint("Failed to open a file (%s) because of (%s)\n",
+ util_uri_to_path(info->id), strerror(errno));
- /**
- * @note
- * But return ZERO, even if we couldn't get a buffer file,
- * the viewer can draw empty screen.
- *
- * and then update it after it gots update events
- */
- return DBOX_STATUS_ERROR_NONE;
+ /**
+ * @note
+ * But return ZERO, even if we couldn't get a buffer file,
+ * the viewer can draw empty screen.
+ *
+ * and then update it after it gots update events
+ */
+ return DBOX_STATUS_ERROR_NONE;
}
/**
* Could we get some advantage if we load a part of file instead of loading all of them?
*/
if (x != 0 || y != 0 || info->w != w || info->h != h) {
- int iy;
- register int index;
- register int width;
-
- for (iy = y; iy < h; iy++) {
- index = iy * info->w + x;
- width = w * info->pixels;
-
- if (lseek(fd, index * info->pixels, SEEK_SET) != index * info->pixels) {
- ErrPrint("lseek: %s\n", strerror(errno));
- if (close(fd) < 0) {
- ErrPrint("close: %s\n", strerror(errno));
- }
- /**
- * @note
- * But return ZERO, even if we couldn't get a buffer file,
- * the viewer can draw empty screen.
- *
- * and then update it after it gots update events
- */
- return DBOX_STATUS_ERROR_NONE;
- }
-
- if (read(fd, ((unsigned int *)buffer->data) + index, width) != width) {
- if (close(fd) < 0) {
- ErrPrint("close: %s\n", strerror(errno));
- }
- /**
- * @note
- * But return ZERO, even if we couldn't get a buffer file,
- * the viewer can draw empty screen.
- *
- * and then update it after it gots update events
- */
- return DBOX_STATUS_ERROR_NONE;
- }
- }
+ int iy;
+ register int index;
+ register int width;
+
+ for (iy = y; iy < h; iy++) {
+ index = iy * info->w + x;
+ width = w * info->pixels;
+
+ if (lseek(fd, index * info->pixels, SEEK_SET) != index * info->pixels) {
+ ErrPrint("lseek: %s\n", strerror(errno));
+ if (close(fd) < 0) {
+ ErrPrint("close: %s\n", strerror(errno));
+ }
+ /**
+ * @note
+ * But return ZERO, even if we couldn't get a buffer file,
+ * the viewer can draw empty screen.
+ *
+ * and then update it after it gots update events
+ */
+ return DBOX_STATUS_ERROR_NONE;
+ }
+
+ if (read(fd, ((unsigned int *)buffer->data) + index, width) != width) {
+ if (close(fd) < 0) {
+ ErrPrint("close: %s\n", strerror(errno));
+ }
+ /**
+ * @note
+ * But return ZERO, even if we couldn't get a buffer file,
+ * the viewer can draw empty screen.
+ *
+ * and then update it after it gots update events
+ */
+ return DBOX_STATUS_ERROR_NONE;
+ }
+ }
} else {
- if (read(fd, buffer->data, info->bufsz) != info->bufsz) {
- ErrPrint("read: %s\n", strerror(errno));
- if (close(fd) < 0) {
- ErrPrint("close: %s\n", strerror(errno));
- }
-
- /**
- * @note
- * But return ZERO, even if we couldn't get a buffer file,
- * the viewer can draw empty screen.
- *
- * and then update it after it gots update events
- */
- return DBOX_STATUS_ERROR_NONE;
- }
+ if (read(fd, buffer->data, info->bufsz) != info->bufsz) {
+ ErrPrint("read: %s\n", strerror(errno));
+ if (close(fd) < 0) {
+ ErrPrint("close: %s\n", strerror(errno));
+ }
+
+ /**
+ * @note
+ * But return ZERO, even if we couldn't get a buffer file,
+ * the viewer can draw empty screen.
+ *
+ * and then update it after it gots update events
+ */
+ return DBOX_STATUS_ERROR_NONE;
+ }
}
if (close(fd) < 0) {
- ErrPrint("close: %s\n", strerror(errno));
+ ErrPrint("close: %s\n", strerror(errno));
}
return DBOX_STATUS_ERROR_NONE;
}
buffer = info->buffer;
if (!buffer) { /*!< Ignore this sync request */
- return DBOX_STATUS_ERROR_NONE;
+ return DBOX_STATUS_ERROR_NONE;
}
if (buffer->state != DBOX_FB_STATE_CREATED) {
- ErrPrint("Invalid state of a FB\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid state of a FB\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (buffer->type != DBOX_FB_TYPE_PIXMAP) {
- ErrPrint("Invalid buffer\n");
- return DBOX_STATUS_ERROR_NONE;
+ ErrPrint("Invalid buffer\n");
+ return DBOX_STATUS_ERROR_NONE;
}
if (!s_info.disp) {
- s_info.disp = XOpenDisplay(NULL);
- if (s_info.disp) {
- Screen *screen;
+ s_info.disp = XOpenDisplay(NULL);
+ if (s_info.disp) {
+ Screen *screen;
- s_info.disp_is_opened = 1;
+ s_info.disp_is_opened = 1;
- screen = DefaultScreenOfDisplay(s_info.disp);
+ screen = DefaultScreenOfDisplay(s_info.disp);
- s_info.screen = DefaultScreen(s_info.disp);
- s_info.visual = DefaultVisualOfScreen(screen);
- } else {
- ErrPrint("Failed to open a display\n");
- return DBOX_STATUS_ERROR_FAULT;
- }
+ s_info.screen = DefaultScreen(s_info.disp);
+ s_info.visual = DefaultVisualOfScreen(screen);
+ } else {
+ ErrPrint("Failed to open a display\n");
+ return DBOX_STATUS_ERROR_FAULT;
+ }
}
if (info->handle == 0) {
- ErrPrint("Pixmap ID is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Pixmap ID is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (info->bufsz == 0) {
- /*!
- * If the client does not acquire the buffer,
- * This function will do nothing.
- * It will work only if the buffer is acquired.
- * To sync its contents.
- */
- DbgPrint("Nothing can be sync\n");
- return DBOX_STATUS_ERROR_NONE;
+ /*!
+ * If the client does not acquire the buffer,
+ * This function will do nothing.
+ * It will work only if the buffer is acquired.
+ * To sync its contents.
+ */
+ DbgPrint("Nothing can be sync\n");
+ return DBOX_STATUS_ERROR_NONE;
}
si.shmid = shmget(IPC_PRIVATE, info->bufsz, IPC_CREAT | 0666);
if (si.shmid < 0) {
- ErrPrint("shmget: %s\n", strerror(errno));
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("shmget: %s\n", strerror(errno));
+ return DBOX_STATUS_ERROR_FAULT;
}
si.readOnly = False;
si.shmaddr = shmat(si.shmid, NULL, 0);
if (si.shmaddr == (void *)-1) {
- if (shmctl(si.shmid, IPC_RMID, 0) < 0) {
- ErrPrint("shmctl: %s\n", strerror(errno));
- }
+ if (shmctl(si.shmid, IPC_RMID, 0) < 0) {
+ ErrPrint("shmctl: %s\n", strerror(errno));
+ }
- return DBOX_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
/*!
* Use the 24 bits Pixmap for Video player
*/
xim = XShmCreateImage(s_info.disp, s_info.visual,
- (info->pixels << 3), ZPixmap, NULL,
- &si,
- info->w, info->h);
+ (info->pixels << 3), ZPixmap, NULL,
+ &si,
+ info->w, info->h);
if (xim == NULL) {
- if (shmdt(si.shmaddr) < 0) {
- ErrPrint("shmdt: %s\n", strerror(errno));
- }
+ if (shmdt(si.shmaddr) < 0) {
+ ErrPrint("shmdt: %s\n", strerror(errno));
+ }
- if (shmctl(si.shmid, IPC_RMID, 0) < 0) {
- ErrPrint("shmctl: %s\n", strerror(errno));
- }
+ if (shmctl(si.shmid, IPC_RMID, 0) < 0) {
+ ErrPrint("shmctl: %s\n", strerror(errno));
+ }
- return DBOX_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
xim->data = si.shmaddr;
XSync(s_info.disp, False);
if (x != 0 || y != 0 || info->w != w || info->h != h) {
- int ix;
- int iy;
- register int index;
-
- for (iy = y; iy < h; iy++) {
- for (ix = x; ix < w; ix++) {
- index = iy * info->w + x;
- *(((unsigned int *)buffer->data) + index) = *(((unsigned int *)xim->data) + index);
- }
- }
+ int ix;
+ int iy;
+ register int index;
+
+ for (iy = y; iy < h; iy++) {
+ for (ix = x; ix < w; ix++) {
+ index = iy * info->w + x;
+ *(((unsigned int *)buffer->data) + index) = *(((unsigned int *)xim->data) + index);
+ }
+ }
} else {
- memcpy(buffer->data, xim->data, info->bufsz);
+ memcpy(buffer->data, xim->data, info->bufsz);
}
XShmDetach(s_info.disp, &si);
XDestroyImage(xim);
if (shmdt(si.shmaddr) < 0) {
- ErrPrint("shmdt: %s\n", strerror(errno));
+ ErrPrint("shmdt: %s\n", strerror(errno));
}
if (shmctl(si.shmid, IPC_RMID, 0) < 0) {
- ErrPrint("shmctl: %s\n", strerror(errno));
+ ErrPrint("shmctl: %s\n", strerror(errno));
}
return DBOX_STATUS_ERROR_NONE;
int fb_sync(struct fb_info *info, int x, int y, int w, int h)
{
if (!info) {
- ErrPrint("FB Handle is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("FB Handle is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!info->id || info->id[0] == '\0') {
- DbgPrint("Ingore sync\n");
- return DBOX_STATUS_ERROR_NONE;
+ DbgPrint("Ingore sync\n");
+ return DBOX_STATUS_ERROR_NONE;
}
if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
- return sync_for_file(info, x, y, w, h);
+ return sync_for_file(info, x, y, w, h);
} else if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
- return sync_for_pixmap(info, x, y, w, h);
+ return sync_for_pixmap(info, x, y, w, h);
} else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) {
- /* No need to do sync */
- return DBOX_STATUS_ERROR_NONE;
+ /* No need to do sync */
+ return DBOX_STATUS_ERROR_NONE;
}
return DBOX_STATUS_ERROR_INVALID_PARAMETER;
struct fb_info *info;
if (!id || id[0] == '\0') {
- ErrPrint("Invalid ID\n");
- return NULL;
+ ErrPrint("Invalid ID\n");
+ return NULL;
}
info = calloc(1, sizeof(*info));
if (!info) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return NULL;
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return NULL;
}
info->id = strdup(id);
if (!info->id) {
- ErrPrint("Heap: %s\n", strerror(errno));
- free(info);
- return NULL;
+ ErrPrint("Heap: %s\n", strerror(errno));
+ free(info);
+ return NULL;
}
info->pixels = sizeof(int); /* Use the default pixels(depth) */
if (sscanf(info->id, SCHEMA_SHM "%d", &info->handle) == 1) {
- DbgPrint("SHMID: %d is gotten\n", info->handle);
+ DbgPrint("SHMID: %d is gotten\n", info->handle);
} else if (sscanf(info->id, SCHEMA_PIXMAP "%d:%d", &info->handle, &info->pixels) == 2) {
- DbgPrint("PIXMAP-SHMID: %d is gotten (%d)\n", info->handle, info->pixels);
+ DbgPrint("PIXMAP-SHMID: %d is gotten (%d)\n", info->handle, info->pixels);
} else {
- info->handle = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ info->handle = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
info->bufsz = 0;
int fb_destroy(struct fb_info *info)
{
if (!info) {
- ErrPrint("Handle is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handle is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (info->buffer) {
- dynamicbox_fb_t buffer;
- buffer = info->buffer;
+ dynamicbox_fb_t buffer;
+ buffer = info->buffer;
- buffer->info = NULL;
+ buffer->info = NULL;
}
free(info->id);
int fb_is_created(struct fb_info *info)
{
if (!info) {
- ErrPrint("Handle is not valid\n");
- return 0;
+ ErrPrint("Handle is not valid\n");
+ return 0;
}
if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP)) && info->handle != 0) {
- return 1;
+ return 1;
} else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM)) && info->handle > 0) {
- return 1;
+ return 1;
} else {
- const char *path;
- path = util_uri_to_path(info->id);
- if (path && access(path, F_OK | R_OK) == 0) {
- return 1;
- } else {
- ErrPrint("access: %s (%s)\n", strerror(errno), path);
- }
+ const char *path;
+ path = util_uri_to_path(info->id);
+ if (path && access(path, F_OK | R_OK) == 0) {
+ return 1;
+ } else {
+ ErrPrint("access: %s (%s)\n", strerror(errno), path);
+ }
}
return 0;
dynamicbox_fb_t buffer;
if (!info) {
- ErrPrint("info == NIL\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
+ ErrPrint("info == NIL\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
}
if (!info->buffer) {
- if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
- update_fb_size(info);
-
- buffer = calloc(1, sizeof(*buffer) + info->bufsz);
- if (!buffer) {
- ErrPrint("Heap: %s\n", strerror(errno));
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
- info->bufsz = 0;
- return NULL;
- }
-
- buffer->type = DBOX_FB_TYPE_PIXMAP;
- buffer->refcnt = 0;
- buffer->state = DBOX_FB_STATE_CREATED;
- buffer->info = info;
- info->buffer = buffer;
-
- /*!
- * \note
- * Just update from here.
- */
- sync_for_pixmap(info, 0, 0, info->w, info->h);
- } else if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
- update_fb_size(info);
-
- buffer = calloc(1, sizeof(*buffer) + info->bufsz);
- if (!buffer) {
- ErrPrint("Heap: %s\n", strerror(errno));
- info->bufsz = 0;
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
- return NULL;
- }
-
- buffer->type = DBOX_FB_TYPE_FILE;
- buffer->refcnt = 0;
- buffer->state = DBOX_FB_STATE_CREATED;
- buffer->info = info;
- info->buffer = buffer;
-
- sync_for_file(info, 0, 0, info->w, info->h);
- } else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) {
- buffer = shmat(info->handle, NULL, 0);
- if (buffer == (void *)-1) {
- ErrPrint("shmat: %s (%d)\n", strerror(errno), info->handle);
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
- return NULL;
- }
-
- return buffer->data;
- } else {
- ErrPrint("Buffer is not created (%s)\n", info->id);
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
- }
+ if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
+ update_fb_size(info);
+
+ buffer = calloc(1, sizeof(*buffer) + info->bufsz);
+ if (!buffer) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ info->bufsz = 0;
+ return NULL;
+ }
+
+ buffer->type = DBOX_FB_TYPE_PIXMAP;
+ buffer->refcnt = 0;
+ buffer->state = DBOX_FB_STATE_CREATED;
+ buffer->info = info;
+ info->buffer = buffer;
+
+ /*!
+ * \note
+ * Just update from here.
+ */
+ sync_for_pixmap(info, 0, 0, info->w, info->h);
+ } else if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
+ update_fb_size(info);
+
+ buffer = calloc(1, sizeof(*buffer) + info->bufsz);
+ if (!buffer) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ info->bufsz = 0;
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ return NULL;
+ }
+
+ buffer->type = DBOX_FB_TYPE_FILE;
+ buffer->refcnt = 0;
+ buffer->state = DBOX_FB_STATE_CREATED;
+ buffer->info = info;
+ info->buffer = buffer;
+
+ sync_for_file(info, 0, 0, info->w, info->h);
+ } else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) {
+ buffer = shmat(info->handle, NULL, 0);
+ if (buffer == (void *)-1) {
+ ErrPrint("shmat: %s (%d)\n", strerror(errno), info->handle);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ return NULL;
+ }
+
+ return buffer->data;
+ } else {
+ ErrPrint("Buffer is not created (%s)\n", info->id);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
}
buffer = info->buffer;
switch (buffer->type) {
- case DBOX_FB_TYPE_PIXMAP:
- buffer->refcnt++;
- break;
- case DBOX_FB_TYPE_FILE:
- buffer->refcnt++;
- break;
- default:
- DbgPrint("Unknwon FP: %d\n", buffer->type);
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- break;
+ case DBOX_FB_TYPE_PIXMAP:
+ buffer->refcnt++;
+ break;
+ case DBOX_FB_TYPE_FILE:
+ buffer->refcnt++;
+ break;
+ default:
+ DbgPrint("Unknwon FP: %d\n", buffer->type);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ break;
}
return buffer->data;
dynamicbox_fb_t buffer;
if (!data) {
- ErrPrint("buffer data == NIL\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("buffer data == NIL\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
buffer = container_of(data, struct dynamicbox_fb, data);
if (buffer->state != DBOX_FB_STATE_CREATED) {
- ErrPrint("Invalid handle\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handle\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
switch (buffer->type) {
- case DBOX_FB_TYPE_SHM:
- if (shmdt(buffer) < 0) {
- ErrPrint("shmdt: %s\n", strerror(errno));
- }
- break;
- case DBOX_FB_TYPE_PIXMAP:
- buffer->refcnt--;
- if (buffer->refcnt == 0) {
- struct fb_info *info;
- info = buffer->info;
-
- buffer->state = DBOX_FB_STATE_DESTROYED;
- free(buffer);
-
- if (info && info->buffer == buffer) {
- info->buffer = NULL;
- }
- }
- break;
- case DBOX_FB_TYPE_FILE:
- buffer->refcnt--;
- if (buffer->refcnt == 0) {
- struct fb_info *info;
- info = buffer->info;
-
- buffer->state = DBOX_FB_STATE_DESTROYED;
- free(buffer);
-
- if (info && info->buffer == buffer) {
- info->buffer = NULL;
- }
- }
- break;
- default:
- ErrPrint("Unknwon buffer type\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- break;
+ case DBOX_FB_TYPE_SHM:
+ if (shmdt(buffer) < 0) {
+ ErrPrint("shmdt: %s\n", strerror(errno));
+ }
+ break;
+ case DBOX_FB_TYPE_PIXMAP:
+ buffer->refcnt--;
+ if (buffer->refcnt == 0) {
+ struct fb_info *info;
+ info = buffer->info;
+
+ buffer->state = DBOX_FB_STATE_DESTROYED;
+ free(buffer);
+
+ if (info && info->buffer == buffer) {
+ info->buffer = NULL;
+ }
+ }
+ break;
+ case DBOX_FB_TYPE_FILE:
+ buffer->refcnt--;
+ if (buffer->refcnt == 0) {
+ struct fb_info *info;
+ info = buffer->info;
+
+ buffer->state = DBOX_FB_STATE_DESTROYED;
+ free(buffer);
+
+ if (info && info->buffer == buffer) {
+ info->buffer = NULL;
+ }
+ }
+ break;
+ default:
+ ErrPrint("Unknwon buffer type\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ break;
}
return DBOX_STATUS_ERROR_NONE;
int ret;
if (!data) {
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
buffer = container_of(data, struct dynamicbox_fb, data);
if (buffer->state != DBOX_FB_STATE_CREATED) {
- ErrPrint("Invalid handle\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handle\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
switch (buffer->type) {
- case DBOX_FB_TYPE_SHM:
- if (shmctl(buffer->refcnt, IPC_STAT, &buf) < 0) {
- ErrPrint("Error: %s\n", strerror(errno));
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
- return DBOX_STATUS_ERROR_FAULT;
- }
-
- ret = buf.shm_nattch;
- break;
- case DBOX_FB_TYPE_PIXMAP:
- ret = buffer->refcnt;
- break;
- case DBOX_FB_TYPE_FILE:
- ret = buffer->refcnt;
- break;
- default:
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- break;
+ case DBOX_FB_TYPE_SHM:
+ if (shmctl(buffer->refcnt, IPC_STAT, &buf) < 0) {
+ ErrPrint("Error: %s\n", strerror(errno));
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ return DBOX_STATUS_ERROR_FAULT;
+ }
+
+ ret = buf.shm_nattch;
+ break;
+ case DBOX_FB_TYPE_PIXMAP:
+ ret = buffer->refcnt;
+ break;
+ case DBOX_FB_TYPE_FILE:
+ ret = buffer->refcnt;
+ break;
+ default:
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ break;
}
return ret;
int fb_get_size(struct fb_info *info, int *w, int *h)
{
if (!info) {
- ErrPrint("Handle is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handle is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
*w = info->w;
int fb_size(struct fb_info *info)
{
if (!info) {
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return 0;
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return 0;
}
update_fb_size(info);
dynamicbox_fb_t buffer;
if (!info) {
- return DBOX_FB_TYPE_ERROR;
+ return DBOX_FB_TYPE_ERROR;
}
buffer = info->buffer;
if (!buffer) {
- 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 = DBOX_FB_TYPE_FILE;
- } else if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
- type = DBOX_FB_TYPE_PIXMAP;
- } else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) {
- type = DBOX_FB_TYPE_SHM;
- }
- }
-
- return type;
+ 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 = DBOX_FB_TYPE_FILE;
+ } else if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
+ type = DBOX_FB_TYPE_PIXMAP;
+ } else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) {
+ type = DBOX_FB_TYPE_SHM;
+ }
+ }
+
+ return type;
}
return buffer->type;
buffer = info->buffer;
if (!buffer) { /* Ignore this sync request */
- return DBOX_STATUS_ERROR_NONE;
+ return DBOX_STATUS_ERROR_NONE;
}
if (buffer->state != CREATED) {
- ErrPrint("Invalid state of a FB\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid state of a FB\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (buffer->type != DBOX_BUFFER_TYPE_FILE) {
- ErrPrint("Invalid buffer\n");
- return DBOX_STATUS_ERROR_NONE;
+ ErrPrint("Invalid buffer\n");
+ return DBOX_STATUS_ERROR_NONE;
}
fd = open(util_uri_to_path(info->id), O_RDONLY);
if (fd < 0) {
- ErrPrint("Failed to open a file (%s) because of (%s)\n",
- util_uri_to_path(info->id), strerror(errno));
-
- /*!
- * \note
- * But return ZERO, even if we couldn't get a buffer file,
- * the viewer can draw empty screen.
- *
- * and then update it after it gots update events
- */
- return DBOX_STATUS_ERROR_NONE;
+ ErrPrint("Failed to open a file (%s) because of (%s)\n",
+ util_uri_to_path(info->id), strerror(errno));
+
+ /*!
+ * \note
+ * But return ZERO, even if we couldn't get a buffer file,
+ * the viewer can draw empty screen.
+ *
+ * and then update it after it gots update events
+ */
+ return DBOX_STATUS_ERROR_NONE;
}
if (read(fd, buffer->data, info->bufsz) != info->bufsz) {
- ErrPrint("read: %s\n", strerror(errno));
- if (close(fd) < 0) {
- ErrPrint("close: %s\n", strerror(errno));
- }
-
- /*!
- * \note
- * But return ZERO, even if we couldn't get a buffer file,
- * the viewer can draw empty screen.
- *
- * and then update it after it gots update events
- */
- return DBOX_STATUS_ERROR_NONE;
+ ErrPrint("read: %s\n", strerror(errno));
+ if (close(fd) < 0) {
+ ErrPrint("close: %s\n", strerror(errno));
+ }
+
+ /*!
+ * \note
+ * But return ZERO, even if we couldn't get a buffer file,
+ * the viewer can draw empty screen.
+ *
+ * and then update it after it gots update events
+ */
+ return DBOX_STATUS_ERROR_NONE;
}
if (close(fd) < 0) {
- ErrPrint("close: %s\n", strerror(errno));
+ ErrPrint("close: %s\n", strerror(errno));
}
return DBOX_STATUS_ERROR_NONE;
}
int fb_sync(struct fb_info *info, int x, int y, int w, int h)
{
if (!info) {
- ErrPrint("FB Handle is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("FB Handle is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!info->id || info->id[0] == '\0') {
- DbgPrint("Ingore sync\n");
- return DBOX_STATUS_ERROR_NONE;
+ DbgPrint("Ingore sync\n");
+ return DBOX_STATUS_ERROR_NONE;
}
if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
- return sync_for_file(info);
+ return sync_for_file(info);
} else if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
} else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) {
- /* No need to do sync */
- return DBOX_STATUS_ERROR_NONE;
+ /* No need to do sync */
+ return DBOX_STATUS_ERROR_NONE;
}
return DBOX_STATUS_ERROR_INVALID_PARAMETER;
struct fb_info *info;
if (!id || id[0] == '\0') {
- ErrPrint("Invalid ID\n");
- return NULL;
+ ErrPrint("Invalid ID\n");
+ return NULL;
}
info = calloc(1, sizeof(*info));
if (!info) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return NULL;
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return NULL;
}
info->id = strdup(id);
if (!info->id) {
- ErrPrint("Heap: %s\n", strerror(errno));
- free(info);
- return NULL;
+ ErrPrint("Heap: %s\n", strerror(errno));
+ free(info);
+ return NULL;
}
info->pixels = sizeof(int); /* Use the default pixels(depth) */
if (sscanf(info->id, SCHEMA_SHM "%d", &info->handle) == 1) {
- DbgPrint("SHMID: %d is gotten\n", info->handle);
+ DbgPrint("SHMID: %d is gotten\n", info->handle);
} else if (sscanf(info->id, SCHEMA_PIXMAP "%d:%d", &info->handle, &info->pixels) == 2) {
- DbgPrint("PIXMAP-SHMID: %d is gotten (%d)\n", info->handle, info->pixels);
- ErrPrint("Unsupported\n");
- free(info);
- return NULL;
+ DbgPrint("PIXMAP-SHMID: %d is gotten (%d)\n", info->handle, info->pixels);
+ ErrPrint("Unsupported\n");
+ free(info);
+ return NULL;
} else {
- info->handle = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ info->handle = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
info->bufsz = 0;
int fb_destroy(struct fb_info *info)
{
if (!info) {
- ErrPrint("Handle is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handle is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (info->buffer) {
- struct buffer *buffer;
- buffer = info->buffer;
+ struct buffer *buffer;
+ buffer = info->buffer;
- buffer->info = NULL;
+ buffer->info = NULL;
}
free(info->id);
int fb_is_created(struct fb_info *info)
{
if (!info) {
- ErrPrint("Handle is not valid\n");
- return 0;
+ ErrPrint("Handle is not valid\n");
+ return 0;
}
if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP)) && info->handle != 0) {
- return 1;
+ return 1;
} else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM)) && info->handle > 0) {
- return 1;
+ return 1;
} else {
- const char *path;
- path = util_uri_to_path(info->id);
- if (path && access(path, F_OK | R_OK) == 0) {
- return 1;
- } else {
- ErrPrint("access: %s (%s)\n", strerror(errno), path);
- }
+ const char *path;
+ path = util_uri_to_path(info->id);
+ if (path && access(path, F_OK | R_OK) == 0) {
+ return 1;
+ } else {
+ ErrPrint("access: %s (%s)\n", strerror(errno), path);
+ }
}
return 0;
struct buffer *buffer;
if (!info) {
- ErrPrint("info == NIL\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
+ ErrPrint("info == NIL\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
}
if (!info->buffer) {
- if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
- ErrPrint("Unsupported Type\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
- } else if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
- update_fb_size(info);
-
- buffer = calloc(1, sizeof(*buffer) + info->bufsz);
- if (!buffer) {
- ErrPrint("Heap: %s\n", strerror(errno));
- info->bufsz = 0;
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
- return NULL;
- }
-
- buffer->type = DBOX_BUFFER_TYPE_FILE;
- buffer->refcnt = 0;
- buffer->state = CREATED;
- buffer->info = info;
- info->buffer = buffer;
-
- sync_for_file(info);
- } else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) {
- buffer = shmat(info->handle, NULL, 0);
- if (buffer == (void *)-1) {
- ErrPrint("shmat: %s (%d)\n", strerror(errno), info->handle);
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
- return NULL;
- }
-
- return buffer->data;
- } else {
- ErrPrint("Buffer is not created (%s)\n", info->id);
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return NULL;
- }
+ if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
+ ErrPrint("Unsupported Type\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
+ } else if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
+ update_fb_size(info);
+
+ buffer = calloc(1, sizeof(*buffer) + info->bufsz);
+ if (!buffer) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ info->bufsz = 0;
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ return NULL;
+ }
+
+ buffer->type = DBOX_BUFFER_TYPE_FILE;
+ buffer->refcnt = 0;
+ buffer->state = CREATED;
+ buffer->info = info;
+ info->buffer = buffer;
+
+ sync_for_file(info);
+ } else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) {
+ buffer = shmat(info->handle, NULL, 0);
+ if (buffer == (void *)-1) {
+ ErrPrint("shmat: %s (%d)\n", strerror(errno), info->handle);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ return NULL;
+ }
+
+ return buffer->data;
+ } else {
+ ErrPrint("Buffer is not created (%s)\n", info->id);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
}
buffer = info->buffer;
switch (buffer->type) {
- case DBOX_BUFFER_TYPE_FILE:
- buffer->refcnt++;
- break;
- case DBOX_BUFFER_TYPE_PIXMAP:
- default:
- DbgPrint("Unknwon FP: %d\n", buffer->type);
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- break;
+ case DBOX_BUFFER_TYPE_FILE:
+ buffer->refcnt++;
+ break;
+ case DBOX_BUFFER_TYPE_PIXMAP:
+ default:
+ DbgPrint("Unknwon FP: %d\n", buffer->type);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ break;
}
return buffer->data;
struct buffer *buffer;
if (!data) {
- ErrPrint("buffer data == NIL\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("buffer data == NIL\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
buffer = container_of(data, struct buffer, data);
if (buffer->state != CREATED) {
- ErrPrint("Invalid handle\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handle\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
switch (buffer->type) {
- case DBOX_BUFFER_TYPE_SHM:
- if (shmdt(buffer) < 0) {
- ErrPrint("shmdt: %s\n", strerror(errno));
- }
- break;
- case DBOX_BUFFER_TYPE_FILE:
- buffer->refcnt--;
- if (buffer->refcnt == 0) {
- struct fb_info *info;
- info = buffer->info;
-
- buffer->state = DBOX_FB_STATE_DESTROYED;
- free(buffer);
-
- if (info && info->buffer == buffer) {
- info->buffer = NULL;
- }
- }
- break;
- case DBOX_BUFFER_TYPE_PIXMAP:
- default:
- ErrPrint("Unknwon buffer type\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- break;
+ case DBOX_BUFFER_TYPE_SHM:
+ if (shmdt(buffer) < 0) {
+ ErrPrint("shmdt: %s\n", strerror(errno));
+ }
+ break;
+ case DBOX_BUFFER_TYPE_FILE:
+ buffer->refcnt--;
+ if (buffer->refcnt == 0) {
+ struct fb_info *info;
+ info = buffer->info;
+
+ buffer->state = DBOX_FB_STATE_DESTROYED;
+ free(buffer);
+
+ if (info && info->buffer == buffer) {
+ info->buffer = NULL;
+ }
+ }
+ break;
+ case DBOX_BUFFER_TYPE_PIXMAP:
+ default:
+ ErrPrint("Unknwon buffer type\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ break;
}
return DBOX_STATUS_ERROR_NONE;
int ret;
if (!data) {
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
buffer = container_of(data, struct buffer, data);
if (buffer->state != CREATED) {
- ErrPrint("Invalid handle\n");
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid handle\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
switch (buffer->type) {
- case DBOX_BUFFER_TYPE_SHM:
- if (shmctl(buffer->refcnt, IPC_STAT, &buf) < 0) {
- ErrPrint("Error: %s\n", strerror(errno));
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
- return DBOX_STATUS_ERROR_FAULT;
- }
-
- ret = buf.shm_nattch;
- break;
- case DBOX_BUFFER_TYPE_FILE:
- ret = buffer->refcnt;
- break;
- case DBOX_BUFFER_TYPE_PIXMAP:
- default:
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- break;
+ case DBOX_BUFFER_TYPE_SHM:
+ if (shmctl(buffer->refcnt, IPC_STAT, &buf) < 0) {
+ ErrPrint("Error: %s\n", strerror(errno));
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ return DBOX_STATUS_ERROR_FAULT;
+ }
+
+ ret = buf.shm_nattch;
+ break;
+ case DBOX_BUFFER_TYPE_FILE:
+ ret = buffer->refcnt;
+ break;
+ case DBOX_BUFFER_TYPE_PIXMAP:
+ default:
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ break;
}
return ret;
int fb_get_size(struct fb_info *info, int *w, int *h)
{
if (!info) {
- ErrPrint("Handle is not valid\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Handle is not valid\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
*w = info->w;
int fb_size(struct fb_info *info)
{
if (!info) {
- dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
- return 0;
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return 0;
}
update_fb_size(info);
struct buffer *buffer;
if (!info) {
- return DBOX_BUFFER_TYPE_ERROR;
+ return DBOX_BUFFER_TYPE_ERROR;
}
buffer = info->buffer;
if (!buffer) {
- 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 = 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 = DBOX_BUFFER_TYPE_SHM;
- }
- }
-
- return type;
+ 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 = 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 = DBOX_BUFFER_TYPE_SHM;
+ }
+ }
+
+ return type;
}
return buffer->type;
#define FILE_SERVICE_PORT 8209
#define CRITICAL_SECTION_BEGIN(handle) \
-do { \
- int ret; \
- ret = pthread_mutex_lock(handle); \
- if (ret != 0) { \
- ErrPrint("Failed to lock: %s\n", strerror(ret)); \
- } \
-} while (0)
+ do { \
+ int ret; \
+ ret = pthread_mutex_lock(handle); \
+ if (ret != 0) { \
+ ErrPrint("Failed to lock: %s\n", strerror(ret)); \
+ } \
+ } while (0)
#define CRITICAL_SECTION_END(handle) \
-do { \
- int ret; \
- ret = pthread_mutex_unlock(handle); \
- if (ret != 0) { \
- ErrPrint("Failed to unlock: %s\n", strerror(ret)); \
- } \
-} while (0)
+ do { \
+ int ret; \
+ ret = pthread_mutex_unlock(handle); \
+ if (ret != 0) { \
+ ErrPrint("Failed to unlock: %s\n", strerror(ret)); \
+ } \
+ } while (0)
#define CANCEL_SECTION_BEGIN() do { \
int ret; \
ret = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); \
if (ret != 0) { \
- ErrPrint("Unable to set cancelate state: %s\n", strerror(ret)); \
+ ErrPrint("Unable to set cancelate state: %s\n", strerror(ret)); \
} \
} while (0)
int ret; \
ret = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); \
if (ret != 0) { \
- ErrPrint("Unable to set cancelate state: %s\n", strerror(ret)); \
+ ErrPrint("Unable to set cancelate state: %s\n", strerror(ret)); \
} \
} while (0)
int status; \
status = close(p[PIPE_READ]); \
if (status < 0) { \
- ErrPrint("close: %s\n", strerror(errno)); \
+ ErrPrint("close: %s\n", strerror(errno)); \
} \
status = close(p[PIPE_WRITE]); \
if (status < 0) { \
- ErrPrint("close: %s\n", strerror(errno)); \
+ ErrPrint("close: %s\n", strerror(errno)); \
} \
} while (0)
ret = write(fd, &ch, sizeof(ch));
if (ret != sizeof(ch)) {
- ErrPrint("write: %s\n", strerror(errno));
- return ret;
+ ErrPrint("write: %s\n", strerror(errno));
+ return ret;
}
return 0;
ret = read(fd, &ch, sizeof(ch));
if (ret != sizeof(ch)) {
- ErrPrint("read: %s\n", strerror(errno));
- return ret;
+ ErrPrint("read: %s\n", strerror(errno));
+ return ret;
}
ret = (int)((unsigned int)ch);
addr = malloc(strlen(client_addr()) + 1);
if (!addr) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return -ENOMEM;
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return -ENOMEM;
}
if (sscanf(client_addr(), COM_CORE_REMOTE_SCHEME"%[^:]:%d", addr, &port) != 2) {
- ErrPrint("Invalid URL\n");
- free(addr);
- return -EINVAL;
+ ErrPrint("Invalid URL\n");
+ free(addr);
+ return -EINVAL;
}
len = strlen(COM_CORE_REMOTE_SCHEME);
file_addr = malloc(len);
if (!file_addr) {
- ErrPrint("Heap: %s\n", strerror(errno));
- free(addr);
- return -ENOMEM;
+ ErrPrint("Heap: %s\n", strerror(errno));
+ free(addr);
+ return -ENOMEM;
}
snprintf(file_addr, len, COM_CORE_REMOTE_SCHEME"%s:%d", addr, FILE_SERVICE_PORT);
{
item->ret = DBOX_STATUS_ERROR_FAULT;
if (write(s_info.evt_pipe[PIPE_WRITE], &item, sizeof(item)) != sizeof(item)) {
- ErrPrint("write: %s\n", strerror(errno));
- free(item->filename);
- free(item->save_to);
- free(item);
- item = NULL;
+ ErrPrint("write: %s\n", strerror(errno));
+ free(item->filename);
+ free(item->save_to);
+ free(item);
+ item = NULL;
}
}
fd_set set;
int offset;
enum {
- RECV_INIT,
- RECV_HEADER,
- RECV_DATA,
+ RECV_INIT,
+ RECV_HEADER,
+ RECV_DATA,
} recv_state;
struct burst_head *head;
struct burst_data *body;
recv_state = RECV_INIT;
select_fd = (s_info.file_service_fd > s_info.ctrl_pipe[PIPE_READ] ? s_info.file_service_fd : s_info.ctrl_pipe[PIPE_READ]) + 1;
while (ret == 0) {
- FD_ZERO(&set);
- FD_SET(s_info.file_service_fd, &set);
- FD_SET(s_info.ctrl_pipe[PIPE_READ], &set);
-
- tv.tv_sec = 3;
- tv.tv_usec = 0;
- ret = select(select_fd , &set, NULL, NULL, &tv);
- if (ret < 0) {
- ret = -errno;
- if (errno == EINTR) {
- ErrPrint("INTERRUPTED\n");
- ret = 0;
- continue;
- }
- ErrPrint("Error: %s\n", strerror(errno));
- break;
- } else if (ret == 0) {
- ErrPrint("Timeout\n");
- ret = -ETIMEDOUT;
- break;
- }
-
- if (item && FD_ISSET(s_info.file_service_fd, &set)) {
- switch (recv_state) {
- case RECV_INIT:
- if (head == NULL) {
- recvsz = sizeof(*head);
-
- head = malloc(recvsz);
- if (!head) {
- ErrPrint("Heap: %s\n", strerror(errno));
- ret = DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- write_item_to_pipe(item, ret);
- item = NULL;
- break;
- }
-
- offset = 0;
- recv_state = RECV_HEADER;
- }
- case RECV_HEADER:
- if (offset < recvsz) {
- ret = secure_socket_recv(s_info.file_service_fd, (char *)head + offset, recvsz - offset, NULL);
- if (ret > 0) {
- offset += ret;
- } else {
- free(head);
- head = NULL;
- recv_state = RECV_INIT;
- ret = DBOX_STATUS_ERROR_FAULT;
- write_item_to_pipe(item, ret);
- item = NULL;
- break;
- }
- }
-
- if (offset == sizeof(*head)) {
- void *tmp;
-
- recvsz += head->flen;
-
- tmp = realloc(head, recvsz);
- if (!tmp) {
- ErrPrint("Heap: %s\n", strerror(errno));
-
- free(head);
- head = NULL;
- recv_state = RECV_INIT;
-
- ret = DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- write_item_to_pipe(item, ret);
- item = NULL;
- break;
- }
-
- head = tmp;
- } else if (offset == recvsz) {
- DbgPrint("Filesize: %d, name[%s]\n", head->size, head->fname);
- if (strcmp(item->filename, head->fname)) {
- ErrPrint("Invalid data sequence (%s <> %s)\n", item->filename, head->fname);
-
- free(head);
- head = NULL;
- recv_state = RECV_INIT;
- ret = DBOX_STATUS_ERROR_FAULT;
- write_item_to_pipe(item, ret);
- item = NULL;
- break;
- }
-
- file_fd = open(item->save_to, O_WRONLY|O_CREAT, 0644);
- if (file_fd < 0) {
- ErrPrint("open: %s\n", strerror(errno));
- free(head);
- head = NULL;
- recv_state = RECV_INIT;
-
- ret = DBOX_STATUS_ERROR_IO_ERROR;
- write_item_to_pipe(item, ret);
- item = NULL;
- break;
- }
-
- recv_state = RECV_DATA;
- body = NULL;
-
- } else {
- ErrPrint("Invalid state\n");
- free(head);
- head = NULL;
- recv_state = RECV_INIT;
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- write_item_to_pipe(item, ret);
- item = NULL;
- }
- break;
- case RECV_DATA:
- if (!body) {
- body = malloc(sizeof(*body));
- if (!body) {
- free(head);
- head = NULL;
- recv_state = RECV_INIT;
- ret = DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- write_item_to_pipe(item, ret);
- item = NULL;
- break;
- }
-
- recvsz = sizeof(*body);
- offset = 0;
- }
-
- ret = secure_socket_recv(s_info.file_service_fd, (char *)body + offset, recvsz - offset, NULL);
- if (ret > 0) {
- offset += ret;
- } else {
- free(head);
- head = NULL;
- free(body);
- body = NULL;
- recv_state = RECV_INIT;
- ret = DBOX_STATUS_ERROR_FAULT;
- write_item_to_pipe(item, ret);
- item = NULL;
- break;
- }
-
- if (offset == sizeof(*body)) {
- void *tmp;
-
- if (body->size < 0) {
- ErrPrint("body->size: %d\n", body->size);
- free(head);
- head = NULL;
- free(body);
- body = NULL;
- recv_state = RECV_INIT;
- ret = DBOX_STATUS_ERROR_FAULT;
- write_item_to_pipe(item, ret);
- item = NULL;
- break;
- }
-
- recvsz += body->size;
-
- tmp = realloc(body, recvsz);
- if (!tmp) {
- ErrPrint("Heap: %s\n", strerror(errno));
- free(head);
- head = NULL;
-
- free(body);
- body = NULL;
- recv_state = RECV_INIT;
-
- ret = DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- write_item_to_pipe(item, ret);
- item = NULL;
- break;
- }
- } else if (offset == recvsz) {
- /* Flush this to the file */
- ret = write(file_fd, body->data, body->size);
- if (ret < 0) {
- ErrPrint("write: %s\n", strerror(errno));
- free(head);
- head = NULL;
-
- free(body);
- body = NULL;
- recv_state = RECV_INIT;
-
- ret = DBOX_STATUS_ERROR_IO_ERROR;
- write_item_to_pipe(item, ret);
- item = NULL;
- break;
- } else {
- if (body->size != ret) {
- DbgPrint("Body is not flushed correctly: %d, %d\n", ret, body->size);
- ret = body->size;
- }
-
- file_offset += ret;
- if (file_offset == head->size) {
- if (close(file_fd) < 0) {
- ErrPrint("close: %s\n", strerror(errno));
- }
- ret = DBOX_STATUS_ERROR_NONE;
- write_item_to_pipe(item, ret);
- item = NULL;
- }
- }
-
- free(body);
- body = NULL;
-
- free(head);
- head = NULL;
-
- recv_state = RECV_INIT;
- } else {
- ErrPrint("Invalid state\n");
-
- ret = -EFAULT;
- free(body);
- body = NULL;
- free(head);
- head = NULL;
- recv_state = RECV_INIT;
-
- ret = DBOX_STATUS_ERROR_FAULT;
- write_item_to_pipe(item, ret);
- item = NULL;
- }
- break;
- default:
- ErrPrint("Unknown event: %d\n", recv_state);
- ret = DBOX_STATUS_ERROR_FAULT;
- write_item_to_pipe(item, ret);
- item = NULL;
- break;
- }
- } else if (item == NULL && recv_state == RECV_INIT && FD_ISSET(s_info.ctrl_pipe[PIPE_READ], &set)) {
- int ch;
- struct dlist *l;
-
- /* Only if the recv state is not changed, we can get next request item */
- ch = get_event_ch(s_info.ctrl_pipe[PIPE_READ]);
- if (ch == EVT_END_CH) {
- DbgPrint("Service thread is canceled\n");
- break;
- }
-
- CRITICAL_SECTION_BEGIN(&s_info.file_svc_lock);
- l = dlist_nth(s_info.request_list, 0);
- item = dlist_data(l);
- s_info.request_list = dlist_remove(s_info.request_list, l);
- CRITICAL_SECTION_END(&s_info.file_svc_lock);
- }
+ FD_ZERO(&set);
+ FD_SET(s_info.file_service_fd, &set);
+ FD_SET(s_info.ctrl_pipe[PIPE_READ], &set);
+
+ tv.tv_sec = 3;
+ tv.tv_usec = 0;
+ ret = select(select_fd , &set, NULL, NULL, &tv);
+ if (ret < 0) {
+ ret = -errno;
+ if (errno == EINTR) {
+ ErrPrint("INTERRUPTED\n");
+ ret = 0;
+ continue;
+ }
+ ErrPrint("Error: %s\n", strerror(errno));
+ break;
+ } else if (ret == 0) {
+ ErrPrint("Timeout\n");
+ ret = -ETIMEDOUT;
+ break;
+ }
+
+ if (item && FD_ISSET(s_info.file_service_fd, &set)) {
+ switch (recv_state) {
+ case RECV_INIT:
+ if (head == NULL) {
+ recvsz = sizeof(*head);
+
+ head = malloc(recvsz);
+ if (!head) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ ret = DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ write_item_to_pipe(item, ret);
+ item = NULL;
+ break;
+ }
+
+ offset = 0;
+ recv_state = RECV_HEADER;
+ }
+ case RECV_HEADER:
+ if (offset < recvsz) {
+ ret = secure_socket_recv(s_info.file_service_fd, (char *)head + offset, recvsz - offset, NULL);
+ if (ret > 0) {
+ offset += ret;
+ } else {
+ free(head);
+ head = NULL;
+ recv_state = RECV_INIT;
+ ret = DBOX_STATUS_ERROR_FAULT;
+ write_item_to_pipe(item, ret);
+ item = NULL;
+ break;
+ }
+ }
+
+ if (offset == sizeof(*head)) {
+ void *tmp;
+
+ recvsz += head->flen;
+
+ tmp = realloc(head, recvsz);
+ if (!tmp) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+
+ free(head);
+ head = NULL;
+ recv_state = RECV_INIT;
+
+ ret = DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ write_item_to_pipe(item, ret);
+ item = NULL;
+ break;
+ }
+
+ head = tmp;
+ } else if (offset == recvsz) {
+ DbgPrint("Filesize: %d, name[%s]\n", head->size, head->fname);
+ if (strcmp(item->filename, head->fname)) {
+ ErrPrint("Invalid data sequence (%s <> %s)\n", item->filename, head->fname);
+
+ free(head);
+ head = NULL;
+ recv_state = RECV_INIT;
+ ret = DBOX_STATUS_ERROR_FAULT;
+ write_item_to_pipe(item, ret);
+ item = NULL;
+ break;
+ }
+
+ file_fd = open(item->save_to, O_WRONLY|O_CREAT, 0644);
+ if (file_fd < 0) {
+ ErrPrint("open: %s\n", strerror(errno));
+ free(head);
+ head = NULL;
+ recv_state = RECV_INIT;
+
+ ret = DBOX_STATUS_ERROR_IO_ERROR;
+ write_item_to_pipe(item, ret);
+ item = NULL;
+ break;
+ }
+
+ recv_state = RECV_DATA;
+ body = NULL;
+
+ } else {
+ ErrPrint("Invalid state\n");
+ free(head);
+ head = NULL;
+ recv_state = RECV_INIT;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ write_item_to_pipe(item, ret);
+ item = NULL;
+ }
+ break;
+ case RECV_DATA:
+ if (!body) {
+ body = malloc(sizeof(*body));
+ if (!body) {
+ free(head);
+ head = NULL;
+ recv_state = RECV_INIT;
+ ret = DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ write_item_to_pipe(item, ret);
+ item = NULL;
+ break;
+ }
+
+ recvsz = sizeof(*body);
+ offset = 0;
+ }
+
+ ret = secure_socket_recv(s_info.file_service_fd, (char *)body + offset, recvsz - offset, NULL);
+ if (ret > 0) {
+ offset += ret;
+ } else {
+ free(head);
+ head = NULL;
+ free(body);
+ body = NULL;
+ recv_state = RECV_INIT;
+ ret = DBOX_STATUS_ERROR_FAULT;
+ write_item_to_pipe(item, ret);
+ item = NULL;
+ break;
+ }
+
+ if (offset == sizeof(*body)) {
+ void *tmp;
+
+ if (body->size < 0) {
+ ErrPrint("body->size: %d\n", body->size);
+ free(head);
+ head = NULL;
+ free(body);
+ body = NULL;
+ recv_state = RECV_INIT;
+ ret = DBOX_STATUS_ERROR_FAULT;
+ write_item_to_pipe(item, ret);
+ item = NULL;
+ break;
+ }
+
+ recvsz += body->size;
+
+ tmp = realloc(body, recvsz);
+ if (!tmp) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ free(head);
+ head = NULL;
+
+ free(body);
+ body = NULL;
+ recv_state = RECV_INIT;
+
+ ret = DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ write_item_to_pipe(item, ret);
+ item = NULL;
+ break;
+ }
+ } else if (offset == recvsz) {
+ /* Flush this to the file */
+ ret = write(file_fd, body->data, body->size);
+ if (ret < 0) {
+ ErrPrint("write: %s\n", strerror(errno));
+ free(head);
+ head = NULL;
+
+ free(body);
+ body = NULL;
+ recv_state = RECV_INIT;
+
+ ret = DBOX_STATUS_ERROR_IO_ERROR;
+ write_item_to_pipe(item, ret);
+ item = NULL;
+ break;
+ } else {
+ if (body->size != ret) {
+ DbgPrint("Body is not flushed correctly: %d, %d\n", ret, body->size);
+ ret = body->size;
+ }
+
+ file_offset += ret;
+ if (file_offset == head->size) {
+ if (close(file_fd) < 0) {
+ ErrPrint("close: %s\n", strerror(errno));
+ }
+ ret = DBOX_STATUS_ERROR_NONE;
+ write_item_to_pipe(item, ret);
+ item = NULL;
+ }
+ }
+
+ free(body);
+ body = NULL;
+
+ free(head);
+ head = NULL;
+
+ recv_state = RECV_INIT;
+ } else {
+ ErrPrint("Invalid state\n");
+
+ ret = -EFAULT;
+ free(body);
+ body = NULL;
+ free(head);
+ head = NULL;
+ recv_state = RECV_INIT;
+
+ ret = DBOX_STATUS_ERROR_FAULT;
+ write_item_to_pipe(item, ret);
+ item = NULL;
+ }
+ break;
+ default:
+ ErrPrint("Unknown event: %d\n", recv_state);
+ ret = DBOX_STATUS_ERROR_FAULT;
+ write_item_to_pipe(item, ret);
+ item = NULL;
+ break;
+ }
+ } else if (item == NULL && recv_state == RECV_INIT && FD_ISSET(s_info.ctrl_pipe[PIPE_READ], &set)) {
+ int ch;
+ struct dlist *l;
+
+ /* Only if the recv state is not changed, we can get next request item */
+ ch = get_event_ch(s_info.ctrl_pipe[PIPE_READ]);
+ if (ch == EVT_END_CH) {
+ DbgPrint("Service thread is canceled\n");
+ break;
+ }
+
+ CRITICAL_SECTION_BEGIN(&s_info.file_svc_lock);
+ l = dlist_nth(s_info.request_list, 0);
+ item = dlist_data(l);
+ s_info.request_list = dlist_remove(s_info.request_list, l);
+ CRITICAL_SECTION_END(&s_info.file_svc_lock);
+ }
}
return (void *)ret;
fd = g_io_channel_unix_get_fd(src);
if (!(cond & G_IO_IN)) {
- DbgPrint("Client is disconencted\n");
- return FALSE;
+ DbgPrint("Client is disconencted\n");
+ return FALSE;
}
if ((cond & G_IO_ERR) || (cond & G_IO_HUP) || (cond & G_IO_NVAL)) {
- DbgPrint("Client connection is lost\n");
- return FALSE;
+ DbgPrint("Client connection is lost\n");
+ return FALSE;
}
if (read(fd, &item, sizeof(item)) != sizeof(item)) {
- ErrPrint("read: %s\n", strerror(errno));
+ ErrPrint("read: %s\n", strerror(errno));
} else {
- if (item->result_cb) {
- item->result_cb(item->filename, item->save_to, item->ret, item->data);
- }
+ if (item->result_cb) {
+ item->result_cb(item->filename, item->save_to, item->ret, item->data);
+ }
- free(item->filename);
- free(item->save_to);
- free(item);
+ free(item->filename);
+ free(item->save_to);
+ free(item);
}
return TRUE;
item = malloc(sizeof(*item));
if (!item) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return -ENOMEM;
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return -ENOMEM;
}
item->filename = strdup(filename);
if (!item->filename) {
- ErrPrint("Heap: %s\n", strerror(errno));
- free(item);
- return -ENOMEM;
+ ErrPrint("Heap: %s\n", strerror(errno));
+ free(item);
+ return -ENOMEM;
}
item->save_to = strdup(save_to);
if (!item->save_to) {
- ErrPrint("Heap: %s\n", strerror(errno));
- free(item->filename);
- free(item);
- return -ENOMEM;
+ ErrPrint("Heap: %s\n", strerror(errno));
+ free(item->filename);
+ free(item);
+ return -ENOMEM;
}
item->result_cb = result_cb;
guint id;
if (strncmp(client_addr(), COM_CORE_REMOTE_SCHEME, strlen(COM_CORE_REMOTE_SCHEME))) {
- return 0;
+ return 0;
}
s_info.file_service_fd = file_service_open();
if (s_info.file_service_fd < 0) {
- return -EFAULT;
+ return -EFAULT;
}
if (pipe2(s_info.ctrl_pipe, O_NONBLOCK | O_CLOEXEC) < 0) {
- ErrPrint("file service: %s\n", strerror(errno));
- file_service_close(s_info.file_service_fd);
- s_info.file_service_fd = -1;
- return -EFAULT;
+ ErrPrint("file service: %s\n", strerror(errno));
+ file_service_close(s_info.file_service_fd);
+ s_info.file_service_fd = -1;
+ return -EFAULT;
}
if (pipe2(s_info.evt_pipe, O_NONBLOCK | O_CLOEXEC) < 0) {
- ErrPrint("file service: %s\n", strerror(errno));
- CLOSE_PIPE(s_info.ctrl_pipe);
- file_service_close(s_info.file_service_fd);
- s_info.file_service_fd = -1;
- return -EFAULT;
+ ErrPrint("file service: %s\n", strerror(errno));
+ CLOSE_PIPE(s_info.ctrl_pipe);
+ file_service_close(s_info.file_service_fd);
+ s_info.file_service_fd = -1;
+ return -EFAULT;
}
status = pthread_mutex_init(&s_info.file_svc_lock, NULL);
if (status != 0) {
- ErrPrint("Mutex: %s\n", strerror(status));
- CLOSE_PIPE(s_info.ctrl_pipe);
- CLOSE_PIPE(s_info.evt_pipe);
- file_service_close(s_info.file_service_fd);
- s_info.file_service_fd = -1;
- return -EFAULT;
+ ErrPrint("Mutex: %s\n", strerror(status));
+ CLOSE_PIPE(s_info.ctrl_pipe);
+ CLOSE_PIPE(s_info.evt_pipe);
+ file_service_close(s_info.file_service_fd);
+ s_info.file_service_fd = -1;
+ return -EFAULT;
}
gio = g_io_channel_unix_new(s_info.evt_pipe[PIPE_READ]);
if (!gio) {
- ErrPrint("io channel new\n");
- status = pthread_mutex_destroy(&s_info.file_svc_lock);
- if (status != 0) {
- ErrPrint("destroy: %s\n", strerror(status));
- }
- CLOSE_PIPE(s_info.ctrl_pipe);
- CLOSE_PIPE(s_info.evt_pipe);
- file_service_close(s_info.file_service_fd);
- s_info.file_service_fd = -1;
- return -EFAULT;
+ ErrPrint("io channel new\n");
+ status = pthread_mutex_destroy(&s_info.file_svc_lock);
+ if (status != 0) {
+ ErrPrint("destroy: %s\n", strerror(status));
+ }
+ CLOSE_PIPE(s_info.ctrl_pipe);
+ CLOSE_PIPE(s_info.evt_pipe);
+ file_service_close(s_info.file_service_fd);
+ s_info.file_service_fd = -1;
+ return -EFAULT;
}
g_io_channel_set_close_on_unref(gio, FALSE);
id = g_io_add_watch(gio, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL, (GIOFunc)evt_cb, NULL);
if (id <= 0) {
- GError *err = NULL;
- ErrPrint("Failed to add IO watch\n");
- g_io_channel_shutdown(gio, TRUE, &err);
- if (err) {
- ErrPrint("Shutdown: %s\n", err->message);
- g_error_free(err);
- }
- g_io_channel_unref(gio);
-
- status = pthread_mutex_destroy(&s_info.file_svc_lock);
- if (status != 0) {
- ErrPrint("destroy: %s\n", strerror(status));
- }
- CLOSE_PIPE(s_info.ctrl_pipe);
- CLOSE_PIPE(s_info.evt_pipe);
- file_service_close(s_info.file_service_fd);
- s_info.file_service_fd = -1;
- return -EIO;
+ GError *err = NULL;
+ ErrPrint("Failed to add IO watch\n");
+ g_io_channel_shutdown(gio, TRUE, &err);
+ if (err) {
+ ErrPrint("Shutdown: %s\n", err->message);
+ g_error_free(err);
+ }
+ g_io_channel_unref(gio);
+
+ status = pthread_mutex_destroy(&s_info.file_svc_lock);
+ if (status != 0) {
+ ErrPrint("destroy: %s\n", strerror(status));
+ }
+ CLOSE_PIPE(s_info.ctrl_pipe);
+ CLOSE_PIPE(s_info.evt_pipe);
+ file_service_close(s_info.file_service_fd);
+ s_info.file_service_fd = -1;
+ return -EIO;
}
status = pthread_create(&s_info.file_svc_thid, NULL, file_service_main, NULL);
if (status != 0) {
- GError *err = NULL;
- ErrPrint("Failed to add IO watch\n");
- g_io_channel_shutdown(gio, TRUE, &err);
- if (err) {
- ErrPrint("Shutdown: %s\n", err->message);
- g_error_free(err);
- }
- g_io_channel_unref(gio);
-
- ErrPrint("file service: %s\n", strerror(status));
- CLOSE_PIPE(s_info.ctrl_pipe);
- CLOSE_PIPE(s_info.evt_pipe);
- file_service_close(s_info.file_service_fd);
- s_info.file_service_fd = -1;
-
- status = pthread_mutex_destroy(&s_info.file_svc_lock);
- if (status != 0) {
- ErrPrint("destroy: %s\n", strerror(status));
- }
-
- return -EFAULT;
+ GError *err = NULL;
+ ErrPrint("Failed to add IO watch\n");
+ g_io_channel_shutdown(gio, TRUE, &err);
+ if (err) {
+ ErrPrint("Shutdown: %s\n", err->message);
+ g_error_free(err);
+ }
+ g_io_channel_unref(gio);
+
+ ErrPrint("file service: %s\n", strerror(status));
+ CLOSE_PIPE(s_info.ctrl_pipe);
+ CLOSE_PIPE(s_info.evt_pipe);
+ file_service_close(s_info.file_service_fd);
+ s_info.file_service_fd = -1;
+
+ status = pthread_mutex_destroy(&s_info.file_svc_lock);
+ if (status != 0) {
+ ErrPrint("destroy: %s\n", strerror(status));
+ }
+
+ return -EFAULT;
}
g_io_channel_unref(gio);
int ret;
if (strncmp(client_addr(), COM_CORE_REMOTE_SCHEME, strlen(COM_CORE_REMOTE_SCHEME))) {
- return 0;
+ return 0;
}
(void)put_event_ch(s_info.ctrl_pipe[PIPE_WRITE], EVT_END_CH);
ret = pthread_join(s_info.file_svc_thid, &svc_ret);
if (ret != 0) {
- ErrPrint("join: %s\n", strerror(ret));
+ ErrPrint("join: %s\n", strerror(ret));
} else {
- DbgPrint("file svc returns: %d\n", (int)svc_ret);
+ DbgPrint("file svc returns: %d\n", (int)svc_ret);
}
ret = pthread_mutex_destroy(&s_info.file_svc_lock);
if (ret != 0) {
- ErrPrint("destroy: %s\n", strerror(ret));
+ ErrPrint("destroy: %s\n", strerror(ret));
}
CLOSE_PIPE(s_info.evt_pipe);
void (*ret_cb)(dynamicbox_h handler, const struct packet *result, void *data);
void *data;
enum {
- TYPE_ACK,
- TYPE_NOACK
+ TYPE_ACK,
+ TYPE_NOACK
} type;
};
l = dlist_nth(s_info.cmd_list, 0);
if (!l) {
- return NULL;
+ return NULL;
}
command = dlist_data(l);
command = malloc(sizeof(*command));
if (!command) {
- ErrPrint("Failed to allocate mem for command\n");
- return NULL;
+ ErrPrint("Failed to allocate mem for command\n");
+ return NULL;
}
command->handler = dbox_ref(handler);
command = pop_command();
if (!command) {
- s_info.cmd_timer = 0;
- return FALSE;
+ s_info.cmd_timer = 0;
+ return FALSE;
}
/*!
* increate the reference counter of the item->param
*/
if (command->type == TYPE_NOACK) {
- if (com_core_packet_send_only(client_fd(), command->packet) < 0) {
- ErrPrint("Failed to send a packet to master\n");
- }
+ if (com_core_packet_send_only(client_fd(), command->packet) < 0) {
+ ErrPrint("Failed to send a packet to master\n");
+ }
- destroy_command(command);
+ destroy_command(command);
} else {
- if (com_core_packet_async_send(client_fd(), command->packet, 0u, done_cb, command) < 0) {
- ErrPrint("Failed to send a packet to master\n");
- if (command->ret_cb) {
- command->ret_cb(command->handler, NULL, command->data);
- }
- destroy_command(command);
- }
+ if (com_core_packet_async_send(client_fd(), command->packet, 0u, done_cb, command) < 0) {
+ ErrPrint("Failed to send a packet to master\n");
+ if (command->ret_cb) {
+ command->ret_cb(command->handler, NULL, command->data);
+ }
+ destroy_command(command);
+ }
}
return TRUE;
}
void master_rpc_check_and_fire_consumer(void)
{
if (!s_info.cmd_list || s_info.cmd_timer || client_fd() < 0) {
- return;
+ return;
}
s_info.cmd_timer = g_timeout_add(REQUEST_DELAY, cmd_consumer, NULL);
if (!s_info.cmd_timer) {
- ErrPrint("Failed to add timer\n");
+ ErrPrint("Failed to add timer\n");
}
}
command = data;
if (!packet) {
- /*! \NOTE:
- * Release resource even if
- * we failed to finish the method call
- */
- command->ttl--;
- if (command->ttl > 0) {
- prepend_command(command);
- return 0;
- }
-
- goto out;
+ /*! \NOTE:
+ * Release resource even if
+ * we failed to finish the method call
+ */
+ command->ttl--;
+ if (command->ttl > 0) {
+ prepend_command(command);
+ return 0;
+ }
+
+ goto out;
}
if (packet_get(packet, "i", &ret) != 1) {
- ErrPrint("Invalid result packet\n");
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ ErrPrint("Invalid result packet\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
if (command->ret_cb) {
- command->ret_cb(command->handler, packet, command->data);
+ command->ret_cb(command->handler, packet, command->data);
}
destroy_command(command);
command = create_command(handler, packet);
if (!command) {
- ErrPrint("Failed to create a command\n");
- packet_unref(packet);
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to create a command\n");
+ packet_unref(packet);
+ return DBOX_STATUS_ERROR_FAULT;
}
command->ret_cb = ret_cb;
command->type = TYPE_ACK;
if (urgent) {
- prepend_command(command);
+ prepend_command(command);
} else {
- push_command(command);
+ push_command(command);
}
packet_unref(packet);
command = create_command(handler, packet);
if (!command) {
- ErrPrint("Failed to create a command\n");
- packet_unref(packet);
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to create a command\n");
+ packet_unref(packet);
+ return DBOX_STATUS_ERROR_FAULT;
}
command->ret_cb = NULL;
struct command *command;
if (!pkgname) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
dlist_foreach_safe(s_info.cmd_list, l, n, command) {
- if (!command->handler) {
- continue;
- }
-
- if (!strcmp(command->handler->common->pkgname, pkgname)) {
- s_info.cmd_list = dlist_remove(s_info.cmd_list, l);
- if (command->ret_cb) {
- command->ret_cb(command->handler, NULL, command->data);
- }
-
- destroy_command(command);
- }
+ if (!command->handler) {
+ continue;
+ }
+
+ if (!strcmp(command->handler->common->pkgname, pkgname)) {
+ s_info.cmd_list = dlist_remove(s_info.cmd_list, l);
+ if (command->ret_cb) {
+ command->ret_cb(command->handler, NULL, command->data);
+ }
+
+ destroy_command(command);
+ }
}
return 0;
struct dlist *n;
dlist_foreach_safe(s_info.cmd_list, l, n, command) {
- s_info.cmd_list = dlist_remove(s_info.cmd_list, l);
+ s_info.cmd_list = dlist_remove(s_info.cmd_list, l);
- if (command->ret_cb) {
- command->ret_cb(command->handler, NULL, command->data);
- }
+ if (command->ret_cb) {
+ command->ret_cb(command->handler, NULL, command->data);
+ }
- destroy_command(command);
+ destroy_command(command);
}
return 0;
result = com_core_packet_oneshot_send(client_addr(), packet, 0.0f);
if (result) {
- if (packet_get(result, "i", &ret) != 1) {
- ErrPrint("Invalid result packet\n");
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
+ if (packet_get(result, "i", &ret) != 1) {
+ ErrPrint("Invalid result packet\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
- packet_unref(result);
+ packet_unref(result);
} else {
- ErrPrint("Failed to send a sync request\n");
- ret = DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Failed to send a sync request\n");
+ ret = DBOX_STATUS_ERROR_FAULT;
}
packet_unref(packet);
name_len = strlen(filename);
while (--name_len >= 0 && *check_ptr) {
- if (filename[name_len] != *check_ptr) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
+ if (filename[name_len] != *check_ptr) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
- check_ptr ++;
+ check_ptr ++;
}
return 0;
struct timespec ts;
do {
- if (clock_gettime(s_info.type, &ts) == 0) {
- return ts.tv_sec + ts.tv_nsec / 1000000000.0f;
- }
-
- ErrPrint("%d: %s\n", s_info.type, strerror(errno));
- if (s_info.type == CLOCK_MONOTONIC) {
- s_info.type = CLOCK_REALTIME;
- } else if (s_info.type == CLOCK_REALTIME) {
- struct timeval tv;
- if (gettimeofday(&tv, NULL) < 0) {
- ErrPrint("gettimeofday: %s\n", strerror(errno));
- break;
- }
-
- return tv.tv_sec + tv.tv_usec / 1000000.0f;
- }
+ if (clock_gettime(s_info.type, &ts) == 0) {
+ return ts.tv_sec + ts.tv_nsec / 1000000000.0f;
+ }
+
+ ErrPrint("%d: %s\n", s_info.type, strerror(errno));
+ if (s_info.type == CLOCK_MONOTONIC) {
+ s_info.type = CLOCK_REALTIME;
+ } else if (s_info.type == CLOCK_REALTIME) {
+ struct timeval tv;
+ if (gettimeofday(&tv, NULL) < 0) {
+ ErrPrint("gettimeofday: %s\n", strerror(errno));
+ break;
+ }
+
+ return tv.tv_sec + tv.tv_usec / 1000000.0f;
+ }
} while (1);
return 0.0f;
struct timeval tv;
if (gettimeofday(&tv, NULL) < 0) {
- ErrPrint("gettimeofday: %s\n", strerror(errno));
- tv.tv_sec = 0;
- tv.tv_usec = 0;
+ ErrPrint("gettimeofday: %s\n", strerror(errno));
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
}
return (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f;
int length;
length = name ? strlen(name) : 0;
if (!length) {
- return ".";
+ return ".";
}
while (--length > 0 && name[length] != '/');
len = strlen(SCHEMA_FILE);
if (strncasecmp(uri, SCHEMA_FILE, len)) {
- return NULL;
+ return NULL;
}
return uri + len;
int ret;
if (!filename) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
desclen = strlen(filename) + 6; /* .desc */
descfile = malloc(desclen);
if (!descfile) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
}
ret = snprintf(descfile, desclen, "%s.desc", filename);
if (ret < 0) {
- ErrPrint("Error: %s\n", strerror(errno));
- free(descfile);
- return DBOX_STATUS_ERROR_FAULT;
+ ErrPrint("Error: %s\n", strerror(errno));
+ free(descfile);
+ return DBOX_STATUS_ERROR_FAULT;
}
(void)unlink(descfile);