- if (strcmp(operation, "create") == 0) {
- __instance_create(handle, id, content, w, h);
- } else if (strcmp(operation, "resize") == 0) {
- __resize_window(id, w, h);
- } else if (strcmp(operation, "update") == 0) {
- if (id)
- __instance_update(handle, id, force, content);
- else
- __instance_update_all(handle, force, content);
-
- } else if (strcmp(operation, "destroy") == 0) {
- __instance_destroy(handle, id, WIDGET_APP_DESTROY_TYPE_PERMANENT, UPDATE_ALL);
- } else if (strcmp(operation, "resume") == 0) {
- __instance_resume(handle, id, UPDATE_ALL);
- } else if (strcmp(operation, "pause") == 0) {
- __instance_pause(handle, id, UPDATE_ALL);
- } else if (strcmp(operation, "terminate") == 0) {
- __instance_destroy(handle, id, WIDGET_APP_DESTROY_TYPE_TEMPORARY, UPDATE_ALL);
- }
-
- return;
-error:
- LOGD("error on control");
- return;
-}
-
-static void __pause_all(int send_update)
-{
- GList *contexts = _widget_app_get_contexts();
- GList *iter = g_list_first(contexts);
-
- while (iter != NULL) {
- widget_context_s *cxt = (widget_context_s *)iter->data;
-
- switch (cxt->state) {
- case WC_READY:
- __instance_resume(cxt->provider, cxt->id, send_update);
- __instance_pause(cxt->provider, cxt->id, send_update);
- break;
- case WC_RUNNING:
- __instance_pause(cxt->provider, cxt->id, send_update);
- break;
- }
- LOGD("pause %s", cxt->id);
- iter = g_list_next(iter);
- }
-}
-
-/* LCOV_EXCL_START */
-static void __resume_all(int send_update)
-{
- GList *contexts = _widget_app_get_contexts();
- GList *iter = g_list_first(contexts);
-
- while (iter != NULL) {
- widget_context_s *cxt = (widget_context_s *)iter->data;
-
- switch (cxt->state) {
- case WC_READY:
- __instance_resume(cxt->provider, cxt->id, send_update);
- break;
- case WC_PAUSED:
- __instance_resume(cxt->provider, cxt->id, send_update);
- break;
- }
- iter = g_list_next(iter);
- }
-}
-/* LCOV_EXCL_STOP */
-
-static void __destroy_all(int reason, int send_update)
-{
- GList *contexts = _widget_app_get_contexts();
- GList *iter = g_list_first(contexts);
-
- __pause_all(send_update);
- while (iter != NULL) {
- widget_context_s *cxt = (widget_context_s *)iter->data;
- iter = g_list_next(iter);
- switch (cxt->state) {
- case WC_PAUSED:
- LOGD("destroy %d : %s", cxt->state, cxt->id);
- __instance_destroy(cxt->provider, cxt->id, reason, send_update);
- break;
- }
- }
-}
-
-
-static Eina_Bool __show_cb(void *data, int type, void *event)
-{
- Ecore_Wl_Event_Window_Show *ev = event;
- widget_context_s *cxt = __find_context_by_win(ev->win);
-
- LOGD("show %d %d", (unsigned int)ev->win, (unsigned int)ev->data[0]);
-
- if (cxt)
- __instance_resume(cxt->provider, cxt->id, UPDATE_ALL);
- else
- LOGE("unknown window error: %d", ev->win); /* LCOV_EXCL_LINE */
-
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool __hide_cb(void *data, int type, void *event)
-{
- Ecore_Wl_Event_Window_Hide *ev = event;
- widget_context_s *cxt = __find_context_by_win(ev->win);
-
-
- LOGD("hide %d", (unsigned int)ev->win);
-
- if (cxt)
- __instance_pause(cxt->provider, cxt->id, UPDATE_ALL);