if (lb_text_lb(handler)) {
lb_set_size(handler, lb_w, lb_h);
- ret = parse_desc(handler, util_uri_to_path(id), 0);
+ ret = parse_desc(handler, livebox_filename(handler), 0);
/*!
* \note
* DESC parser will call the "text event callback".
return NULL;
}
+static struct packet *master_size_changed(pid_t pid, int handle, const struct packet *packet)
+{
+ struct livebox *handler;
+ const char *pkgname;
+ const char *id;
+ int status;
+ int ret;
+ int w;
+ int h;
+ int is_pd;
+
+ if (!packet) {
+ ErrPrint("Invalid packet\n");
+ ret = -EINVAL;
+ goto out;
+ }
+
+ ret = packet_get(packet, "ssiiii", &pkgname, &id, &is_pd, &w, &h, &status);
+ if (ret != 6) {
+ ErrPrint("Invalid argument\n");
+ ret = -EINVAL;
+ goto out;
+ }
+
+ DbgPrint("Size is changed: %dx%d (%s)\n", w, h, id);
+
+ handler = lb_find_livebox(pkgname, id);
+ if (!handler) {
+ ErrPrint("Livebox(%s - %s) is not found\n", pkgname, id);
+ ret = -ENOENT;
+ goto out;
+ }
+
+ if (handler->state != CREATE) {
+ ErrPrint("Hander is not created yet\n");
+ ret = -EPERM;
+ goto out;
+ }
+
+ if (is_pd) {
+ DbgPrint("PD is resized\n");
+ /*!
+ * \NOTE
+ * PD is not able to resized by the client.
+ * PD is only can be managed by the provider.
+ * So the PD has no private resized event handler.
+ * Notify it via global event handler.
+ */
+ if (status == 0) {
+ lb_set_pdsize(handler, w, h);
+ lb_invoke_event_handler(handler, LB_EVENT_PD_SIZE_CHANGED);
+ } else {
+ ErrPrint("This is not possible. PD Size is changed but the return value is not ZERO\n");
+ }
+ } else {
+ DbgPrint("LB is resized\n");
+ if (status == 0) {
+ DbgPrint("Livebox size is updated (%dx%d)\n", w, h);
+ lb_set_size(handler, w, h);
+
+ if (handler->size_changed_cb) {
+ DbgPrint("Call the size changed callback\n");
+ handler->size_changed_cb(handler, status, handler->size_cbdata);
+
+ handler->size_changed_cb = NULL;
+ handler->size_cbdata = NULL;
+ } else {
+ DbgPrint("Call the global size changed callback\n");
+ lb_invoke_event_handler(handler, LB_EVENT_LB_SIZE_CHANGED);
+ DbgPrint("Size changed callback done\n");
+ }
+ } else {
+ DbgPrint("Livebox size is not changed: %dx%d, %d\n", w, h, status);
+ }
+ }
+
+out:
+ return NULL;
+}
+
static struct packet *master_period_changed(pid_t pid, int handle, const struct packet *packet)
{
struct livebox *handler;
const char *title;
double timestamp;
- int auto_launch;
+ const char *auto_launch;
double priority;
int size_list;
int user;
int ret;
- ret = packet_get(packet, "dsssiiiissssidiiiiidsi",
+ ret = packet_get(packet, "dsssiiiisssssdiiiiidsi",
×tamp,
&pkgname, &id, &content,
&lb_w, &lb_h, &pd_w, &pd_h,
ErrPrint("[%lf] pkgname: %s, id: %s, content: %s, "
"pd_w: %d, pd_h: %d, lb_w: %d, lb_h: %d, "
"cluster: %s, category: %s, lb_fname: \"%s\", pd_fname: \"%s\", "
- "auto_launch: %d, priority: %lf, size_list: %d, user: %d, pinup: %d, "
+ "auto_launch: %s, priority: %lf, size_list: %d, user: %d, pinup: %d, "
"lb_type: %d, pd_type: %d, period: %lf, title: [%s], is_pinned_up: %d\n",
timestamp, pkgname, id, content,
pd_w, pd_h, lb_w, lb_h,
.handler = master_period_changed,
},
{
+ .cmd = "size_changed",
+ .handler = master_size_changed,
+ },
+ {
.cmd = "pinup",
.handler = master_pinup,
},