From c72543353a711b443a140c4ba393bf4b1dcd65e4 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Fri, 23 Jul 2021 12:52:45 +0900 Subject: [PATCH] ecore_wl2: add ecore_wl2_window_transient_parent_set API This API makes relationship between windows as a child and a parent. And the child window must set the place_below flag where it is placed. If the place_below flag is true, then child window is placed UNDER the parent, Otherwise, it is placed ON the parent. @tizen_only Change-Id: I19d834a14e2fa0376be9ecf356f713713e77366c Signed-off-by: Doyoun Kang --- src/lib/ecore_wl2/Ecore_Wl2.h | 21 +++++++++++++++++++ src/lib/ecore_wl2/ecore_wl2_window.c | 40 ++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index 6174f3e..08f5548 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h @@ -1108,6 +1108,27 @@ EAPI void ecore_wl2_window_position_set(Ecore_Wl2_Window *window, int x, int y); EAPI int ecore_wl2_window_active_angle_get(Ecore_Wl2_Window *window); // +//TIZEN_ONLY(20210721) +/** + * @internal + * + * Set a parent window of Ecore_Wl2_Window + * + * This makes a relationship between parent and child. And child can choose where it is placed. + * If a @p place_below is true, then the window is always placed under the parent. + * Otherwise, it is placed on the parent. + * + * @param window The window on which to set the parent + * @param parent The parent window + * @param place_below If @p place_below is EINA_TRUE, the @p window is placed under the @p parent, + * Otherwise, the @p window is placed on the @p parent + * + * @ingroup Ecore_Wl2_Window_Group + * @since_tizen 6.5 + */ +EAPI void ecore_wl2_window_transient_parent_set(Ecore_Wl2_Window *window, Ecore_Wl2_Window *parent, Eina_Bool place_below); +// + //TIZEN_ONLY(20171216): add ecore_wl2_window_find /** @internal */ EAPI Ecore_Wl2_Window *ecore_wl2_window_find(unsigned int id); diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c index 30ff85f..075470e 100644 --- a/src/lib/ecore_wl2/ecore_wl2_window.c +++ b/src/lib/ecore_wl2/ecore_wl2_window.c @@ -1633,6 +1633,46 @@ ecore_wl2_window_parent_set(Ecore_Wl2_Window *window, Ecore_Wl2_Window *parent) // } +// TIZEN_ONLY(20210721) : for below child +static void +_ecore_wl2_window_parent_set_with_below(Ecore_Wl2_Window *window, Ecore_Wl2_Window *parent) +{ + window->parent = parent; + if (window->parent) + { + if (window->parent->surface) + tizen_policy_set_parent_with_below(window->display->wl.tz_policy, window->surface, window->parent->surface); + else + ERR("Fail to set parent below. Parent window's surface doesn't exist."); + } + else + { + tizen_policy_set_parent_with_below(window->display->wl.tz_policy, window->surface, NULL); + } +} + +EAPI void +ecore_wl2_window_transient_parent_set(Ecore_Wl2_Window *window, Ecore_Wl2_Window *parent, Eina_Bool place_below) +{ + EINA_SAFETY_ON_NULL_RETURN(window); + EINA_SAFETY_ON_NULL_RETURN(window->surface); + EINA_SAFETY_ON_NULL_RETURN(window->display->wl.tz_policy); + + uint32_t ver = wl_proxy_get_version((struct wl_proxy *)window->display->wl.tz_policy); + if (ver < TIZEN_POLICY_SET_PARENT_WITH_BELOW_SINCE_VERSION) + { + ERR("ecore_wl2_window_transient_parent_set is not supported in this version:%d (required version:%d)", + ver, TIZEN_POLICY_SET_PARENT_WITH_BELOW_SINCE_VERSION); + return; + } + + if (place_below) + _ecore_wl2_window_parent_set_with_below(window, parent); + else + ecore_wl2_window_parent_set(window, parent); +} +// + EAPI void ecore_wl2_window_stack_mode_set(Ecore_Wl2_Window *window, Ecore_Wl2_Window_Stack_Mode mode) { -- 2.7.4