diff options
author | Seunghun Lee <shiin.lee@samsung.com> | 2016-02-17 15:42:42 +0900 |
---|---|---|
committer | Seunghun Lee <shiin.lee@samsung.com> | 2016-02-19 11:25:59 +0900 |
commit | f32743060e18888e17c221e3088d5c26eb586659 (patch) | |
tree | 1959b2055036549a38ef79d907e26fbec51a4215 | |
parent | 2f62e0af369749386203f8b0981d55b8a48c56ef (diff) | |
download | efl-util-f32743060e18888e17c221e3088d5c26eb586659.tar.gz efl-util-f32743060e18888e17c221e3088d5c26eb586659.tar.bz2 efl-util-f32743060e18888e17c221e3088d5c26eb586659.zip |
re-configure notification level whenever window is shown.
wl_surface is destroyed when hide the window, and created when show the window.
since the configuration of notification level has dependency on the wl_surface,
so we need to re-configure it whenever window is shown.
Change-Id: If3f02e54e3dbe5c4df27c25b602c345c3981d2cd
-rw-r--r-- | src/efl_util.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/efl_util.c b/src/efl_util.c index 9860db6..ba1b831 100644 --- a/src/efl_util.c +++ b/src/efl_util.c @@ -66,6 +66,7 @@ typedef struct _Efl_Util_Callback_Info #if WAYLAND typedef struct _Efl_Util_Wl_Surface_Lv_Info { + Evas_Object *window; void *surface; /* wl_surface */ int level; Eina_Bool wait_for_done; @@ -594,6 +595,36 @@ _cb_wl_tz_policy_scr_mode_done(void *data, EFL_UTIL_ERROR_PERMISSION_DENIED, cb_info->data); } + +static void +_cb_window_show(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Efl_Util_Wl_Surface_Lv_Info *lv_info; + Ecore_Wl_Window *wlwin; + struct wl_surface *surface; + + lv_info = data; + if (EINA_UNLIKELY(!lv_info)) + return; + + wlwin = elm_win_wl_window_get(lv_info->window); + if (EINA_UNLIKELY(!wlwin)) + return; + + surface = ecore_wl_window_surface_get(wlwin); + if (EINA_UNLIKELY(!surface)) + return; + + eina_hash_free_cb_set(_eflutil.wl.policy.hash_noti_lv, NULL); + eina_hash_del_by_key(_eflutil.wl.policy.hash_noti_lv, &lv_info->surface); + + lv_info->surface = surface; + eina_hash_add(_eflutil.wl.policy.hash_noti_lv, &surface, lv_info); + eina_hash_free_cb_set(_eflutil.wl.policy.hash_noti_lv, free); + + tizen_policy_set_notification_level(_eflutil.wl.policy.proto, + surface, (int)lv_info->level); +} #endif /* end of WAYLAND */ API int @@ -672,6 +703,7 @@ efl_util_set_notification_window_level(Evas_Object *window, lv_info = calloc(1, sizeof(Efl_Util_Wl_Surface_Lv_Info)); EINA_SAFETY_ON_NULL_RETURN_VAL(lv_info, EFL_UTIL_ERROR_OUT_OF_MEMORY); + lv_info->window = window; lv_info->surface = surface; lv_info->level = (int)level; lv_info->wait_for_done = EINA_TRUE; @@ -679,6 +711,9 @@ efl_util_set_notification_window_level(Evas_Object *window, eina_hash_add(_eflutil.wl.policy.hash_noti_lv, &surface, lv_info); + + evas_object_event_callback_add(window, EVAS_CALLBACK_SHOW, + _cb_window_show, lv_info); } else { @@ -687,6 +722,7 @@ efl_util_set_notification_window_level(Evas_Object *window, lv_info->state = TIZEN_POLICY_ERROR_STATE_NONE; } + tizen_policy_set_notification_level(_eflutil.wl.policy.proto, surface, (int)level); |