diff options
author | Hyungdeuk Kim <hd3.kim@samsung.com> | 2013-03-20 18:48:51 +0900 |
---|---|---|
committer | Hyungdeuk Kim <hd3.kim@samsung.com> | 2013-03-20 18:48:51 +0900 |
commit | 7e2775d1fa8b4fcd59217285a7f18c25f4ee33bd (patch) | |
tree | 7ceefb142168640329e765da4dab6c4c5b05c77f | |
parent | ec0eaacf200be6e4cf466383b5f0e6ecc396f626 (diff) | |
download | ui-gadget-1-7e2775d1fa8b4fcd59217285a7f18c25f4ee33bd.tar.gz ui-gadget-1-7e2775d1fa8b4fcd59217285a7f18c25f4ee33bd.tar.bz2 ui-gadget-1-7e2775d1fa8b4fcd59217285a7f18c25f4ee33bd.zip |
add code to remove ui cb under ug_destroy_all case
-rwxr-xr-x | CMakeLists.txt | 2 | ||||
-rwxr-xr-x | client/ug-client.c | 2 | ||||
-rwxr-xr-x | include/ug-dbg.h | 1 | ||||
-rwxr-xr-x | packaging/ui-gadget-1.spec | 2 | ||||
-rwxr-xr-x | src/manager.c | 49 | ||||
-rw-r--r-- | src/module.c | 5 | ||||
-rwxr-xr-x | ug-efl-engine/ug-efl-engine.c | 28 |
7 files changed, 62 insertions, 27 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f6a577a..71b3437 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,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 elementary) +PKG_CHECK_MODULES(PKGS REQUIRED glib-2.0 utilX bundle dlog x11 capi-appfw-application appsvc capi-appfw-app-manager ecore) FOREACH(flag ${PKGS_CFLAGS}) SET(CFLAGS "${CFLAGS} ${flag}") ENDFOREACH(flag) diff --git a/client/ug-client.c b/client/ug-client.c index 04e3c10..7c2ac36 100755 --- a/client/ug-client.c +++ b/client/ug-client.c @@ -396,8 +396,6 @@ int main(int argc, char *argv[]) }; int cmdlen = 0; - setenv("ELM_ENGINE", "gl", 1); //enabling the OpenGL as the backend of the EFL. - memset(&ad, 0x0, sizeof(struct appdata)); ops.data = &ad; diff --git a/include/ug-dbg.h b/include/ug-dbg.h index 00167b0..d4e5905 100755 --- a/include/ug-dbg.h +++ b/include/ug-dbg.h @@ -33,5 +33,6 @@ #define _ERR(fmt, arg...) LOGE("\x1b[31m" fmt "\x1b[0m", ##arg) #define _DBG(fmt, arg...) LOGD("\x1b[32m" fmt "\x1b[0m", ##arg) #define _INFO(fmt, arg...) LOGI("\x1b[33m" fmt "\x1b[0m", ##arg) +#define _WRN(fmt, arg...) LOGW("\x1b[34m" fmt "\x1b[0m", ##arg) #endif /* __UG_DBG_H__ */ diff --git a/packaging/ui-gadget-1.spec b/packaging/ui-gadget-1.spec index c00f77c..04ed768 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.17 +Version: 0.1.18 Release: 1 Group: System/Libraries License: Apache License, Version 2.0 diff --git a/src/manager.c b/src/manager.c index 6b30a13..7af9fb3 100755 --- a/src/manager.c +++ b/src/manager.c @@ -28,7 +28,6 @@ #include <X11/Xatom.h> #include <X11/Xutil.h> -#include <Elementary.h> #include <Ecore.h> #include "ug.h" @@ -383,16 +382,16 @@ static int ugman_indicator_update(enum ug_option opt, enum ug_event event) int enable; int cur_state; - _DBG("indicator update opt(%d)", opt); + cur_state = utilx_get_indicator_state(ug_man.disp, ug_man.win_id); + + _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 { - cur_state = utilx_get_indicator_state(ug_man.disp, ug_man.win_id); + else enable = cur_state ? 1 : 0; - } break; case UG_OPT_INDICATOR_PORTRAIT_ONLY: enable = ug_man.is_landscape ? 0 : 1; @@ -410,8 +409,9 @@ static int ugman_indicator_update(enum ug_option opt, enum ug_event event) return -1; } - utilx_enable_indicator(ug_man.disp, ug_man.win_id, enable); - + if(cur_state != enable) { + utilx_enable_indicator(ug_man.disp, ug_man.win_id, enable); + } return 0; } @@ -481,12 +481,9 @@ static int ugman_ug_destroy(void *data) ug->state = UG_STATE_DESTROYED; - if (ug->module) - ops = &ug->module->ops; - if (ug->children) { child = ug->children; - _DBG("ug_destroy ug(%p) has child(%p)", ug, child); + _DBG("ug_destroy ug(%p) has child(%p)", ug, child->data); while (child) { trail = g_slist_next(child); ugman_ug_destroy(child->data); @@ -494,12 +491,28 @@ static int ugman_ug_destroy(void *data) } } + if((ug != ug_man.root) && (ug->layout) && + (ug->layout_state != UG_LAYOUT_DESTROY)) { + /* ug_destroy_all case */ + struct ug_engine_ops *eng_ops = NULL; + + if (ug_man.engine) + eng_ops = &ug_man.engine->ops; + + if (eng_ops && eng_ops->destroy) + eng_ops->destroy(ug, NULL, NULL); + } + + if (ug->module) + ops = &ug->module->ops; + if (ops && ops->destroy) { _DBG("ug(%p) module destory cb call", ug); ops->destroy(ug, ug->service, ops->priv); } - ug_relation_del(ug); + if (ug != ug_man.root) + ug_relation_del(ug); if (ug->mode == UG_MODE_FULLVIEW) { if (ug_man.fv_top == ug) { @@ -572,11 +585,9 @@ static int ugman_ug_create(void *data) } 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); + ug_man.last_rotate_evt = __ug_x_rotation_get(ug_man.disp, ug_man.win_id); } + ugman_ug_event(ug, ug_man.last_rotate_evt); if(ug->mode == UG_MODE_FRAMEVIEW) ugman_ug_start(ug); @@ -703,7 +714,7 @@ int ugman_ug_del(ui_gadget_h ug) struct ug_engine_ops *eng_ops = NULL; if (!ug || !ugman_ug_exist(ug) || ug->state == UG_STATE_DESTROYED) { - _ERR("ugman_ug_del failed: Invalid ug"); + _ERR("ugman_ug_del failed: Invalid ug(%p)"); errno = EINVAL; return -1; } @@ -808,7 +819,7 @@ int ugman_resume(void) } if (!ug_man.root) { - _ERR("ugman_resume failed: no root"); + _WRN("ugman_resume failed: no root"); return -1; } @@ -861,7 +872,7 @@ int ugman_send_event(enum ug_event event) } if (!ug_man.root) { - _ERR("ugman_send_event failed: no root"); + _WRN("ugman_send_event failed: no root"); return -1; } diff --git a/src/module.c b/src/module.c index da518d3..2f4915e 100644 --- a/src/module.c +++ b/src/module.c @@ -57,7 +57,6 @@ struct ug_module *ug_module_load(const char *name) int (*module_init) (struct ug_module_ops *ops); module = calloc(1, sizeof(struct ug_module)); - if (!module) { errno = ENOMEM; return NULL; @@ -103,6 +102,7 @@ struct ug_module *ug_module_load(const char *name) goto module_dlclose; module->handle = handle; + module->module_name = strdup(name); return module; module_dlclose: @@ -133,6 +133,9 @@ int ug_module_unload(struct ug_module *module) module->handle = NULL; } + if(module->module_name) + free(module->module_name); + free(module); return 0; } diff --git a/ug-efl-engine/ug-efl-engine.c b/ug-efl-engine/ug-efl-engine.c index b7abc37..dcdef36 100755 --- a/ug-efl-engine/ug-efl-engine.c +++ b/ug-efl-engine/ug-efl-engine.c @@ -38,6 +38,19 @@ 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 _layout_del_cb(void *data, Evas_Object *obj, void *event_info) +{ + ui_gadget_h ug = (ui_gadget_h)data; + if (!ug) + return; + + _WRN("ug(%p) layout is deleted by abnormal path", ug); + + evas_object_event_callback_del(ug->layout, EVAS_CALLBACK_DEL, _layout_del_cb); + + ug->layout_state = UG_LAYOUT_DESTROY; + ug->layout = NULL; +} static void __del_effect_top_layout(ui_gadget_h ug) { @@ -91,7 +104,10 @@ static void __del_effect_end(ui_gadget_h ug) navi = NULL; } } - evas_object_hide(ug->layout); + if (ug->layout) { + evas_object_hide(ug->layout); + evas_object_event_callback_del(ug->layout, EVAS_CALLBACK_DEL, _layout_del_cb); + } ecore_idler_add((Ecore_Task_Cb)__destroy_end_cb, (void *)ug); @@ -156,10 +172,9 @@ static void __on_hideonly_cb(void *data, Evas_Object *obj) if (!ug) return; - _DBG("\t obj=%p ug=%p state=%d", obj, ug, ug->layout_state); + _DBG("\t obj=%p ug=%p layout_state=%d state=%d", obj, ug, ug->layout_state, ug->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) { @@ -190,6 +205,12 @@ static void on_destroy(ui_gadget_h ug, ui_gadget_h t_ug, 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); + return; + } + if(!hide_end_cb) hide_end_cb = hide_cb; @@ -259,6 +280,7 @@ static void on_show_cb(void *data, Evas *e, Evas_Object *obj, evas_object_intercept_hide_callback_add(ug->layout, __on_hideonly_cb, ug); + evas_object_event_callback_add(ug->layout, EVAS_CALLBACK_DEL, _layout_del_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); |