summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xCMakeLists.txt2
-rwxr-xr-xclient/CMakeLists.txt4
-rwxr-xr-xclient/ug-client.c99
-rwxr-xr-xclient/ug-client.h2
-rwxr-xr-xinclude/SLP_UI_Gadget_PG.h3
-rw-r--r--include/ug-module.h1
-rwxr-xr-xinclude/ug.h9
-rwxr-xr-xinclude/ui-gadget-engine.h5
-rwxr-xr-xinclude/ui-gadget.h5
-rwxr-xr-xpackaging/ui-gadget-1.spec4
-rwxr-xr-xsrc/manager.c233
-rw-r--r--src/module.c73
-rwxr-xr-xug-efl-engine/ug-efl-engine.c131
13 files changed, 376 insertions, 195 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1d8dbba..8bcb15f 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,7 +26,7 @@ SET(SRCS src/ug.c
ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
-PKG_CHECK_MODULES(PKGS REQUIRED glib-2.0 utilX bundle dlog x11 capi-appfw-application appsvc capi-appfw-app-manager ecore)
+PKG_CHECK_MODULES(PKGS REQUIRED glib-2.0 utilX dlog x11 capi-appfw-application capi-appfw-app-manager ecore)
FOREACH(flag ${PKGS_CFLAGS})
SET(CFLAGS "${CFLAGS} ${flag}")
ENDFOREACH(flag)
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
index cd31296..5100421 100755
--- a/client/CMakeLists.txt
+++ b/client/CMakeLists.txt
@@ -9,7 +9,6 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(CLIENT_PKGS REQUIRED
capi-appfw-application
- capi-system-runtime-info
appcore-efl
appsvc
bundle
@@ -18,7 +17,8 @@ PKG_CHECK_MODULES(CLIENT_PKGS REQUIRED
dlog
elementary
evas
- x11)
+ x11
+ vconf)
FOREACH(flag ${CLIENT_PKGS_CFLAGS})
SET(CLIENT_CFLAGS "${CLIENT_CFLAGS} ${flag}")
diff --git a/client/ug-client.c b/client/ug-client.c
index 5d6961c..11da8df 100755
--- a/client/ug-client.c
+++ b/client/ug-client.c
@@ -25,13 +25,13 @@
#include <Ecore_X.h>
#include <dlog.h>
#include <aul.h>
-#include <appsvc.h>
#include <app.h>
-#include <runtime_info.h>
+#include <vconf.h>
#include "ug-client.h"
#include <Ecore_X.h>
+#include <utilX.h>
#ifdef LOG_TAG
#undef LOG_TAG
@@ -145,26 +145,61 @@ void _ug_client_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
}
}
-void _ug_client_result_cb(ui_gadget_h ug, service_h result, void *priv)
+void _ug_client_result_cb(ui_gadget_h ug, service_h reply, void *priv)
{
- struct appdata *ad;
+ struct appdata *ad = NULL;
int ret;
+ char* value = NULL;
+ int result;
if (!ug || !priv)
return;
+
+ ret = service_get_extra_data (reply, UG_SERVICE_DATA_RESULT, &value);
+ if((ret == SERVICE_ERROR_NONE) && (value)) {
+ result = atoi(value);
+ LOGD("reply result is %d", result);
+ } else {
+ LOGW("get reply result error(%d) . result will be SERVICE_RESULT_SUCCEEDED", ret);
+ result = SERVICE_RESULT_SUCCEEDED;
+ }
+
ad = priv;
+ if (!ad) {
+ LOGE("appdata is null");
+ return;
+ }
- ret = service_reply_to_launch_request(result, ad->request, SERVICE_RESULT_SUCCEEDED);
+ ret = service_reply_to_launch_request(reply, ad->request, (service_result_e)result);
if (ret != SERVICE_ERROR_NONE)
LOGE("service_reply_to_launch_request failed, %d", ret);
}
void _ug_client_destroy_cb(ui_gadget_h ug, void *priv)
{
+ struct appdata *ad = NULL;
+
if (!ug)
return;
- ug_destroy(ug);
+ ad = priv;
+ if (!ad) {
+ LOGE("appdata is null. win lower is fail");
+ } else {
+ LOGD("window lower");
+ elm_win_lower(ad->win);
+ }
+
+ elm_exit();
+}
+
+void _ug_client_end_cb(ui_gadget_h ug, void *priv)
+{
+ if (!ug)
+ return;
+
+ LOGD("_ug_client_end_cb invoked");
+
elm_exit();
}
@@ -175,7 +210,7 @@ static void profile_changed_cb(void *data, Evas_Object * obj, void *event)
LOGE("!!! profile_changed_cb(%s) !!!", profile);
if (strcmp(profile, "desktop") == 0)
- elm_win_indicator_mode_set (obj, ELM_WIN_INDICATOR_HIDE);
+ elm_win_indicator_mode_set(obj, ELM_WIN_INDICATOR_HIDE);
}
static Evas_Object *create_win(const char *name)
@@ -230,13 +265,38 @@ static int low_battery(void *data)
static int lang_changed(void *data)
{
+ char* lang = NULL;
+
+ lang = vconf_get_str(VCONFKEY_LANGSET);
+ if(lang) {
+ LOGD("lang : %s", lang);
+ elm_language_set((const char*)lang);
+ free(lang);
+ } else {
+ LOGW("language get error");
+ }
+
return ug_send_event(UG_EVENT_LANG_CHANGE);
}
+static void _home_screen_top_cb(keynode_t* node, void *data)
+{
+ struct appdata *ad = data;
+
+ if (!node) {
+ LOGE("home screen top cb node value is null");
+ return;
+ }
+
+ if ((node->value.i == VCONFKEY_IDLE_SCREEN_TOP_TRUE) && (!ad->is_transient)) {
+ LOGW("home key pressed. window is not transient. ug client will be terminated");
+ elm_exit();
+ }
+}
+
static int app_create(void *data)
{
struct appdata *ad = data;
- enum appcore_rm rm;
Evas_Object *win;
Evas_Object *ly;
Evas_Object *conform;
@@ -269,7 +329,6 @@ static int app_create(void *data)
edje_object_signal_callback_add(elm_layout_edje_get(ly),
"EXIT", "*", main_quit_cb, NULL);
ad->ly_main = ly;
- elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_SHOW);
lang_changed(ad);
/* rotate notice */
@@ -317,6 +376,14 @@ static int app_terminate(void *data)
ad->win = NULL;
}
+ service_destroy(ad->request);
+
+ if (ad->name) {
+ free(ad->name);
+ }
+
+ LOGD("app_terminate end");
+
return 0;
}
@@ -327,10 +394,14 @@ static int app_pause(void *data)
LOGD("app_pause called");
ug_pause();
+
+#if ENABLE_TRANSIENT_SUB_MODE
if (!ad->is_transient) {
LOGD("app_pause received. close ug service");
elm_exit();
}
+#endif
+
return 0;
}
@@ -356,10 +427,15 @@ static int app_reset(bundle *b, void *data)
Ecore_X_Window id2 = elm_win_xwindow_get(ad->win);
ret = appsvc_request_transient_app(b, id2, svc_cb, "svc test");
- if (ret)
+ if (ret) {
LOGD("fail to request transient app: return value(%d)", ret);
- else
+ if(vconf_notify_key_changed(VCONFKEY_IDLE_SCREEN_TOP, _home_screen_top_cb, ad) != 0) {
+ LOGW("home screen vconf key changed cb error");
+ }
+ } else {
+ /* check home screen raise */
ad->is_transient = 1;
+ }
if (ad->win) {
elm_win_activate(ad->win);
@@ -379,6 +455,7 @@ static int app_reset(bundle *b, void *data)
cbs.layout_cb = _ug_client_layout_cb;
cbs.destroy_cb = _ug_client_destroy_cb;
cbs.result_cb = _ug_client_result_cb;
+ cbs.end_cb = _ug_client_end_cb;
cbs.priv = ad;
mode = ad->is_frameview ? UG_MODE_FRAMEVIEW : UG_MODE_FULLVIEW;
diff --git a/client/ug-client.h b/client/ug-client.h
index af62743..ab6ee0c 100755
--- a/client/ug-client.h
+++ b/client/ug-client.h
@@ -48,7 +48,7 @@ struct appdata {
Evas_Object *conform;
ui_gadget_h ug;
- const char *name;
+ char *name;
int is_frameview;
int is_transient;
diff --git a/include/SLP_UI_Gadget_PG.h b/include/SLP_UI_Gadget_PG.h
index 70387f2..08f683d 100755
--- a/include/SLP_UI_Gadget_PG.h
+++ b/include/SLP_UI_Gadget_PG.h
@@ -189,8 +189,6 @@ UG_OPT_INDICATOR_LANDSCAPE_ONLY
UG_OPT_INDICATOR_DISABLE
// current indicator status will be held
UG_OPT_INDICATOR_MANUAL
-// Enable indicator overlap
-UG_OPT_OVERLAP_ENABLE
@endcode
\note <b>struct ug_data</b> is a user defined private data structure describing base layout, own UI gadget handler, and whatever you need:
@@ -509,7 +507,6 @@ Available options are as following:
- UG_OPT_LANDSCAPE_ONLY
- UG_OPT_INDICATOR_DISABLE
- UG_OPT_INDICATOR_MANUAL
-- UG_OPT_OVERLAP_ENABLE
And we used UG_OPT_INDICATOR_POTRAIT_ONLY in "helloUG-efl"
diff --git a/include/ug-module.h b/include/ug-module.h
index 7d7bf5e..2db135f 100644
--- a/include/ug-module.h
+++ b/include/ug-module.h
@@ -28,6 +28,7 @@ struct ug_module {
void *handle;
char *module_name;
struct ug_module_ops ops;
+ char *addr;
};
struct ug_module *ug_module_load(const char *name);
diff --git a/include/ug.h b/include/ug.h
index fe3be22..eb2ae64 100755
--- a/include/ug.h
+++ b/include/ug.h
@@ -22,18 +22,16 @@
#ifndef __UG_H__
#define __UG_H__
-#include <bundle.h>
#include "ug-module.h"
#include "ui-gadget.h"
-struct ug_child;
-
enum ug_state {
UG_STATE_READY = 0x00,
UG_STATE_CREATED,
UG_STATE_RUNNING,
UG_STATE_STOPPED,
UG_STATE_DESTROYING,
+ UG_STATE_PENDING_DESTROY,
UG_STATE_DESTROYED,
UG_STATE_INVALID,
UG_STATE_MAX
@@ -50,6 +48,11 @@ enum ug_layout_state {
UG_LAYOUT_MAX
};
+enum ug_ui_req {
+ UG_UI_REQ_GET_CONFORMANT = 0x00,
+ UG_UI_REQ_MAX
+};
+
struct ui_gadget_s {
const char *name;
void *layout;
diff --git a/include/ui-gadget-engine.h b/include/ui-gadget-engine.h
index 13986cf..7581256 100755
--- a/include/ui-gadget-engine.h
+++ b/include/ui-gadget-engine.h
@@ -38,7 +38,6 @@
* @{
*/
-#include <bundle.h>
#include "ui-gadget.h"
#ifdef __cplusplus
@@ -54,8 +53,10 @@ struct ug_engine_ops {
void *(*create)(void *win, ui_gadget_h ug, void(*show_end_cb)(void *data));
/** destroy operation */
void (*destroy)(ui_gadget_h ug, ui_gadget_h fv_top, void(*hide_end_cb)(void *data));
+ /** request operation */
+ void *(*request)(void *data, ui_gadget_h ug, int req);
/** reserved operations */
- void *reserved[4];
+ void *reserved[3];
};
#ifdef __cplusplus
diff --git a/include/ui-gadget.h b/include/ui-gadget.h
index dfa13b4..ceabcee 100755
--- a/include/ui-gadget.h
+++ b/include/ui-gadget.h
@@ -128,14 +128,9 @@ enum ug_option {
UG_OPT_INDICATOR_MANUAL = 0x04,
/**< Indicator option:
Indicator will be handled manually */
- UG_OPT_OVERLAP_ENABLE = 0x08,
- /**< Overlap option: Enable indicator overlap */
UG_OPT_MAX
};
-#define GET_OPT_INDICATOR_VAL(opt) opt % UG_OPT_OVERLAP_ENABLE
-#define GET_OPT_OVERLAP_VAL(opt) opt & UG_OPT_OVERLAP_ENABLE
-
#define UG_SERVICE_DATA_RESULT "__UG_SEND_REUSLT__"
/**
diff --git a/packaging/ui-gadget-1.spec b/packaging/ui-gadget-1.spec
index fa250f9..52a3d57 100755
--- a/packaging/ui-gadget-1.spec
+++ b/packaging/ui-gadget-1.spec
@@ -1,7 +1,7 @@
Name: ui-gadget-1
Summary: UI Gadget Library
-Version: 0.1.25
+Version: 0.1.26
Release: 1
Group: System/Libraries
License: Apache License, Version 2.0
@@ -16,8 +16,8 @@ BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(appsvc)
BuildRequires: pkgconfig(capi-appfw-application)
-BuildRequires: pkgconfig(capi-system-runtime-info)
BuildRequires: pkgconfig(capi-appfw-app-manager)
+BuildRequires: pkgconfig(vconf)
BuildRequires: cmake
BuildRequires: edje-bin
diff --git a/src/manager.c b/src/manager.c
index bc3de24..27de462 100755
--- a/src/manager.c
+++ b/src/manager.c
@@ -78,12 +78,19 @@ static int ug_relation_del(ui_gadget_h ug)
p = ug->parent;
if (!p) {
- _ERR("ug_relation_del failed: no parent");
+ _WRN("ug_relation_del failed: no parent");
return -1;
}
- p->children = g_slist_remove(p->children, ug);
- if (ug->children)
+
+ if(p->children) {
+ p->children = g_slist_remove(p->children, ug);
+ }
+
+ if (ug->children) {
g_slist_free(ug->children);
+ ug->children = NULL;
+ }
+
ug->parent = NULL;
return 0;
@@ -231,10 +238,11 @@ static void ugman_tree_dump(ui_gadget_h ug)
while (child) {
c = child->data;
- _DBG("[%d] %s [%c] (%p) (PARENT: %s)",
+ _DBG("[%d] %s [%c] (mem : %s) (ug : %p) (PARENT: %s)",
lv,
c && c->name ? c->name : "NO CHILD INFO FIXIT!!!",
- c && c->mode == UG_MODE_FULLVIEW ? 'F' : 'f', c, name);
+ c && c->mode == UG_MODE_FULLVIEW ? 'F' : 'f',
+ c->module->addr, c, name);
ugman_tree_dump(c);
child = g_slist_next(child);
}
@@ -328,6 +336,8 @@ static int ugman_ug_resume(void *data)
if (!ug)
goto end;
+ _DBG("ug(%p)->state : %d", ug, ug->state);
+
switch (ug->state) {
case UG_STATE_CREATED:
ugman_ug_start(ug);
@@ -359,24 +369,6 @@ static int ugman_ug_resume(void *data)
return 0;
}
-static int ugman_indicator_overlap_update(enum ug_option opt)
-{
- if (!ug_man.win) {
- _ERR("indicator update failed: no window");
- return -1;
- }
-
- if(GET_OPT_OVERLAP_VAL(opt)) {
- _DBG("update overlap indicator / opt(%d)", opt);
- elm_object_signal_emit(ug_man.conform, "elm,state,indicator,overlap", "");
- } else {
- _DBG("update no overlap indicator / opt(%d)", opt);
- elm_object_signal_emit(ug_man.conform, "elm,state,indicator,nooverlap", "");
- }
-
- return 0;
-}
-
static int ugman_indicator_update(enum ug_option opt, enum ug_event event)
{
int enable;
@@ -386,31 +378,31 @@ static int ugman_indicator_update(enum ug_option opt, enum ug_event event)
_DBG("indicator update opt(%d) cur_state(%d)", opt, cur_state);
- switch (GET_OPT_INDICATOR_VAL(opt)) {
- case UG_OPT_INDICATOR_ENABLE:
- if (event == UG_EVENT_NONE)
- enable = 1;
- else
- enable = cur_state ? 1 : 0;
- break;
- case UG_OPT_INDICATOR_PORTRAIT_ONLY:
- enable = ug_man.is_landscape ? 0 : 1;
- break;
- case UG_OPT_INDICATOR_LANDSCAPE_ONLY:
- enable = ug_man.is_landscape ? 1 : 0;
- break;
- case UG_OPT_INDICATOR_DISABLE:
- enable = 0;
- break;
- case UG_OPT_INDICATOR_MANUAL:
- return 0;
- default:
- _ERR("update failed: Invalid opt(%d)", opt);
- return -1;
+ switch (opt) {
+ case UG_OPT_INDICATOR_ENABLE:
+ if (event == UG_EVENT_NONE)
+ enable = 1;
+ else
+ enable = cur_state ? 1 : 0;
+ break;
+ case UG_OPT_INDICATOR_PORTRAIT_ONLY:
+ enable = ug_man.is_landscape ? 0 : 1;
+ break;
+ case UG_OPT_INDICATOR_LANDSCAPE_ONLY:
+ enable = ug_man.is_landscape ? 1 : 0;
+ break;
+ case UG_OPT_INDICATOR_DISABLE:
+ enable = 0;
+ break;
+ case UG_OPT_INDICATOR_MANUAL:
+ return 0;
+ default:
+ _ERR("update failed: Invalid opt(%d)", opt);
+ return -1;
}
if(cur_state != enable) {
- _DBG("set indicator as %d", enable);
+ _DBG("set indicator status as %d", enable);
utilx_enable_indicator(ug_man.disp, ug_man.win_id, enable);
}
return 0;
@@ -423,7 +415,6 @@ static int ugman_ug_getopt(ui_gadget_h ug)
/* Indicator Option */
if (ug->mode == UG_MODE_FULLVIEW) {
- ugman_indicator_overlap_update(ug->opt);
ugman_indicator_update(ug->opt, UG_EVENT_NONE);
}
@@ -461,37 +452,29 @@ static int ugman_ug_destroy(void *data)
{
ui_gadget_h ug = data;
struct ug_module_ops *ops = NULL;
- GSList *child, *trail;
+ struct ug_cbs *cbs;
job_start();
if (!ug)
goto end;
- _DBG("ugman_ug_destroy ug(%p) state(%d)", ug, ug->state);
+ _DBG("ug(%p) state(%d)", ug, ug->state);
switch (ug->state) {
- case UG_STATE_CREATED:
- case UG_STATE_RUNNING:
- case UG_STATE_STOPPED:
- case UG_STATE_DESTROYING:
- break;
- default:
- goto end;
+ case UG_STATE_CREATED:
+ case UG_STATE_RUNNING:
+ case UG_STATE_STOPPED:
+ case UG_STATE_DESTROYING:
+ case UG_STATE_PENDING_DESTROY:
+ break;
+ default:
+ _WRN("ug(%p) state is already destroyed", ug);
+ goto end;
}
ug->state = UG_STATE_DESTROYED;
- if (ug->children) {
- child = ug->children;
- _DBG("ug_destroy ug(%p) has child(%p)", ug, child->data);
- while (child) {
- trail = g_slist_next(child);
- ugman_ug_destroy(child->data);
- child = trail;
- }
- }
-
if((ug != ug_man.root) && (ug->layout) &&
(ug->layout_state != UG_LAYOUT_DESTROY)) {
/* ug_destroy_all case */
@@ -512,13 +495,29 @@ static int ugman_ug_destroy(void *data)
ops->destroy(ug, ug->service, ops->priv);
}
+ cbs = &ug->cbs;
+ if (cbs && cbs->end_cb) {
+ _DBG("ug(%p) end cb will be invoked", ug);
+ cbs->end_cb(ug, cbs->priv);
+ }
+
+ if((ug->parent) && (ug->parent->state == UG_STATE_PENDING_DESTROY)) {
+ if((ug->parent->children) && (g_slist_length(ug->parent->children) == 1)) {
+ _WRN("pended parent ug(%p) destroy job is added to loop", ug->parent);
+ ecore_idler_add((Ecore_Task_Cb)ugman_ug_destroy, ug->parent);
+ } else {
+ _WRN("pended parent ug(%p) will be destroyed after another children is destroyed", ug->parent);
+ }
+ }
+
if (ug != ug_man.root)
ug_relation_del(ug);
if (ug->mode == UG_MODE_FULLVIEW) {
if (ug_man.fv_top == ug) {
ug_fvlist_del(ug);
- ugman_ug_getopt(ug_man.fv_top);
+ if(!ug_man.destroy_all)
+ ugman_ug_getopt(ug_man.fv_top);
} else {
ug_fvlist_del(ug);
}
@@ -540,7 +539,12 @@ static int ugman_ug_destroy(void *data)
static void ug_hide_end_cb(void *data)
{
ui_gadget_h ug = data;
- ecore_idler_add((Ecore_Task_Cb)ugman_ug_destroy, ug);
+ if (ug->children) {
+ _WRN("child ug is still destroying. parent ug(%p) will be destroyed later", ug);
+ ug->state = UG_STATE_PENDING_DESTROY;
+ } else {
+ ecore_idler_add((Ecore_Task_Cb)ugman_ug_destroy, (void *)ug);
+ }
}
static int ugman_ug_create(void *data)
@@ -572,7 +576,6 @@ static int ugman_ug_create(void *data)
}
if (ug->mode == UG_MODE_FULLVIEW) {
if (eng_ops && eng_ops->create) {
- //change start cb function call after transition,finished for fullview
ug_man.conform = eng_ops->create(ug_man.win, ug, ugman_ug_start);
}
}
@@ -622,8 +625,17 @@ int ugman_ug_add(ui_gadget_h parent, ui_gadget_h ug)
ug_fvlist_add(ug_man.root);
}
- if (!parent)
+ if (!parent) {
parent = ug_man.root;
+ } else {
+ switch (parent->state) {
+ case UG_STATE_DESTROYING:
+ case UG_STATE_PENDING_DESTROY:
+ case UG_STATE_DESTROYED:
+ _WRN("parent(%p) state(%d) error", parent, parent->state);
+ return -1;
+ }
+ }
if (ug_relation_add(parent, ug)) {
_ERR("failed : ug_relation_add fail");
@@ -695,15 +707,6 @@ int ugman_ug_destroying(ui_gadget_h ug)
if (ug->module)
ops = &ug->module->ops;
- if (ug->children) {
- child = ug->children;
- while (child) {
- trail = g_slist_next(child);
- ugman_ug_destroying(child->data);
- child = trail;
- }
- }
-
if (ops && ops->destroying)
ops->destroying(ug, ug->service, ops->priv);
@@ -723,12 +726,12 @@ int ugman_ug_del(ui_gadget_h ug)
_DBG("ugman_ug_del start ug(%p)", ug);
if (ug->destroy_me) {
- _ERR("ugman_ug_del failed: ug is alreay on destroying");
+ _WRN("ugman_ug_del failed: ug is alreay on destroying");
return -1;
}
if (!ug_man.is_initted) {
- _ERR("ugman_ug_del failed: manager is not initted");
+ _WRN("ugman_ug_del failed: manager is not initted");
return -1;
}
@@ -737,6 +740,18 @@ int ugman_ug_del(ui_gadget_h ug)
return -1;
}
+ if (ug->children) {
+ GSList *child, *trail;
+
+ child = ug->children;
+ _DBG("ugman_ug_del ug(%p) has child(%p)", ug, child->data);
+ while (child) {
+ trail = g_slist_next(child);
+ ugman_ug_del(child->data);
+ child = trail;
+ }
+ }
+
ugman_ug_destroying(ug);
/* pre call for indicator update time issue */
@@ -775,6 +790,24 @@ int ugman_ug_del(ui_gadget_h ug)
return 0;
}
+
+int ugman_ug_del_child(ui_gadget_h ug)
+{
+ GSList *child, *trail;
+
+ if (ug->children) {
+ child = ug->children;
+ _DBG("ug destroy all. ug(%p) has child(%p)", ug, child->data);
+ while (child) {
+ trail = g_slist_next(child);
+ ugman_ug_del_child(child->data);
+ child = trail;
+ }
+ }
+
+ ugman_ug_destroy(ug);
+}
+
int ugman_ug_del_all(void)
{
/* Terminate */
@@ -790,10 +823,11 @@ int ugman_ug_del_all(void)
_DBG("ug_del_all. root(%p) walking(%d) ", ug_man.root, ug_man.walking);
- if (ug_man.walking > 0)
+ if (ug_man.walking > 0) {
ug_man.destroy_all = 1;
- else
- ugman_ug_destroy(ug_man.root);
+ } else {
+ ugman_ug_del_child(ug_man.root);
+ }
return 0;
}
@@ -840,7 +874,7 @@ int ugman_pause(void)
}
if (!ug_man.root) {
- _ERR("ugman_pause failed: no root");
+ _WRN("ugman_pause failed: no root");
return -1;
}
@@ -971,9 +1005,30 @@ void *ugman_get_window(void)
void *ugman_get_conformant(void)
{
- return ug_man.conform;
-}
+ struct ug_engine_ops *eng_ops = NULL;
+ void* ret = NULL;
+ if(ug_man.conform) {
+ _DBG("return cached conform(%p) info", ug_man.conform);
+ return ug_man.conform;
+ }
+
+ if (ug_man.engine) {
+ eng_ops = &ug_man.engine->ops;
+ } else {
+ _WRN("ui engine is not loaded");
+ return NULL;
+ }
+
+ if (eng_ops && eng_ops->create) {
+ ret = eng_ops->request(ug_man.win, NULL, UG_UI_REQ_GET_CONFORMANT);
+ ug_man.conform = ret;
+ } else {
+ _WRN("ui engine is not loaded");
+ }
+
+ return ret;
+}
static inline void job_start(void)
{
@@ -986,8 +1041,10 @@ static inline void job_end(void)
if (!ug_man.walking && ug_man.destroy_all) {
ug_man.destroy_all = 0;
- if (ug_man.root)
- ugman_ug_destroy(ug_man.root);
+ if (ug_man.root) {
+ _DBG("ug_destroy_all pneding job exist. ug_destroy_all begin");
+ ugman_ug_del_all();
+ }
}
if (ug_man.walking < 0)
diff --git a/src/module.c b/src/module.c
index bd2fedc..ddc34bd 100644
--- a/src/module.c
+++ b/src/module.c
@@ -36,6 +36,9 @@
#define UG_MODULE_INIT_SYM "UG_MODULE_INIT"
#define UG_MODULE_EXIT_SYM "UG_MODULE_EXIT"
+#define MEM_ADDR_LEN 8
+#define MEM_ADDR_TOT_LEN 17
+
static int file_exist(const char *filename)
{
FILE *file;
@@ -47,6 +50,66 @@ static int file_exist(const char *filename)
return 0;
}
+static char *__ug_module_get_addr(const char *ug_so)
+{
+ FILE *file;
+ int ret;
+ char buf[PATH_MAX] = {0,};
+ char mem[PATH_MAX] = {0,};
+
+ char *token_param = NULL;
+ char *saveptr = NULL;
+ int cnt = 0;
+
+ if(ug_so == NULL)
+ goto func_out;
+
+ snprintf(buf, sizeof(buf), "/proc/%d/maps", getpid());
+
+ file = fopen(buf, "r");
+ if (file == NULL) {
+ _WRN("proc open fail(%d)", errno);
+ goto func_out;
+ }
+
+ memset(buf, 0x00, PATH_MAX);
+
+ while(fgets(buf, PATH_MAX, file) != NULL)
+ {
+ if(strstr(buf, ug_so)) {
+ token_param = strtok_r(buf," ", &saveptr);
+ if((token_param == NULL) || (strlen(token_param) > MEM_ADDR_TOT_LEN)) {
+ _ERR("proc token param(%s) error", token_param);
+ goto close_out;
+ }
+
+ if(cnt > 0) {
+ memcpy((void *)(mem+MEM_ADDR_LEN+1),
+ (const void *)(token_param+MEM_ADDR_LEN+1), MEM_ADDR_LEN);
+ } else {
+ memcpy((void *)mem, (const void *)token_param, strlen(token_param));
+ cnt++;
+ }
+ } else {
+ if(cnt > 0)
+ goto close_out;
+ }
+
+ memset(buf, 0x00, PATH_MAX);
+ saveptr = NULL;
+ }
+
+close_out:
+ fclose(file);
+ file = NULL;
+
+func_out:
+ if(strlen(mem) > 0)
+ return strdup(mem);
+ else
+ return NULL;
+}
+
struct ug_module *ug_module_load(const char *name)
{
void *handle;
@@ -76,6 +139,9 @@ struct ug_module *ug_module_load(const char *name)
snprintf(ug_file, PATH_MAX, "/usr/ug/lib/libug-%s.so", name);
if (file_exist(ug_file))
break;
+ snprintf(ug_file, PATH_MAX, "/opt/ug/lib/libug-%s.so", name);
+ if (file_exist(ug_file))
+ break;
snprintf(ug_file, PATH_MAX, "/opt/usr/ug/lib/libug-%s.so", name);
if (file_exist(ug_file))
break;
@@ -103,6 +169,9 @@ struct ug_module *ug_module_load(const char *name)
module->handle = handle;
module->module_name = strdup(name);
+
+ module->addr = __ug_module_get_addr(ug_file);
+
return module;
module_dlclose:
@@ -129,6 +198,7 @@ int ug_module_unload(struct ug_module *module)
else
_ERR("dlsym failed: %s", dlerror());
+ _DBG("dlclose(%s)", module->module_name);
dlclose(module->handle);
module->handle = NULL;
}
@@ -136,6 +206,9 @@ int ug_module_unload(struct ug_module *module)
if(module->module_name)
free(module->module_name);
+ if(module->addr)
+ free(module->addr);
+
free(module);
return 0;
}
diff --git a/ug-efl-engine/ug-efl-engine.c b/ug-efl-engine/ug-efl-engine.c
index 1faefb8..1dcacad 100755
--- a/ug-efl-engine/ug-efl-engine.c
+++ b/ug-efl-engine/ug-efl-engine.c
@@ -37,48 +37,38 @@ static void on_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void (*show_end_cb)(void* data) = NULL;
static void (*hide_end_cb)(void* data) = NULL;
-static void _layout_del_cb(void *data, Evas_Object *obj, void *event_info)
+
+static Evas_Object *_get_win_conformant(Evas_Object *win)
{
- ui_gadget_h ug = (ui_gadget_h)data;
- if (!ug)
- return;
+ Evas_Object *con = NULL;
- _WRN("ug(%p) layout is deleted by abnormal path", ug);
+ if (!win) {
+ _WRN("\t Invalid param error");
+ return NULL;
+ }
- evas_object_event_callback_del(ug->layout, EVAS_CALLBACK_DEL, _layout_del_cb);
+ con = evas_object_data_get(win, "\377 elm,conformant");
+ if (con)
+ _DBG("\t success to get conformant");
+ else
+ _WRN("\t fail to get conformant");
- ug->layout_state = UG_LAYOUT_DESTROY;
- ug->layout = NULL;
+ return con;
}
-static Eina_Bool __destroy_end_cb(void *data)
+static void _layout_del_cb(void *data, Evas_Object *obj, void *event_info)
{
- GSList *child;
ui_gadget_h ug = (ui_gadget_h)data;
+ if (!ug)
+ return;
- _DBG("\t __destroy_end_cb ug=%p", ug);
-
- if (ug->children) {
- child = ug->children;
- //_DBG("\t ug(%p) has children(%p)", ug, child);
- while (child) {
- if(!child->data) {
- _ERR("child->data is null");
- return ECORE_CALLBACK_CANCEL;
- }
-
- //_DBG("\t child(%p) layout_state(%d)", child, ((ui_gadget_h)child->data)->layout_state);
+ _WRN("ug(%p) layout is deleted by abnormal path", ug);
- if( ((ui_gadget_h)child->data)->layout_state == UG_LAYOUT_HIDEEFFECT) {
- //_DBG("\t wait hideeffect child(%p)", ug);
- return ECORE_CALLBACK_RENEW;
- }
- child = g_slist_next(child);
- }
- }
+ evas_object_event_callback_del(ug->layout, EVAS_CALLBACK_DEL,
+ (Evas_Object_Event_Cb)_layout_del_cb);
- hide_end_cb(ug);
- return ECORE_CALLBACK_CANCEL;
+ ug->layout_state = UG_LAYOUT_DESTROY;
+ ug->layout = NULL;
}
static void __del_effect_end(ui_gadget_h ug)
@@ -94,12 +84,13 @@ static void __del_effect_end(ui_gadget_h ug)
}
if (ug->layout) {
evas_object_hide(ug->layout);
- evas_object_event_callback_del(ug->layout, EVAS_CALLBACK_DEL, _layout_del_cb);
+ evas_object_event_callback_del(ug->layout, EVAS_CALLBACK_DEL,
+ (Evas_Object_Event_Cb)_layout_del_cb);
}
- ecore_idler_add((Ecore_Task_Cb)__destroy_end_cb, (void *)ug);
-
ug->layout_state = UG_LAYOUT_DESTROY;
+
+ hide_end_cb(ug);
}
static void __del_finished(void *data, Evas_Object *obj, void *event_info)
@@ -131,34 +122,14 @@ static void __del_effect_top_layout(ui_gadget_h ug)
static void __del_effect_layout(ui_gadget_h ug, ui_gadget_h t_ug)
{
- GSList *child;
-
if (!ug)
return;
_DBG("\t ug=%p state=%d , t_ug=%p", ug, ug->layout_state, t_ug);
- if (ug->children) {
- child = ug->children;
- _DBG("\t ug(%p) has children(%p)", ug, child);
- while (child) {
- __del_effect_layout(child->data, t_ug);
- child = g_slist_next(child);
- }
- }
-
- if((ug == t_ug)&&(ug->layout_state != UG_LAYOUT_NOEFFECT)){
- if (ug->layout_state != UG_LAYOUT_HIDEEFFECT) {
- __del_effect_top_layout(ug);
- } else {
- _ERR("\t top ug(%p) state is hideeffect.");
- return;
- }
- } else {
- _DBG("\t remove navi item: ug=%p state=%d", ug, ug->layout_state);
- elm_object_item_del(ug->effect_layout);
- ug->effect_layout = NULL;
- }
+ _DBG("\t remove navi item: ug=%p state=%d", ug, ug->layout_state);
+ elm_object_item_del(ug->effect_layout);
+ ug->effect_layout = NULL;
__del_effect_end(ug);
}
@@ -239,14 +210,15 @@ static void on_destroy(ui_gadget_h ug, ui_gadget_h t_ug,
{
if (!ug)
return;
- _DBG("\t ug=%p tug=%p state=%d", ug, t_ug, ug->layout_state);
+ _DBG("\t ug=%p tug=%p layout_state=%d", ug, t_ug, ug->layout_state);
evas_object_intercept_hide_callback_del(ug->layout,
__on_hideonly_cb);
if(hide_cb == NULL) {
/* ug_destroy_all case */
- evas_object_event_callback_del(ug->layout, EVAS_CALLBACK_DEL, _layout_del_cb);
+ evas_object_event_callback_del(ug->layout, EVAS_CALLBACK_DEL,
+ (Evas_Object_Event_Cb)_layout_del_cb);
return;
}
@@ -268,22 +240,11 @@ static void on_destroy(ui_gadget_h ug, ui_gadget_h t_ug,
} else if (ug->layout_state == UG_LAYOUT_HIDEEFFECT) {
;
} else {
- _WRN("[UG Effect Plug-in] : layout state error!!");
+ _WRN("[UG Effect Plug-in] : layout state(%p) error!!", ug->layout_state);
__del_effect_end(ug);
}
}
-static void __update_indicator_overlap(int opt)
-{
- if (GET_OPT_OVERLAP_VAL(opt)) {
- _DBG("\t this is Overlap UG. Send overlap sig on_show_cb");
- elm_object_signal_emit(conform, "elm,state,indicator,overlap", "");
- } else {
- _DBG("\t this is no overlap UG. Send no overlap sig on_show_cb");
- elm_object_signal_emit(conform, "elm,state,indicator,nooverlap", "");
- }
-}
-
static void __show_finished(void *data, Evas_Object *obj, void *event_info)
{
ui_gadget_h ug = (ui_gadget_h)data;
@@ -330,17 +291,12 @@ static void on_show_cb(void *data, Evas *e, Evas_Object *obj,
_DBG("\t UG_LAYOUT_Init(%d) obj=%p", ug->layout_state, obj);
ug->layout_state = UG_LAYOUT_SHOWEFFECT;
- __update_indicator_overlap(ug->opt);
-
evas_object_smart_callback_add(navi, "transition,finished",
__show_finished, ug);
ug->effect_layout = elm_naviframe_item_push(navi, NULL, NULL, NULL,
ug->layout, NULL);
} else if (ug->layout_state == UG_LAYOUT_NOEFFECT) {
_DBG("\t UG_LAYOUT_NOEFFECT obj=%p", obj);
-
- __update_indicator_overlap(ug->opt);
-
Elm_Object_Item *navi_top = elm_naviframe_top_item_get(navi);
ug->effect_layout = elm_naviframe_item_insert_after(navi,
navi_top, NULL, NULL, NULL, ug->layout, NULL);
@@ -392,13 +348,33 @@ static void *on_create(void *win, ui_gadget_h ug,
evas_object_hide(ug->layout);
evas_object_event_callback_add(ug->layout, EVAS_CALLBACK_SHOW, on_show_cb, ug);
- evas_object_event_callback_add(ug->layout, EVAS_CALLBACK_DEL, _layout_del_cb, ug);
+ evas_object_event_callback_add(ug->layout, EVAS_CALLBACK_DEL,
+ (Evas_Object_Event_Cb)_layout_del_cb, ug);
ug->layout_state = UG_LAYOUT_INIT;
return conform;
}
+static void *on_request(void *data, ui_gadget_h ug, int req)
+{
+ void *ret;
+
+ _DBG("on_request ug(%p) req(%d)", ug, req);
+
+ switch(req)
+ {
+ case UG_UI_REQ_GET_CONFORMANT :
+ ret = (void *)_get_win_conformant((Evas_Object *)data);
+ break;
+ default :
+ _WRN("wrong req id(%d)", req);
+ return NULL;
+ }
+
+ return ret;
+}
+
UG_ENGINE_API int UG_ENGINE_INIT(struct ug_engine_ops *ops)
{
if (!ops)
@@ -406,6 +382,7 @@ UG_ENGINE_API int UG_ENGINE_INIT(struct ug_engine_ops *ops)
ops->create = on_create;
ops->destroy = on_destroy;
+ ops->request = on_request;
return 0;
}