summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiwoong Im <jiwoong.im@samsung.com>2016-03-28 19:06:57 +0900
committerJiwoong Im <jiwoong.im@samsung.com>2016-04-04 19:36:04 -0700
commitc03ad4957f334b9e42b4fab1e2fc42e12e078451 (patch)
tree5b00f0ce7c45b244e5fa44a2be2503e6a83bab6f
parent982f58616e9d466a76d13fe23bdbc97c512d8893 (diff)
downloadui-gadget-1-c03ad4957f334b9e42b4fab1e2fc42e12e078451.tar.gz
ui-gadget-1-c03ad4957f334b9e42b4fab1e2fc42e12e078451.tar.bz2
ui-gadget-1-c03ad4957f334b9e42b4fab1e2fc42e12e078451.zip
add missing internal api from tizen 2.4
- int ugman_resume_ug() int ugman_pause_ug() int ugman_create_cb() Change-Id: I76f13d7f6567e50b46ad159f0f5c8603f4e46e77 Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
-rw-r--r--CMakeLists.txt1
-rw-r--r--include/ug-manager.h6
-rw-r--r--include/ui-gadget.h72
-rw-r--r--src/manager.c74
-rw-r--r--src/ug.c34
5 files changed, 187 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4bcd44f..a60e1ae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,6 +16,7 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
ADD_DEFINITIONS("-DDATAFS=\"${DATADIR}\"")
+ADD_DEFINITIONS("-DENABLE_UG_CREATE_CB")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -Wall")
INCLUDE(FindPkgConfig)
diff --git a/include/ug-manager.h b/include/ug-manager.h
index dc6c778..133b6ab 100644
--- a/include/ug-manager.h
+++ b/include/ug-manager.h
@@ -43,7 +43,9 @@ int ugman_init(void *win, enum ug_option opt);
int ugman_init_efl(Evas_Object *win, enum ug_option opt);
int ugman_resume(void);
+int ugman_resume_ug(ui_gadget_h ug);
int ugman_pause(void);
+int ugman_pause_ug(ui_gadget_h ug);
int ugman_send_event(enum ug_event event);
int ugman_send_key_event(enum ug_key_event event);
int ugman_send_message(ui_gadget_h ug, app_control_h msg);
@@ -53,4 +55,8 @@ void *ugman_get_conformant(void);
int ugman_ug_exist(ui_gadget_h ug);
+#ifdef ENABLE_UG_CREATE_CB
+int ugman_create_cb(void (*create_cb)(char *, char *, char *, void *), void *user_data);
+#endif
+
#endif /* __UG_MANAGER_H__ */
diff --git a/include/ui-gadget.h b/include/ui-gadget.h
index 64c833c..9e0f653 100644
--- a/include/ui-gadget.h
+++ b/include/ui-gadget.h
@@ -813,6 +813,78 @@ int ug_disable_effect(ui_gadget_h ug);
*/
int ug_is_installed(const char *name);
+/**
+ * @brief Pauses the given UI gadget instance.
+ *
+ * @details @b Purpose: This function is used to pause the specified UI gadget instance and its children in the "Running" state. Eventually, the state of the UI gadget instance will be "Stopped".
+ *
+ * @details @b Typical @b use @b case: Application developers who want to pause the specified UI gadget instance can use this function.
+ *
+ * @details @b Method @b of @b function @b operation: "Pause" state operations of the UI gadgets with the "Running" state in the sub-tree that has the specified UI gadget as the root node are invoked by post-order traversal.
+ *
+ * @b Context @b of @b function: This function is supposed to be called after successful initialization with ug_init() and creation of ug_create().
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] ug The UI gadget
+ *
+ * @return @c 0 on success,
+ * otherwise @c -1 on error
+ *
+ * @pre ug_init() should be called.
+ * ug_create() should be used to create the @a ug gadget.
+ *
+ * @see ug_resume_ug()
+ *
+ * @par Sample code:
+ * @code
+ * #include <ui-gadget.h>
+ * ...
+ * // pauses the given UI gadget instance.
+ * ug_pause_ug(ug);
+ * ...
+ * @endcode
+ */
+int ug_pause_ug(ui_gadget_h ug);
+
+/**
+ * @brief Resumes the given UI gadget instance.
+ *
+ * @details @b Purpose: This function is used to resume the specified UI gadget instance and its children in the "Stopped" state. Eventually, the state of the UI gadget instance will be "Running".
+ *
+ * @details @b Typical @b use @b case: Application developers who want to resume the specified UI gadget instance can use this function.
+ *
+ * @details @b Method @b of @b function @b operation: "Resume" state operations of the UI gadgets with the "Stopped" state in the sub-tree that has specified UI gadget as the root node are invoked by post-order traversal.
+ *
+ * @details @b Context @b of @b function: This function should be called after successful initialization by ug_init() and creation of ug_create().
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] ug The UI gadget
+ *
+ * @return @c 0 on success,
+ * otherwise @c -1 on error
+ *
+ * @pre ug_init() should be called.
+ * ug_create() should be used to create the @a ug gadget.
+ *
+ * @see ug_pause_ug()
+ *
+ * @par Sample code:
+ * @code
+ * #include <ui-gadget.h>
+ * ...
+ * // resumes the given UI gadget instance.
+ * ug_resume_ug(ug);
+ * ...
+ * @endcode
+ */
+int ug_resume_ug(ui_gadget_h ug);
+
+/**
+ * @}
+ */
+
#ifdef __cplusplus
}
#endif
diff --git a/src/manager.c b/src/manager.c
index 409082d..0f19b4a 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -44,6 +44,12 @@
#define ugman_idler_add(func, data) \
ecore_job_add((Ecore_Cb) func, (void *)data);
+#ifdef ENABLE_UG_CREATE_CB
+typedef void (*fn_ug_trace_cb)(char *ug, char *mem, char *parent, void *user_data);
+fn_ug_trace_cb g_create_cb;
+void *g_create_cb_user_data;
+#endif
+
struct ug_manager {
ui_gadget_h root;
ui_gadget_h fv_top;
@@ -605,6 +611,19 @@ static int ugman_ug_create(void *data)
ugman_tree_dump(ug_man.root);
+#ifdef ENABLE_UG_CREATE_CB
+ if (g_create_cb) {
+ ui_gadget_h parent = ug->parent;
+
+ _DBG("invoke trace create cb(%p)", g_create_cb);
+
+ g_create_cb((char *)ug->name, (char *)ug->module->addr,
+ parent ? (char *)parent->name : NULL,
+ g_create_cb_user_data);
+ }
+#endif
+
+
return 0;
}
@@ -909,6 +928,25 @@ int ugman_resume(void)
return 0;
}
+int ugman_resume_ug(ui_gadget_h ug)
+{
+ if (!ug_man.is_initted) {
+ _ERR("ugman_pause_ug failed: manager is not initialized");
+ return -1;
+ }
+
+ if (!ug_man.root || !ug) {
+ _WRN("ugman_pause_ug failed: no root");
+ return -1;
+ }
+
+ _DBG("ugman_resume_ug called");
+
+ ugman_idler_add((Idle_Cb)ugman_ug_resume, ug);
+
+ return 0;
+}
+
int ugman_pause(void)
{
/* PAUSE (Background) */
@@ -929,6 +967,25 @@ int ugman_pause(void)
return 0;
}
+int ugman_pause_ug(ui_gadget_h ug)
+{
+ if (!ug_man.is_initted) {
+ _ERR("ugman_pause_ug failed: manager is not initialized");
+ return -1;
+ }
+
+ if (!ug_man.root || !ug) {
+ _WRN("ugman_pause_ug failed: no root");
+ return -1;
+ }
+
+ _DBG("ugman_pause_ug called");
+
+ ugman_idler_add((Idle_Cb)ugman_ug_pause, ug);
+
+ return 0;
+}
+
static int ugman_send_event_pre(void *data)
{
job_start();
@@ -1097,3 +1154,20 @@ int ugman_ug_exist(ui_gadget_h ug)
{
return ugman_ug_find(ug_man.root, ug);
}
+
+#ifdef ENABLE_UG_CREATE_CB
+int ugman_create_cb(void (*create_cb)(char *, char *, char *, void *), void *user_data)
+{
+ if (create_cb == NULL) {
+ _DBG("disable trace create cb");
+ g_create_cb_user_data = NULL;
+ g_create_cb = NULL;
+ } else {
+ _DBG("enable trace create cb(%p)", create_cb);
+ g_create_cb_user_data = user_data;
+ g_create_cb = create_cb;
+ }
+
+ return 0;
+}
+#endif
diff --git a/src/ug.c b/src/ug.c
index 0ae3416..2090c58 100644
--- a/src/ug.c
+++ b/src/ug.c
@@ -140,11 +140,33 @@ UG_API int ug_pause(void)
return ugman_pause();
}
+UG_API int ug_pause_ug(ui_gadget_h ug)
+{
+ if (!ug || !ugman_ug_exist(ug)) {
+ _ERR("ug_pause_ug() failed: Invalid ug");
+ errno = EINVAL;
+ return -1;
+ }
+
+ return ugman_pause_ug(ug);
+}
+
UG_API int ug_resume(void)
{
return ugman_resume();
}
+UG_API int ug_resume_ug(ui_gadget_h ug)
+{
+ if (!ug || !ugman_ug_exist(ug)) {
+ _ERR("ug_resume_ug() failed: Invalid ug");
+ errno = EINVAL;
+ return -1;
+ }
+
+ return ugman_resume_ug(ug);
+}
+
UG_API int ug_destroy(ui_gadget_h ug)
{
return ugman_ug_del(ug);
@@ -354,3 +376,15 @@ UG_API int ug_is_installed(const char *name)
return ug_exist(name);
}
+#ifdef ENABLE_UG_CREATE_CB
+UG_API int ug_create_cb(void (*create_cb)(char *, char *, char *, void *), void *user_data)
+{
+ int ret;
+
+ ret = ugman_create_cb(create_cb, user_data);
+ if (ret == -1)
+ _ERR("trace cb register fail");
+
+ return ret;
+}
+#endif