* after this request.
*/
if (ret == 0) {
+ DbgPrint("Resize request is done, prepare the size changed event\n");
handler->size_changed_cb = cb;
handler->size_cbdata = cbdata;
} else {
+ DbgPrint("Resize request is failed: %d\n", ret);
cb(handler, ret, cbdata);
}
}
}
}
-static int send_mouse_event(struct livebox *handler, const char *event, double x, double y, int w, int h)
+static int send_mouse_event(struct livebox *handler, const char *event, int x, int y)
{
struct packet *packet;
double timestamp;
timestamp = util_timestamp();
- packet = packet_create_noack(event, "ssiiddd", handler->pkgname, handler->id, w, h,
- timestamp, x, y);
+ packet = packet_create_noack(event, "ssdii", handler->pkgname, handler->id, timestamp, x, y);
if (!packet) {
ErrPrint("Failed to build param\n");
return -EFAULT;
}
+ DbgPrint("Send: %dx%d\n", x, y);
+
return master_rpc_request_only(handler, packet);
}
return NULL;
}
- if (livebox_service_is_enabled(pkgname) == 0) {
- DbgPrint("Livebox [%s] is disabled package\n", pkgname);
- return NULL;
- }
-
if (type != LB_SIZE_TYPE_UNKNOWN)
livebox_service_get_size(type, &width, &height);
return NULL;
}
+ if (livebox_service_is_enabled(handler->pkgname) == 0) {
+ DbgPrint("Livebox [%s](%s) is disabled package\n", handler->pkgname, pkgname);
+ free(handler->pkgname);
+ free(handler);
+ return NULL;
+ }
+
if (content) {
handler->content = strdup(content);
if (!handler->content) {
return -EINVAL;
}
+ if (handler->period_changed_cb) {
+ ErrPrint("Previous request for changing period is not finished\n");
+ return -EBUSY;
+ }
+
if (!handler->is_user) {
ErrPrint("CA Livebox is not able to change the period\n");
return -EPERM;
return -EINVAL;
}
+ if (handler->size_changed_cb) {
+ ErrPrint("Previous resize request is not finished yet\n");
+ return -EBUSY;
+ }
+
if (!handler->is_user) {
ErrPrint("CA Livebox is not able to be resized\n");
return -EPERM;
}
if (handler->lb.auto_launch)
- if (aul_launch_app(handler->lb.auto_launch, NULL) < 0)
+ if (aul_open_app(handler->lb.auto_launch) < 0)
ErrPrint("Failed to launch app %s\n", handler->lb.auto_launch);
timestamp = util_timestamp();
if (!handler->lb.mouse_event && (handler->lb.type == _LB_TYPE_BUFFER || handler->lb.type == _LB_TYPE_SCRIPT)) {
int ret; /* Shadow variable */
- ret = send_mouse_event(handler, "lb_mouse_down", x, y, handler->lb.width, handler->lb.height);
+ ret = send_mouse_event(handler, "lb_mouse_down", x * handler->lb.width, y * handler->lb.height);
if (ret < 0)
DbgPrint("Failed to send Down: %d\n", ret);
- ret = send_mouse_event(handler, "lb_mouse_move", x, y, handler->lb.width, handler->lb.height);
+ ret = send_mouse_event(handler, "lb_mouse_move", x * handler->lb.width, y * handler->lb.height);
if (ret < 0)
DbgPrint("Failed to send Move: %d\n", ret);
- ret = send_mouse_event(handler, "lb_mouse_up", x, y, handler->lb.width, handler->lb.height);
+ ret = send_mouse_event(handler, "lb_mouse_up", x * handler->lb.width, y * handler->lb.height);
if (ret < 0)
DbgPrint("Failed to send Up: %d\n", ret);
}
return master_rpc_async_request(handler, packet, 0, pd_create_cb, create_cb_info(cb, data));
}
+EAPI int livebox_move_pd(struct livebox *handler, double x, double y)
+{
+ struct packet *packet;
+
+ if (!handler) {
+ ErrPrint("Handler is NIL\n");
+ return -EINVAL;
+ }
+
+ if (!handler->pd.data.fb || handler->state != CREATE || !handler->id) {
+ ErrPrint("Handler is not valid\n");
+ return -EINVAL;
+ }
+
+ if (!handler->is_pd_created) {
+ DbgPrint("PD is not created\n");
+ return -EINVAL;
+ }
+
+ packet = packet_create_noack("pd_move", "ssdd", handler->pkgname, handler->id, x, y);
+ if (!packet) {
+ ErrPrint("Failed to build param\n");
+ return -EFAULT;
+ }
+
+ return master_rpc_request_only(handler, packet);
+}
+
EAPI int livebox_activate(const char *pkgname, ret_cb_t cb, void *data)
{
struct packet *packet;
EAPI int livebox_content_event(struct livebox *handler, enum content_event_type type, double x, double y)
{
- int w;
- int h;
+ int w = 1;
+ int h = 1;
char cmd[20] = { '\0', };
char *ptr = cmd;
}
if (type & CONTENT_EVENT_PD_MASK) {
+ int flag = 1;
+
if (!handler->is_pd_created) {
ErrPrint("PD is not created\n");
return -EINVAL;
if (type & CONTENT_EVENT_MOUSE_MOVE) {
if (fabs(x - handler->pd.x) < MINIMUM_EVENT && fabs(y - handler->pd.y) < MINIMUM_EVENT)
return -EBUSY;
+ } else if (type & CONTENT_EVENT_MOUSE_SET) {
+ flag = 0;
}
}
- w = handler->pd.width;
- h = handler->pd.height;
- handler->pd.x = x;
- handler->pd.y = y;
+ if (flag) {
+ w = handler->pd.width;
+ h = handler->pd.height;
+ handler->pd.x = x;
+ handler->pd.y = y;
+ }
*ptr++ = 'p';
*ptr++ = 'd';
} else {
+ int flag = 1;
+
if (type & CONTENT_EVENT_MOUSE_MASK) {
if (!handler->lb.mouse_event) {
ErrPrint("Box is not support the mouse event\n");
if (type & CONTENT_EVENT_MOUSE_MOVE) {
if (fabs(x - handler->lb.x) < MINIMUM_EVENT && fabs(y - handler->lb.y) < MINIMUM_EVENT)
return -EBUSY;
+ } else if (type & CONTENT_EVENT_MOUSE_SET) {
+ flag = 0;
}
}
- w = handler->lb.width;
- h = handler->lb.height;
- handler->lb.x = x;
- handler->lb.y = y;
+ if (flag) {
+ w = handler->lb.width;
+ h = handler->lb.height;
+ handler->lb.x = x;
+ handler->lb.y = y;
+ }
*ptr++ = 'l';
*ptr++ = 'b';
}
case CONTENT_EVENT_MOUSE_MOVE | CONTENT_EVENT_MOUSE_MASK:
strcpy(ptr, "_mouse_move");
break;
+ case CONTENT_EVENT_MOUSE_SET | CONTENT_EVENT_MOUSE_MASK:
+ strcpy(ptr, "_mouse_set");
+ break;
+ case CONTENT_EVENT_MOUSE_UNSET | CONTENT_EVENT_MOUSE_MASK:
+ strcpy(ptr, "_mouse_unset");
+ break;
case CONTENT_EVENT_KEY_DOWN | CONTENT_EVENT_KEY_MASK:
strcpy(ptr, "_key_down");
break;
return -EINVAL;
}
- return send_mouse_event(handler, cmd, x, y, w, h);
+ return send_mouse_event(handler, cmd, x * w, y * h);
}
EAPI const char *livebox_filename(struct livebox *handler)
if (!h)
h = &_h;
- *w = handler->pd.width;
- *h = handler->pd.height;
-
- switch (handler->pd.type) {
- case _PD_TYPE_BUFFER:
- case _PD_TYPE_SCRIPT:
- if (!handler->is_pd_created) {
- DbgPrint("Buffer is not created yet - reset size\n");
- *w = 0;
- *h = 0;
- }
- break;
- default:
- break;
+ if (!handler->is_pd_created) {
+ DbgPrint("Buffer is not created yet [%dx%d]\n", *w, *h);
+ *w = handler->pd.default_width;
+ *h = handler->pd.default_height;
+ } else {
+ *w = handler->pd.width;
+ *h = handler->pd.height;
}
return 0;
return -EINVAL;
}
+ if (handler->group_changed_cb) {
+ ErrPrint("Previous group changing request is not finished yet\n");
+ return -EBUSY;
+ }
+
if (!handler->is_user) {
ErrPrint("CA Livebox is not able to change the group\n");
return -EPERM;
return -EINVAL;
}
+ if (handler->pinup_cb) {
+ ErrPrint("Previous pinup request is not finished\n");
+ return -EBUSY;
+ }
+
if (handler->is_pinned_up == flag) {
DbgPrint("No changes\n");
return -EALREADY;
}
}
+ DbgPrint("Change the visibility %d <> %d, %s\n", handler->visible, state, handler->id);
+
if (handler->visible == state)
return 0;
handler->pd.height = h;
}
+void lb_set_default_pdsize(struct livebox *handler, int w, int h)
+{
+ handler->pd.default_width = w;
+ handler->pd.default_height = h;
+}
+
void lb_invoke_fault_handler(enum livebox_fault_type event, const char *pkgname, const char *file, const char *func)
{
struct dlist *l;
return master_rpc_async_request(handler, packet, 0, del_ret_cb, create_cb_info(cb, data));
}
+EAPI int livebox_client_paused(void)
+{
+ struct packet *packet;
+
+ packet = packet_create_noack("client_paused", "d", util_timestamp());
+ if (!packet) {
+ ErrPrint("Failed to create a pause packet\n");
+ return -EFAULT;
+ }
+
+ return master_rpc_request_only(NULL, packet);
+}
+
+EAPI int livebox_client_resumed(void)
+{
+ struct packet *packet;
+
+ packet = packet_create_noack("client_resumed", "d", util_timestamp());
+ if (!packet) {
+ ErrPrint("Failed to create a resume packet\n");
+ return -EFAULT;
+ }
+
+ return master_rpc_request_only(NULL, packet);
+}
+
/* End of a file */