extern void instance_set_orientation(struct inst_info *inst, int orientation);
extern int instance_orientation(struct inst_info *inst);
+extern void instance_watch_set_need_to_recover(struct inst_info *inst, int recover);
+extern int instance_watch_need_to_recover(struct inst_info *inst);
+extern int instance_watch_recover_visible_state(struct inst_info *inst);
+
/* End of a file */
enum widget_visible_state visible;
struct {
+ int need_to_recover;
+ } watch;
+
+ struct {
int width;
int height;
double priority;
return WIDGET_ERROR_NONE;
}
+/**
+ * @note
+ * Just touch the visible state again.
+ */
+HAPI int instance_watch_recover_visible_state(struct inst_info *inst)
+{
+ switch (inst->visible) {
+ case WIDGET_SHOW:
+ case WIDGET_HIDE:
+ (void)resume_widget(inst);
+ instance_thaw_updator(inst);
+ /**
+ * @note
+ * We don't need to send the monitor event.
+ */
+ break;
+ case WIDGET_HIDE_WITH_PAUSE:
+ (void)pause_widget(inst);
+ instance_freeze_updator(inst);
+ break;
+ default:
+ return WIDGET_ERROR_INVALID_PARAMETER;
+ }
+
+ return WIDGET_ERROR_NONE;
+}
+
static void resize_cb(struct slave_node *slave, const struct packet *packet, void *data)
{
struct resize_cbdata *cbdata = data;
return inst->orientation;
}
+HAPI void instance_watch_set_need_to_recover(struct inst_info *inst, int recover)
+{
+ inst->watch.need_to_recover = !!recover;
+}
+
+HAPI int instance_watch_need_to_recover(struct inst_info *inst)
+{
+ return inst->watch.need_to_recover;
+}
+
/* End of a file */
int cnt;
int ret;
const char *category;
+ int is_watch;
if (!slave_need_to_reactivate_instances(slave)) {
DbgPrint("Do not need to reactivate instances\n");
}
category = package_category(info);
- if (category && strcmp(CATEGORY_WATCH_CLOCK, category) == 0) {
- DbgPrint("[%s] is a watch application, don't recover its state\n", package_name(info));
- return 0;
- }
+ is_watch = (category && strcmp(CATEGORY_WATCH_CLOCK, category) == 0);
cnt = 0;
EINA_LIST_FOREACH_SAFE(info->inst_list, l, n, inst) {
- ret = instance_recover_state(inst);
- if (!ret) {
- continue;
- }
+ if (is_watch) {
+ /**
+ * @note
+ * Watch will be recovered by SLAVE_SYNC_HELLO command.
+ * Not from here.
+ */
+ instance_watch_set_need_to_recover(inst, EINA_TRUE);
+ } else {
+ ret = instance_recover_state(inst);
+ if (!ret) {
+ continue;
+ }
- instance_thaw_updator(inst);
+ instance_thaw_updator(inst);
+ }
cnt++;
}
result = instance_duplicate_packet_create(packet, inst, info, width, height);
+ if (instance_watch_need_to_recover(inst)) {
+ /**
+ * @note
+ * Reset the state recover flag.
+ */
+ (void)instance_watch_set_need_to_recover(inst, EINA_FALSE);
+
+ /**
+ * @note
+ * Re-send the visible state change request in this case.
+ * But, this will be sent after return from this function.
+ * Request will be sent from command comsumer which are running by timer callback.
+ * (slave_rpc_request_only, slave_rpc_async_request, ...)
+ */
+ (void)instance_watch_recover_visible_state(inst);
+ }
+
DbgFree(widget_id);
}