summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJinkun Jang <jinkun.jang@samsung.com>2013-03-15 16:12:46 (GMT)
committerJinkun Jang <jinkun.jang@samsung.com>2013-03-15 16:12:46 (GMT)
commitec0eaacf200be6e4cf466383b5f0e6ecc396f626 (patch)
tree5e5b497a0523cbdbd471cf2e9c61570474741033
parent7596e199c101a324ac0bbab1be727962fe0ebf07 (diff)
downloadui-gadget-1-ec0eaacf200be6e4cf466383b5f0e6ecc396f626.zip
ui-gadget-1-ec0eaacf200be6e4cf466383b5f0e6ecc396f626.tar.gz
ui-gadget-1-ec0eaacf200be6e4cf466383b5f0e6ecc396f626.tar.bz2
merge with master
-rwxr-xr-xclient/ug-client.c9
-rwxr-xr-x[-rw-r--r--]include/ug-dbg.h0
-rwxr-xr-xinclude/ui-gadget-engine.h2
-rwxr-xr-xpackaging/ui-gadget-1.spec2
-rwxr-xr-xsrc/manager.c198
-rwxr-xr-xsrc/ug.c2
-rwxr-xr-xug-efl-engine/ug-efl-engine.c297
7 files changed, 329 insertions, 181 deletions
diff --git a/client/ug-client.c b/client/ug-client.c
index 1125ef0..04e3c10 100755
--- a/client/ug-client.c
+++ b/client/ug-client.c
@@ -67,7 +67,6 @@ static int rotate(enum appcore_rm m, void *data)
{
struct appdata *ad = data;
int r;
- bool is_rotation_lock = false;
if (ad == NULL || ad->win == NULL)
return 0;
@@ -113,8 +112,10 @@ void _ug_client_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
ad = priv;
base = ug_get_layout(ug);
- if (!base)
+ if (!base) {
+ LOGE("base layout is null");
return;
+ }
switch (mode) {
case UG_MODE_FULLVIEW:
@@ -273,6 +274,8 @@ static int app_terminate(void *data)
{
struct appdata *ad = data;
+ LOGD("app_terminate called");
+
ug_destroy_all();
if (ad->ly_main) {
@@ -292,6 +295,8 @@ static int app_pause(void *data)
{
struct appdata *ad = data;
+ LOGD("app_pause called");
+
ug_pause();
if (!ad->is_transient) {
LOGD("app_pause received. close ug service");
diff --git a/include/ug-dbg.h b/include/ug-dbg.h
index 00167b0..00167b0 100644..100755
--- a/include/ug-dbg.h
+++ b/include/ug-dbg.h
diff --git a/include/ui-gadget-engine.h b/include/ui-gadget-engine.h
index 035bf20..13986cf 100755
--- a/include/ui-gadget-engine.h
+++ b/include/ui-gadget-engine.h
@@ -53,7 +53,7 @@ struct ug_engine_ops {
/** create operation */
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)(ui_gadget_h ug));
+ void (*destroy)(ui_gadget_h ug, ui_gadget_h fv_top, void(*hide_end_cb)(void *data));
/** reserved operations */
void *reserved[4];
};
diff --git a/packaging/ui-gadget-1.spec b/packaging/ui-gadget-1.spec
index dac7f3d..c00f77c 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.16
+Version: 0.1.17
Release: 1
Group: System/Libraries
License: Apache License, Version 2.0
diff --git a/src/manager.c b/src/manager.c
index 36cccb5..6b30a13 100755
--- a/src/manager.c
+++ b/src/manager.c
@@ -25,6 +25,8 @@
#include <errno.h>
#include <glib.h>
#include <utilX.h>
+#include <X11/Xatom.h>
+#include <X11/Xutil.h>
#include <Elementary.h>
#include <Ecore.h>
@@ -109,6 +111,99 @@ static int ug_fvlist_del(ui_gadget_h c)
return 0;
}
+static int __ug_x_get_window_property(Display *dpy, Window win, Atom atom,
+ Atom type, unsigned int *val,
+ unsigned int len)
+{
+ unsigned char *prop_ret;
+ Atom type_ret;
+ unsigned long bytes_after;
+ unsigned long num_ret;
+ int format_ret;
+ unsigned int i;
+ int num;
+
+ prop_ret = NULL;
+ if (XGetWindowProperty(dpy, win, atom, 0, 0x7fffffff, False,
+ type, &type_ret, &format_ret, &num_ret,
+ &bytes_after, &prop_ret) != Success)
+ return -1;
+
+ if (type_ret != type || format_ret != 32)
+ num = -1;
+ else if (num_ret == 0 || !prop_ret)
+ num = 0;
+ else {
+ if (num_ret < len)
+ len = num_ret;
+ for (i = 0; i < len; i++) {
+ val[i] = ((unsigned long *)prop_ret)[i];
+ }
+ num = len;
+ }
+
+ if (prop_ret)
+ XFree(prop_ret);
+
+ return num;
+}
+
+static enum ug_event __ug_x_rotation_get(Display *dpy, Window win)
+{
+ Window active_win;
+ Window root_win;
+ int rotation = -1;
+ int ret = -1;
+ enum ug_event func_ret;
+
+ Atom atom_active_win;
+ Atom atom_win_rotate_angle;
+
+ root_win = XDefaultRootWindow(dpy);
+
+ atom_active_win = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
+ ret = __ug_x_get_window_property(dpy, root_win, atom_active_win,
+ XA_WINDOW,
+ (unsigned int *)&active_win, 1);
+ if (ret < 0) {
+ func_ret = UG_EVENT_ROTATE_PORTRAIT;
+ goto func_out;
+ }
+
+ atom_win_rotate_angle =
+ XInternAtom(dpy, "_E_ILLUME_ROTATE_ROOT_ANGLE", False);
+ ret = __ug_x_get_window_property(dpy, root_win,
+ atom_win_rotate_angle, XA_CARDINAL,
+ (unsigned int *)&rotation, 1);
+
+ _DBG("x_rotation_get / ret(%d),degree(%d)", ret, rotation);
+
+ if (ret == -1)
+ func_ret = UG_EVENT_ROTATE_PORTRAIT;
+ else {
+ switch (rotation) {
+ case 0:
+ func_ret = UG_EVENT_ROTATE_PORTRAIT;
+ break;
+ case 90:
+ func_ret = UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN;
+ break;
+ case 180:
+ func_ret = UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN;
+ break;
+ case 270:
+ func_ret = UG_EVENT_ROTATE_LANDSCAPE;
+ break;
+ default:
+ func_ret = UG_EVENT_ROTATE_PORTRAIT;
+ break;
+ }
+ }
+
+func_out:
+ return func_ret;
+}
+
static void ugman_tree_dump(ui_gadget_h ug)
{
static int i;
@@ -165,14 +260,18 @@ static int ugman_ug_find(ui_gadget_h p, ui_gadget_h ug)
return 0;
}
-static int ugman_ug_start(void *data)
+static void ugman_ug_start(void *data)
{
ui_gadget_h ug = data;
struct ug_module_ops *ops = NULL;
- if (!ug || ug->state != UG_STATE_CREATED
- || ug->state == UG_STATE_RUNNING)
- return 0;
+ if (!ug) {
+ _ERR("ug is null");
+ return;
+ } else if (ug->state != UG_STATE_CREATED) {
+ _ERR("ug(%p) state(%d) is error", ug, ug->state);
+ return;
+ }
_DBG("ug=%p", ug);
@@ -184,7 +283,7 @@ static int ugman_ug_start(void *data)
if (ops && ops->start)
ops->start(ug, ug->service, ops->priv);
- return 0;
+ return;
}
static int ugman_ug_pause(void *data)
@@ -284,6 +383,8 @@ static int ugman_indicator_update(enum ug_option opt, enum ug_event event)
int enable;
int cur_state;
+ _DBG("indicator update opt(%d)", opt);
+
switch (GET_OPT_INDICATOR_VAL(opt)) {
case UG_OPT_INDICATOR_ENABLE:
if (event == UG_EVENT_NONE)
@@ -347,6 +448,8 @@ static int ugman_ug_event(ui_gadget_h ug, enum ug_event event)
if (ug->module)
ops = &ug->module->ops;
+ _DBG("ug_event_cb : ug(%p) / event(%d)", ug, event);
+
if (ops && ops->event)
ops->event(ug, event, ug->service, ops->priv);
@@ -364,7 +467,7 @@ static int ugman_ug_destroy(void *data)
if (!ug)
goto end;
- _DBG("ugman_ug_destroy start ug(%p)", ug);
+ _DBG("ugman_ug_destroy ug(%p) state(%d)", ug, ug->state);
switch (ug->state) {
case UG_STATE_CREATED:
@@ -383,6 +486,7 @@ static int ugman_ug_destroy(void *data)
if (ug->children) {
child = ug->children;
+ _DBG("ug_destroy ug(%p) has child(%p)", ug, child);
while (child) {
trail = g_slist_next(child);
ugman_ug_destroy(child->data);
@@ -391,7 +495,7 @@ static int ugman_ug_destroy(void *data)
}
if (ops && ops->destroy) {
- _DBG("ug module destory cb call");
+ _DBG("ug(%p) module destory cb call", ug);
ops->destroy(ug, ug->service, ops->priv);
}
@@ -406,6 +510,7 @@ static int ugman_ug_destroy(void *data)
}
}
+ _DBG("free ug(%p)", ug);
ug_free(ug);
if (ug_man.root == ug)
@@ -418,9 +523,10 @@ static int ugman_ug_destroy(void *data)
return 0;
}
-static void ug_hide_end_cb(ui_gadget_h ug)
+static void ug_hide_end_cb(void *data)
{
- ecore_idler_add(ugman_ug_destroy, ug);
+ ui_gadget_h ug = data;
+ ecore_idler_add((Ecore_Task_Cb)ugman_ug_destroy, ug);
}
static int ugman_ug_create(void *data)
@@ -430,8 +536,10 @@ static int ugman_ug_create(void *data)
struct ug_cbs *cbs;
struct ug_engine_ops *eng_ops = NULL;
- if (!ug || ug->state != UG_STATE_READY)
+ if (!ug || ug->state != UG_STATE_READY) {
+ _ERR("ug(%p) input param error");
return -1;
+ }
ug->state = UG_STATE_CREATED;
@@ -445,6 +553,7 @@ static int ugman_ug_create(void *data)
ug->layout = ops->create(ug, ug->mode, ug->service, ops->priv);
if (!ug->layout) {
ug_relation_del(ug);
+ _ERR("ug(%p) layout is null", ug);
return -1;
}
if (ug->mode == UG_MODE_FULLVIEW) {
@@ -458,10 +567,16 @@ static int ugman_ug_create(void *data)
if (cbs && cbs->layout_cb)
cbs->layout_cb(ug, ug->mode, cbs->priv);
- ugman_ug_getopt(ug);
+ _DBG("after caller layout cb call");
+ ugman_indicator_update(ug->opt, UG_EVENT_NONE);
}
- ugman_ug_event(ug, ug_man.last_rotate_evt);
+ if(ug_man.last_rotate_evt == UG_EVENT_NONE) {
+ ugman_ug_event(ug,
+ __ug_x_rotation_get(ug_man.disp, ug_man.win_id));
+ } else {
+ ugman_ug_event(ug, ug_man.last_rotate_evt);
+ }
if(ug->mode == UG_MODE_FRAMEVIEW)
ugman_ug_start(ug);
@@ -474,20 +589,22 @@ static int ugman_ug_create(void *data)
int ugman_ug_add(ui_gadget_h parent, ui_gadget_h ug)
{
if (!ug_man.is_initted) {
- _ERR("ugman_ug_add failed: manager is not initted");
+ _ERR("failed: manager is not initted");
return -1;
}
if (!ug_man.root) {
if (parent) {
- _ERR("ugman_ug_add failed: parent has to be NULL w/o root");
+ _ERR("failed: parent has to be NULL w/o root");
errno = EINVAL;
return -1;
}
ug_man.root = ug_root_create();
- if (!ug_man.root)
+ if (!ug_man.root) {
+ _ERR("failed : ug root create fail");
return -1;
+ }
ug_man.root->opt = ug_man.base_opt;
ug_man.root->layout = ug_man.win;
ug_fvlist_add(ug_man.root);
@@ -496,12 +613,15 @@ int ugman_ug_add(ui_gadget_h parent, ui_gadget_h ug)
if (!parent)
parent = ug_man.root;
- if (ug_relation_add(parent, ug))
+ if (ug_relation_add(parent, ug)) {
+ _ERR("failed : ug_relation_add fail");
return -1;
+ }
- if (ugman_ug_create(ug) == -1)
+ if (ugman_ug_create(ug) == -1) {
+ _ERR("failed : ugman_ug_create fail");
return -1;
-
+ }
if (ug->mode == UG_MODE_FULLVIEW)
ug_fvlist_add(ug);
@@ -608,9 +728,23 @@ int ugman_ug_del(ui_gadget_h ug)
ugman_ug_destroying(ug);
/* pre call for indicator update time issue */
+ bool is_update = false;
+ ui_gadget_h t = NULL;
if (ug_man.fv_top == ug) {
- ui_gadget_h t;
+ is_update = true;
t = g_slist_nth_data(ug_man.fv_list, 1);
+ } else {
+ if (ug->children) {
+ GSList *child;
+ child = g_slist_last(ug->children);
+ if(ug_man.fv_top == (ui_gadget_h)child->data) {
+ is_update = true;
+ t = g_slist_nth_data(ug_man.fv_list,
+ g_slist_index(ug_man.fv_list,(gconstpointer)ug)+1);
+ }
+ }
+ }
+ if((is_update)&&(t)) {
ugman_ug_getopt(t);
}
@@ -624,7 +758,7 @@ int ugman_ug_del(ui_gadget_h ug)
eng_ops->destroy(ug, NULL, ug_hide_end_cb);
}
else
- ecore_idler_add(ugman_ug_destroy, ug);
+ ecore_idler_add((Ecore_Task_Cb)ugman_ug_destroy, ug);
return 0;
}
@@ -642,6 +776,8 @@ int ugman_ug_del_all(void)
return -1;
}
+ _DBG("ug_del_all. root(%p) walking(%d) ", ug_man.root, ug_man.walking);
+
if (ug_man.walking > 0)
ug_man.destroy_all = 1;
else
@@ -657,7 +793,7 @@ int ugman_init(Display *disp, Window xid, void *win, enum ug_option opt)
ug_man.disp = disp;
ug_man.win_id = xid;
ug_man.base_opt = opt;
- ug_man.last_rotate_evt = UG_EVENT_ROTATE_PORTRAIT;
+ ug_man.last_rotate_evt = UG_EVENT_NONE;
ug_man.engine = ug_engine_load();
return 0;
@@ -676,7 +812,9 @@ int ugman_resume(void)
return -1;
}
- ecore_idler_add(ugman_ug_resume, ug_man.root);
+ _DBG("ugman_resume called");
+
+ ecore_idler_add((Ecore_Task_Cb)ugman_ug_resume, ug_man.root);
return 0;
}
@@ -694,7 +832,9 @@ int ugman_pause(void)
return -1;
}
- ecore_idler_add(ugman_ug_pause, ug_man.root);
+ _DBG("ugman_pause called");
+
+ ecore_idler_add((Ecore_Task_Cb)ugman_ug_pause, ug_man.root);
return 0;
}
@@ -720,6 +860,11 @@ int ugman_send_event(enum ug_event event)
return -1;
}
+ if (!ug_man.root) {
+ _ERR("ugman_send_event failed: no root");
+ return -1;
+ }
+
/* In case of rotation, indicator state has to be updated */
switch (event) {
case UG_EVENT_ROTATE_PORTRAIT:
@@ -736,12 +881,7 @@ int ugman_send_event(enum ug_event event)
is_rotation = 0;
}
- if (!ug_man.root) {
- _ERR("ugman_send_event failed: no root");
- return -1;
- }
-
- ecore_idler_add(ugman_send_event_pre, (void *)event);
+ ecore_idler_add((Ecore_Task_Cb)ugman_send_event_pre, (void *)event);
if (is_rotation && ug_man.fv_top)
ugman_indicator_update(ug_man.fv_top->opt, event);
diff --git a/src/ug.c b/src/ug.c
index 09f4679..aac737b 100755
--- a/src/ug.c
+++ b/src/ug.c
@@ -138,7 +138,7 @@ UG_API int ug_destroy_me(ui_gadget_h ug)
}
if (ug->state == UG_STATE_DESTROYING) {
- _ERR("ug_destory_me() failed:ug is alreay on destroying");
+ _ERR("ug_destory_me() failed:ug(%p) is already on destroying", ug);
return -1;
}
diff --git a/ug-efl-engine/ug-efl-engine.c b/ug-efl-engine/ug-efl-engine.c
index f4bf697..b7abc37 100755
--- a/ug-efl-engine/ug-efl-engine.c
+++ b/ug-efl-engine/ug-efl-engine.c
@@ -33,213 +33,224 @@
static Evas_Object *navi = NULL;
static Evas_Object *conform = NULL;
-struct cb_data {
- ui_gadget_h ug;
- void (*transition_cb)(ui_gadget_h ug);
-};
-static void __hide_finished(void *data, Evas_Object *obj, void *event_info);
static void on_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void __hide_finished(void *data, Evas_Object *obj, void *event_info);
+static void (*show_end_cb)(void* data) = NULL;
+static void (*hide_end_cb)(void* data) = NULL;
-static void _on_hideonly_cb(void *data, Evas_Object *obj)
-{
- ui_gadget_h ug = (ui_gadget_h)data;
- if (!ug)
- return;
+static void __del_effect_top_layout(ui_gadget_h ug)
+{
+ _DBG("\t cb transition add ug=%p", ug);
+ evas_object_smart_callback_add(navi, "transition,finished",
+ __hide_finished, ug);
+ elm_naviframe_item_pop(navi);
+ ug->effect_layout = NULL;
+ ug->layout_state = UG_LAYOUT_HIDEEFFECT;
+}
- _DBG("\t obj=%p ug=%p state=%d", obj, ug, ug->layout_state);
+static Eina_Bool __destroy_end_cb(void *data)
+{
+ GSList *child;
+ ui_gadget_h ug = (ui_gadget_h)data;
- evas_object_intercept_hide_callback_del(ug->layout, _on_hideonly_cb);
+ _DBG("\t __destroy_end_cb ug=%p", ug);
- struct cb_data *cb_d;
- cb_d = (struct cb_data *)calloc(1, sizeof(struct cb_data));
- cb_d->ug = ug;
- cb_d->transition_cb = NULL;
+ 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);
+
+ 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_add(ug->layout, EVAS_CALLBACK_SHOW, on_show_cb, cb_d);
+ hide_end_cb(ug);
+ return ECORE_CALLBACK_CANCEL;
+}
- if (ug->layout_state == UG_LAYOUT_NOEFFECT) {
- ;
- }
- if (ug->layout_state == UG_LAYOUT_SHOW) {
- ug->layout_state = UG_LAYOUT_HIDEEFFECT;
+static void __del_effect_end(ui_gadget_h ug)
+{
+ if (navi) {
+ Elm_Object_Item *t = elm_naviframe_top_item_get(navi);
+ Elm_Object_Item *b = elm_naviframe_bottom_item_get(navi);
+ if (t == b) {
+ _DBG("\t remove navi");
+ evas_object_del(navi);
+ navi = NULL;
+ }
}
+ evas_object_hide(ug->layout);
- if (GET_OPT_OVERLAP_VAL(ug->opt) == UG_OPT_OVERLAP_ENABLE) {
- _DBG("\t this is Overlap UG. Send nooverlap sig on hide_cb");
- elm_object_signal_emit(conform, "elm,state,indicator,nooverlap", "");
- }
+ ecore_idler_add((Ecore_Task_Cb)__destroy_end_cb, (void *)ug);
- if (elm_naviframe_top_item_get(navi) == ug->effect_layout) {
- elm_naviframe_item_pop(navi);
- } else {
- elm_object_item_del(ug->effect_layout);
- ug->effect_layout = NULL;
- }
+ ug->layout_state = UG_LAYOUT_DESTROY;
}
-static void _del_effect_layout(ui_gadget_h ug)
+static void __del_effect_layout(ui_gadget_h ug, ui_gadget_h t_ug)
{
- GSList *child, *trail;
+ GSList *child;
if (!ug)
return;
- _DBG("\t ug=%p state=%d", ug, ug->layout_state);
-
- evas_object_intercept_hide_callback_del(ug->layout, _on_hideonly_cb);
+ _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) {
- trail = g_slist_next(child);
- _del_effect_layout(child->data);
- child = trail;
+ __del_effect_layout(child->data, t_ug);
+ child = g_slist_next(child);
}
}
- /* effect_layout of frameview is null */
- /* remove navi item */
- if (ug->effect_layout) {
- _DBG("\t remove navi item: ug=%p", ug);
- if (ug->layout_state == UG_LAYOUT_HIDEEFFECT) {
- _DBG("\t del cb, ug=%p", ug);
- evas_object_smart_callback_del(navi, "transition,finished",
- __hide_finished);
+ 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;
}
- if (navi) {
- Elm_Object_Item *t = elm_naviframe_top_item_get(navi);
- Elm_Object_Item *b = elm_naviframe_bottom_item_get(navi);
- if (t == b) {
- _DBG("\t remove navi");
- evas_object_del(navi);
- navi = NULL;
- }
- }
- evas_object_hide(ug->layout);
+ __del_effect_end(ug);
}
static void __hide_finished(void *data, Evas_Object *obj, void *event_info)
{
- struct cb_data *cb_d = (struct cb_data *)data;
-
- if (!cb_d)
+ ui_gadget_h ug = (ui_gadget_h)data;
+ if (!ug)
return;
+ _DBG("\t obj=%p ug=%p", obj, ug);
+
evas_object_smart_callback_del(obj, "transition,finished",
__hide_finished);
- ui_gadget_h ug = cb_d->ug;
- _DBG("\t obj=%p ug=%p state=%d", obj, ug, ug->layout_state);
-
- ug->effect_layout = NULL;
- _del_effect_layout(ug);
- cb_d->transition_cb(ug);
- free(cb_d);
+ if(ug->layout_state == UG_LAYOUT_HIDEEFFECT)
+ __del_effect_end(ug);
+ else
+ _ERR("wrong ug(%p) state(%d)", ug, ug->layout_state);
}
-static int __find_child(ui_gadget_h p, ui_gadget_h ug)
+static void __on_hideonly_cb(void *data, Evas_Object *obj)
{
- GSList *child = NULL;
-
- if (!p || !ug)
- return 0;
- child = p->children;
-
- while (child) {
- if (child->data == ug)
- return 1;
- if (__find_child(child->data, ug))
- return 1;
- child = g_slist_next(child);
+ ui_gadget_h ug = (ui_gadget_h)data;
+
+ if (!ug)
+ return;
+
+ _DBG("\t obj=%p ug=%p state=%d", obj, ug, ug->layout_state);
+
+ evas_object_intercept_hide_callback_del(ug->layout, __on_hideonly_cb);
+
+ evas_object_event_callback_add(ug->layout, EVAS_CALLBACK_SHOW, on_show_cb, ug);
+
+ if (ug->layout_state == UG_LAYOUT_SHOW) {
+ ug->layout_state = UG_LAYOUT_HIDE;
+ } else if (ug->layout_state == UG_LAYOUT_NOEFFECT) {
+ ;
+ } else {
+ _ERR("wrong ug(%p) state(%d)", ug, ug->layout_state);
+ return;
}
- return 0;
+ if (elm_naviframe_top_item_get(navi) == ug->effect_layout) {
+ elm_naviframe_item_pop(navi);
+ } else {
+ elm_object_item_del(ug->effect_layout);
+ }
+
+ ug->effect_layout = NULL;
}
static void on_destroy(ui_gadget_h ug, ui_gadget_h t_ug,
- void (*hide_end_cb) (ui_gadget_h ug))
+ void (*hide_cb)(void* data))
{
if (!ug)
return;
_DBG("\t ug=%p tug=%p state=%d", ug, t_ug, ug->layout_state);
evas_object_intercept_hide_callback_del(ug->layout,
- _on_hideonly_cb);
+ __on_hideonly_cb);
+
+ if(!hide_end_cb)
+ hide_end_cb = hide_cb;
if (ug != t_ug) {
_DBG("requested ug(%p) is not top ug(%p)", ug, t_ug);
- _del_effect_layout(ug);
- hide_end_cb(ug);
+ __del_effect_layout(ug, t_ug);
return;
}
- if (ug->layout_state == UG_LAYOUT_SHOW) {
- struct cb_data *cb_d;
- cb_d = (struct cb_data *)calloc(1, sizeof(struct cb_data));
- cb_d->ug = ug;
- cb_d->transition_cb = hide_end_cb;
-
- _DBG("\t cb add ug=%p", ug);
-
- /* overlap update does not needed because manager will do that at on_destroy scenario */
-
- evas_object_smart_callback_add(navi, "transition,finished",
- __hide_finished, cb_d);
- elm_naviframe_item_pop(navi);
- ug->layout_state = UG_LAYOUT_HIDEEFFECT;
+ if(ug->layout_state == UG_LAYOUT_SHOW) {
+ __del_effect_top_layout(ug);
} else if (ug->layout_state == UG_LAYOUT_HIDE
- || ug->layout_state == UG_LAYOUT_NOEFFECT) {
- _del_effect_layout(ug);
- hide_end_cb(ug);
- } else if (ug->layout_state == UG_LAYOUT_HIDEEFFECT
- || ug->layout_state == UG_LAYOUT_SHOWEFFECT) {
- ug->layout_state = UG_LAYOUT_DESTROY;
+ || ug->layout_state == UG_LAYOUT_NOEFFECT
+ || ug->layout_state == UG_LAYOUT_SHOWEFFECT) {
+ __del_effect_layout(ug, t_ug);
+ } else if (ug->layout_state == UG_LAYOUT_HIDEEFFECT) {
+ ;
} else {
_ERR("[UG Effect Plug-in] : layout state error!!");
}
}
-static void __show_finished(void *data, Evas_Object *obj, void *event_info)
+static void __update_indicator_overlap(int opt)
{
- struct cb_data *cb_d = (struct cb_data *)data;
- if (!cb_d)
- return;
+ 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", "");
+ }
+}
- ui_gadget_h ug = cb_d->ug;
+static void __show_finished(void *data, Evas_Object *obj, void *event_info)
+{
+ ui_gadget_h ug = (ui_gadget_h)data;
if (!ug)
return;
- _DBG("\tobj=%p ug=%p state=%d", obj, ug, ug->layout_state);
+ _DBG("\tobj=%p ug=%p", obj, ug);
evas_object_smart_callback_del(obj, "transition,finished",
__show_finished);
- if (ug->layout_state == UG_LAYOUT_NOEFFECT)
- return;
-
- if (ug->layout_state == UG_LAYOUT_DESTROY)
- ;
- else
+ if (ug->layout_state == UG_LAYOUT_DESTROY) {
+ _DBG("ug(%p) already destroyed", ug);
+ } else if (ug->layout_state == UG_LAYOUT_SHOWEFFECT) {
ug->layout_state = UG_LAYOUT_SHOW;
+ if(show_end_cb)
+ show_end_cb(ug);
+ } else {
+ _ERR("wrong state(%d)", ug->layout_state);
+ }
- if(cb_d->transition_cb)
- cb_d->transition_cb(ug);
- free(cb_d);
+ return;
}
static void on_show_cb(void *data, Evas *e, Evas_Object *obj,
void *event_info)
{
- struct cb_data *cb_d = (struct cb_data *)data;
- if (!cb_d)
- return;
- ui_gadget_h ug = cb_d->ug;
+ ui_gadget_h ug = (ui_gadget_h)data;
if (!ug)
return;
_DBG("\tobj=%p ug=%p layout=%p state=%d", obj, ug, ug->layout, ug->layout_state);
@@ -247,48 +258,42 @@ static void on_show_cb(void *data, Evas *e, Evas_Object *obj,
evas_object_event_callback_del(ug->layout, EVAS_CALLBACK_SHOW, on_show_cb);
evas_object_intercept_hide_callback_add(ug->layout,
- _on_hideonly_cb, ug);
+ __on_hideonly_cb, ug);
+ //if 'elm.swallow.ug' string is changed, msg team have to apply this changes.
elm_object_part_content_set(conform, "elm.swallow.ug", navi);
- if (ug->layout_state == UG_LAYOUT_HIDE
+ if (ug->layout_state == UG_LAYOUT_HIDEEFFECT
|| ug->layout_state == UG_LAYOUT_INIT) {
_DBG("\t UG_LAYOUT_Init(%d) obj=%p", ug->layout_state, obj);
ug->layout_state = UG_LAYOUT_SHOWEFFECT;
- if (GET_OPT_OVERLAP_VAL(ug->opt)) {
- _DBG("\t this is Overlap UG. Send overlap sig on_show_cb");
- elm_object_signal_emit(conform, "elm,state,indicator,overlap", "");
- }
+ __update_indicator_overlap(ug->opt);
evas_object_smart_callback_add(navi, "transition,finished",
- __show_finished, cb_d);
+ __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);
- if (GET_OPT_OVERLAP_VAL(ug->opt)) {
- _DBG("\t this is Overlap UG. Send overlap sig on_show_cb");
- elm_object_signal_emit(conform, "elm,state,indicator,overlap", "");
- }
+ __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);
-
//ug start cb
- if(cb_d->transition_cb)
- cb_d->transition_cb(ug);
- free(cb_d);
+ if(show_end_cb)
+ show_end_cb(ug);
} else {
_ERR("\tlayout state error!! state=%d\n", ug->layout_state);
- free(cb_d);
}
+
+ _DBG("\ton_show_cb end ug=%p", ug);
}
static void *on_create(void *win, ui_gadget_h ug,
- void (*show_end_cb) (void* data))
+ void (*show_cb)(void* data))
{
Evas_Object *navi_bg;
Evas_Object *con = NULL;
@@ -319,13 +324,11 @@ static void *on_create(void *win, ui_gadget_h ug,
elm_naviframe_item_push(navi, NULL, NULL, NULL, navi_bg, NULL);
}
- struct cb_data *cb_d;
- cb_d = (struct cb_data *)calloc(1, sizeof(struct cb_data));
- cb_d->ug = ug;
- cb_d->transition_cb = show_end_cb;
+ if(!show_end_cb)
+ show_end_cb = show_cb;
evas_object_hide(ug->layout);
- evas_object_event_callback_add(ug->layout, EVAS_CALLBACK_SHOW, on_show_cb, cb_d);
+ evas_object_event_callback_add(ug->layout, EVAS_CALLBACK_SHOW, on_show_cb, ug);
ug->layout_state = UG_LAYOUT_INIT;