From 783fbd2f0f9fc204ad9797e3ee964bde37277973 Mon Sep 17 00:00:00 2001
From: Daehyeon Jung
Date: Tue, 5 Jul 2016 22:57:11 +0900
Subject: [PATCH 01/16] Fix widget instance update
Change-Id: Ia43fdb6fd16e1870ed68fcacb0c2cb26cc9bc60e
Signed-off-by: Daehyeon Jung
---
src/widget_app.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 53 insertions(+), 4 deletions(-)
diff --git a/src/widget_app.c b/src/widget_app.c
index 608f729..9d717ae 100755
--- a/src/widget_app.c
+++ b/src/widget_app.c
@@ -156,8 +156,12 @@ static gint __comp_by_id(gconstpointer a, gconstpointer b)
static widget_context_s *__find_context_by_id(const char *id)
{
- GList *ret = g_list_find_custom(contexts, id, __comp_by_id);
+ GList *ret;
+ if (id == NULL)
+ return NULL;
+
+ ret = g_list_find_custom(contexts, id, __comp_by_id);
if (ret == NULL)
return NULL;
@@ -228,6 +232,7 @@ static int __send_update_status(const char *class_id, const char *instance_id,
if (extra) {
bundle_encode(extra, &raw, &len);
bundle_add_str(b, WIDGET_K_CONTENT_INFO, (const char *)raw);
+ aul_widget_instance_add(class_id, instance_id);
}
_D("send update %s(%d) to %s", instance_id, status, viewer_endpoint);
@@ -349,6 +354,35 @@ static int __instance_resize(widget_class_h handle, const char *id, int w, int h
}
/* LCOV_EXCL_START */
+static int __instance_update_all(widget_class_h handle, int force, const char *content)
+{
+ widget_context_s *wc;
+ int ret = 0;
+ bundle *b = NULL;
+ GList *context = contexts;
+
+ if (content)
+ b = bundle_decode((const bundle_raw *)content, strlen(content));
+
+ if (handle->ops.update) {
+ while (context) {
+ wc = (widget_context_s *)context->data;
+ handle->ops.update(wc, b, force, handle->user_data);
+ ret = __send_update_status(handle->classid, wc->id,
+ WIDGET_INSTANCE_EVENT_UPDATE, NULL);
+ _D("updated:%s", wc->id);
+ context = context->next;
+ }
+ }
+
+ if (b)
+ bundle_free(b);
+
+ return ret;
+}
+/* LCOV_EXCL_STOP */
+
+/* LCOV_EXCL_START */
static int __instance_update(widget_class_h handle, const char *id, int force, const char *content)
{
widget_context_s *wc = __find_context_by_id(id);
@@ -399,10 +433,19 @@ static int __instance_create(widget_class_h handle, const char *id, const char *
contexts = g_list_append(contexts, wc);
- handle->ops.create(wc, content_info, w, h, handle->user_data);
- ret = __send_update_status(handle->classid, wc->id,
+ ret = handle->ops.create(wc, content_info, w, h, handle->user_data);
+ if (ret < 0) {
+ /* TODO send abort */
+ } else {
+ ret = __send_update_status(handle->classid, wc->id,
WIDGET_INSTANCE_EVENT_CREATE, NULL);
+ if (content == NULL)
+ content = "NULL";
+
+ aul_widget_instance_add(handle->classid, id);
+ }
+
if (content_info)
bundle_free(content_info);
@@ -438,6 +481,8 @@ static int __instance_destroy(widget_class_h handle, const char *id,
WIDGET_INSTANCE_EVENT_EXTRA_UPDATED, content_info);
}
+ aul_widget_instance_del(handle->classid, id);
+
if (content_info)
bundle_free(content_info);
@@ -549,7 +594,11 @@ static void __control(bundle *b)
} else if (strcmp(operation, "resize") == 0) {
__resize_window(id, w, h);
} else if (strcmp(operation, "update") == 0) {
- __instance_update(handle, id, force, content);
+ 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) {
--
2.7.4
From d076ceffa92521cd4e6a554212f8efeda4d85da6 Mon Sep 17 00:00:00 2001
From: Semun Lee
Date: Fri, 29 Jul 2016 17:01:15 +0900
Subject: [PATCH 02/16] Consider fallback to english for i18n
LANGUAGE variable can contain default language information.
It will be used when the mo files for the selected language is not
available.
Change-Id: I3a7fa43cd3736bf29bdbad6a0ea8b3b80fbabf8b
Signed-off-by: Semun Lee
---
src/widget-i18n.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/widget-i18n.c b/src/widget-i18n.c
index 7fbca1a..39ae5c5 100755
--- a/src/widget-i18n.c
+++ b/src/widget-i18n.c
@@ -35,9 +35,12 @@
void _update_lang(void)
{
+ char language[32];
char *r;
char *lang = vconf_get_str(VCONFKEY_LANGSET);
if (lang) {
+ snprintf(language, sizeof(language), "%s:en_US:en_GB:en", lang);
+ setenv("LANGUAGE", language, 1);
setenv("LANG", lang, 1);
setenv("LC_MESSAGES", lang, 1);
--
2.7.4
From 150f55cbec59b7f623b8381992b8db8a1e66ce87 Mon Sep 17 00:00:00 2001
From: Hyunho Kang
Date: Mon, 18 Jul 2016 20:20:33 +0900
Subject: [PATCH 03/16] Add widget app restart logic
Change-Id: I54bce1b3e0eba8c919a238c808986fdb814fc277
Signed-off-by: Hyunho Kang
---
CMakeLists.txt | 1 +
include/widget_app_internal.h | 3 ++
src/widget-private.h | 30 +++++++++++
src/widget_app.c | 60 ++++++++--------------
src/widget_app_internal.c | 114 ++++++++++++++++++++++++++++++++++++++++++
5 files changed, 170 insertions(+), 38 deletions(-)
create mode 100644 src/widget_app_internal.c
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 652d965..8e4023a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,6 +25,7 @@ SET(APPCORE_WIDGET "capi-appfw-widget-application")
SET(SRCS_widget
src/widget-i18n.c
src/widget_app.c
+ src/widget_app_internal.c
src/widget_error.c
)
SET(HEADERS_widget widget_app.h widget_app_efl.h widget_app_internal.h)
diff --git a/include/widget_app_internal.h b/include/widget_app_internal.h
index 024cfa9..c278012 100644
--- a/include/widget_app_internal.h
+++ b/include/widget_app_internal.h
@@ -27,6 +27,7 @@ extern "C" {
* For in-house applications
*
*/
+
typedef struct {
struct __pointer {
double x;
@@ -60,6 +61,8 @@ struct _widget_class_factory_full {
};
const widget_class_factory_full_s *widget_app_get_class_factory(void);
+int widget_app_restart();
+
#ifdef __cplusplus
}
diff --git a/src/widget-private.h b/src/widget-private.h
index ef6d32c..847c099 100644
--- a/src/widget-private.h
+++ b/src/widget-private.h
@@ -18,12 +18,42 @@
#ifndef __APPCORE_WIDGET_PRIVATE_H__
#define __APPCORE_WIDGET_PRIVATE_H__
+#include
+
+#include
#include
#include
#include
#define FEATURE_SHELL_APPWIDGET "http://tizen.org/feature/shell.appwidget"
+struct _widget_class {
+ void *user_data;
+ widget_instance_lifecycle_callback_s ops;
+ char *classid;
+ struct _widget_class *next;
+ struct _widget_class *prev;
+};
+
+struct _widget_context {
+ char *id;
+ struct _widget_class *provider;
+ int state;
+ void *tag;
+ Evas_Object *win;
+ int win_id;
+ char *content;
+ widget_instance_lifecycle_callback_s ops;
+};
+
+typedef struct _widget_context widget_context_s;
+
+GList *_widget_app_get_contexts();
+int _widget_app_add_context(widget_context_s *wc);
+int _widget_app_remove_context(widget_context_s *wc);
+int _widget_app_set_viewer_endpoint(char *viewer_endpoint);
+char *_widget_app_get_viewer_endpoint();
+int _widget_app_free_viewer_endpoint();
int _set_i18n(const char *domainname);
void _update_lang(void);
void _update_region(void);
diff --git a/src/widget_app.c b/src/widget_app.c
index 9d717ae..f90e7ec 100755
--- a/src/widget_app.c
+++ b/src/widget_app.c
@@ -62,14 +62,6 @@ enum {
UPDATE_ALL = 1,
};
-struct _widget_class {
- void *user_data;
- widget_instance_lifecycle_callback_s ops;
- char *classid;
- struct _widget_class *next;
- struct _widget_class *prev;
-};
-
struct app_event_handler {
app_event_type_e type;
app_event_cb cb;
@@ -81,19 +73,7 @@ struct app_event_info {
void *value;
};
-struct _widget_context {
- char *id;
- struct _widget_class *provider;
- int state;
- void *tag;
- Evas_Object *win;
- int win_id;
- char *content;
- widget_instance_lifecycle_callback_s ops;
-};
-
typedef struct _widget_class widget_class_s;
-typedef struct _widget_context widget_context_s;
#define WIDGET_APP_EVENT_MAX 5
static GList *handler_list[WIDGET_APP_EVENT_MAX] = {NULL, };
@@ -103,8 +83,6 @@ static widget_app_lifecycle_callback_s *app_ops;
static void *app_user_data;
static char *appid;
static widget_class_h class_provider;
-static GList *contexts;
-static char *viewer_endpoint;
static int exit_called;
static void _widget_core_set_appcore_event_cb(void);
@@ -157,6 +135,7 @@ static gint __comp_by_id(gconstpointer a, gconstpointer b)
static widget_context_s *__find_context_by_id(const char *id)
{
GList *ret;
+ GList *contexts = _widget_app_get_contexts();
if (id == NULL)
return NULL;
@@ -178,6 +157,7 @@ static gint __comp_by_win(gconstpointer a, gconstpointer b)
static widget_context_s *__find_context_by_win(int win)
{
+ GList *contexts = _widget_app_get_contexts();
GList *ret = g_list_find_custom(contexts, GINT_TO_POINTER(win), __comp_by_win);
if (ret == NULL)
@@ -197,9 +177,9 @@ static int __send_lifecycle_event(const char *class_id, const char *instance_id,
return -1; /* LCOV_EXCL_LINE */
}
- bundle_add_str(b, WIDGET_K_ID, class_id);
- bundle_add_str(b, WIDGET_K_INSTANCE, instance_id);
- bundle_add_byte(b, WIDGET_K_STATUS, &status, sizeof(int));
+ bundle_add_str(b, AUL_K_WIDGET_ID, class_id);
+ bundle_add_str(b, AUL_K_WIDGET_INSTANCE_ID, instance_id);
+ bundle_add_byte(b, AUL_K_WIDGET_STATUS, &status, sizeof(int));
_D("send lifecycle %s(%d)", instance_id, status);
ret = aul_app_com_send("widget.status", b);
@@ -218,6 +198,7 @@ static int __send_update_status(const char *class_id, const char *instance_id,
int lifecycle = -1;
bundle_raw *raw = NULL;
int len;
+ char *viewer_endpoint = _widget_app_get_viewer_endpoint();
b = bundle_create();
if (!b) {
@@ -225,9 +206,9 @@ static int __send_update_status(const char *class_id, const char *instance_id,
return -1; /* LCOV_EXCL_LINE */
}
- bundle_add_str(b, WIDGET_K_ID, class_id);
- bundle_add_str(b, WIDGET_K_INSTANCE, instance_id);
- bundle_add_byte(b, WIDGET_K_STATUS, &status, sizeof(int));
+ bundle_add_str(b, AUL_K_WIDGET_ID, class_id);
+ bundle_add_str(b, AUL_K_WIDGET_INSTANCE_ID, instance_id);
+ bundle_add_byte(b, AUL_K_WIDGET_STATUS, &status, sizeof(int));
if (extra) {
bundle_encode(extra, &raw, &len);
@@ -359,7 +340,7 @@ static int __instance_update_all(widget_class_h handle, int force, const char *c
widget_context_s *wc;
int ret = 0;
bundle *b = NULL;
- GList *context = contexts;
+ GList *context = _widget_app_get_contexts();
if (content)
b = bundle_decode((const bundle_raw *)content, strlen(content));
@@ -431,7 +412,7 @@ static int __instance_create(widget_class_h handle, const char *id, const char *
content_info = bundle_decode((const bundle_raw *)content, strlen(content));
}
- contexts = g_list_append(contexts, wc);
+ _widget_app_add_context(wc);
ret = handle->ops.create(wc, content_info, w, h, handle->user_data);
if (ret < 0) {
@@ -460,6 +441,7 @@ static int __instance_destroy(widget_class_h handle, const char *id,
int event = WIDGET_INSTANCE_EVENT_TERMINATE;
bundle *content_info;
+
if (!wc) {
_E("could not find widget obj: %s", id); /* LCOV_EXCL_LINE */
return WIDGET_ERROR_INVALID_PARAMETER; /* LCOV_EXCL_LINE */
@@ -488,7 +470,7 @@ static int __instance_destroy(widget_class_h handle, const char *id,
ret = __send_update_status(handle->classid, id, event, NULL);
- contexts = g_list_remove(contexts, wc);
+ _widget_app_remove_context(wc);
if (wc->id)
free(wc->id);
@@ -498,7 +480,7 @@ static int __instance_destroy(widget_class_h handle, const char *id,
free(wc);
- if (contexts == NULL && !exit_called) /* all instance destroyed */
+ if (_widget_app_get_contexts() == NULL && !exit_called) /* all instance destroyed */
widget_app_exit();
return ret;
@@ -559,7 +541,7 @@ static void __control(bundle *b)
if (class_id == NULL)
class_id = appid;
- bundle_get_str(b, WIDGET_K_INSTANCE, &id);
+ bundle_get_str(b, AUL_K_WIDGET_INSTANCE_ID, &id);
bundle_get_str(b, WIDGET_K_OPERATION, &operation);
handle = __find_class_handler(class_id, class_provider);
@@ -617,6 +599,7 @@ error:
static void __pause_all(int send_update)
{
+ GList *contexts = _widget_app_get_contexts();
GList *iter = g_list_first(contexts);
while (iter != NULL) {
@@ -638,6 +621,7 @@ static void __pause_all(int send_update)
/* 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) {
@@ -658,6 +642,7 @@ static void __resume_all(int send_update)
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);
@@ -849,6 +834,7 @@ static int __before_loop(int argc, char **argv)
char *wayland_display = NULL;
char *xdg_runtime_dir = NULL;
char *name;
+ char *viewer_endpoint;
#if !(GLIB_CHECK_VERSION(2, 36, 0))
g_type_init();
@@ -861,7 +847,7 @@ static int __before_loop(int argc, char **argv)
bundle_get_str(kb, WIDGET_K_ENDPOINT, &viewer_endpoint);
if (viewer_endpoint) {
_E("viewer endpoint :%s", viewer_endpoint);
- viewer_endpoint = strdup(viewer_endpoint);
+ _widget_app_set_viewer_endpoint(viewer_endpoint);
} else {
_E("endpoint is missing");
}
@@ -952,9 +938,7 @@ static void __after_loop()
if (app_ops->terminate)
app_ops->terminate(app_user_data);
- if (viewer_endpoint)
- free(viewer_endpoint);
-
+ _widget_app_free_viewer_endpoint();
_widget_core_unset_appcore_event_cb();
__free_handler_list();
elm_shutdown();
@@ -1202,6 +1186,7 @@ EXPORT_API int widget_app_terminate_context(widget_context_h context)
EXPORT_API int widget_app_foreach_context(widget_context_cb cb, void *data)
{
+ GList *contexts = _widget_app_get_contexts();
GList *list;
widget_context_s *wc;
@@ -1517,4 +1502,3 @@ EXPORT_API int widget_app_context_set_title(widget_context_h context,
return WIDGET_ERROR_NONE;
}
-
diff --git a/src/widget_app_internal.c b/src/widget_app_internal.c
new file mode 100644
index 0000000..45b56d8
--- /dev/null
+++ b/src/widget_app_internal.c
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include "widget_app.h"
+#include "widget-log.h"
+#include "widget-private.h"
+#include "widget_app_internal.h"
+#include "widget-private.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "CAPI_WIDGET_APPLICATION"
+
+static char *viewer_endpoint = NULL;
+static GList *contexts = NULL;
+
+EXPORT_API int widget_app_restart()
+{
+ int ret;
+ int status = AUL_WIDGET_INSTANCE_EVENT_APP_RESTART_REQUEST;
+ bundle *kb;
+ widget_context_s *wc;
+ char *classid;
+
+ if (contexts == NULL) {
+ _E("no widget");
+ return WIDGET_ERROR_IO_ERROR;
+ }
+ wc = (widget_context_s *)contexts->data;
+ classid = wc->provider->classid;
+ _D("restart widget classid : %s", classid);
+
+ kb = bundle_create();
+ bundle_add_str(kb, AUL_K_WIDGET_ID, classid);
+ bundle_add_byte(kb, AUL_K_WIDGET_STATUS, &status, sizeof(int));
+ ret = aul_app_com_send(viewer_endpoint, kb);
+ bundle_free(kb);
+ if (ret != AUL_R_OK) {
+ _E("failed to kill app");
+ return WIDGET_ERROR_IO_ERROR;
+ }
+ return WIDGET_ERROR_NONE;
+}
+
+GList *_widget_app_get_contexts()
+{
+ return contexts;
+}
+
+int _widget_app_add_context(widget_context_s *wc)
+{
+ contexts = g_list_append(contexts, wc);
+ return WIDGET_ERROR_NONE;
+}
+
+int _widget_app_remove_context(widget_context_s *wc)
+{
+ contexts = g_list_remove(contexts, wc);
+ return WIDGET_ERROR_NONE;
+}
+
+int _widget_app_set_viewer_endpoint(char *endpoint)
+{
+ if (endpoint == NULL)
+ return WIDGET_ERROR_INVALID_PARAMETER;
+
+ viewer_endpoint = strdup(endpoint);
+ if (viewer_endpoint == NULL)
+ return WIDGET_ERROR_OUT_OF_MEMORY;
+
+ return WIDGET_ERROR_NONE;
+}
+
+char *_widget_app_get_viewer_endpoint()
+{
+ return viewer_endpoint;
+}
+
+int _widget_app_free_viewer_endpoint()
+{
+ if (viewer_endpoint)
+ free(viewer_endpoint);
+
+ return WIDGET_ERROR_NONE;
+}
--
2.7.4
From 94e629734622f169fd471ab4f5545235ffffc784 Mon Sep 17 00:00:00 2001
From: Hyunho Kang
Date: Wed, 17 Aug 2016 17:10:59 +0900
Subject: [PATCH 04/16] Fix uninitialized value
Change-Id: Ic81d24835bf996c312eb1a5b8ea67bb6e4b6cf67
Signed-off-by: Hyunho Kang
---
src/widget_app.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/widget_app.c b/src/widget_app.c
index f90e7ec..2128f0b 100755
--- a/src/widget_app.c
+++ b/src/widget_app.c
@@ -834,7 +834,7 @@ static int __before_loop(int argc, char **argv)
char *wayland_display = NULL;
char *xdg_runtime_dir = NULL;
char *name;
- char *viewer_endpoint;
+ char *viewer_endpoint = NULL;
#if !(GLIB_CHECK_VERSION(2, 36, 0))
g_type_init();
--
2.7.4
From 18493cdad7b750868f2b30cbb375146fc7baebb0 Mon Sep 17 00:00:00 2001
From: Hyunho Kang
Date: Tue, 6 Sep 2016 18:05:53 +0900
Subject: [PATCH 05/16] Implement widget_service_get_instance_count
Change-Id: Ie927848973f36955635ff120bcf85ffe6ef18f2e
Signed-off-by: Hyunho Kang
---
src/widget_app.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/widget_app.c b/src/widget_app.c
index 2128f0b..60d3d08 100755
--- a/src/widget_app.c
+++ b/src/widget_app.c
@@ -441,10 +441,10 @@ static int __instance_destroy(widget_class_h handle, const char *id,
int event = WIDGET_INSTANCE_EVENT_TERMINATE;
bundle *content_info;
-
if (!wc) {
- _E("could not find widget obj: %s", id); /* LCOV_EXCL_LINE */
- return WIDGET_ERROR_INVALID_PARAMETER; /* LCOV_EXCL_LINE */
+ _E("could not find widget obj: %s, clear amd info", id); /* LCOV_EXCL_LINE */
+ aul_widget_instance_del(handle->classid, id); /* LCOV_EXCL_LINE */
+ return WIDGET_ERROR_NONE; /* LCOV_EXCL_LINE */
}
wc->state = WC_TERMINATED;
@@ -458,13 +458,12 @@ static int __instance_destroy(widget_class_h handle, const char *id,
if (reason == WIDGET_APP_DESTROY_TYPE_PERMANENT) {
event = WIDGET_INSTANCE_EVENT_DESTROY;
+ aul_widget_instance_del(handle->classid, id);
} else {
ret = __send_update_status(handle->classid, id,
WIDGET_INSTANCE_EVENT_EXTRA_UPDATED, content_info);
}
- aul_widget_instance_del(handle->classid, id);
-
if (content_info)
bundle_free(content_info);
@@ -614,6 +613,7 @@ static void __pause_all(int send_update)
__instance_pause(cxt->provider, cxt->id, send_update);
break;
}
+ LOGD("pause %s", cxt->id);
iter = g_list_next(iter);
}
}
@@ -646,16 +646,15 @@ static void __destroy_all(int reason, int send_update)
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 %s", cxt->state, cxt->id);
__instance_destroy(cxt->provider, cxt->id, reason, send_update);
break;
}
- iter = g_list_next(iter);
}
}
--
2.7.4
From 7615492553b49fc96faa0ee8f2c20afeab00ae1e Mon Sep 17 00:00:00 2001
From: Hyunho Kang
Date: Fri, 23 Sep 2016 10:34:19 +0900
Subject: [PATCH 06/16] Fix wrong doxygen format
Change-Id: Idbb4c367cd57724e9b0c210a075e668b66d4a636
Signed-off-by: Hyunho Kang
---
include/widget_app.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/widget_app.h b/include/widget_app.h
index 3b49868..3cd38a0 100755
--- a/include/widget_app.h
+++ b/include/widget_app.h
@@ -38,9 +38,9 @@ extern "C" {
* @since_tizen 2.3.1
*/
typedef enum widget_app_destroy_type {
- WIDGET_APP_DESTROY_TYPE_PERMANENT = 0x00, /* User deleted this widget from the viewer */
- WIDGET_APP_DESTROY_TYPE_TEMPORARY = 0x01, /* Widget is deleted because of other reasons (e.g. widget process is terminated temporarily by the system) */
-} widget_app_destroy_type_e; /**< Delete type */
+ WIDGET_APP_DESTROY_TYPE_PERMANENT = 0x00, /**< User deleted this widget from the viewer */
+ WIDGET_APP_DESTROY_TYPE_TEMPORARY = 0x01, /**< Widget is deleted because of other reasons (e.g. widget process is terminated temporarily by the system) */
+} widget_app_destroy_type_e;
/**
* @brief The handle for widget class.
--
2.7.4
From 54fa55eb30fa95fc111a23d2ccee190901ddf60f Mon Sep 17 00:00:00 2001
From: Hwankyu Jhun
Date: Fri, 7 Oct 2016 15:05:27 +0900
Subject: [PATCH 07/16] Add package id to the lifecycle info
Change-Id: I812173fb03a725df74c710fe756d35bc9492f6f6
Signed-off-by: Hwankyu Jhun
---
src/widget_app.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/widget_app.c b/src/widget_app.c
index 60d3d08..c3edd63 100755
--- a/src/widget_app.c
+++ b/src/widget_app.c
@@ -84,6 +84,7 @@ static void *app_user_data;
static char *appid;
static widget_class_h class_provider;
static int exit_called;
+static char *package_id;
static void _widget_core_set_appcore_event_cb(void);
static void _widget_core_unset_appcore_event_cb(void);
@@ -170,6 +171,7 @@ static int __send_lifecycle_event(const char *class_id, const char *instance_id,
int status)
{
bundle *b = bundle_create();
+ char pkgid[256] = {0, };
int ret;
if (b == NULL) {
@@ -177,9 +179,17 @@ static int __send_lifecycle_event(const char *class_id, const char *instance_id,
return -1; /* LCOV_EXCL_LINE */
}
+ if (package_id == NULL) {
+ ret = aul_app_get_pkgid_bypid(getpid(), pkgid, sizeof(pkgid));
+ if (ret == 0)
+ package_id = strdup(pkgid);
+ }
+
bundle_add_str(b, AUL_K_WIDGET_ID, class_id);
bundle_add_str(b, AUL_K_WIDGET_INSTANCE_ID, instance_id);
bundle_add_byte(b, AUL_K_WIDGET_STATUS, &status, sizeof(int));
+ if (package_id)
+ bundle_add_str(b, AUL_K_PKGID, package_id);
_D("send lifecycle %s(%d)", instance_id, status);
ret = aul_app_com_send("widget.status", b);
@@ -940,6 +950,12 @@ static void __after_loop()
_widget_app_free_viewer_endpoint();
_widget_core_unset_appcore_event_cb();
__free_handler_list();
+
+ if (package_id) {
+ free(package_id);
+ package_id = NULL;
+ }
+
elm_shutdown();
}
--
2.7.4
From 576ddaf71e45cd95fa04e5c0ec6e2be7eba9e0b6 Mon Sep 17 00:00:00 2001
From: Hyunho Kang
Date: Wed, 12 Oct 2016 19:33:35 +0900
Subject: [PATCH 08/16] Support widget content info share
Change-Id: Ic8b4db04bf4aba55006bb38dca0d59b001de644b
Signed-off-by: Hyunho Kang
---
src/widget_app.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/src/widget_app.c b/src/widget_app.c
index c3edd63..243908a 100755
--- a/src/widget_app.c
+++ b/src/widget_app.c
@@ -759,6 +759,30 @@ static void __add_climsg()
ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_CONFIGURE, __configure_cb, NULL);
}
+static void __get_content(bundle *b)
+{
+ char *instance_id = NULL;
+ widget_context_s *cxt = NULL;
+
+ bundle_get_str(b, AUL_K_WIDGET_INSTANCE_ID, &instance_id);
+ if (!instance_id)
+ return;
+
+ cxt = __find_context_by_id(instance_id);
+ if (!cxt) {
+ _E("can not find instance id:%s", instance_id);
+ return;
+ }
+
+ if (cxt->content) {
+ bundle_add_str(b, AUL_K_WIDGET_CONTENT_INFO, cxt->content);
+ _D("content info of %s found", cxt->id);
+ } else {
+ bundle_add_str(b, AUL_K_WIDGET_CONTENT_INFO, "");
+ _D("empty content info added");
+ }
+}
+
static int __aul_handler(aul_type type, bundle *b, void *data)
{
char *caller = NULL;
@@ -785,6 +809,9 @@ static int __aul_handler(aul_type type, bundle *b, void *data)
case AUL_TERMINATE:
widget_app_exit();
break;
+ case AUL_WIDGET_CONTENT:
+ __get_content(b);
+ break;
default:
break;
}
--
2.7.4
From fa3ec686bf8cbb43cb8087442cae1449caa3694c Mon Sep 17 00:00:00 2001
From: Daehyeon Jung
Date: Mon, 10 Oct 2016 19:36:17 +0900
Subject: [PATCH 09/16] replace pepper-based backend to tbm-based
Change-Id: I36817241c9797b8cdc924b9507a3cf51a491d226
Signed-off-by: Daehyeon Jung
---
CMakeLists.txt | 4 +++-
packaging/appcore-widget.spec | 2 ++
src/widget_app.c | 42 ++++++++++++++++++++++++------------------
3 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8e4023a..e2669a7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,6 +42,8 @@ pkg_check_modules(pkg_widget REQUIRED
vconf-internal-keys
widget_service
capi-system-info
+ ecore-wayland
+ tizen-remote-surface-client
)
FOREACH(flag ${pkg_widget_CFLAGS})
SET(EXTRA_CFLAGS_widget "${EXTRA_CFLAGS_widget} ${flag}")
@@ -51,7 +53,7 @@ ADD_LIBRARY(${APPCORE_WIDGET} SHARED ${SRCS_widget})
SET_TARGET_PROPERTIES(${APPCORE_WIDGET} PROPERTIES SOVERSION ${VERSION_MAJOR})
SET_TARGET_PROPERTIES(${APPCORE_WIDGET} PROPERTIES VERSION ${VERSION})
SET_TARGET_PROPERTIES(${APPCORE_WIDGET} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_widget})
-TARGET_LINK_LIBRARIES(${APPCORE_WIDGET} ${pkg_widget_LDFLAGS} "-ldl")
+TARGET_LINK_LIBRARIES(${APPCORE_WIDGET} ${pkg_widget_LDFLAGS} "-ldl -Wl,--no-undefined")
INSTALL(TARGETS ${APPCORE_WIDGET} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPCORE_WIDGET}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
diff --git a/packaging/appcore-widget.spec b/packaging/appcore-widget.spec
index 71da10d..5355ca0 100644
--- a/packaging/appcore-widget.spec
+++ b/packaging/appcore-widget.spec
@@ -17,6 +17,8 @@ BuildRequires: pkgconfig(appcore-common)
BuildRequires: pkgconfig(capi-appfw-app-common)
BuildRequires: pkgconfig(widget_service)
BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: pkgconfig(wayland-tbm-client)
+BuildRequires: pkgconfig(ecore-wayland)
BuildRequires: cmake
diff --git a/src/widget_app.c b/src/widget_app.c
index 243908a..80d9cb8 100755
--- a/src/widget_app.c
+++ b/src/widget_app.c
@@ -36,6 +36,7 @@
#include
#include
#include
+#include
#include "widget_app.h"
#include "widget-log.h"
@@ -867,8 +868,6 @@ static int __before_loop(int argc, char **argv)
{
int r;
bundle *kb = NULL;
- char *wayland_display = NULL;
- char *xdg_runtime_dir = NULL;
char *name;
char *viewer_endpoint = NULL;
@@ -878,8 +877,6 @@ static int __before_loop(int argc, char **argv)
kb = bundle_import_from_argv(argc, argv);
if (kb) {
- bundle_get_str(kb, AUL_K_WAYLAND_WORKING_DIR, &xdg_runtime_dir);
- bundle_get_str(kb, AUL_K_WAYLAND_DISPLAY, &wayland_display);
bundle_get_str(kb, WIDGET_K_ENDPOINT, &viewer_endpoint);
if (viewer_endpoint) {
_E("viewer endpoint :%s", viewer_endpoint);
@@ -888,22 +885,14 @@ static int __before_loop(int argc, char **argv)
_E("endpoint is missing");
}
- if (xdg_runtime_dir)
- setenv("XDG_RUNTIME_DIR", xdg_runtime_dir, 1);
-
- _D("xdg_runtime_dir:%s", xdg_runtime_dir);
-
- if (wayland_display)
- setenv("WAYLAND_DISPLAY", wayland_display, 1);
-
- _D("wayland_display:%s", wayland_display);
-
bundle_free(kb);
kb = NULL;
} else {
_E("failed to get launch argv"); /* LCOV_EXCL_LINE */
}
+ aul_rsm_provider_init();
+
elm_init(argc, argv);
r = aul_launch_init(__aul_handler, NULL);
@@ -974,6 +963,8 @@ static void __after_loop()
if (app_ops->terminate)
app_ops->terminate(app_user_data);
+ aul_rsm_provider_fini();
+
_widget_app_free_viewer_endpoint();
_widget_core_unset_appcore_event_cb();
__free_handler_list();
@@ -1155,7 +1146,6 @@ EXPORT_API int widget_app_main(int argc, char **argv,
__FUNCTION__,
"widget_app_create_cb() callback must be "
"registered");
-
app_ops = callback;
app_user_data = user_data;
r = __before_loop(argc, argv);
@@ -1362,6 +1352,7 @@ EXPORT_API int widget_app_get_elm_win(widget_context_h context,
widget_context_s *cxt = (widget_context_s *)context;
Evas_Object *ret_win;
Ecore_Wl_Window *wl_win;
+ struct wl_surface *surface;
if (!_is_widget_feature_enabled()) {
_E("not supported"); /* LCOV_EXCL_LINE */
@@ -1375,17 +1366,25 @@ EXPORT_API int widget_app_get_elm_win(widget_context_h context,
ret_win = elm_win_add(NULL, cxt->id, ELM_WIN_BASIC);
if (ret_win == NULL) {
_E("failed to create window"); /* LCOV_EXCL_LINE */
- return WIDGET_ERROR_FAULT; /* LCOV_EXCL_LINE */
+ goto fault; /* LCOV_EXCL_LINE */
}
wl_win = elm_win_wl_window_get(ret_win);
if (wl_win == NULL) {
_E("failed to get wayland window"); /* LCOV_EXCL_LINE */
- evas_object_del(ret_win); /* LCOV_EXCL_LINE */
- return WIDGET_ERROR_FAULT; /* LCOV_EXCL_LINE */
+ goto fault;
}
+ surface = ecore_wl_window_surface_get(wl_win);
+ if (surface == NULL) {
+ _E("failed to get surface"); /* LCOV_EXCL_LINE */
+ goto fault; /* LCOV_EXCL_LINE */
+ }
+
+ aul_rsm_provider_remote_enable(cxt->id, surface);
+
ecore_wl_window_class_name_set(wl_win, cxt->id);
+ elm_win_aux_hint_add(ret_win, "wm.policy.win.user.geometry", "1");
*win = ret_win;
cxt->win = ret_win;
@@ -1394,6 +1393,13 @@ EXPORT_API int widget_app_get_elm_win(widget_context_h context,
_D("window created: %d", cxt->win_id);
return WIDGET_ERROR_NONE;
+
+fault:
+ if (ret_win) /* LCOV_EXCL_LINE */
+ evas_object_del(ret_win); /* LCOV_EXCL_LINE */
+
+ return WIDGET_ERROR_FAULT; /* LCOV_EXCL_LINE */
+
}
widget_class_h _widget_class_create(widget_class_s *prev, const char *class_id,
--
2.7.4
From 6b384d023e533b8bd89ce81cd5844bf50d1a1cac Mon Sep 17 00:00:00 2001
From: Shinwoo Kim
Date: Mon, 14 Nov 2016 11:47:49 +0900
Subject: [PATCH 10/16] [accessibility][screen-reader] make widget accessible
Change-Id: I2db8f30ae410aba654b3559e19f510f938ed023f
---
src/widget_app.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/widget_app.c b/src/widget_app.c
index 80d9cb8..374e437 100755
--- a/src/widget_app.c
+++ b/src/widget_app.c
@@ -1346,6 +1346,14 @@ EXPORT_API const char *widget_app_get_id(widget_context_h context)
return context->id;
}
+static void _win_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ /* Remove data used in accessibility */
+ char *plug_id;
+ plug_id = evas_object_data_del(obj, "___PLUGID");
+ free(plug_id);
+}
+
EXPORT_API int widget_app_get_elm_win(widget_context_h context,
Evas_Object **win)
{
@@ -1353,6 +1361,7 @@ EXPORT_API int widget_app_get_elm_win(widget_context_h context,
Evas_Object *ret_win;
Ecore_Wl_Window *wl_win;
struct wl_surface *surface;
+ char buffer[256];
if (!_is_widget_feature_enabled()) {
_E("not supported"); /* LCOV_EXCL_LINE */
@@ -1390,6 +1399,11 @@ EXPORT_API int widget_app_get_elm_win(widget_context_h context,
cxt->win = ret_win;
cxt->win_id = ecore_wl_window_id_get(wl_win);
+ /* Set data to use in accessibility */
+ snprintf(buffer, sizeof(buffer), "%s:%d", cxt->id, getpid());
+ evas_object_data_set(ret_win, "___PLUGID", strdup(buffer));
+ evas_object_event_callback_add(ret_win, EVAS_CALLBACK_DEL, _win_del_cb, NULL);
+
_D("window created: %d", cxt->win_id);
return WIDGET_ERROR_NONE;
--
2.7.4
From 8f3616ab0951a76bf2080e50a6bd0ff8c77b0637 Mon Sep 17 00:00:00 2001
From: Hyunho Kang
Date: Fri, 18 Nov 2016 10:48:05 +0900
Subject: [PATCH 11/16] Fix CMakeLists.txt
To make extendible for adding source & header files.
Change-Id: I79ed47c2e1078b6797be46a4a4467ce3851fb6c9
Signed-off-by: Hyunho Kang
---
CMakeLists.txt | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e2669a7..2099f82 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,13 +22,6 @@ SET(CMAKE_SKIP_BUILD_RPATH TRUE)
# Build appcore-widget Library
# ------------------------------
SET(APPCORE_WIDGET "capi-appfw-widget-application")
-SET(SRCS_widget
- src/widget-i18n.c
- src/widget_app.c
- src/widget_app_internal.c
- src/widget_error.c
- )
-SET(HEADERS_widget widget_app.h widget_app_efl.h widget_app_internal.h)
INCLUDE(FindPkgConfig)
pkg_check_modules(pkg_widget REQUIRED
@@ -49,7 +42,8 @@ FOREACH(flag ${pkg_widget_CFLAGS})
SET(EXTRA_CFLAGS_widget "${EXTRA_CFLAGS_widget} ${flag}")
ENDFOREACH(flag)
-ADD_LIBRARY(${APPCORE_WIDGET} SHARED ${SRCS_widget})
+AUX_SOURCE_DIRECTORY(src SOURCES)
+ADD_LIBRARY(${APPCORE_WIDGET} SHARED ${SOURCES})
SET_TARGET_PROPERTIES(${APPCORE_WIDGET} PROPERTIES SOVERSION ${VERSION_MAJOR})
SET_TARGET_PROPERTIES(${APPCORE_WIDGET} PROPERTIES VERSION ${VERSION})
SET_TARGET_PROPERTIES(${APPCORE_WIDGET} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_widget})
@@ -57,6 +51,8 @@ TARGET_LINK_LIBRARIES(${APPCORE_WIDGET} ${pkg_widget_LDFLAGS} "-ldl -Wl,--no-und
INSTALL(TARGETS ${APPCORE_WIDGET} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPCORE_WIDGET}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-FOREACH(hfile ${HEADERS_widget})
- INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/${hfile} DESTINATION include/appfw)
-ENDFOREACH(hfile)
+
+INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION include/appfw/
+ FILES_MATCHING
+ PATTERN "*.h"
+ )
\ No newline at end of file
--
2.7.4
From d1d148d3981632531c3c0b31cc6ba1c15cfc269d Mon Sep 17 00:00:00 2001
From: Junghoon Park
Date: Wed, 30 Nov 2016 17:01:54 +0900
Subject: [PATCH 12/16] Use strdup instead of g_strdup
- strdup should be used beacase it was freed by free()
Change-Id: I77c200e75661c27e0ac5eb26f6cc9ad190d7475c
Signed-off-by: Junghoon Park
---
src/widget_app.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/widget_app.c b/src/widget_app.c
index 374e437..dc45392 100755
--- a/src/widget_app.c
+++ b/src/widget_app.c
@@ -413,7 +413,7 @@ static int __instance_create(widget_class_h handle, const char *id, const char *
return WIDGET_ERROR_OUT_OF_MEMORY;
wc->state = WC_READY;
- wc->id = g_strdup(id);
+ wc->id = strdup(id);
wc->provider = handle;
wc->win = NULL;
wc->win_id = -1;
--
2.7.4
From 65326312013c0fe8f9b78f1e44f74a1ca2ccc02f Mon Sep 17 00:00:00 2001
From: Hwankyu Jhun
Date: Tue, 6 Dec 2016 09:49:25 +0900
Subject: [PATCH 13/16] Fix log format
Change-Id: Ibe94d27267119a38fe614fd4f13736fb3b8f1311
Signed-off-by: Hwankyu Jhun
---
src/widget_app.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/widget_app.c b/src/widget_app.c
index dc45392..8898766 100755
--- a/src/widget_app.c
+++ b/src/widget_app.c
@@ -662,7 +662,7 @@ static void __destroy_all(int reason, int send_update)
iter = g_list_next(iter);
switch (cxt->state) {
case WC_PAUSED:
- LOGD("destroy %s", cxt->state, cxt->id);
+ LOGD("destroy %d : %s", cxt->state, cxt->id);
__instance_destroy(cxt->provider, cxt->id, reason, send_update);
break;
}
--
2.7.4
From d56a2f159c189b27361020d1cffc4a4382c9354c Mon Sep 17 00:00:00 2001
From: Hyunho Kang
Date: Thu, 24 Nov 2016 17:03:15 +0900
Subject: [PATCH 14/16] Set default preferred rotation to 0
Some devices set all applications preferred rotation to 90 degree
widget app sould not be rotated becasue viewer will be rotated
Change-Id: I1ad6204423ee7845c4ccf21614fc8eaae246bc01
Signed-off-by: Hyunho Kang
---
src/widget_app.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/widget_app.c b/src/widget_app.c
index 8898766..4ee4e2e 100755
--- a/src/widget_app.c
+++ b/src/widget_app.c
@@ -1362,6 +1362,7 @@ EXPORT_API int widget_app_get_elm_win(widget_context_h context,
Ecore_Wl_Window *wl_win;
struct wl_surface *surface;
char buffer[256];
+ int rots[3] = {0};
if (!_is_widget_feature_enabled()) {
_E("not supported"); /* LCOV_EXCL_LINE */
@@ -1378,6 +1379,9 @@ EXPORT_API int widget_app_get_elm_win(widget_context_h context,
goto fault; /* LCOV_EXCL_LINE */
}
+ elm_win_wm_rotation_preferred_rotation_set(ret_win, -1);
+ elm_win_wm_rotation_available_rotations_set(ret_win, rots, 1);
+
wl_win = elm_win_wl_window_get(ret_win);
if (wl_win == NULL) {
_E("failed to get wayland window"); /* LCOV_EXCL_LINE */
--
2.7.4
From e95b5d19521b531da453f48c71d9777f335bdb28 Mon Sep 17 00:00:00 2001
From: Hyunho Kang
Date: Mon, 12 Dec 2016 15:03:39 +0900
Subject: [PATCH 15/16] Replace tbm to screen-connector
Change-Id: Icd7d1ae8c78e860fcaf816ee880c7f6ba4d06974
Signed-off-by: Hyunho Kang
---
CMakeLists.txt | 1 +
packaging/appcore-widget.spec | 1 +
src/widget_app.c | 10 ++++------
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2099f82..13129fc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,6 +37,7 @@ pkg_check_modules(pkg_widget REQUIRED
capi-system-info
ecore-wayland
tizen-remote-surface-client
+ screen_connector_provider
)
FOREACH(flag ${pkg_widget_CFLAGS})
SET(EXTRA_CFLAGS_widget "${EXTRA_CFLAGS_widget} ${flag}")
diff --git a/packaging/appcore-widget.spec b/packaging/appcore-widget.spec
index 5355ca0..8bdedaa 100644
--- a/packaging/appcore-widget.spec
+++ b/packaging/appcore-widget.spec
@@ -19,6 +19,7 @@ BuildRequires: pkgconfig(widget_service)
BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(wayland-tbm-client)
BuildRequires: pkgconfig(ecore-wayland)
+BuildRequires: pkgconfig(screen_connector_provider)
BuildRequires: cmake
diff --git a/src/widget_app.c b/src/widget_app.c
index 4ee4e2e..3b85e32 100755
--- a/src/widget_app.c
+++ b/src/widget_app.c
@@ -36,7 +36,7 @@
#include
#include
#include
-#include
+#include
#include "widget_app.h"
#include "widget-log.h"
@@ -891,8 +891,7 @@ static int __before_loop(int argc, char **argv)
_E("failed to get launch argv"); /* LCOV_EXCL_LINE */
}
- aul_rsm_provider_init();
-
+ screen_connector_provider_init();
elm_init(argc, argv);
r = aul_launch_init(__aul_handler, NULL);
@@ -963,7 +962,7 @@ static void __after_loop()
if (app_ops->terminate)
app_ops->terminate(app_user_data);
- aul_rsm_provider_fini();
+ screen_connector_provider_fini();
_widget_app_free_viewer_endpoint();
_widget_core_unset_appcore_event_cb();
@@ -1393,8 +1392,7 @@ EXPORT_API int widget_app_get_elm_win(widget_context_h context,
_E("failed to get surface"); /* LCOV_EXCL_LINE */
goto fault; /* LCOV_EXCL_LINE */
}
-
- aul_rsm_provider_remote_enable(cxt->id, surface);
+ screen_connector_provider_remote_enable(cxt->id, surface);
ecore_wl_window_class_name_set(wl_win, cxt->id);
elm_win_aux_hint_add(ret_win, "wm.policy.win.user.geometry", "1");
--
2.7.4
From 3be5a3fd119e14a5834a1e946b1298f2a4ed5922 Mon Sep 17 00:00:00 2001
From: Daehyeon Jung
Date: Fri, 16 Dec 2016 18:14:20 +0900
Subject: [PATCH 16/16] fix API description
Change-Id: Ic83954f5ded30d25949b24e07afb708a9737c6d1
---
doc/appcore-widget_doc.h | 43 ++++++++----------
include/widget_app.h | 115 ++++++++++++++++++++++-------------------------
include/widget_app_efl.h | 15 ++++---
3 files changed, 81 insertions(+), 92 deletions(-)
diff --git a/doc/appcore-widget_doc.h b/doc/appcore-widget_doc.h
index 1a83d63..99b698c 100755
--- a/doc/appcore-widget_doc.h
+++ b/doc/appcore-widget_doc.h
@@ -14,28 +14,26 @@
* limitations under the License.
*/
+
/**
- *
* @ingroup CAPI_WIDGET_FRAMEWORK
* @defgroup CAPI_WIDGET_APP_MODULE Widget Application
- * @brief Widget application API
- *
+ * @brief Widget application API.
* @section CAPI_WIDGET_APP_MODULE_HEADER Required Header
- * \#include
- * \#include
+ * \#include
+ * \#include
+ *
* @section CAPI_WIDGET_APP_MODULE_OVERVIEW Overview
* The @ref CAPI_WIDGET_APP_MODULE API provides functions for handling Tizen widget application state changes or system events. Tizen widget application can be shown in the home screen.
- * This APIs support making multiple widget instances per an application.
- *
+ * This API supports making multiple widget instances per an application.
* This API provides interfaces for the following categories:
- * - Starting or exiting the main event loop
- * - Registering callbacks for application state change events
- * - Registering callbacks for basic system events
- * - Registering callbacks for instance state change events
+ * - Starting or exiting the main event loop.
+ * - Registering callbacks for application state change events.
+ * - Registering callbacks for basic system events.
+ * - Registering callbacks for instance state change events.
*
* @subsection CAPI_WIDGET_APP_MODULE_STATE_CHANGE_EVENT Registering Callbacks for Application State Change Events
- * As for Tizen widget application states, it is very simple and somewhat similer to Tizen service application states.
- *
+ * As for Tizen widget application states, it is very simple and somewhat similar to Tizen service application states.
*
*
*
@@ -46,7 +44,7 @@
* widget_app_create_cb() |
* Hook to take necessary actions before the main event loop starts.
* Your UI generation code should be placed here so that you do not miss any events from your application UI.
- * Please make sure that you should make a class handle and return it. It will be used when the event for creating widget instance is received.
+ * Please make sure that you make a class handle and return it. It will be used when the event for creating widget instance is received.
* You can initialize shared resources for widget instances in this callback function as well.
* |
*
@@ -54,24 +52,23 @@
* widget_app_terminate_cb() |
* Hook to take necessary actions when your application is terminating.
* Your application should release all resources, especially any
- * allocations and shared resources must be freed here so other running applications can fully use these shared resources.
+ * allocations and shared resources must be freed here so that other running applications can fully use these shared resources.
* |
*
*
*
- *
* Please refer to the following state diagram to see the possible transitions and callbacks that are called while transition.
+ *
* @image html widget_app_lifecycle.png "Widget Application States"
*
* @subsection CAPI_WIDGET_APP_MODULE_SYSTEM_EVENT Registering Callbacks for System Events
- * Tizen widget applications can receive system events with widget_app_add_event_handler() api.
+ * Tizen widget applications can receive system events with widget_app_add_event_handler() API.
* The type of system events that can be received are same as Tizen UI applications except for APP_EVENT_DEVICE_ORIENTATION_CHANGED.
* See @ref CAPI_APPLICATION_MODULE.
* The event for APP_EVENT_DEVICE_ORIENTATION_CHANGED is not supported in this module.
- *
+
* @subsection CAPI_WIDGET_APP_INSTNACE_STATE_CHANGE_EVENT Registering callbacks for instance state change events
- * As for Tizen widget instance states, it is somewhat similer to Tizen application states.
- *
+ * As for Tizen widget instance states, it is somewhat similar to Tizen application states.
*
*
*
@@ -82,7 +79,7 @@
* widget_instance_create_cb() |
* Called after widget instance is created.
* In this callback, you can initialize resources for this instance.
- * If parameter 'content' is not NULL, You should restore the pervious status.
+ * If parameter 'content' is not NULL, you should restore the pervious status.
* |
*
*
@@ -117,13 +114,11 @@
*
*
*
- *
* Please refer to the following state diagram to see the possible transitions and callbacks that are called while transition.
+ *
* @image html widget_obj_lifecycle.png "Widget Instance States"
*
* @section CAPI_WIDGET_APP_MODULE_RELATED_FEATURES Related Features
* This API is related with the following feature:
* - http://tizen.org/feature/shell.appwidget
- *
- *
*/
diff --git a/include/widget_app.h b/include/widget_app.h
index 3cd38a0..da53d6b 100755
--- a/include/widget_app.h
+++ b/include/widget_app.h
@@ -33,6 +33,7 @@ extern "C" {
* @{
*/
+
/**
* @brief Destroy type of widget instance.
* @since_tizen 2.3.1
@@ -40,28 +41,29 @@ extern "C" {
typedef enum widget_app_destroy_type {
WIDGET_APP_DESTROY_TYPE_PERMANENT = 0x00, /**< User deleted this widget from the viewer */
WIDGET_APP_DESTROY_TYPE_TEMPORARY = 0x01, /**< Widget is deleted because of other reasons (e.g. widget process is terminated temporarily by the system) */
-} widget_app_destroy_type_e;
+} widget_app_destroy_type_e; /**< Delete type */
+
/**
- * @brief The handle for widget class.
+ * @brief The widget class handle.
* @since_tizen 2.3.1
*/
typedef struct _widget_class *widget_class_h;
+
/**
- * @brief The handle for widget context.
+ * @brief The widget context handle.
* @since_tizen 2.3.1
*/
typedef struct _widget_context *widget_context_h;
+
/**
* @brief Called when the widget instance starts.
* @since_tizen 2.3.1
- *
* @details The callback function is called after widget instance is created.
* In this callback, you can initialize resources for this instance.
- *
- * @param[in] context The context of widget instance.
+ * @param[in] context The context of widget instance
* @param[in] content The data set for the previous status
* @param[in] w The pixel value for widget width
* @param[in] h The pixel value for widget height
@@ -72,37 +74,34 @@ typedef struct _widget_context *widget_context_h;
*/
typedef int (*widget_instance_create_cb)(widget_context_h context, bundle *content, int w, int h, void *user_data);
+
/**
* @brief Called before the widget instance is destroyed.
* @since_tizen 2.3.1
- *
* @details The callback function is called before widget instance is destroyed.
* In this callback, you can finalize resources for this instance.
- * If reason is not #WIDGET_APP_DESTROY_TYPE_TEMPORARY, It should store the current status by using incoming bundle.
- *
- * @param[in] context The context of widget instance.
- * @param[in] reason The reason for destruction
- * @param[in,out] content The data set to save
- * @param[in] user_data The user data passed from widget_app_class_create function
+ * If reason is not #WIDGET_APP_DESTROY_TYPE_TEMPORARY, it should store the current status by using incoming bundle.
* @remark Note that the parameter 'content' is used to save the status of the widget instance.
* As a input parameter, content contains the saved status of the widget instance.
* You can fill the content parameter with the current status in this callback,
* then the framework will save the content by receiving it as a output parameter.
* Consequently, you should not use widget_app_context_set_content_info() api in this callback.
* The content will be overwritten after this callback returns with the 'content' parameter.
- *
+ * @param[in] context The context of widget instance
+ * @param[in] reason The reason for destruction
+ * @param[in,out] content The data set to save
+ * @param[in] user_data The user data passed from widget_app_class_create function
* @return #WIDGET_ERROR_NONE on success,
* otherwise an error code (see WIDGET_ERROR_XXX) on failure
*/
typedef int (*widget_instance_destroy_cb)(widget_context_h context, widget_app_destroy_type_e reason, bundle *content, void *user_data);
+
/**
* @brief Called when the widget is invisible.
* @since_tizen 2.3.1
- *
* @details The callback function is called when the widget is invisible.
* The paused instance may be destroyed by framework.
- *
* @param[in] context The context of widget instance
* @param[in] user_data The user data passed from widget_app_class_create function
* @return #WIDGET_ERROR_NONE on success,
@@ -110,12 +109,11 @@ typedef int (*widget_instance_destroy_cb)(widget_context_h context, widget_app_d
*/
typedef int (*widget_instance_pause_cb)(widget_context_h context, void *user_data);
+
/**
* @brief Called when the widget is visible.
* @since_tizen 2.3.1
- *
* @details The callback function is called when the widget is visible.
- *
* @param[in] context The context of widget instance
* @param[in] user_data The user data passed from widget_app_class_create function
* @return #WIDGET_ERROR_NONE on success,
@@ -123,12 +121,11 @@ typedef int (*widget_instance_pause_cb)(widget_context_h context, void *user_dat
*/
typedef int (*widget_instance_resume_cb)(widget_context_h context, void *user_data);
+
/**
* @brief Called before the widget size is changed.
* @since_tizen 2.3.1
- *
* @details The callback function is called before the widget size is changed.
- *
* @param[in] context The context of widget instance
* @param[in] w The pixel value for widget width
* @param[in] h The pixel value for widget height
@@ -138,13 +135,12 @@ typedef int (*widget_instance_resume_cb)(widget_context_h context, void *user_da
*/
typedef int (*widget_instance_resize_cb)(widget_context_h context, int w, int h, void *user_data);
+
/**
* @brief Called when the event for updating widget is received.
* @since_tizen 2.3.1
- *
* @details The callback function is called when the event for updating widget is received.
- *
- * @param[in] context The context of widget instance.
+ * @param[in] context The context of widget instance
* @param[in] content The data set for updating this widget. It will be provided by requester.
* Requester can use widget_service_trigger_update()
* @param[in] force Although the widget is paused, if it is TRUE, the widget can be updated
@@ -155,6 +151,7 @@ typedef int (*widget_instance_resize_cb)(widget_context_h context, int w, int h,
*/
typedef int (*widget_instance_update_cb)(widget_context_h context, bundle *content, int force, void *user_data);
+
/**
* @brief The structure for lifecycle of a widget instance.
* @since_tizen 2.3.1
@@ -168,14 +165,13 @@ typedef struct {
widget_instance_update_cb update; /**< The callback function is called when the event for updating widget is received. */
} widget_instance_lifecycle_callback_s;
+
/**
* @brief Called when the application starts.
* @since_tizen 2.3.1
- *
* @details The callback function is called before the main loop of the application starts.
* In this callback, you can initialize resources which can be shared among widget instances.
* This function should return the handle for widget class so that it will be used for making instances of widget.
- *
* @param[in] user_data The user data passed from the callback registration function
* @return The object of widget class
* @see widget_app_main()
@@ -192,17 +188,18 @@ typedef struct {
*/
typedef widget_class_h (*widget_app_create_cb)(void *user_data);
+
/**
* @brief Called when the application's main loop exits.
* @details This callback function is called once after the main loop of the application exits.
* You should release the application's resources in this function.
* @since_tizen 2.3.1
- *
* @param[in] user_data The user data passed from the callback registration function
* @see widget_app_main()
*/
typedef void (*widget_app_terminate_cb)(void *user_data);
+
/**
* @brief The structure for lifecycle of a widget application.
* @since_tizen 2.3.1
@@ -212,31 +209,29 @@ typedef struct {
widget_app_terminate_cb terminate; /**< This callback function is called once after the main loop of the application exits. */
} widget_app_lifecycle_callback_s;
+
/**
* @brief Called for each widget context.
* @since_tizen 2.3.1
- *
* @details This function will be called in the function of widget_app_foreach_context repeatedly.
- *
* @param[in] context The context for widget instance
* @param[in] data The data for caller
- * @return true to continue with the next iteration of the loop,
- * otherwise false to break out of the loop.
+ * @return @c true to continue with the next iteration of the loop,
+ * otherwise @c false to break out of the loop
* @see widget_app_foreach_context()
*/
typedef bool (*widget_context_cb)(widget_context_h context, void *data);
+
/**
* @brief Runs the main loop of the application until widget_app_exit() is called.
* @since_tizen 2.3.1
- *
* @param[in] argc The argument count
* @param[in] argv The argument vector
* @param[in] callback The set of callback functions to handle application events
* @param[in] user_data The user data to be passed to the callback functions
- *
* @return #WIDGET_ERROR_NONE on success,
- * otherwise an error code (see WIDGET_ERROR_XXX) on failure
+ * otherwise an error code (see WIDGET_ERROR_XXX) on failure
* @retval #WIDGET_ERROR_NONE Successful
* @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported
@@ -245,13 +240,13 @@ typedef bool (*widget_context_cb)(widget_context_h context, void *data);
*/
int widget_app_main(int argc, char **argv, widget_app_lifecycle_callback_s *callback, void *user_data);
+
/**
* @brief Exits the main loop of the application.
* @details The main loop of the application stops and widget_app_terminate_cb() is invoked.
* @since_tizen 2.3.1
- *
* @return #WIDGET_ERROR_NONE on success,
- * otherwise an error code (see WIDGET_ERROR_XXX) on failure
+ * otherwise an error code (see WIDGET_ERROR_XXX) on failure
* @retval #WIDGET_ERROR_NONE Successful
* @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported
* @retval #WIDGET_ERROR_FAULT Unrecoverable error
@@ -260,14 +255,13 @@ int widget_app_main(int argc, char **argv, widget_app_lifecycle_callback_s *call
*/
int widget_app_exit(void);
+
/**
* @brief Finishes context for the widget instance.
* @since_tizen 2.3.1
- *
* @param[in] context The context for widget instance
- *
* @return #WIDGET_ERROR_NONE on success,
- * otherwise an error code (see WIDGET_ERROR_XXX) on failure
+ * otherwise an error code (see WIDGET_ERROR_XXX) on failure
* @retval #WIDGET_ERROR_NONE Successful
* @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported
@@ -275,15 +269,14 @@ int widget_app_exit(void);
*/
int widget_app_terminate_context(widget_context_h context);
+
/**
* @brief Retrieves all widget contexts in this application.
* @since_tizen 2.3.1
- *
* @param[in] callback The iteration callback function
* @param[in] data The data for the callback function
- *
* @return #WIDGET_ERROR_NONE on success,
- * otherwise an error code (see WIDGET_ERROR_XXX) on failure
+ * otherwise an error code (see WIDGET_ERROR_XXX) on failure
* @retval #WIDGET_ERROR_NONE Successful
* @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WIDGET_ERROR_CANCELED The iteration is canceled
@@ -293,17 +286,16 @@ int widget_app_terminate_context(widget_context_h context);
*/
int widget_app_foreach_context(widget_context_cb callback, void *data);
+
/**
* @brief Adds the system event handler.
* @since_tizen 2.3.1
- *
* @param[out] event_handler The event handler
* @param[in] event_type The system event type. APP_EVENT_DEVICE_ORIENTATION_CHANGED is not supported
* @param[in] callback The callback function
* @param[in] user_data The user data to be passed to the callback function
- *
* @return #WIDGET_ERROR_NONE on success,
- * otherwise an error code (see WIDGET_ERROR_XXX) on failure
+ * otherwise an error code (see WIDGET_ERROR_XXX) on failure
* @retval #WIDGET_ERROR_NONE Successful
* @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WIDGET_ERROR_OUT_OF_MEMORY Out of memory
@@ -319,11 +311,9 @@ int widget_app_add_event_handler(app_event_handler_h *event_handler, app_event_t
/**
* @brief Removes registered event handler.
* @since_tizen 2.3.1
- *
* @param[in] event_handler The event handler
- *
- * @return #WIDGET_ERROR_NONE on success,
- * otherwise an error code (see WIDGET_ERROR_XXX) on failure
+ * @return #WIDGET_ERROR_NONE on success
+ * otherwise an error code (see WIDGET_ERROR_XXX) on failure
* @retval #WIDGET_ERROR_NONE Successful
* @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported
@@ -332,25 +322,25 @@ int widget_app_add_event_handler(app_event_handler_h *event_handler, app_event_t
*/
int widget_app_remove_event_handler(app_event_handler_h event_handler);
+
/**
* @brief Gets a widget instance id.
* @since_tizen 2.3.1
- *
- * @param[in] context The context for widget instance
- *
* @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
- * @return Widget ID on success, otherwise NULL
+ * @remark You must not free returned Widget ID
+ * @param[in] context The context for widget instance
+ * @return Widget ID on success,
+ * otherwise NULL
* @exception #WIDGET_ERROR_NOT_SUPPORTED Not supported
* @exception #WIDGET_ERROR_FAULT Unrecoverable error
- * @remark You must not free returned Widget ID
* @see get_last_result()
*/
const char *widget_app_get_id(widget_context_h context);
+
/**
* @brief Makes a class for widget instances.
* @since_tizen 2.3.1
- *
* @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
* @param[in] callback The set of lifecycle callbacks
* @param[in] user_data The user data to be passed to the callback functions
@@ -363,42 +353,42 @@ const char *widget_app_get_id(widget_context_h context);
*/
widget_class_h widget_app_class_create(widget_instance_lifecycle_callback_s callback, void *user_data);
+
/**
* @brief Sets a tag in the context.
* @since_tizen 2.3.1
- *
* @param[in] context The context for widget instance
* @param[in] tag The value to save
- *
* @return #WIDGET_ERROR_NONE on success,
- * otherwise an error code (see WIDGET_ERROR_XXX) on failure
+ * otherwise an error code (see WIDGET_ERROR_XXX) on failure
* @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported
* @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WIDGET_ERROR_FAULT Unrecoverable error
*/
int widget_app_context_set_tag(widget_context_h context, void *tag);
+
/**
* @brief Gets the tag in the context.
* @since_tizen 2.3.1
- *
* @param[in] context The context for widget instance
* @param[out] tag The value to get
* @return #WIDGET_ERROR_NONE on success,
- * otherwise an error code (see WIDGET_ERROR_XXX) on failure
+ * otherwise an error code (see WIDGET_ERROR_XXX) on failure
* @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported
* @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WIDGET_ERROR_FAULT Unrecoverable error
*/
int widget_app_context_get_tag(widget_context_h context, void **tag);
+
/**
* @brief Sets the content info to the widget.
* @since_tizen 2.3.1
* @param[in] context The context for widget instance
* @param[in] content_info The data set to save
* @return #WIDGET_ERROR_NONE on success,
- * otherwise an error code (see WIDGET_ERROR_XXX) on failure
+ * otherwise an error code (see WIDGET_ERROR_XXX) on failure
* @retval #WIDGET_ERROR_NONE Successfully sent
* @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument
* @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported
@@ -407,13 +397,14 @@ int widget_app_context_get_tag(widget_context_h context, void **tag);
*/
int widget_app_context_set_content_info(widget_context_h context, bundle *content_info);
+
/**
* @brief Sends the title to the widget.
* @since_tizen 2.3.1
* @param[in] context The context for widget instance
* @param[in] title When an accessibility mode is turned on, this string will be read
* @return #WIDGET_ERROR_NONE on success,
- * otherwise an error code (see WIDGET_ERROR_XXX) on failure
+ * otherwise an error code (see WIDGET_ERROR_XXX) on failure
* @retval #WIDGET_ERROR_NONE Successfully sent
* @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument
* @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported
@@ -422,6 +413,7 @@ int widget_app_context_set_content_info(widget_context_h context, bundle *conten
*/
int widget_app_context_set_title(widget_context_h context, const char *title);
+
/**
* @brief Adds an additional widget class for multi-class of widget instantiation.
* @since_tizen 3.0
@@ -449,4 +441,3 @@ widget_class_h widget_app_class_add(widget_class_h widget_class, const char *cla
#endif
#endif /* __TIZEN_APPFW_WIDGET_APP_H__ */
-
diff --git a/include/widget_app_efl.h b/include/widget_app_efl.h
index fd1a0c0..092f195 100644
--- a/include/widget_app_efl.h
+++ b/include/widget_app_efl.h
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+
#ifndef __TIZEN_APPFW_WIDGET_APP_EFL_H__
#define __TIZEN_APPFW_WIDGET_APP_EFL_H__
@@ -24,30 +25,32 @@
extern "C" {
#endif
+
/**
* @addtogroup CAPI_WIDGET_APP_MODULE
* @{
*/
/**
- * @brief Gets a evas object for the widget
+ * @brief Gets an Evas object for the widget.
* @since_tizen 2.3.1
- *
* @param[in] context The context for widget instance
- * @param[out] win Evas object for window
- *
- * @return 0 on success, otherwise a negative error value
- * @retval #WIDGET_ERROR_NONE Successfull
+ * @param[out] win evas object for window
+ * @return 0 on success,
+ * otherwise a negative error value
+ * @retval #WIDGET_ERROR_NONE Successful
* @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WIDGET_ERROR_FAULT Failed to make evas object
* @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported
*/
int widget_app_get_elm_win(widget_context_h context, Evas_Object **win);
+
/**
* @}
*/
+
#ifdef __cplusplus
}
#endif
--
2.7.4